Help us shape the future of Go! Take the 2026 Go Developer Survey

pro

package
v1.233.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package pro is a generated GoMock package.

Package pro is a generated GoMock package.

Index

Constants

View Source
const (
	DefaultHTTPTimeoutSecs           = 30
	DefaultDialTimeoutSecs           = 10
	DefaultIdleConnTimeoutSecs       = 30
	DefaultResponseHeaderTimeoutSecs = 15
	DefaultExpectContinueTimeoutSecs = 1
)
View Source
const (
	// DefaultMaxPayloadBytes leaves substantial headroom below Vercel's ~4.5 MB
	// request body limit, including request metadata and batch fields.
	DefaultMaxPayloadBytes = 3 * 1024 * 1024

	// BatchFieldsOverheadBytes conservatively bounds JSON batch metadata,
	// including a UUID and the decimal representation of two integer fields.
	BatchFieldsOverheadBytes = 200

	// DefaultMetadataOverheadBytes is the conservative fallback for metadata size estimation.
	DefaultMetadataOverheadBytes = 512
)
View Source
const (
	// DefaultMaxRetries is the maximum number of retry attempts for upload operations.
	// Total attempts = 1 (initial) + DefaultMaxRetries.
	DefaultMaxRetries = 3
	// DefaultBaseDelay is the initial backoff delay before the first retry.
	DefaultBaseDelay = 1 * time.Second
)
View Source
const AtmosProBotActor = "atmos-pro[bot]"

AtmosProBotActor is the GitHub actor name for the Atmos Pro GitHub App. When the app pushes a commit, the subsequent CI run sees this as the actor.

View Source
const (
	// DefaultHTTPClientTimeout is the default timeout for HTTP client requests.
	DefaultHTTPClientTimeout = 10 * time.Second
)
View Source
const DefaultProAudience = "atmos-pro.com"

DefaultProAudience is the default OIDC audience for Atmos Pro token exchange.

Variables

This section is empty.

Functions

func DecodeEnvelope added in v1.221.0

func DecodeEnvelope[T any](r io.Reader) (*dtos.Envelope[T], error)

DecodeEnvelope decodes an Atmos Pro API response body into the canonical envelope, reading the typed payload from `data`. Use this for every Pro response that returns a data payload so top-level fields are never mistaken for the payload — the bug class where a flat decode silently drops a `data`-nested result (see envelope_test.go).

func ExchangeOIDCToken added in v1.221.0

func ExchangeOIDCToken(baseURL, baseAPIEndpoint, oidcToken, workspaceID string) (string, error)

ExchangeOIDCToken exchanges a GitHub Actions OIDC token for an Atmos Pro session JWT via POST {baseURL}/{baseAPIEndpoint}/auth/github-oidc. Exported for reuse by the atmos/pro auth provider.

func ExecuteCommit added in v1.215.0

func ExecuteCommit(atmosConfig *schema.AtmosConfiguration, message, comment, addPattern string, stageAll bool) error

ExecuteCommit detects changed files in the git index, base64-encodes their contents, and sends them to Atmos Pro to create a server-side commit via the GitHub App. This ensures commits trigger CI (unlike GITHUB_TOKEN commits).

Loop prevention: if GITHUB_ACTOR is the Atmos Pro bot, the command exits early with a success message. This protects users who forget to add the `if: github.actor != 'atmos-pro[bot]'` guard to their workflow.

func GetGitHubOIDCTokenContext added in v1.230.0

func GetGitHubOIDCTokenContext(ctx context.Context, githubOIDCSettings schema.GithubOIDCSettings, audience string, clients ...*http.Client) (string, error)

GetGitHubOIDCTokenContext fetches a fresh token within the caller's delivery deadline.

func MintGitHubOIDCToken added in v1.221.0

func MintGitHubOIDCToken(githubOIDCSettings schema.GithubOIDCSettings, audience string) (string, error)

MintGitHubOIDCToken mints a GitHub Actions OIDC token for the given audience. Exported for reuse by the atmos/pro auth provider. When audience is empty, DefaultProAudience is used.

Types

type APIClient added in v1.195.0

type APIClient interface {
	// UploadInstances uploads component instances to Atmos Pro.
	UploadInstances(req *dtos.InstancesUploadRequest) error
}

APIClient defines operations for interacting with Atmos Pro API. This interface allows mocking of API operations in tests.

type APIError added in v1.213.0

type APIError struct {
	StatusCode int
	Operation  string
	Err        error
}

APIError represents an error from the Atmos Pro API that includes the HTTP status code. This allows retry logic to distinguish retryable errors (401, 5xx) from non-retryable ones (400, 403, 404).

func (*APIError) Error added in v1.213.0

func (e *APIError) Error() string

Error returns a human-readable description of the API error.

