MCPcopy Create free account
hub / github.com/coder/coder / ProtoFromManifest

Function ProtoFromManifest

codersdk/agentsdk/convert.go:76–102  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

74// It does not populate the proto's Secrets field because the SDK
75// Manifest intentionally does not carry secrets (see ManifestFromProto).
76func 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
104func MetadataDescriptionsFromProto(descriptions []*proto.WorkspaceAgentMetadata_Description) []codersdk.WorkspaceAgentMetadataDescription {
105 ret := make([]codersdk.WorkspaceAgentMetadataDescription, len(descriptions))

Callers 2

TestManifestFunction · 0.92
NewClientWithSecretsFunction · 0.92

Calls 6

DERPMapToProtoFunction · 0.92
ProtoFromAppsFunction · 0.85
ProtoFromScriptsFunction · 0.85
ProtoFromDevcontainersFunction · 0.85
ErrorfMethod · 0.45

Tested by 1

TestManifestFunction · 0.74