Documentation ¶
Overview ¶
Package cloud implements a client SDK for communication with the cloud API.
Package cloud implements the SDK for communicating with the Terramate Cloud.
Index ¶
- Constants
- func Get[T Resource](ctx context.Context, client *Client, u url.URL) (entity T, err error)
- func Patch[T Resource](ctx context.Context, client *Client, payload interface{}, url url.URL) (entity T, err error)
- func Post[T Resource](ctx context.Context, client *Client, payload interface{}, url url.URL) (entity T, err error)
- func Put[T Resource](ctx context.Context, client *Client, payload interface{}, url url.URL) (entity T, err error)
- func Request[T Resource](ctx context.Context, c *Client, method string, url url.URL, postBody io.Reader) (entity T, err error)
- type Author
- type ChangesetDetails
- type Client
- func (c *Client) CheckVersion(ctx context.Context) error
- func (c *Client) CreateDeploymentStacks(ctx context.Context, orgUUID UUID, deploymentUUID UUID, ...) (DeploymentStacksResponse, error)
- func (c *Client) CreatePreview(ctx context.Context, opts CreatePreviewOpts) (*CreatedPreview, error)
- func (c *Client) CreateStackDrift(ctx context.Context, orgUUID UUID, driftPayload DriftStackPayloadRequest) (EmptyResponse, error)
- func (c *Client) DriftDetails(ctx context.Context, orgUUID UUID, stackID int64, driftID int64) (Drift, error)
- func (c *Client) GetStack(ctx context.Context, orgUUID UUID, repo, target, metaID string) (StackObject, bool, error)
- func (c *Client) ListReviewRequests(ctx context.Context, orgUUID UUID) (ReviewRequestResponses, error)
- func (c *Client) MemberOrganizations(ctx context.Context) (orgs MemberOrganizations, err error)
- func (c *Client) StackLastDrift(ctx context.Context, orgUUID UUID, stackID int64) (DriftsStackPayloadResponse, error)
- func (c *Client) StacksByStatus(ctx context.Context, orgUUID UUID, repository string, target string, ...) ([]StackObject, error)
- func (c *Client) SyncCommandLogs(ctx context.Context, orgUUID UUID, stackID int64, deploymentUUID UUID, ...) error
- func (c *Client) URL(path string, queries ...url.Values) url.URL
- func (c *Client) UpdateDeploymentStacks(ctx context.Context, orgUUID UUID, deploymentUUID UUID, ...) error
- func (c *Client) UpdateStackPreview(ctx context.Context, opts UpdateStackPreviewOpts) error
- func (c *Client) Users(ctx context.Context) (user User, err error)
- type CommandLog
- type CommandLogs
- type CreatePreviewOpts
- type CreatePreviewPayloadRequest
- type CreatePreviewResponse
- type CreatedPreview
- type Credential
- type DeploymentMetadata
- type DeploymentStackRequest
- type DeploymentStackRequests
- type DeploymentStackResponse
- type DeploymentStacksPayloadRequest
- type DeploymentStacksResponse
- type Drift
- type DriftStackPayloadRequest
- type DriftStackPayloadRequests
- type Drifts
- type DriftsStackPayloadResponse
- type EmptyResponse
- type GitMetadata
- type GithubMetadata
- type GitlabMetadata
- type Label
- type LogChannel
- type LogSyncer
- type MemberOrganization
- type MemberOrganizations
- type PaginatedResult
- type PreviewStack
- type PreviewStacks
- type Resource
- type ResponsePreviewStack
- type ResponsePreviewStacks
- type ReviewRequest
- type ReviewRequestResponse
- type ReviewRequestResponsePayload
- type ReviewRequestResponses
- type Reviewer
- type Reviewers
- type RunContext
- type Stack
- type StackObject
- type StacksResponse
- type StatusFilters
- type Syncer
- type UUID
- type UpdateDeploymentStack
- type UpdateDeploymentStacks
- type UpdateStackPreviewOpts
- type UpdateStackPreviewPayloadRequest
- type User
- type WellKnown
Constants ¶
const ( // WellKnownCLIPath is the well-known base path. WellKnownCLIPath = "/.well-known/cli.json" // UsersPath is the users endpoint base path. UsersPath = "/v1/users" // MembershipsPath is the memberships endpoint base path. MembershipsPath = "/v1/memberships" // DeploymentsPath is the deployments endpoint base path. DeploymentsPath = "/v1/deployments" // DriftsPath is the drifts endpoint base path. DriftsPath = "/v1/drifts" // StacksPath is the stacks endpoint base path. StacksPath = "/v1/stacks" // ReviewRequestsPath is the review requests endpoint base path. ReviewRequestsPath = "/v1/review_requests" )
const ( // PreviewsPath is the previews endpoints base path. PreviewsPath = "/v1/previews" // StackPreviewsPath is the stack previews endpoint base path. StackPreviewsPath = "/v1/stack_previews" )
const BaseURL = "https://" + Host
BaseURL is the default cloud.terramate.io base API URL.
const DefaultLogBatchSize = 256
DefaultLogBatchSize is the default batch size.
const DefaultLogSyncInterval = 1 * time.Second
DefaultLogSyncInterval is the maximum idle duration before a sync could happen.
const ErrNotFound errors.Kind = "resource not found (HTTP Status 404)"
ErrNotFound indicates the requested resource does not exist in the server.
const ErrUnexpectedResponseBody errors.Kind = "unexpected API response body"
ErrUnexpectedResponseBody indicates the server responded with an unexpected body.
const ErrUnexpectedStatus errors.Kind = "unexpected status code"
ErrUnexpectedStatus indicates the server responded with an unexpected status code.
const Host = "api.terramate.io"
Host of the official Terramate Cloud API.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get requests the endpoint components list making a GET request and decode the response into the entity T if validates successfully.
func Patch ¶
func Patch[T Resource](ctx context.Context, client *Client, payload interface{}, url url.URL) (entity T, err error)
Patch requests the endpoint components list making a PATCH request and decode the response into the entity T if validates successfully.
func Post ¶
func Post[T Resource](ctx context.Context, client *Client, payload interface{}, url url.URL) (entity T, err error)
Post requests the endpoint components list making a POST request and decode the response into the entity T if validates successfully.
Types ¶
type ChangesetDetails ¶ added in v0.4.5
type ChangesetDetails struct { Provisioner string `json:"provisioner"` ChangesetASCII string `json:"changeset_ascii,omitempty"` ChangesetJSON string `json:"changeset_json,omitempty"` Serial *int64 `json:"serial,omitempty"` }
ChangesetDetails represents the details of a changeset (e.g. the terraform plan).
func (ChangesetDetails) Validate ¶ added in v0.4.5
func (ds ChangesetDetails) Validate() error
Validate the drift details.
type Client ¶
type Client struct { // BaseURL is the cloud base endpoint URL. // If not set, it defaults to [BaseURL]. BaseURL string IDPKey string Credential Credential // HTTPClient is the HTTP client reused in all connections. // if not set, a new instance of http.Client is created on the first request. HTTPClient *http.Client Logger *zerolog.Logger // contains filtered or unexported fields }
Client is the cloud SDK client.
func (*Client) CheckVersion ¶ added in v0.4.4
CheckVersion checks if current Terramate version can be used to communicate with the cloud.
func (*Client) CreateDeploymentStacks ¶
func (c *Client) CreateDeploymentStacks( ctx context.Context, orgUUID UUID, deploymentUUID UUID, deploymentStacksPayload DeploymentStacksPayloadRequest, ) (DeploymentStacksResponse, error)
CreateDeploymentStacks creates a new deployment for provided stacks payload.
func (*Client) CreatePreview ¶ added in v0.5.0
func (c *Client) CreatePreview(ctx context.Context, opts CreatePreviewOpts) (*CreatedPreview, error)
CreatePreview creates a new preview in the cloud
func (*Client) CreateStackDrift ¶ added in v0.4.2
func (c *Client) CreateStackDrift( ctx context.Context, orgUUID UUID, driftPayload DriftStackPayloadRequest, ) (EmptyResponse, error)
CreateStackDrift pushes a new drift status for the given stack.
func (*Client) DriftDetails ¶ added in v0.4.3
func (c *Client) DriftDetails(ctx context.Context, orgUUID UUID, stackID int64, driftID int64) (Drift, error)
DriftDetails retrieves details of the given driftID.
func (*Client) GetStack ¶ added in v0.4.3
func (c *Client) GetStack(ctx context.Context, orgUUID UUID, repo, target, metaID string) (StackObject, bool, error)
GetStack retrieves the details of the stack with given repo and metaID.
func (*Client) ListReviewRequests ¶ added in v0.5.0
func (c *Client) ListReviewRequests(ctx context.Context, orgUUID UUID) (ReviewRequestResponses, error)
ListReviewRequests retrieves the review requests for the given organization.
func (*Client) MemberOrganizations ¶
func (c *Client) MemberOrganizations(ctx context.Context) (orgs MemberOrganizations, err error)
MemberOrganizations returns all organizations which are associated with the user.
func (*Client) StackLastDrift ¶ added in v0.4.4
func (c *Client) StackLastDrift(ctx context.Context, orgUUID UUID, stackID int64) (DriftsStackPayloadResponse, error)
StackLastDrift returns the drifts of the given stack.
func (*Client) StacksByStatus ¶ added in v0.4.3
func (c *Client) StacksByStatus(ctx context.Context, orgUUID UUID, repository string, target string, stackFilters StatusFilters) ([]StackObject, error)
StacksByStatus returns all stacks for the given organization. It paginates as needed and returns the total stacks response.
func (*Client) SyncCommandLogs ¶ added in v0.5.0
func (c *Client) SyncCommandLogs( ctx context.Context, orgUUID UUID, stackID int64, deploymentUUID UUID, logs CommandLogs, stackPreviewID string, ) error
SyncCommandLogs sends a batch of command logs to Terramate Cloud.
func (*Client) URL ¶ added in v0.4.4
URL builds an URL for the given path and queries from the client's base URL.
func (*Client) UpdateDeploymentStacks ¶
func (c *Client) UpdateDeploymentStacks(ctx context.Context, orgUUID UUID, deploymentUUID UUID, payload UpdateDeploymentStacks) error
UpdateDeploymentStacks updates the deployment status of each stack in the payload set.
func (*Client) UpdateStackPreview ¶ added in v0.5.0
func (c *Client) UpdateStackPreview(ctx context.Context, opts UpdateStackPreviewOpts) error
UpdateStackPreview updates a stack preview in the cloud.
type CommandLog ¶ added in v0.5.0
type CommandLog struct { Line int64 `json:"log_line"` Timestamp *time.Time `json:"timestamp"` Channel LogChannel `json:"channel"` Message string `json:"message"` }
CommandLog represents a single log message.
func (CommandLog) Validate ¶ added in v0.5.0
func (l CommandLog) Validate() error
Validate a command log.
type CommandLogs ¶ added in v0.5.0
type CommandLogs []*CommandLog
CommandLogs represents a batch of log messages.
func (CommandLogs) Validate ¶ added in v0.5.0
func (ls CommandLogs) Validate() error
Validate a list of command logs.
type CreatePreviewOpts ¶ added in v0.5.0
type CreatePreviewOpts struct { Runs []RunContext AffectedStacks map[string]*config.Stack OrgUUID UUID PushedAt int64 CommitSHA string Technology string TechnologyLayer string Repository string Target string FromTarget string DefaultBranch string ReviewRequest *ReviewRequest Metadata *DeploymentMetadata }
CreatePreviewOpts is the options for the CreatePreview function
type CreatePreviewPayloadRequest ¶ added in v0.5.0
type CreatePreviewPayloadRequest struct { CommitSHA string `json:"commit_sha"` PushedAt int64 `json:"pushed_at"` Technology string `json:"technology"` TechnologyLayer string `json:"technology_layer"` ReviewRequest *ReviewRequest `json:"review_request,omitempty"` Metadata *DeploymentMetadata `json:"metadata,omitempty"` Stacks PreviewStacks `json:"stacks"` }
CreatePreviewPayloadRequest is the request payload for the creation of stack deployments.
func (CreatePreviewPayloadRequest) Validate ¶ added in v0.5.0
func (r CreatePreviewPayloadRequest) Validate() error
Validate the CreatePreviewPayloadRequest object.
type CreatePreviewResponse ¶ added in v0.5.0
type CreatePreviewResponse struct { PreviewID string `json:"preview_id"` Stacks ResponsePreviewStacks `json:"stacks"` }
CreatePreviewResponse represents the deployment creation response item.
func (CreatePreviewResponse) Validate ¶ added in v0.5.0
func (r CreatePreviewResponse) Validate() error
Validate validates the CreatePreviewResponse payload
type CreatedPreview ¶ added in v0.5.0
CreatedPreview is the result of CreatePreview
type Credential ¶
type Credential interface { // Token retrieves a new token ready be used (the credential provider must refresh the token if needed) Token() (string, error) }
Credential is the interface for the credential providers.
type DeploymentMetadata ¶ added in v0.4.1
type DeploymentMetadata struct { GitMetadata GithubMetadata GitlabMetadata }
DeploymentMetadata stores the metadata available in the target platform. It's marshaled as a flat hashmap of values. Note: no sensitive information must be stored here because it could be logged.
func (DeploymentMetadata) Validate ¶ added in v0.4.1
func (m DeploymentMetadata) Validate() error
Validate the metadata.
type DeploymentStackRequest ¶
type DeploymentStackRequest struct { Stack CommitSHA string `json:"commit_sha,omitempty"` DeploymentURL string `json:"deployment_url,omitempty"` DeploymentStatus deployment.Status `json:"deployment_status,omitempty"` DeploymentCommand string `json:"deployment_cmd"` }
DeploymentStackRequest represents the stack object of the request payload type for the creation of stack deployments.
func (DeploymentStackRequest) Validate ¶
func (d DeploymentStackRequest) Validate() error
Validate the deployment stack request.
type DeploymentStackRequests ¶
type DeploymentStackRequests []DeploymentStackRequest
DeploymentStackRequests is a list of DeploymentStacksRequest.
func (DeploymentStackRequests) Validate ¶
func (d DeploymentStackRequests) Validate() error
Validate the list of deployment stack requests.
type DeploymentStackResponse ¶
type DeploymentStackResponse struct { StackID int64 `json:"stack_id"` StackMetaID string `json:"meta_id"` // TODO(snk): The target in the response is not handled yet. This needs to happen once we // support creating deployments with the same stack/meta_id on multiple targets. Target string `json:"target"` Status deployment.Status `json:"status"` }
DeploymentStackResponse represents the deployment creation response item.
func (DeploymentStackResponse) Validate ¶
func (d DeploymentStackResponse) Validate() error
Validate the deployment stack response.
type DeploymentStacksPayloadRequest ¶
type DeploymentStacksPayloadRequest struct { ReviewRequest *ReviewRequest `json:"review_request,omitempty"` Stacks DeploymentStackRequests `json:"stacks"` Workdir project.Path `json:"workdir"` Metadata *DeploymentMetadata `json:"metadata,omitempty"` }
DeploymentStacksPayloadRequest is the request payload for the creation of stack deployments.
func (DeploymentStacksPayloadRequest) Validate ¶
func (d DeploymentStacksPayloadRequest) Validate() error
Validate the deployment stack payload.
type DeploymentStacksResponse ¶
type DeploymentStacksResponse []DeploymentStackResponse
DeploymentStacksResponse represents the list of DeploymentStackResponse.
func (DeploymentStacksResponse) Validate ¶
func (ds DeploymentStacksResponse) Validate() error
Validate the list of deployment stacks response.
type Drift ¶ added in v0.4.3
type Drift struct { ID int64 `json:"id"` Status drift.Status `json:"status"` Details *ChangesetDetails `json:"drift_details,omitempty"` Metadata *DeploymentMetadata `json:"metadata,omitempty"` }
Drift represents the drift information for a given stack.
type DriftStackPayloadRequest ¶ added in v0.4.2
type DriftStackPayloadRequest struct { Stack Stack `json:"stack"` Status drift.Status `json:"drift_status"` Details *ChangesetDetails `json:"drift_details,omitempty"` Metadata *DeploymentMetadata `json:"metadata,omitempty"` StartedAt *time.Time `json:"started_at,omitempty"` FinishedAt *time.Time `json:"finished_at,omitempty"` Command []string `json:"command"` }
DriftStackPayloadRequest is the payload for the drift sync.
func (DriftStackPayloadRequest) Validate ¶ added in v0.4.2
func (d DriftStackPayloadRequest) Validate() error
Validate the drift request payload.
type DriftStackPayloadRequests ¶ added in v0.4.2
type DriftStackPayloadRequests []DriftStackPayloadRequest
DriftStackPayloadRequests is a list of DriftStackPayloadRequest
func (DriftStackPayloadRequests) Validate ¶ added in v0.4.2
func (ds DriftStackPayloadRequests) Validate() error
Validate the list of drift requests.
type DriftsStackPayloadResponse ¶ added in v0.4.3
type DriftsStackPayloadResponse struct { Drifts Drifts `json:"drifts"` Pagination PaginatedResult `json:"paginated_result"` }
DriftsStackPayloadResponse is the payload returned when listing stack drifts.
func (DriftsStackPayloadResponse) Validate ¶ added in v0.4.3
func (ds DriftsStackPayloadResponse) Validate() error
Validate the drifts list response payload.
type EmptyResponse ¶ added in v0.4.1
type EmptyResponse string
EmptyResponse is used to represent an empty string response.
func (EmptyResponse) Validate ¶ added in v0.4.1
func (s EmptyResponse) Validate() error
Validate that content is empty.
type GitMetadata ¶ added in v0.5.0
type GitMetadata struct { GitCommitSHA string `json:"git_commit_sha,omitempty"` GitCommitAuthorName string `json:"git_commit_author_name,omitempty"` GitCommitAuthorEmail string `json:"git_commit_author_email,omitempty"` GitCommitAuthorTime *time.Time `json:"git_commit_author_time,omitempty"` GitCommitTitle string `json:"git_commit_title,omitempty"` GitCommitDescription string `json:"git_commit_description,omitempty"` }
GitMetadata are the git related metadata.
type GithubMetadata ¶ added in v0.9.1
type GithubMetadata struct { GithubPullRequestAuthorLogin string `json:"github_pull_request_author_login,omitempty"` GithubPullRequestAuthorAvatarURL string `json:"github_pull_request_author_avatar_url,omitempty"` GithubPullRequestAuthorGravatarID string `json:"github_pull_request_author_gravatar_id,omitempty"` GithubPullRequestURL string `json:"github_pull_request_url,omitempty"` GithubPullRequestNumber int `json:"github_pull_request_number,omitempty"` GithubPullRequestTitle string `json:"github_pull_request_title,omitempty"` GithubPullRequestDescription string `json:"github_pull_request_description,omitempty"` GithubPullRequestState string `json:"github_pull_request_state,omitempty"` GithubPullRequestMergeCommitSHA string `json:"github_pull_request_merge_commit_sha,omitempty"` GithubPullRequestHeadLabel string `json:"github_pull_request_head_label,omitempty"` GithubPullRequestHeadRef string `json:"github_pull_request_head_ref,omitempty"` GithubPullRequestHeadSHA string `json:"github_pull_request_head_sha,omitempty"` GithubPullRequestHeadAuthorLogin string `json:"github_pull_request_head_author_login,omitempty"` GithubPullRequestHeadAuthorAvatarURL string `json:"github_pull_request_head_author_avatar_url,omitempty"` GithubPullRequestHeadAuthorGravatarID string `json:"github_pull_request_head_author_gravatar_id,omitempty"` GithubPullRequestBaseLabel string `json:"github_pull_request_base_label,omitempty"` GithubPullRequestBaseRef string `json:"github_pull_request_base_ref,omitempty"` GithubPullRequestBaseSHA string `json:"github_pull_request_base_sha,omitempty"` GithubPullRequestBaseAuthorLogin string `json:"github_pull_request_base_author_login,omitempty"` GithubPullRequestBaseAuthorAvatarURL string `json:"github_pull_request_base_author_avatar_url,omitempty"` GithubPullRequestBaseAuthorGravatarID string `json:"github_pull_request_base_author_gravatar_id,omitempty"` GithubPullRequestCreatedAt *time.Time `json:"github_pull_request_created_at,omitempty"` GithubPullRequestUpdatedAt *time.Time `json:"github_pull_request_updated_at,omitempty"` GithubPullRequestClosedAt *time.Time `json:"github_pull_request_closed_at,omitempty"` GithubPullRequestMergedAt *time.Time `json:"github_pull_request_merged_at,omitempty"` GithubCommitVerified *bool `json:"github_commit_verified,omitempty"` GithubCommitVerifiedReason string `json:"github_commit_verified_reason,omitempty"` GithubCommitTitle string `json:"github_commit_title,omitempty"` GithubCommitDescription string `json:"github_commit_description,omitempty"` GithubCommitAuthorLogin string `json:"github_commit_author_login,omitempty"` GithubCommitAuthorAvatarURL string `json:"github_commit_author_avatar_url,omitempty"` GithubCommitAuthorGravatarID string `json:"github_commit_author_gravatar_id,omitempty"` GithubCommitAuthorGitName string `json:"github_commit_author_git_name,omitempty"` GithubCommitAuthorGitEmail string `json:"github_commit_author_git_email,omitempty"` GithubCommitAuthorGitDate *time.Time `json:"github_commit_author_git_date,omitempty"` GithubCommitCommitterLogin string `json:"github_commit_committer_login,omitempty"` GithubCommitCommitterAvatarURL string `json:"github_commit_committer_avatar_url,omitempty"` GithubCommitCommitterGravatarID string `json:"github_commit_committer_gravatar_id,omitempty"` GithubCommitCommitterGitName string `json:"github_commit_committer_git_name,omitempty"` GithubCommitCommitterGitEmail string `json:"github_commit_committer_git_email,omitempty"` GithubCommitCommitterGitDate *time.Time `json:"github_commit_committer_git_date,omitempty"` GithubActionsDeploymentBranch string `json:"github_actions_deployment_branch,omitempty"` GithubActionsDeploymentActor string `json:"github_actions_deployment_actor,omitempty"` GithubActionsDeploymentTriggeredBy string `json:"github_actions_triggered_by,omitempty"` GithubActionsRunID string `json:"github_actions_run_id,omitempty"` GithubActionsRunAttempt string `json:"github_actions_run_attempt,omitempty"` GithubActionsWorkflowName string `json:"github_actions_workflow_name,omitempty"` GithubActionsWorkflowRef string `json:"github_actions_workflow_ref,omitempty"` }
GithubMetadata is the GitHub related metadata
type GitlabMetadata ¶ added in v0.9.1
type GitlabMetadata struct { GitlabMergeRequestAuthorID int `json:"gitlab_merge_request_author_id,omitempty"` GitlabMergeRequestAuthorName string `json:"gitlab_merge_request_author_name,omitempty"` GitlabMergeRequestAuthorWebURL string `json:"gitlab_merge_request_author_web_url,omitempty"` GitlabMergeRequestAuthorUsername string `json:"gitlab_merge_request_author_username,omitempty"` GitlabMergeRequestAuthorAvatarURL string `json:"gitlab_merge_request_author_avatar_url,omitempty"` GitlabMergeRequestAuthorState string `json:"gitlab_merge_request_author_state,omitempty"` GitlabMergeRequestID int `json:"gitlab_merge_request_id,omitempty"` GitlabMergeRequestIID int `json:"gitlab_merge_request_iid,omitempty"` GitlabMergeRequestState string `json:"gitlab_merge_request_state,omitempty"` GitlabMergeRequestCreatedAt string `json:"gitlab_merge_request_created_at,omitempty"` GitlabMergeRequestUpdatedAt string `json:"gitlab_merge_request_updated_at,omitempty"` GitlabMergeRequestTargetBranch string `json:"gitlab_merge_request_target_branch,omitempty"` GitlabMergeRequestSourceBranch string `json:"gitlab_merge_request_source_branch,omitempty"` GitlabMergeRequestMergeStatus string `json:"gitlab_merge_request_merge_status,omitempty"` GitlabMergeRequestWebURL string `json:"gitlab_merge_request_web_url,omitempty"` // CICD GitlabCICDJobManual bool `json:"gitlab_cicd_job_manual,omitempty"` // CI_JOB_MANUAL GitlabCICDPipelineID string `json:"gitlab_cicd_pipeline_id,omitempty"` // CI_PIPELINE_ID GitlabCICDPipelineSource string `json:"gitlab_cicd_pipeline_source,omitempty"` // CI_PIPELINE_SOURCE GitlabCICDPipelineName string `json:"gitlab_cicd_pipeline_name,omitempty"` // CI_PIPELINE_NAME GitlabCICDPipelineTriggered bool `json:"gitlan_cicd_pipeline_triggered,omitempty"` // CI_PIPELINE_TRIGGERED GitlabCICDPipelineURL string `json:"gitlab_cicd_pipeline_url,omitempty"` // CI_PIPELINE_URL GitlabCICDPipelineCreatedAt string `json:"gitlab_cicd_pipeline_created_at,omitempty"` // CI_PIPELINE_CREATED_AT GitlabCICDJobID string `json:"gitlab_cicd_job_id,omitempty"` // CI_JOB_ID GitlabCICDJobName string `json:"gitlab_cicd_job_name,omitempty"` // CI_JOB_NAME GitlabCICDJobStartedAt string `json:"gitlab_cicd_job_started_at,omitempty"` // CI_JOB_STARTED_AT GitlabCICDUserEmail string `json:"gitlab_cicd_user_email,omitempty"` // GITLAB_USER_EMAIL GitlabCICDUserName string `json:"gitlab_cicd_user_name,omitempty"` // GITLAB_USER_NAME GitlabCICDUserLogin string `json:"gitlab_cicd_user_login,omitempty"` // GITLAB_USER_LOGIN GitlabCICDCommitBranch string `json:"gitlab_cicd_commit_branch,omitempty"` // CI_COMMIT_BRANCH // either CI_COMMIT_BRANCH or CI_MERGE_REQUEST_SOURCE_BRANCH_NAME GitlabCICDBranch string `json:"gitlab_cicd_branch,omitempty"` // Only available for merge request pipelines GitlabCICDMergeRequestApproved *bool `json:"gitlab_cicd_merge_request_approved,omitempty"` // CI_MERGE_REQUEST_APPROVED }
GitlabMetadata holds the Gitlab specific metadata.
type Label ¶ added in v0.4.4
type Label struct { Name string `json:"name"` Color string `json:"color,omitempty"` Description string `json:"description,omitempty"` }
Label of a review request.
type LogChannel ¶ added in v0.4.3
type LogChannel int
LogChannel is an enum-like type for the output channels supported.
const ( StdoutLogChannel LogChannel // StdoutLogChannel is the stdout channel StderrLogChannel // StderrLogChannel is the stderr channel )
func (*LogChannel) MarshalJSON ¶ added in v0.4.3
func (c *LogChannel) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (LogChannel) String ¶ added in v0.4.3
func (c LogChannel) String() string
String returns the channel name.
func (*LogChannel) UnmarshalJSON ¶ added in v0.4.3
func (c *LogChannel) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type LogSyncer ¶ added in v0.4.3
type LogSyncer struct {
// contains filtered or unexported fields
}
LogSyncer is the log syncer controller type.
func NewLogSyncer ¶ added in v0.4.3
NewLogSyncer creates a new log syncer.
func NewLogSyncerWith ¶ added in v0.4.3
NewLogSyncerWith creates a new customizable syncer.
type MemberOrganization ¶
type MemberOrganization struct { MemberID int64 `json:"member_id,omitempty"` Name string `json:"org_name"` DisplayName string `json:"org_display_name"` Domain string `json:"org_domain"` UUID UUID `json:"org_uuid"` Role string `json:"role,omitempty"` Status string `json:"status"` }
MemberOrganization represents the organization associated with the member.
func (MemberOrganization) Validate ¶
func (org MemberOrganization) Validate() error
Validate checks if at least the fields required by Terramate CLI are set.
type MemberOrganizations ¶
type MemberOrganizations []MemberOrganization
MemberOrganizations is a list of organizations associated with the member.
func (MemberOrganizations) String ¶
func (orgs MemberOrganizations) String() string
String is a human readable list of organizations associated with a user.
func (MemberOrganizations) Validate ¶
func (orgs MemberOrganizations) Validate() error
Validate if the organization list is valid.
type PaginatedResult ¶ added in v0.4.4
type PaginatedResult struct { Total int64 `json:"total"` Page int64 `json:"page"` PerPage int64 `json:"per_page"` }
PaginatedResult represents the pagination object.
func (PaginatedResult) Validate ¶ added in v0.4.4
func (p PaginatedResult) Validate() error
Validate the "paginate_result" field.
type PreviewStack ¶ added in v0.5.0
type PreviewStack struct { Stack PreviewStatus preview.StackStatus `json:"preview_status"` Cmd []string `json:"cmd,omitempty"` }
PreviewStack represents the stack object of the request payload type for the creation of stack deployments.
type PreviewStacks ¶ added in v0.5.0
type PreviewStacks []PreviewStack
PreviewStacks is a list of stack objects for the request payload
func (PreviewStacks) Validate ¶ added in v0.5.0
func (s PreviewStacks) Validate() error
Validate the PreviewStacks object.
type Resource ¶
type Resource interface {
Validate() error
}
Resource is the interface used to represent resource entities.
type ResponsePreviewStack ¶ added in v0.5.0
type ResponsePreviewStack struct { MetaID string `json:"meta_id"` StackPreviewID string `json:"stack_preview_id"` }
ResponsePreviewStack represents a specific stack in the preview response.
type ResponsePreviewStacks ¶ added in v0.5.0
type ResponsePreviewStacks []ResponsePreviewStack
ResponsePreviewStacks is a list of stack objects in the response payload
func (ResponsePreviewStacks) Validate ¶ added in v0.5.0
func (s ResponsePreviewStacks) Validate() error
Validate the ResponsePreviewStacks object.
type ReviewRequest ¶ added in v0.5.0
type ReviewRequest struct { Platform string `json:"platform"` Repository string `json:"repository"` CommitSHA string `json:"commit_sha"` Number int `json:"number"` Title string `json:"title"` Description string `json:"description"` URL string `json:"url"` Labels []Label `json:"labels,omitempty"` Author Author `json:"author"` Reviewers Reviewers `json:"reviewers,omitempty"` Status string `json:"status"` Draft bool `json:"draft"` ReviewDecision string `json:"review_decision,omitempty"` ChangesRequestedCount int `json:"changes_requested_count"` ApprovedCount int `json:"approved_count"` ChecksTotalCount int `json:"checks_total_count"` ChecksFailureCount int `json:"checks_failure_count"` ChecksSuccessCount int `json:"checks_success_count"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` PushedAt *time.Time `json:"pushed_at,omitempty"` Branch string `json:"branch"` BaseBranch string `json:"base_branch"` }
ReviewRequest is the review_request object.
func (ReviewRequest) Validate ¶ added in v0.5.0
func (rr ReviewRequest) Validate() error
Validate the DeploymentReviewRequest object.
type ReviewRequestResponse ¶ added in v0.5.0
type ReviewRequestResponse struct { ID int64 `json:"review_request_id"` CommitSHA string `json:"commit_sha"` Number int `json:"number"` }
ReviewRequestResponse is the response payload for the review request creation.
func (ReviewRequestResponse) Validate ¶ added in v0.5.0
func (rr ReviewRequestResponse) Validate() error
Validate the ReviewRequestResponse object.
type ReviewRequestResponsePayload ¶ added in v0.5.0
type ReviewRequestResponsePayload struct { ReviewRequests ReviewRequestResponses `json:"review_requests"` Pagination PaginatedResult `json:"paginated_result"` }
ReviewRequestResponsePayload is the review request response payload.
func (ReviewRequestResponsePayload) Validate ¶ added in v0.5.0
func (rr ReviewRequestResponsePayload) Validate() error
Validate the review request response payload.
type ReviewRequestResponses ¶ added in v0.5.0
type ReviewRequestResponses []ReviewRequestResponse
ReviewRequestResponses is a list of review request responses.
func (ReviewRequestResponses) Validate ¶ added in v0.5.0
func (rrs ReviewRequestResponses) Validate() error
Validate the list of review request responses.
type Reviewer ¶ added in v0.4.4
type Reviewer Author
Reviewer is the user's reviewer of a Pull/Merge Request.
type RunContext ¶ added in v0.5.0
RunContext is the context for a run
type Stack ¶
type Stack struct { Repository string `json:"repository"` Target string `json:"target,omitempty"` FromTarget string `json:"from_target,omitempty"` DefaultBranch string `json:"default_branch"` Path string `json:"path"` MetaID string `json:"meta_id"` MetaName string `json:"meta_name,omitempty"` MetaDescription string `json:"meta_description,omitempty"` MetaTags []string `json:"meta_tags,omitempty"` }
Stack represents the stack as defined by the user HCL code.
type StackObject ¶ added in v0.4.4
type StackObject struct { ID int64 `json:"stack_id"` Stack Status stack.Status `json:"status"` DeploymentStatus deployment.Status `json:"deployment_status"` DriftStatus drift.Status `json:"drift_status"` // readonly fields CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` SeenAt *time.Time `json:"seen_at,omitempty"` }
StackObject represents a stack object in the Terramate Cloud.
func (StackObject) Validate ¶ added in v0.4.4
func (stack StackObject) Validate() error
Validate the stack entity.
type StacksResponse ¶ added in v0.4.1
type StacksResponse struct { Stacks []StackObject `json:"stacks"` Pagination PaginatedResult `json:"paginated_result"` }
StacksResponse represents the stacks object response.
func (StacksResponse) Validate ¶ added in v0.4.1
func (stacksResp StacksResponse) Validate() error
Validate the StacksResponse object.
type StatusFilters ¶ added in v0.9.1
type StatusFilters struct { StackStatus stack.FilterStatus DeploymentStatus deployment.FilterStatus DriftStatus drift.FilterStatus }
StatusFilters defines multiple statuses stack filters.
func NoStatusFilters ¶ added in v0.9.1
func NoStatusFilters() StatusFilters
NoStatusFilters returns a StatusFilters with no filter.
func (StatusFilters) HasFilter ¶ added in v0.9.1
func (f StatusFilters) HasFilter() bool
HasFilter tells if StackFilter has any filter set.
type Syncer ¶ added in v0.4.3
type Syncer func(l CommandLogs)
Syncer is the actual synchronizer callback.
type UpdateDeploymentStack ¶
type UpdateDeploymentStack struct { StackID int64 `json:"stack_id"` Status deployment.Status `json:"status"` Details *ChangesetDetails `json:"changeset_details,omitempty"` }
UpdateDeploymentStack is the request payload item for updating the deployment status.
func (UpdateDeploymentStack) Validate ¶
func (d UpdateDeploymentStack) Validate() error
Validate the UpdateDeploymentStack object.
type UpdateDeploymentStacks ¶
type UpdateDeploymentStacks struct {
Stacks []UpdateDeploymentStack `json:"stacks"`
}
UpdateDeploymentStacks is the request payload for updating the deployment status.
func (UpdateDeploymentStacks) Validate ¶
func (ds UpdateDeploymentStacks) Validate() error
Validate the list of UpdateDeploymentStack.
type UpdateStackPreviewOpts ¶ added in v0.5.0
type UpdateStackPreviewOpts struct { OrgUUID UUID StackPreviewID string Status preview.StackStatus ChangesetDetails *ChangesetDetails }
UpdateStackPreviewOpts is the options for UpdateStackPreview
type UpdateStackPreviewPayloadRequest ¶ added in v0.5.0
type UpdateStackPreviewPayloadRequest struct { Status string `json:"status"` ChangesetDetails *ChangesetDetails `json:"changeset_details,omitempty"` }
UpdateStackPreviewPayloadRequest is the request payload for the update of stack previews.
func (UpdateStackPreviewPayloadRequest) Validate ¶ added in v0.5.0
func (r UpdateStackPreviewPayloadRequest) Validate() error
Validate the UpdateStackPreviewPayloadRequest object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package deployment provides types and helpers for cloud deployments.
|
Package deployment provides types and helpers for cloud deployments. |
Package drift provides types and helpers for cloud drifts.
|
Package drift provides types and helpers for cloud drifts. |
Package preview contains functionality for the preview feature in Terramate Cloud.
|
Package preview contains functionality for the preview feature in Terramate Cloud. |
Package stack provides types and helpers for cloud stacks.
|
Package stack provides types and helpers for cloud stacks. |
Package testserver provides fake Terramate Cloud endpoints for testing purposes.
|
Package testserver provides fake Terramate Cloud endpoints for testing purposes. |
cloudstore
Package cloudstore provides the in-memory store used by the fake Terramate Cloud server.
|
Package cloudstore provides the in-memory store used by the fake Terramate Cloud server. |
cmd/testserver
Package main implements the cloudmock service.
|
Package main implements the cloudmock service. |