For 4xx responses the server's error message is already user-facing ("Drift detection validation failed: ..."), so the redundant "HTTP <code>:" prefix is dropped — the user sees "UploadInstances: <message>".

For 5xx and other errors the prefix is kept because the inner cause is usually a generic fallback like "API request failed with status N" and the explicit status code helps both users and support.

func (*APIError) IsAuthError added in v1.213.0

func (e *APIError) IsAuthError() bool

IsAuthError returns true if the error is a 401 Unauthorized.

func (*APIError) IsRetryable added in v1.213.0

func (e *APIError) IsRetryable() bool

IsRetryable returns true if the error represents a retryable HTTP status (401 or 5xx).

func (*APIError) Unwrap added in v1.213.0

func (e *APIError) Unwrap() error

Unwrap returns the underlying error for use with errors.Is and errors.As.

type AtmosProAPIClient

type AtmosProAPIClient struct {
	APIToken        string
	BaseAPIEndpoint string
	BaseURL         string
	HTTPClient      *http.Client

	MaxPayloadBytes int // Configurable max payload size before chunking. 0 uses default.
	// contains filtered or unexported fields
}

AtmosProAPIClient represents the client to interact with the AtmosPro API.

func NewAtmosProAPIClient

func NewAtmosProAPIClient(baseURL, baseAPIEndpoint, apiToken string) *AtmosProAPIClient

NewAtmosProAPIClient creates a new instance of AtmosProAPIClient.

func NewAtmosProAPIClientFromEnv

func NewAtmosProAPIClientFromEnv(atmosConfig *schema.AtmosConfiguration) (*AtmosProAPIClient, error)

NewAtmosProAPIClientFromEnv creates a new AtmosProAPIClient from environment variables.

func (*AtmosProAPIClient) CreateCommit added in v1.215.0

func (c *AtmosProAPIClient) CreateCommit(dto *dtos.CommitRequest) (*dtos.CommitResponse, error)

CreateCommit sends file changes to Atmos Pro to create a server-side commit via the GitHub App. It retries on transient 401/5xx failures with exponential backoff, refreshing the OIDC token on 401 errors before each retry.

func (*AtmosProAPIClient) LockStack

LockStack locks a specific stack.

func (*AtmosProAPIClient) RefreshToken added in v1.213.0

func (c *AtmosProAPIClient) RefreshToken() error

RefreshToken re-exchanges the OIDC token for a fresh Atmos Pro JWT. This is used by retry logic when a 401 suggests the original JWT was signed by a different deployment instance. Returns a no-op nil error when the client was created with a static token (no OIDC).

func (*AtmosProAPIClient) UnlockStack

UnlockStack unlocks a specific stack.

func (*AtmosProAPIClient) UploadAffectedStacks

func (c *AtmosProAPIClient) UploadAffectedStacks(dto *dtos.UploadAffectedStacksRequest) error

UploadAffectedStacks uploads information about affected stacks. Large payloads are automatically split into chunks to stay within server body size limits. Each chunk is retried on transient 401/5xx failures with exponential backoff, refreshing the OIDC token on 401 errors before each retry.

func (*AtmosProAPIClient) UploadExecData added in v1.228.0

UploadExecData uploads a command's structured Data out-of-band, in a single request (never chunked — the blob store handles arbitrarily large single uploads), when the parent ExecutionRecord would otherwise exceed the payload size threshold (FR-011). Returns the blob's URL on success.

func (*AtmosProAPIClient) UploadExecMetadata added in v1.228.0

func (c *AtmosProAPIClient) UploadExecMetadata(dto *dtos.ExecUploadRequest) error

UploadExecMetadata uploads a single command-execution record to Atmos Pro. The base envelope and resource-usage metrics are small and bounded, so they are always sent in full. Dto.Data may be arbitrarily large (e.g. the per-resource change list for terraform plan/apply): UploadExecMetadata marshals the whole record once and, when it is under the payload size threshold, sends Data inline; when at/over the threshold, it first uploads Data out-of-band via UploadExecData (a single request, never chunked) and sends the returned URL in Data's place instead (FR-011, research.md Decision 16).

func (*AtmosProAPIClient) UploadInstanceStatus added in v1.192.0

func (c *AtmosProAPIClient) UploadInstanceStatus(dto *dtos.InstanceStatusUploadRequest) error

UploadInstanceStatus uploads the drift detection result status to the pro API. It retries on transient 401/5xx failures with exponential backoff, refreshing the OIDC token on 401 errors before each retry.

func (*AtmosProAPIClient) UploadInstances added in v1.192.0

func (c *AtmosProAPIClient) UploadInstances(dto *dtos.InstancesUploadRequest) error

UploadInstances uploads drift detection data to the API. Large payloads are automatically split into chunks to stay within server body size limits. Each chunk is retried on transient 401/5xx failures with exponential backoff, refreshing the OIDC token on 401 errors before each retry.

