Documentation
¶
Overview ¶
Package converter maps between gRPC/proto types and SDK domain types.
Index ¶
- func ApproveAllResultFromProto(r *pb.ApproveAllDraftChunksResponse) *types.ApproveAllResult
- func ApproveResultFromProto(r *pb.ApproveDraftChunkResponse) *types.ApproveResult
- func ClearResultFromProto(r *pb.ClearDraftChunksResponse) *types.ClearResult
- func ConfigUpdateResultFromProto(resp *pb.UpdateConfigResponse) *v1.ConfigUpdateResult
- func ConfigUpdateToProto(cu *v1.ConfigUpdate) (*pb.UpdateConfigRequest, error)
- func CopyBoolPtr(p *bool) *bool
- func CopyByteSlice(b []byte) []byte
- func CopyStringMap(m map[string]string) map[string]string
- func CopyStringSlice(s []string) []string
- func DraftHistoryEntryFromProto(e *pb.DraftHistoryEntry) *types.DraftHistoryEntry
- func DraftPolicyFromProto(r *pb.GetDraftPolicyResponse) *types.DraftPolicy
- func EffectiveSettingFromProto(pv *sbv1.EffectiveSetting) *v1.EffectiveSetting
- func ExecChunkFromEvent(event *pb.ExecSandboxEvent) (*types.ExecChunk, int, error)
- func ExecInteractiveRequestToProto(sandboxID string, command []string, cols, rows uint32, opts *types.ExecOptions) *pb.ExecSandboxRequest
- func ExecRequestToProto(sandboxID string, command []string, opts *types.ExecOptions) *pb.ExecSandboxRequest
- func ExecResultFromEvents(events []*pb.ExecSandboxEvent) (*types.ExecResult, error)
- func FromGRPCError(err error) error
- func GatewayConfigFromProto(resp *sbv1.GetGatewayConfigResponse) *v1.GatewayConfig
- func LogLineFromProto(l *pb.SandboxLogLine) *types.LogLine
- func LogResultFromProto(r *pb.GetSandboxLogsResponse) *types.LogResult
- func MillisFromTime(t time.Time) int64
- func NetworkBinaryFromProto(b *sbv1.NetworkBinary) *types.NetworkBinary
- func NetworkBinaryToProto(b *types.NetworkBinary) *sbv1.NetworkBinary
- func NetworkEndpointFromProto(ep *sbv1.NetworkEndpoint) *types.NetworkEndpoint
- func NetworkEndpointToProto(ep *types.NetworkEndpoint) *sbv1.NetworkEndpoint
- func NetworkPolicyRuleFromProto(r *sbv1.NetworkPolicyRule) *types.NetworkPolicyRule
- func NetworkPolicyRuleToProto(r *types.NetworkPolicyRule) *sbv1.NetworkPolicyRule
- func PolicyChunkFromProto(c *pb.PolicyChunk) *types.PolicyChunk
- func PolicyLoadStatusFromProto(s pb.PolicyStatus) types.PolicyLoadStatus
- func PolicyLoadStatusToProto(s types.PolicyLoadStatus) pb.PolicyStatus
- func PolicyMergeOperationToProto(op *v1.PolicyMergeOperation) (*pb.PolicyMergeOperation, error)
- func PolicySourceFromProto(ps sbv1.PolicySource) v1.PolicySource
- func PolicyStatusResultFromProto(r *pb.GetSandboxPolicyStatusResponse) *types.PolicyStatusResult
- func ProfileCategoryFromProto(c pb.ProviderProfileCategory) types.ProfileCategory
- func ProfileCategoryToProto(c types.ProfileCategory) pb.ProviderProfileCategory
- func ProfileCredentialFromProto(c *pb.ProviderProfileCredential) *types.ProfileCredential
- func ProfileCredentialToProto(c *types.ProfileCredential) *pb.ProviderProfileCredential
- func ProfileDiagnosticFromProto(d *pb.ProviderProfileDiagnostic) *types.ProfileDiagnostic
- func ProfileImportItemFromProto(item *pb.ProviderProfileImportItem) *types.ProfileImportItem
- func ProfileImportItemToProto(item *types.ProfileImportItem) *pb.ProviderProfileImportItem
- func ProviderFromProto(p *dm.Provider) *types.Provider
- func ProviderProfileFromProto(p *pb.ProviderProfile) *types.ProviderProfile
- func ProviderProfileToProto(p *types.ProviderProfile) *pb.ProviderProfile
- func ProviderToProto(p *types.Provider) *dm.Provider
- func RefreshConfigToProto(c *types.RefreshConfig) *pb.ConfigureProviderRefreshRequest
- func RefreshStatusFromProto(s *pb.ProviderCredentialRefreshStatus) *types.RefreshStatus
- func RefreshStrategyFromProto(s pb.ProviderCredentialRefreshStrategy) types.RefreshStrategy
- func RefreshStrategyToProto(s types.RefreshStrategy) pb.ProviderCredentialRefreshStrategy
- func SSHSessionFromProto(resp *pb.CreateSshSessionResponse) *v1.SSHSession
- func SSHSessionToProto(session *v1.SSHSession) *pb.CreateSshSessionResponse
- func SandboxConfigFromProto(resp *sbv1.GetSandboxConfigResponse) *v1.SandboxConfig
- func SandboxFromProto(s *pb.Sandbox) *types.Sandbox
- func SandboxPhaseFromProto(phase pb.SandboxPhase) types.SandboxPhase
- func SandboxPhaseToProto(phase types.SandboxPhase) pb.SandboxPhase
- func SandboxPolicyFromProto(p *sbv1.SandboxPolicy) *types.SandboxPolicy
- func SandboxPolicyRevisionFromProto(r *pb.SandboxPolicyRevision) *types.SandboxPolicyRevision
- func SandboxPolicyToProto(p *types.SandboxPolicy) *sbv1.SandboxPolicy
- func SandboxSpecToProto(spec *types.SandboxSpec) *pb.SandboxSpec
- func SandboxToProto(s *types.Sandbox) *pb.Sandbox
- func ServiceEndpointFromProto(resp *pb.ServiceEndpointResponse) *types.ServiceEndpoint
- func ServiceEndpointToProto(se *types.ServiceEndpoint) *pb.ServiceEndpointResponse
- func SettingScopeFromProto(ps sbv1.SettingScope) v1.SettingScope
- func SettingScopeToProto(s v1.SettingScope) sbv1.SettingScope
- func SettingValueFromProto(pv *sbv1.SettingValue) *v1.SettingValue
- func SettingValueToProto(sv *v1.SettingValue) *sbv1.SettingValue
- func TimeFromMillis(ms int64) time.Time
- func UndoResultFromProto(r *pb.UndoDraftChunkResponse) *types.UndoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApproveAllResultFromProto ¶
func ApproveAllResultFromProto(r *pb.ApproveAllDraftChunksResponse) *types.ApproveAllResult
ApproveAllResultFromProto converts a proto ApproveAllDraftChunksResponse to an SDK ApproveAllResult.
func ApproveResultFromProto ¶
func ApproveResultFromProto(r *pb.ApproveDraftChunkResponse) *types.ApproveResult
ApproveResultFromProto converts a proto ApproveDraftChunkResponse to an SDK ApproveResult.
func ClearResultFromProto ¶
func ClearResultFromProto(r *pb.ClearDraftChunksResponse) *types.ClearResult
ClearResultFromProto converts a proto ClearDraftChunksResponse to an SDK ClearResult.
func ConfigUpdateResultFromProto ¶
func ConfigUpdateResultFromProto(resp *pb.UpdateConfigResponse) *v1.ConfigUpdateResult
ConfigUpdateResultFromProto converts an UpdateConfigResponse to an SDK ConfigUpdateResult.
func ConfigUpdateToProto ¶
func ConfigUpdateToProto(cu *v1.ConfigUpdate) (*pb.UpdateConfigRequest, error)
ConfigUpdateToProto converts an SDK ConfigUpdate to an UpdateConfigRequest.
func CopyBoolPtr ¶
CopyBoolPtr returns a copy of a *bool pointer. Returns nil for nil input.
func CopyByteSlice ¶
CopyByteSlice returns a copy of a byte slice. Returns nil for nil input.
func CopyStringMap ¶
CopyStringMap returns a shallow copy of a string-to-string map. Returns nil for nil input.
func CopyStringSlice ¶
CopyStringSlice returns a copy of a string slice. Returns nil for nil input.
func DraftHistoryEntryFromProto ¶
func DraftHistoryEntryFromProto(e *pb.DraftHistoryEntry) *types.DraftHistoryEntry
DraftHistoryEntryFromProto converts a proto DraftHistoryEntry to an SDK DraftHistoryEntry.
func DraftPolicyFromProto ¶
func DraftPolicyFromProto(r *pb.GetDraftPolicyResponse) *types.DraftPolicy
DraftPolicyFromProto converts a proto GetDraftPolicyResponse to an SDK DraftPolicy.
func EffectiveSettingFromProto ¶
func EffectiveSettingFromProto(pv *sbv1.EffectiveSetting) *v1.EffectiveSetting
EffectiveSettingFromProto converts a proto EffectiveSetting to an SDK EffectiveSetting.
func ExecChunkFromEvent ¶
ExecChunkFromEvent converts a proto ExecSandboxEvent to an ExecChunk and/or exit code. For stdout/stderr events, returns the chunk with exitCode -1. For exit events, returns nil chunk with the exit code.
func ExecInteractiveRequestToProto ¶
func ExecInteractiveRequestToProto(sandboxID string, command []string, cols, rows uint32, opts *types.ExecOptions) *pb.ExecSandboxRequest
ExecInteractiveRequestToProto builds a proto ExecSandboxRequest for Interactive mode.
func ExecRequestToProto ¶
func ExecRequestToProto(sandboxID string, command []string, opts *types.ExecOptions) *pb.ExecSandboxRequest
ExecRequestToProto builds a proto ExecSandboxRequest for Run/Stream modes.
func ExecResultFromEvents ¶
func ExecResultFromEvents(events []*pb.ExecSandboxEvent) (*types.ExecResult, error)
ExecResultFromEvents collects a sequence of ExecSandboxEvents into an ExecResult.
func FromGRPCError ¶
FromGRPCError converts a gRPC error to a typed StatusError. Returns nil for nil errors and OK status. Non-gRPC errors pass through unchanged.
func GatewayConfigFromProto ¶
func GatewayConfigFromProto(resp *sbv1.GetGatewayConfigResponse) *v1.GatewayConfig
GatewayConfigFromProto converts a GetGatewayConfigResponse to an SDK GatewayConfig.
func LogLineFromProto ¶
func LogLineFromProto(l *pb.SandboxLogLine) *types.LogLine
LogLineFromProto converts a proto SandboxLogLine to an SDK LogLine.
func LogResultFromProto ¶
func LogResultFromProto(r *pb.GetSandboxLogsResponse) *types.LogResult
LogResultFromProto converts a proto GetSandboxLogsResponse to an SDK LogResult.
func MillisFromTime ¶
MillisFromTime converts a time.Time to a millisecond epoch timestamp. A zero time returns 0.
func NetworkBinaryFromProto ¶
func NetworkBinaryFromProto(b *sbv1.NetworkBinary) *types.NetworkBinary
NetworkBinaryFromProto converts a proto NetworkBinary to an SDK NetworkBinary.
func NetworkBinaryToProto ¶
func NetworkBinaryToProto(b *types.NetworkBinary) *sbv1.NetworkBinary
NetworkBinaryToProto converts an SDK NetworkBinary to a proto NetworkBinary.
func NetworkEndpointFromProto ¶
func NetworkEndpointFromProto(ep *sbv1.NetworkEndpoint) *types.NetworkEndpoint
NetworkEndpointFromProto converts a proto NetworkEndpoint to an SDK NetworkEndpoint. Only Host, Port, and Protocol are mapped; additional proto fields are ignored.
func NetworkEndpointToProto ¶
func NetworkEndpointToProto(ep *types.NetworkEndpoint) *sbv1.NetworkEndpoint
NetworkEndpointToProto converts an SDK NetworkEndpoint to a proto NetworkEndpoint.
func NetworkPolicyRuleFromProto ¶
func NetworkPolicyRuleFromProto(r *sbv1.NetworkPolicyRule) *types.NetworkPolicyRule
NetworkPolicyRuleFromProto converts a proto NetworkPolicyRule to an SDK NetworkPolicyRule.
func NetworkPolicyRuleToProto ¶
func NetworkPolicyRuleToProto(r *types.NetworkPolicyRule) *sbv1.NetworkPolicyRule
NetworkPolicyRuleToProto converts an SDK NetworkPolicyRule to a proto NetworkPolicyRule.
func PolicyChunkFromProto ¶
func PolicyChunkFromProto(c *pb.PolicyChunk) *types.PolicyChunk
PolicyChunkFromProto converts a proto PolicyChunk to an SDK PolicyChunk.
func PolicyLoadStatusFromProto ¶
func PolicyLoadStatusFromProto(s pb.PolicyStatus) types.PolicyLoadStatus
PolicyLoadStatusFromProto converts a proto PolicyStatus to an SDK PolicyLoadStatus.
func PolicyLoadStatusToProto ¶
func PolicyLoadStatusToProto(s types.PolicyLoadStatus) pb.PolicyStatus
PolicyLoadStatusToProto converts an SDK PolicyLoadStatus to a proto PolicyStatus.
func PolicyMergeOperationToProto ¶
func PolicyMergeOperationToProto(op *v1.PolicyMergeOperation) (*pb.PolicyMergeOperation, error)
PolicyMergeOperationToProto converts an SDK PolicyMergeOperation to a proto PolicyMergeOperation. Exactly one of the pointer fields must be non-nil. Returns an error if zero or multiple are set.
func PolicySourceFromProto ¶
func PolicySourceFromProto(ps sbv1.PolicySource) v1.PolicySource
PolicySourceFromProto converts a proto PolicySource enum to an SDK PolicySource.
func PolicyStatusResultFromProto ¶
func PolicyStatusResultFromProto(r *pb.GetSandboxPolicyStatusResponse) *types.PolicyStatusResult
PolicyStatusResultFromProto converts a proto GetSandboxPolicyStatusResponse to an SDK PolicyStatusResult.
func ProfileCategoryFromProto ¶
func ProfileCategoryFromProto(c pb.ProviderProfileCategory) types.ProfileCategory
ProfileCategoryFromProto converts a proto ProviderProfileCategory to an SDK ProfileCategory.
func ProfileCategoryToProto ¶
func ProfileCategoryToProto(c types.ProfileCategory) pb.ProviderProfileCategory
ProfileCategoryToProto converts an SDK ProfileCategory to a proto ProviderProfileCategory.
func ProfileCredentialFromProto ¶
func ProfileCredentialFromProto(c *pb.ProviderProfileCredential) *types.ProfileCredential
ProfileCredentialFromProto converts a proto ProviderProfileCredential to an SDK ProfileCredential. The SDK maps 4 fields from the 10-field proto: Name, Description, Required, and Secret. Secret is derived from whether the proto has a Refresh configuration.
func ProfileCredentialToProto ¶
func ProfileCredentialToProto(c *types.ProfileCredential) *pb.ProviderProfileCredential
ProfileCredentialToProto converts an SDK ProfileCredential to a proto ProviderProfileCredential. Only Name, Description, and Required are mapped. Secret is not round-trippable because it is derived from the Refresh field in the proto.
func ProfileDiagnosticFromProto ¶
func ProfileDiagnosticFromProto(d *pb.ProviderProfileDiagnostic) *types.ProfileDiagnostic
ProfileDiagnosticFromProto converts a proto ProviderProfileDiagnostic to an SDK ProfileDiagnostic.
func ProfileImportItemFromProto ¶
func ProfileImportItemFromProto(item *pb.ProviderProfileImportItem) *types.ProfileImportItem
ProfileImportItemFromProto converts a proto ProviderProfileImportItem to an SDK ProfileImportItem.
func ProfileImportItemToProto ¶
func ProfileImportItemToProto(item *types.ProfileImportItem) *pb.ProviderProfileImportItem
ProfileImportItemToProto converts an SDK ProfileImportItem to a proto ProviderProfileImportItem.
func ProviderFromProto ¶
ProviderFromProto converts a proto Provider to an SDK Provider.
func ProviderProfileFromProto ¶
func ProviderProfileFromProto(p *pb.ProviderProfile) *types.ProviderProfile
ProviderProfileFromProto converts a proto ProviderProfile to an SDK ProviderProfile.
func ProviderProfileToProto ¶
func ProviderProfileToProto(p *types.ProviderProfile) *pb.ProviderProfile
ProviderProfileToProto converts an SDK ProviderProfile to a proto ProviderProfile.
func ProviderToProto ¶
ProviderToProto converts an SDK Provider to a proto Provider.
func RefreshConfigToProto ¶
func RefreshConfigToProto(c *types.RefreshConfig) *pb.ConfigureProviderRefreshRequest
RefreshConfigToProto converts an SDK RefreshConfig to a proto ConfigureProviderRefreshRequest. Material and SecretMaterialKeys are deep-copied.
func RefreshStatusFromProto ¶
func RefreshStatusFromProto(s *pb.ProviderCredentialRefreshStatus) *types.RefreshStatus
RefreshStatusFromProto converts a proto ProviderCredentialRefreshStatus to an SDK RefreshStatus.
func RefreshStrategyFromProto ¶
func RefreshStrategyFromProto(s pb.ProviderCredentialRefreshStrategy) types.RefreshStrategy
RefreshStrategyFromProto converts a proto ProviderCredentialRefreshStrategy to an SDK RefreshStrategy.
func RefreshStrategyToProto ¶
func RefreshStrategyToProto(s types.RefreshStrategy) pb.ProviderCredentialRefreshStrategy
RefreshStrategyToProto converts an SDK RefreshStrategy to a proto ProviderCredentialRefreshStrategy.
func SSHSessionFromProto ¶
func SSHSessionFromProto(resp *pb.CreateSshSessionResponse) *v1.SSHSession
SSHSessionFromProto converts a CreateSshSessionResponse to an SSHSession.
func SSHSessionToProto ¶
func SSHSessionToProto(session *v1.SSHSession) *pb.CreateSshSessionResponse
SSHSessionToProto converts an SSHSession to a CreateSshSessionResponse. This is primarily used for round-trip testing and fake implementations.
func SandboxConfigFromProto ¶
func SandboxConfigFromProto(resp *sbv1.GetSandboxConfigResponse) *v1.SandboxConfig
SandboxConfigFromProto converts a GetSandboxConfigResponse to an SDK SandboxConfig.
func SandboxFromProto ¶
SandboxFromProto converts a proto Sandbox to an SDK Sandbox.
func SandboxPhaseFromProto ¶
func SandboxPhaseFromProto(phase pb.SandboxPhase) types.SandboxPhase
SandboxPhaseFromProto converts a proto SandboxPhase to an SDK SandboxPhase.
func SandboxPhaseToProto ¶
func SandboxPhaseToProto(phase types.SandboxPhase) pb.SandboxPhase
SandboxPhaseToProto converts an SDK SandboxPhase to a proto SandboxPhase.
func SandboxPolicyFromProto ¶ added in v0.2.1
func SandboxPolicyFromProto(p *sbv1.SandboxPolicy) *types.SandboxPolicy
SandboxPolicyFromProto converts a proto SandboxPolicy to an SDK SandboxPolicy. Returns nil for nil input. All slice and map fields are deep-copied.
func SandboxPolicyRevisionFromProto ¶
func SandboxPolicyRevisionFromProto(r *pb.SandboxPolicyRevision) *types.SandboxPolicyRevision
SandboxPolicyRevisionFromProto converts a proto SandboxPolicyRevision to an SDK SandboxPolicyRevision.
func SandboxPolicyToProto ¶ added in v0.2.1
func SandboxPolicyToProto(p *types.SandboxPolicy) *sbv1.SandboxPolicy
SandboxPolicyToProto converts an SDK SandboxPolicy to a proto SandboxPolicy. Returns nil for nil input. All slice and map fields are deep-copied.
func SandboxSpecToProto ¶
func SandboxSpecToProto(spec *types.SandboxSpec) *pb.SandboxSpec
SandboxSpecToProto converts an SDK SandboxSpec to a proto SandboxSpec.
func SandboxToProto ¶
SandboxToProto converts an SDK Sandbox to a proto Sandbox.
func ServiceEndpointFromProto ¶
func ServiceEndpointFromProto(resp *pb.ServiceEndpointResponse) *types.ServiceEndpoint
ServiceEndpointFromProto converts a proto ServiceEndpointResponse to an SDK ServiceEndpoint. The response flattens the nested Endpoint and top-level URL into a single SDK type.
func ServiceEndpointToProto ¶
func ServiceEndpointToProto(se *types.ServiceEndpoint) *pb.ServiceEndpointResponse
ServiceEndpointToProto converts an SDK ServiceEndpoint to a proto ServiceEndpointResponse.
func SettingScopeFromProto ¶
func SettingScopeFromProto(ps sbv1.SettingScope) v1.SettingScope
SettingScopeFromProto converts a proto SettingScope enum to an SDK SettingScope.
func SettingScopeToProto ¶
func SettingScopeToProto(s v1.SettingScope) sbv1.SettingScope
SettingScopeToProto converts an SDK SettingScope to a proto SettingScope enum.
func SettingValueFromProto ¶
func SettingValueFromProto(pv *sbv1.SettingValue) *v1.SettingValue
SettingValueFromProto converts a proto SettingValue (oneof) to an SDK SettingValue.
func SettingValueToProto ¶
func SettingValueToProto(sv *v1.SettingValue) *sbv1.SettingValue
SettingValueToProto converts an SDK SettingValue to a proto SettingValue (oneof).
func TimeFromMillis ¶
TimeFromMillis converts a millisecond epoch timestamp to time.Time. A zero value returns the zero time.
func UndoResultFromProto ¶
func UndoResultFromProto(r *pb.UndoDraftChunkResponse) *types.UndoResult
UndoResultFromProto converts a proto UndoDraftChunkResponse to an SDK UndoResult.
Types ¶
This section is empty.