Documentation
¶
Overview ¶
Package client implements a client for the Codeinfra Service HTTP/REST API. Important note: This client is not versioned, and not intended for external use at this time.
Index ¶
- Variables
- func UserAgent() string
- type Client
- func (pc *Client) ApplyPolicyPack(ctx context.Context, orgName, policyGroup, policyPackName, versionTag string, ...) error
- func (pc *Client) BulkDecryptValue(ctx context.Context, stack StackIdentifier, ciphertexts [][]byte) (map[string][]byte, error)
- func (pc *Client) CancelUpdate(ctx context.Context, update UpdateIdentifier) error
- func (pc *Client) CompleteUpdate(ctx context.Context, update UpdateIdentifier, status apitype.UpdateStatus, ...) error
- func (pc *Client) CreateDeployment(ctx context.Context, stack StackIdentifier, ...) (*apitype.CreateDeploymentResponse, error)
- func (pc *Client) CreateStack(ctx context.Context, stackID StackIdentifier, ...) (apitype.Stack, error)
- func (pc *Client) CreateUpdate(ctx context.Context, kind apitype.UpdateKind, stack StackIdentifier, ...) (UpdateIdentifier, CreateUpdateDetails, error)
- func (pc *Client) DecryptValue(ctx context.Context, stack StackIdentifier, ciphertext []byte) ([]byte, error)
- func (pc *Client) DeleteStack(ctx context.Context, stack StackIdentifier, force bool) (bool, error)
- func (pc *Client) DestroyStackDeploymentSettings(ctx context.Context, stack StackIdentifier) error
- func (pc *Client) DisablePolicyPack(ctx context.Context, orgName string, policyGroup string, ...) error
- func (pc *Client) DoesProjectExist(ctx context.Context, owner string, projectName string) (bool, error)
- func (pc *Client) DownloadPolicyPack(ctx context.Context, url string) (io.ReadCloser, error)
- func (pc *Client) EncryptStackDeploymentSettingsSecret(ctx context.Context, stack StackIdentifier, secret string) (*apitype.SecretValue, error)
- func (pc *Client) EncryptValue(ctx context.Context, stack StackIdentifier, plaintext []byte) ([]byte, error)
- func (pc *Client) ExportStackDeployment(ctx context.Context, stack StackIdentifier, version *int) (apitype.UntypedDeployment, error)
- func (pc *Client) GetCLIVersionInfo(ctx context.Context) (semver.Version, semver.Version, semver.Version, error)
- func (pc *Client) GetCapabilities(ctx context.Context) (*apitype.CapabilitiesResponse, error)
- func (pc *Client) GetCodeinfraAccountDetails(ctx context.Context) (string, []string, *workspace.TokenInformation, error)
- func (pc *Client) GetDeploymentLogs(ctx context.Context, stack StackIdentifier, id, token string) (*apitype.DeploymentLogs, error)
- func (pc *Client) GetDeploymentUpdates(ctx context.Context, stack StackIdentifier, id string) ([]apitype.GetDeploymentUpdatesUpdateInfo, error)
- func (pc *Client) GetGHAppIntegration(ctx context.Context, stack StackIdentifier) (*apitype.GitHubAppIntegration, error)
- func (pc *Client) GetLatestConfiguration(ctx context.Context, stackID StackIdentifier) (config.Map, error)
- func (pc *Client) GetNaturalLanguageQueryResults(ctx context.Context, orgName string, queryString string) (*apitype.CodeinfraQueryResponse, error)
- func (pc *Client) GetPolicyPackSchema(ctx context.Context, orgName, policyPackName, versionTag string) (*apitype.GetPolicyPackConfigSchemaResponse, error)
- func (pc *Client) GetSearchQueryResults(ctx context.Context, orgName string, ...) (*apitype.ResourceSearchResponse, error)
- func (pc *Client) GetStack(ctx context.Context, stackID StackIdentifier) (apitype.Stack, error)
- func (pc *Client) GetStackDeploymentSettings(ctx context.Context, stack StackIdentifier) (*apitype.DeploymentSettings, error)
- func (pc *Client) GetStackUpdates(ctx context.Context, stack StackIdentifier, pageSize int, page int) ([]apitype.UpdateInfo, error)
- func (pc *Client) GetUpdateEngineEvents(ctx context.Context, update UpdateIdentifier, continuationToken *string) (apitype.GetUpdateEventsResponse, error)
- func (pc *Client) GetUpdateEvents(ctx context.Context, update UpdateIdentifier, continuationToken *string) (apitype.UpdateResults, error)
- func (pc *Client) ImportStackDeployment(ctx context.Context, stack StackIdentifier, ...) (UpdateIdentifier, error)
- func (pc *Client) Insecure() bool
- func (pc *Client) InvalidateUpdateCheckpoint(ctx context.Context, update UpdateIdentifier, token UpdateTokenSource) error
- func (pc *Client) ListPolicyGroups(ctx context.Context, orgName string, inContToken *string) (apitype.ListPolicyGroupsResponse, *string, error)
- func (pc *Client) ListPolicyPacks(ctx context.Context, orgName string, inContToken *string) (apitype.ListPolicyPacksResponse, *string, error)
- func (pc *Client) ListStacks(ctx context.Context, filter ListStacksFilter, inContToken *string) ([]apitype.StackSummary, *string, error)
- func (pc *Client) Log3rdPartySecretsProviderDecryptionEvent(ctx context.Context, stack StackIdentifier, secretName string) error
- func (pc *Client) LogBulk3rdPartySecretsProviderDecryptionEvent(ctx context.Context, stack StackIdentifier, command string) error
- func (pc *Client) PatchUpdateCheckpoint(ctx context.Context, update UpdateIdentifier, deployment *apitype.DeploymentV3, ...) error
- func (pc *Client) PatchUpdateCheckpointDelta(ctx context.Context, update UpdateIdentifier, sequenceNumber int, ...) error
- func (pc *Client) PatchUpdateCheckpointVerbatim(ctx context.Context, update UpdateIdentifier, sequenceNumber int, ...) error
- func (pc *Client) PublishPolicyPack(ctx context.Context, orgName string, analyzerInfo plugin.AnalyzerInfo, ...) (string, error)
- func (pc *Client) RecordEngineEvents(ctx context.Context, update UpdateIdentifier, batch apitype.EngineEventBatch, ...) error
- func (pc *Client) RemovePolicyPack(ctx context.Context, orgName string, policyPackName string) error
- func (pc *Client) RemovePolicyPackByVersion(ctx context.Context, orgName string, policyPackName string, versionTag string) error
- func (pc *Client) RenameStack(ctx context.Context, currentID, newID StackIdentifier) error
- func (pc *Client) RenewUpdateLease(ctx context.Context, update UpdateIdentifier, token string, ...) (string, error)
- func (pc *Client) StartUpdate(ctx context.Context, update UpdateIdentifier, ...) (int, string, error)
- func (pc *Client) SubmitAIPrompt(ctx context.Context, requestBody interface{}) (*http.Response, error)
- func (pc *Client) URL() string
- func (pc *Client) UpdateStackDeploymentSettings(ctx context.Context, stack StackIdentifier, ...) error
- func (pc *Client) UpdateStackTags(ctx context.Context, stack StackIdentifier, ...) error
- type CreateUpdateDetails
- type ListStacksFilter
- type StackIdentifier
- type UpdateIdentifier
- type UpdateTokenSource
Constants ¶
This section is empty.
Variables ¶
var ErrNoPreviousDeployment = errors.New("no previous deployment")
ErrNoPreviousDeployment is returned when there isn't a previous deployment.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// If true, do not probe the backend with GET /api/capabilities and assume no capabilities.
DisableCapabilityProbing bool
// contains filtered or unexported fields
}
Client provides a slim wrapper around the Codeinfra HTTP/REST API.
func (*Client) ApplyPolicyPack ¶
func (pc *Client) ApplyPolicyPack(ctx context.Context, orgName, policyGroup, policyPackName, versionTag string, policyPackConfig map[string]*json.RawMessage, ) error
ApplyPolicyPack enables a `PolicyPack` to the Codeinfra organization. If policyGroup is not empty, it will enable the PolicyPack on the default PolicyGroup.
func (*Client) BulkDecryptValue ¶
func (pc *Client) BulkDecryptValue(ctx context.Context, stack StackIdentifier, ciphertexts [][]byte, ) (map[string][]byte, error)
BulkDecryptValue decrypts a ciphertext value in the context of the indicated stack.
func (*Client) CancelUpdate ¶
func (pc *Client) CancelUpdate(ctx context.Context, update UpdateIdentifier) error
CancelUpdate cancels the indicated update.
func (*Client) CompleteUpdate ¶
func (pc *Client) CompleteUpdate(ctx context.Context, update UpdateIdentifier, status apitype.UpdateStatus, token UpdateTokenSource, ) error
CompleteUpdate completes the indicated update with the given status.
func (*Client) CreateDeployment ¶
func (pc *Client) CreateDeployment(ctx context.Context, stack StackIdentifier, req apitype.CreateDeploymentRequest, deploymentInitiator string, ) (*apitype.CreateDeploymentResponse, error)
func (*Client) CreateStack ¶
func (pc *Client) CreateStack( ctx context.Context, stackID StackIdentifier, tags map[apitype.StackTagName]string, teams []string, state *apitype.UntypedDeployment, ) (apitype.Stack, error)
CreateStack creates a stack with the given cloud and stack name in the scope of the indicated project.
func (*Client) CreateUpdate ¶
func (pc *Client) CreateUpdate( ctx context.Context, kind apitype.UpdateKind, stack StackIdentifier, proj *workspace.Project, cfg config.Map, m apitype.UpdateMetadata, opts engine.UpdateOptions, dryRun bool, ) (UpdateIdentifier, CreateUpdateDetails, error)
CreateUpdate creates a new update for the indicated stack with the given kind and assorted options. If the update requires that the Codeinfra program is uploaded, the provided getContents callback will be invoked to fetch the contents of the Codeinfra program.
func (*Client) DecryptValue ¶
func (pc *Client) DecryptValue(ctx context.Context, stack StackIdentifier, ciphertext []byte) ([]byte, error)
DecryptValue decrypts a ciphertext value in the context of the indicated stack.
func (*Client) DeleteStack ¶
DeleteStack deletes the indicated stack. If force is true, the stack is deleted even if it contains resources.
func (*Client) DestroyStackDeploymentSettings ¶
func (pc *Client) DestroyStackDeploymentSettings(ctx context.Context, stack StackIdentifier) error
func (*Client) DisablePolicyPack ¶
func (pc *Client) DisablePolicyPack(ctx context.Context, orgName string, policyGroup string, policyPackName, versionTag string, ) error
DisablePolicyPack disables a `PolicyPack` to the Codeinfra organization. If policyGroup is not empty, it will disable the PolicyPack on the default PolicyGroup.
func (*Client) DoesProjectExist ¶
func (pc *Client) DoesProjectExist(ctx context.Context, owner string, projectName string) (bool, error)
DoesProjectExist returns true if a project with the given name exists, or false otherwise.
func (*Client) DownloadPolicyPack ¶
DownloadPolicyPack applies a `PolicyPack` to the Codeinfra organization.
func (*Client) EncryptStackDeploymentSettingsSecret ¶
func (pc *Client) EncryptStackDeploymentSettingsSecret(ctx context.Context, stack StackIdentifier, secret string, ) (*apitype.SecretValue, error)
func (*Client) EncryptValue ¶
func (pc *Client) EncryptValue(ctx context.Context, stack StackIdentifier, plaintext []byte) ([]byte, error)
EncryptValue encrypts a plaintext value in the context of the indicated stack.
func (*Client) ExportStackDeployment ¶
func (pc *Client) ExportStackDeployment( ctx context.Context, stack StackIdentifier, version *int, ) (apitype.UntypedDeployment, error)
ExportStackDeployment exports the indicated stack's deployment as a raw JSON message. If version is nil, will export the latest version of the stack.
func (*Client) GetCLIVersionInfo ¶
func (pc *Client) GetCLIVersionInfo(ctx context.Context) (semver.Version, semver.Version, semver.Version, error)
GetCLIVersionInfo asks the service for information about versions of the CLI (the newest version as well as the oldest version before the CLI should warn about an upgrade, and the current dev version).
func (*Client) GetCapabilities ¶
func (*Client) GetCodeinfraAccountDetails ¶
func (pc *Client) GetCodeinfraAccountDetails(ctx context.Context) (string, []string, *workspace.TokenInformation, error)
GetCodeinfraAccountDetails returns the user implied by the API token associated with this client.
func (*Client) GetDeploymentLogs ¶
func (pc *Client) GetDeploymentLogs(ctx context.Context, stack StackIdentifier, id, token string, ) (*apitype.DeploymentLogs, error)
func (*Client) GetDeploymentUpdates ¶
func (pc *Client) GetDeploymentUpdates(ctx context.Context, stack StackIdentifier, id string, ) ([]apitype.GetDeploymentUpdatesUpdateInfo, error)
func (*Client) GetGHAppIntegration ¶
func (pc *Client) GetGHAppIntegration( ctx context.Context, stack StackIdentifier, ) (*apitype.GitHubAppIntegration, error)
func (*Client) GetLatestConfiguration ¶
func (pc *Client) GetLatestConfiguration(ctx context.Context, stackID StackIdentifier) (config.Map, error)
GetLatestConfiguration returns the configuration for the latest deployment of a given stack.
func (*Client) GetNaturalLanguageQueryResults ¶
func (*Client) GetPolicyPackSchema ¶
func (pc *Client) GetPolicyPackSchema(ctx context.Context, orgName, policyPackName, versionTag string, ) (*apitype.GetPolicyPackConfigSchemaResponse, error)
GetPolicyPackSchema gets Policy Pack config schema.
func (*Client) GetSearchQueryResults ¶
func (pc *Client) GetSearchQueryResults( ctx context.Context, orgName string, queryParams *apitype.CodeinfraQueryRequest, baseURL string, ) (*apitype.ResourceSearchResponse, error)
Codeinfra Cloud Search Functions
func (*Client) GetStackDeploymentSettings ¶
func (pc *Client) GetStackDeploymentSettings(ctx context.Context, stack StackIdentifier, ) (*apitype.DeploymentSettings, error)
func (*Client) GetStackUpdates ¶
func (pc *Client) GetStackUpdates( ctx context.Context, stack StackIdentifier, pageSize int, page int, ) ([]apitype.UpdateInfo, error)
GetStackUpdates returns all updates to the indicated stack.
func (*Client) GetUpdateEngineEvents ¶
func (pc *Client) GetUpdateEngineEvents(ctx context.Context, update UpdateIdentifier, continuationToken *string, ) (apitype.GetUpdateEventsResponse, error)
GetUpdateEngineEvents returns the engine events for an update.
func (*Client) GetUpdateEvents ¶
func (pc *Client) GetUpdateEvents(ctx context.Context, update UpdateIdentifier, continuationToken *string, ) (apitype.UpdateResults, error)
GetUpdateEvents returns all events, taking an optional continuation token from a previous call.
func (*Client) ImportStackDeployment ¶
func (pc *Client) ImportStackDeployment(ctx context.Context, stack StackIdentifier, deployment *apitype.UntypedDeployment, ) (UpdateIdentifier, error)
ImportStackDeployment imports a new deployment into the indicated stack.
func (*Client) InvalidateUpdateCheckpoint ¶
func (pc *Client) InvalidateUpdateCheckpoint(ctx context.Context, update UpdateIdentifier, token UpdateTokenSource, ) error
InvalidateUpdateCheckpoint invalidates the checkpoint for the indicated update.
func (*Client) ListPolicyGroups ¶
func (pc *Client) ListPolicyGroups(ctx context.Context, orgName string, inContToken *string) ( apitype.ListPolicyGroupsResponse, *string, error, )
ListPolicyGroups lists all `PolicyGroups` the organization has in the Codeinfra service.
func (*Client) ListPolicyPacks ¶
func (pc *Client) ListPolicyPacks(ctx context.Context, orgName string, inContToken *string) ( apitype.ListPolicyPacksResponse, *string, error, )
ListPolicyPacks lists all `PolicyPack` the organization has in the Codeinfra service.
func (*Client) ListStacks ¶
func (pc *Client) ListStacks( ctx context.Context, filter ListStacksFilter, inContToken *string, ) ([]apitype.StackSummary, *string, error)
ListStacks lists all stacks the current user has access to, optionally filtered by project.
func (*Client) Log3rdPartySecretsProviderDecryptionEvent ¶
func (*Client) LogBulk3rdPartySecretsProviderDecryptionEvent ¶
func (*Client) PatchUpdateCheckpoint ¶
func (pc *Client) PatchUpdateCheckpoint(ctx context.Context, update UpdateIdentifier, deployment *apitype.DeploymentV3, token UpdateTokenSource, ) error
PatchUpdateCheckpoint patches the checkpoint for the indicated update with the given contents.
func (*Client) PatchUpdateCheckpointDelta ¶
func (pc *Client) PatchUpdateCheckpointDelta(ctx context.Context, update UpdateIdentifier, sequenceNumber int, checkpointHash string, deploymentDelta json.RawMessage, token UpdateTokenSource, ) error
PatchUpdateCheckpointDelta patches the checkpoint for the indicated update with the given contents, just like PatchUpdateCheckpoint. Unlike PatchUpdateCheckpoint, it uses a text diff-based protocol to conserve bandwidth on large stack states.
func (*Client) PatchUpdateCheckpointVerbatim ¶
func (pc *Client) PatchUpdateCheckpointVerbatim(ctx context.Context, update UpdateIdentifier, sequenceNumber int, untypedDeploymentBytes json.RawMessage, token UpdateTokenSource, ) error
PatchUpdateCheckpointVerbatim is a variant of PatchUpdateCheckpoint that preserves JSON indentation of the UntypedDeployment transferred over the wire.
func (*Client) PublishPolicyPack ¶
func (pc *Client) PublishPolicyPack(ctx context.Context, orgName string, analyzerInfo plugin.AnalyzerInfo, dirArchive io.Reader, ) (string, error)
PublishPolicyPack publishes a `PolicyPack` to the Codeinfra service. If it successfully publishes the Policy Pack, it returns the version of the pack.
func (*Client) RecordEngineEvents ¶
func (pc *Client) RecordEngineEvents( ctx context.Context, update UpdateIdentifier, batch apitype.EngineEventBatch, token UpdateTokenSource, ) error
RecordEngineEvents posts a batch of engine events to the Codeinfra service.
func (*Client) RemovePolicyPack ¶
func (pc *Client) RemovePolicyPack(ctx context.Context, orgName string, policyPackName string) error
RemovePolicyPack removes all versions of a `PolicyPack` from the Codeinfra organization.
func (*Client) RemovePolicyPackByVersion ¶
func (pc *Client) RemovePolicyPackByVersion(ctx context.Context, orgName string, policyPackName string, versionTag string, ) error
RemovePolicyPackByVersion removes a specific version of a `PolicyPack` from the Codeinfra organization.
func (*Client) RenameStack ¶
func (pc *Client) RenameStack(ctx context.Context, currentID, newID StackIdentifier) error
RenameStack renames the provided stack to have the new identifier.
func (*Client) RenewUpdateLease ¶
func (pc *Client) RenewUpdateLease(ctx context.Context, update UpdateIdentifier, token string, duration time.Duration, ) (string, error)
RenewUpdateLease renews the indicated update lease for the given duration.
func (*Client) StartUpdate ¶
func (pc *Client) StartUpdate(ctx context.Context, update UpdateIdentifier, tags map[apitype.StackTagName]string, ) (int, string, error)
StartUpdate starts the indicated update. It returns the new version of the update's target stack and the token used to authenticate operations on the update if any. Replaces the stack's tags with the updated set.
func (*Client) SubmitAIPrompt ¶
func (pc *Client) SubmitAIPrompt(ctx context.Context, requestBody interface{}) (*http.Response, error)
SubmitAIPrompt sends the user's prompt to the Codeinfra Service and streams back the response.
func (*Client) UpdateStackDeploymentSettings ¶
func (pc *Client) UpdateStackDeploymentSettings(ctx context.Context, stack StackIdentifier, deployment apitype.DeploymentSettings, ) error
func (*Client) UpdateStackTags ¶
func (pc *Client) UpdateStackTags( ctx context.Context, stack StackIdentifier, tags map[apitype.StackTagName]string, ) error
UpdateStackTags updates the stacks's tags, replacing all existing tags.
type CreateUpdateDetails ¶
type CreateUpdateDetails struct {
Messages []apitype.Message
RequiredPolicies []apitype.RequiredPolicy
IsCopilotIntegrationEnabled bool
}
type ListStacksFilter ¶
type ListStacksFilter struct {
Project *string
Organization *string
TagName *string
TagValue *string
}
ListStacksFilter describes optional filters when listing stacks.
type StackIdentifier ¶
StackIdentifier is the set of data needed to identify a Codeinfra Cloud stack.
func (StackIdentifier) String ¶
func (s StackIdentifier) String() string
type UpdateIdentifier ¶
type UpdateIdentifier struct {
StackIdentifier
UpdateKind apitype.UpdateKind
UpdateID string
}
UpdateIdentifier is the set of data needed to identify an update to a Codeinfra Cloud stack.