type AtmosProAPIClientInterface added in v1.192.0

type AtmosProAPIClientInterface interface {
	UploadInstances(req *dtos.InstancesUploadRequest) error
	UploadInstanceStatus(dto *dtos.InstanceStatusUploadRequest) error
	UploadAffectedStacks(dto *dtos.UploadAffectedStacksRequest) error
	LockStack(dto *dtos.LockStackRequest) (dtos.LockStackResponse, error)
	UnlockStack(dto *dtos.UnlockStackRequest) (dtos.UnlockStackResponse, error)
	UploadExecMetadata(dto *dtos.ExecUploadRequest) error
	UploadExecData(dto *dtos.ExecDataUploadRequest) (*dtos.ExecDataUploadResponse, error)
}

AtmosProAPIClientInterface defines the interface for the AtmosProAPIClient.

type BatchInfo added in v1.213.0

type BatchInfo struct {
	BatchID    string `json:"batch_id"`
	BatchIndex int    `json:"batch_index"`
	BatchTotal int    `json:"batch_total"`
}

BatchInfo holds metadata for chunked uploads.

type ClientFactory added in v1.195.0

type ClientFactory interface {
	// NewClient creates a new API client from the given configuration.
	NewClient(atmosConfig *schema.AtmosConfiguration) (APIClient, error)
}

ClientFactory creates an APIClient from configuration.

type DefaultClientFactory added in v1.195.0

type DefaultClientFactory struct{}

DefaultClientFactory implements ClientFactory using real API client creation.

func (*DefaultClientFactory) NewClient added in v1.195.0

func (d *DefaultClientFactory) NewClient(atmosConfig *schema.AtmosConfiguration) (APIClient, error)

NewClient creates a new API client from environment variables.

type ErrorReporter added in v1.230.0

type ErrorReporter struct {
	// contains filtered or unexported fields
}

ErrorReporter owns exception destinations and duplicate tracking for one invocation.

func NewErrorReporter added in v1.230.0

func NewErrorReporter(config *schema.AtmosConfiguration, executionID string, options ExceptionTransportOptions) *ErrorReporter

NewErrorReporter snapshots invocation settings. No network requests occur at startup.

func (*ErrorReporter) Capture added in v1.230.0

func (r *ErrorReporter) Capture(err error, context map[string]string)

Capture sends each component failure once, even when an aggregate is later printed again.

func (*ErrorReporter) Flush added in v1.230.0

func (r *ErrorReporter) Flush(ctx context.Context)

Flush drains all destinations against one deadline, then closes their workers.

type ExceptionTransport added in v1.230.0

type ExceptionTransport struct {
	// contains filtered or unexported fields
}

ExceptionTransport sends buffered Sentry events to the repository's Pro endpoint.

func NewExceptionTransport added in v1.230.0

func NewExceptionTransport(settings *schema.ProSettings, repositoryID string, options ExceptionTransportOptions) (*ExceptionTransport, error)

NewExceptionTransport creates a transport without fetching credentials or sending requests.

func (*ExceptionTransport) Close added in v1.230.0

func (t *ExceptionTransport) Close()

Close cancels outstanding requests and stops the worker; it is idempotent.

func (*ExceptionTransport) Configure added in v1.230.0

func (t *ExceptionTransport) Configure(_ sentry.ClientOptions)

Configure installs Pro routing and retains the SDK's envelope serializer and queue.

func (*ExceptionTransport) Flush added in v1.230.0

func (t *ExceptionTransport) Flush(timeout time.Duration) bool

Flush waits for delivery attempts, including rejected requests.

func (*ExceptionTransport) FlushWithContext added in v1.230.0

func (t *ExceptionTransport) FlushWithContext(ctx context.Context) bool

FlushWithContext cancels pending delivery when the shutdown deadline expires.

func (*ExceptionTransport) SendEvent added in v1.230.0

func (t *ExceptionTransport) SendEvent(event *sentry.Event)

SendEvent snapshots and masks each event before returning it to the SDK queue.

type ExceptionTransportOptions added in v1.230.0

type ExceptionTransportOptions struct {
	HTTPClient *http.Client
	Token      func(context.Context) (string, error)
}

ExceptionTransportOptions supplies injectable HTTP and token dependencies.

type MockAPIClient added in v1.195.0

type MockAPIClient struct {
	// contains filtered or unexported fields
}

MockAPIClient is a mock of APIClient interface.

func NewMockAPIClient added in v1.195.0

func NewMockAPIClient(ctrl *gomock.Controller) *MockAPIClient

NewMockAPIClient creates a new mock instance.

func (*MockAPIClient) EXPECT added in v1.195.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAPIClient) UploadInstances added in v1.195.0

func (m *MockAPIClient) UploadInstances(req *dtos.InstancesUploadRequest) error

