ProtoFromManifest converts the SDK Manifest to the proto manifest. It does not populate the proto's Secrets field because the SDK Manifest intentionally does not carry secrets (see ManifestFromProto).
(manifest Manifest)
| 74 | // It does not populate the proto's Secrets field because the SDK |
| 75 | // Manifest intentionally does not carry secrets (see ManifestFromProto). |
| 76 | func ProtoFromManifest(manifest Manifest) (*proto.Manifest, error) { |
| 77 | apps, err := ProtoFromApps(manifest.Apps) |
| 78 | if err != nil { |
| 79 | return nil, xerrors.Errorf("convert workspace apps: %w", err) |
| 80 | } |
| 81 | return &proto.Manifest{ |
| 82 | ParentId: manifest.ParentID[:], |
| 83 | AgentId: manifest.AgentID[:], |
| 84 | AgentName: manifest.AgentName, |
| 85 | OwnerUsername: manifest.OwnerName, |
| 86 | WorkspaceId: manifest.WorkspaceID[:], |
| 87 | WorkspaceName: manifest.WorkspaceName, |
| 88 | // #nosec G115 - Safe conversion for GitAuthConfigs which is expected to be small and positive |
| 89 | GitAuthConfigs: uint32(manifest.GitAuthConfigs), |
| 90 | EnvironmentVariables: manifest.EnvironmentVariables, |
| 91 | Directory: manifest.Directory, |
| 92 | VsCodePortProxyUri: manifest.VSCodePortProxyURI, |
| 93 | MotdPath: manifest.MOTDFile, |
| 94 | DisableDirectConnections: manifest.DisableDirectConnections, |
| 95 | DerpForceWebsockets: manifest.DERPForceWebSockets, |
| 96 | DerpMap: tailnet.DERPMapToProto(manifest.DERPMap), |
| 97 | Scripts: ProtoFromScripts(manifest.Scripts), |
| 98 | Apps: apps, |
| 99 | Metadata: ProtoFromMetadataDescriptions(manifest.Metadata), |
| 100 | Devcontainers: ProtoFromDevcontainers(manifest.Devcontainers), |
| 101 | }, nil |
| 102 | } |
| 103 | |
| 104 | func MetadataDescriptionsFromProto(descriptions []*proto.WorkspaceAgentMetadata_Description) []codersdk.WorkspaceAgentMetadataDescription { |
| 105 | ret := make([]codersdk.WorkspaceAgentMetadataDescription, len(descriptions)) |