UploadInstances mocks base method.

type MockAPIClientMockRecorder added in v1.195.0

type MockAPIClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockAPIClientMockRecorder is the mock recorder for MockAPIClient.

func (*MockAPIClientMockRecorder) UploadInstances added in v1.195.0

func (mr *MockAPIClientMockRecorder) UploadInstances(req any) *gomock.Call

UploadInstances indicates an expected call of UploadInstances.

type MockAtmosProAPIClientInterface added in v1.228.0

type MockAtmosProAPIClientInterface struct {
	// contains filtered or unexported fields
}

MockAtmosProAPIClientInterface is a mock of AtmosProAPIClientInterface interface.

func NewMockAtmosProAPIClientInterface added in v1.228.0

func NewMockAtmosProAPIClientInterface(ctrl *gomock.Controller) *MockAtmosProAPIClientInterface

NewMockAtmosProAPIClientInterface creates a new mock instance.

func (*MockAtmosProAPIClientInterface) EXPECT added in v1.228.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAtmosProAPIClientInterface) LockStack added in v1.228.0

LockStack mocks base method.

func (*MockAtmosProAPIClientInterface) UnlockStack added in v1.228.0

UnlockStack mocks base method.

func (*MockAtmosProAPIClientInterface) UploadAffectedStacks added in v1.228.0

UploadAffectedStacks mocks base method.

func (*MockAtmosProAPIClientInterface) UploadExecData added in v1.228.0

UploadExecData mocks base method.

func (*MockAtmosProAPIClientInterface) UploadExecMetadata added in v1.228.0

func (m *MockAtmosProAPIClientInterface) UploadExecMetadata(dto *dtos.ExecUploadRequest) error

UploadExecMetadata mocks base method.

func (*MockAtmosProAPIClientInterface) UploadInstanceStatus added in v1.228.0

UploadInstanceStatus mocks base method.

func (*MockAtmosProAPIClientInterface) UploadInstances added in v1.228.0

UploadInstances mocks base method.

type MockAtmosProAPIClientInterfaceMockRecorder added in v1.228.0

type MockAtmosProAPIClientInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockAtmosProAPIClientInterfaceMockRecorder is the mock recorder for MockAtmosProAPIClientInterface.

func (*MockAtmosProAPIClientInterfaceMockRecorder) LockStack added in v1.228.0

LockStack indicates an expected call of LockStack.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UnlockStack added in v1.228.0

UnlockStack indicates an expected call of UnlockStack.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UploadAffectedStacks added in v1.228.0

func (mr *MockAtmosProAPIClientInterfaceMockRecorder) UploadAffectedStacks(dto any) *gomock.Call

UploadAffectedStacks indicates an expected call of UploadAffectedStacks.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UploadExecData added in v1.228.0

func (mr *MockAtmosProAPIClientInterfaceMockRecorder) UploadExecData(dto any) *gomock.Call

UploadExecData indicates an expected call of UploadExecData.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UploadExecMetadata added in v1.228.0

func (mr *MockAtmosProAPIClientInterfaceMockRecorder) UploadExecMetadata(dto any) *gomock.Call

UploadExecMetadata indicates an expected call of UploadExecMetadata.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UploadInstanceStatus added in v1.228.0

func (mr *MockAtmosProAPIClientInterfaceMockRecorder) UploadInstanceStatus(dto any) *gomock.Call

UploadInstanceStatus indicates an expected call of UploadInstanceStatus.

func (*MockAtmosProAPIClientInterfaceMockRecorder) UploadInstances added in v1.228.0

func (mr *MockAtmosProAPIClientInterfaceMockRecorder) UploadInstances(req any) *gomock.Call

UploadInstances indicates an expected call of UploadInstances.

type MockClientFactory added in v1.195.0

type MockClientFactory struct {
	// contains filtered or unexported fields
}

MockClientFactory is a mock of ClientFactory interface.

func NewMockClientFactory added in v1.195.0

func NewMockClientFactory(ctrl *gomock.Controller) *MockClientFactory

NewMockClientFactory creates a new mock instance.

func (*MockClientFactory) EXPECT added in v1.195.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClientFactory) NewClient added in v1.195.0

func (m *MockClientFactory) NewClient(atmosConfig *schema.AtmosConfiguration) (APIClient, error)

NewClient mocks base method.

type MockClientFactoryMockRecorder added in v1.195.0

type MockClientFactoryMockRecorder struct {
	// contains filtered or unexported fields
}

MockClientFactoryMockRecorder is the mock recorder for MockClientFactory.

func (*MockClientFactoryMockRecorder) NewClient added in v1.195.0

func (mr *MockClientFactoryMockRecorder) NewClient(atmosConfig any) *gomock.Call

NewClient indicates an expected call of NewClient.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL