scalr

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

README

Scalr Go Client

Installation

Installation can be done with a normal go get:

go get -u github.com/scalr/go-scalr

Documentation

For complete usage of the API client, see the full package docs.

Usage

import scalr "github.com/scalr/go-scalr"

Construct a new Scalr client, then use the various endpoints on the client to access different parts of the Scalr API. For example, to list all environments:

config := &scalr.Config{
	Token: "insert-your-token-here",
}

client, err := scalr.NewClient(config)
if err != nil {
	log.Fatal(err)
}

orgs, err := client.Environments.List(context.Background(), EnvironmentListOptions{})
if err != nil {
	log.Fatal(err)
}

Examples

The examples directory contains a couple of examples. One of which is listed here as well:

package main

import (
	"context"
	"log"

	scalr "github.com/scalr/go-scalr"
)

func main() {
	config := &scalr.Config{
		Token: "insert-your-token-here",
	}

	client, err := scalr.NewClient(config)
	if err != nil {
		log.Fatal(err)
	}

	// Create a context
	ctx := context.Background()

	// Create a new workspace
	w, err := client.Workspaces.Create(ctx, scalr.WorkspaceCreateOptions{
		Name: scalr.String("my-app-tst"),
		Environment: &scalr.Environment{ID: "env-ID"},
	})
	if err != nil {
		log.Fatal(err)
	}

	// Update the workspace
	w, err = client.Workspaces.Update(ctx, w.ID, scalr.WorkspaceUpdateOptions{
		AutoApply:        scalr.Bool(false),
		TerraformVersion: scalr.String("0.12.0"),
		WorkingDirectory: scalr.String("my-app/infra"),
	})
	if err != nil {
		log.Fatal(err)
	}
}

Tests

You will need to set up the environment variables for your Scalr installation. For example:

export SCALR_ADDRESS=https://abcdef.scalr.com
export SCALR_TOKEN=

You can run the acceptance tests like this:

make test

To run specific test:

TESTARGS="-run TestAccessPoliciesList/without_list_options" make test

Documentation

Index

Constants

View Source
const (
	PolicyEnforcementLevelHard     = "hard-mandatory"
	PolicyEnforcementLevelSoft     = "soft-mandatory"
	PolicyEnforcementLevelAdvisory = "advisory"
)

List of available policy enforcement levels.

View Source
const (

	// DefaultAddress of Scalr.
	DefaultAddress = "https://scalr.io"
	// DefaultBasePath on which the API is served.
	DefaultBasePath = "/api/iacp/v3/"
)
View Source
const (
	SlackIntegrationEventRunApprovalRequired string = "run_approval_required"
	SlackIntegrationEventRunSuccess          string = "run_success"
	SlackIntegrationEventRunErrored          string = "run_errored"
)

Variables

View Source
var (
	// ErrWorkspaceLocked is returned when trying to lock a
	// locked workspace.
	ErrWorkspaceLocked = errors.New("workspace already locked")
	// ErrWorkspaceNotLocked is returned when trying to unlock
	// a unlocked workspace.
	ErrWorkspaceNotLocked = errors.New("workspace already unlocked")

	// ErrUnauthorized is returned when a receiving a 401.
	ErrUnauthorized = errors.New("unauthorized")

	ErrResourceNotFound = errors.New("resource not found")
)

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the given bool

func Int

func Int(v int) *int

Int returns a pointer to the given int.

func Int64

func Int64(v int64) *int64

Int64 returns a pointer to the given int64.

func String

func String(v string) *string

String returns a pointer to the given string.

Types

type AccessPolicies

type AccessPolicies interface {
	List(ctx context.Context, options AccessPolicyListOptions) (*AccessPolicyList, error)
	Read(ctx context.Context, accessPolicyID string) (*AccessPolicy, error)
	Create(ctx context.Context, options AccessPolicyCreateOptions) (*AccessPolicy, error)
	Update(ctx context.Context, accessPolicyID string, options AccessPolicyUpdateOptions) (*AccessPolicy, error)
	Delete(ctx context.Context, accessPolicyID string) error
}

AccessPolicies describes all the accessPolicy related methods that the Scalr IACP API supports.

type AccessPolicy

type AccessPolicy struct {
	ID             string          `jsonapi:"primary,access-policies"`
	IsSystem       bool            `jsonapi:"attr,is-system"`
	Roles          []*Role         `jsonapi:"relation,roles"`
	User           *User           `jsonapi:"relation,user,omitempty"`
	Team           *Team           `jsonapi:"relation,team,omitempty"`
	ServiceAccount *ServiceAccount `jsonapi:"relation,service-account,omitempty"`
	Account        *Account        `jsonapi:"relation,account,omitempty"`
	Environment    *Environment    `jsonapi:"relation,environment,omitempty"`
	Workspace      *Workspace      `jsonapi:"relation,workspace,omitempty"`
}

AccessPolicy represents a Scalr accessPolicy.

type AccessPolicyCreateOptions

type AccessPolicyCreateOptions struct {
	ID string `jsonapi:"primary,access-policies"`

	// Relations
	Roles []*Role `jsonapi:"relation,roles"`
	// The subject of access policy, one of this fields must be filled
	User           *User           `jsonapi:"relation,user,omitempty"`
	Team           *Team           `jsonapi:"relation,team,omitempty"`
	ServiceAccount *ServiceAccount `jsonapi:"relation,service-account,omitempty"`
	// Scope
	Account     *Account     `jsonapi:"relation,account,omitempty"`
	Environment *Environment `jsonapi:"relation,environment,omitempty"`
	Workspace   *Workspace   `jsonapi:"relation,workspace,omitempty"`
}

AccessPolicyCreateOptions represents the options for creating a new AccessPolicy.

type AccessPolicyList

type AccessPolicyList struct {
	*Pagination
	Items []*AccessPolicy
}

AccessPolicyList represents a list of accessPolicies.

type AccessPolicyListOptions

type AccessPolicyListOptions struct {
	ListOptions

	Environment    *string `url:"filter[environment],omitempty"`
	Account        *string `url:"filter[account],omitempty"`
	Workspace      *string `url:"filter[workspace],omitempty"`
	User           *string `url:"filter[user],omitempty"`
	ServiceAccount *string `url:"filter[service-account],omitempty"`
	Team           *string `url:"filter[team],omitempty"`
	Include        string  `url:"include,omitempty"`
}

AccessPolicyListOptions represents the options for listing access policies.

type AccessPolicyUpdateOptions

type AccessPolicyUpdateOptions struct {
	// For internal use only!
	ID    string  `jsonapi:"primary,access-policies"`
	Roles []*Role `jsonapi:"relation,roles"`
}

AccessPolicyUpdateOptions represents the options for updating an accessPolicy.

type AccessToken

type AccessToken struct {
	ID          string    `jsonapi:"primary,access-tokens"`
	CreatedAt   time.Time `jsonapi:"attr,created-at,iso8601"`
	Description string    `jsonapi:"attr,description"`
	Token       string    `jsonapi:"attr,token"`
}

AccessToken represents a Scalr access token.

type AccessTokenCreateOptions

type AccessTokenCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,access-tokens"`

	Description *string `jsonapi:"attr,description,omitempty"`
}

AccessTokenCreateOptions represents the options for creating a new AccessToken.

type AccessTokenList

type AccessTokenList struct {
	*Pagination
	Items []*AccessToken
}

AccessTokenList represents a list of access tokens.

type AccessTokenListOptions

type AccessTokenListOptions struct {
	ListOptions
}

AccessTokenListOptions represents the options for listing access tokens.

type AccessTokenUpdateOptions

type AccessTokenUpdateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,access-tokens"`

	Description *string `jsonapi:"attr,description,omitempty"`
}

AccessTokenUpdateOptions represents the options for updating an AccessToken.

type AccessTokens

type AccessTokens interface {
	Read(ctx context.Context, accessTokenID string) (*AccessToken, error)
	Update(ctx context.Context, accessTokenID string, options AccessTokenUpdateOptions) (*AccessToken, error)
	Delete(ctx context.Context, accessTokenID string) error
}

AccessTokens describes all the access token related methods that the Scalr IACP API supports.

type Account

type Account struct {
	ID         string   `jsonapi:"primary,accounts"`
	Name       string   `jsonapi:"attr,name"`
	AllowedIPs []string `jsonapi:"attr,allowed-ips"`
}

Account represents a Scalr IACP account.

type AccountUpdateOptions

type AccountUpdateOptions struct {
	ID         string    `jsonapi:"primary,accounts"`
	AllowedIPs *[]string `jsonapi:"attr,allowed-ips,omitempty"`
}

type AccountUser

type AccountUser struct {
	ID     string            `jsonapi:"primary,account-users"`
	Status AccountUserStatus `jsonapi:"attr,status"`

	// Relations
	Account *Account `jsonapi:"relation,account"`
	User    *User    `jsonapi:"relation,user"`
	Teams   []*Team  `jsonapi:"relation,teams"`
}

AccountUser represents a Scalr account user.

type AccountUserList

type AccountUserList struct {
	*Pagination
	Items []*AccountUser
}

AccountUserList represents a list of account users.

type AccountUserListOptions

type AccountUserListOptions struct {
	Account *string `url:"filter[account],omitempty"`
	User    *string `url:"filter[user],omitempty"`
	Query   *string `url:"query,omitempty"`
	Sort    *string `url:"sort,omitempty"`
	Include *string `url:"include,omitempty"`
}

AccountUserListOptions represents the options for listing account users.

type AccountUserStatus

type AccountUserStatus string

AccountUserStatus represents a status of account user relation.

const (
	AccountUserStatusActive   AccountUserStatus = "Active"
	AccountUserStatusInactive AccountUserStatus = "Inactive"
	AccountUserStatusPending  AccountUserStatus = "Pending"
)

List of available account user statuses.

type AccountUsers

type AccountUsers interface {
	List(ctx context.Context, options AccountUserListOptions) (*AccountUserList, error)
}

AccountUsers describes all the account user related methods that the Scalr IACP API supports.

type Accounts

type Accounts interface {
	Read(ctx context.Context, account string) (*Account, error)
	Update(ctx context.Context, account string, options AccountUpdateOptions) (*Account, error)
}

Accounts describes methods for updating and reading account that the Scalr IACP API supports.

type Agent

type Agent struct {
	ID   string `jsonapi:"primary,agents"`
	Name string `jsonapi:"attr,name"`
	OS   string `jsonapi:"attr,os"`
}

type AgentPool

type AgentPool struct {
	ID         string `jsonapi:"primary,agent-pools"`
	Name       string `jsonapi:"attr,name"`
	VcsEnabled bool   `jsonapi:"attr,vcs-enabled"`

	// The agent pool's scope
	Account     *Account     `jsonapi:"relation,account"`
	Environment *Environment `jsonapi:"relation,environment"`

	// Workspaces this pool is connected to
	Workspaces []*Workspace `jsonapi:"relation,workspaces"`
	// Connected agents
	Agents []*Agent `jsonapi:"relation,agents"`
}

AgentPool represents a Scalr agent pool.

type AgentPoolCreateOptions

type AgentPoolCreateOptions struct {
	ID         string  `jsonapi:"primary,agent-pools"`
	Name       *string `jsonapi:"attr,name"`
	VcsEnabled *bool   `jsonapi:"attr,vcs-enabled,omitempty"`

	// The agent pool's scope
	Account     *Account     `jsonapi:"relation,account"`
	Environment *Environment `jsonapi:"relation,environment,omitempty"`

	// Workspaces this pool is connected to
	Workspaces []*Workspace `jsonapi:"relation,workspaces,omitempty"`
}

AgentPoolCreateOptions represents the options for creating a new AgentPool.

type AgentPoolList

type AgentPoolList struct {
	*Pagination
	Items []*AgentPool
}

AgentPoolList represents a list of agent pools.

type AgentPoolListOptions

type AgentPoolListOptions struct {
	ListOptions

	Account     *string `url:"filter[account],omitempty"`
	Environment *string `url:"filter[environment],omitempty"`
	Name        string  `url:"filter[name],omitempty"`
	AgentPool   string  `url:"filter[agent-pool],omitempty"`
	VcsEnabled  *bool   `url:"filter[vcs-enabled],omitempty"`
	Include     string  `url:"include,omitempty"`
}

AgentPoolListOptions represents the options for listing agent pools.

type AgentPoolTokens

type AgentPoolTokens interface {
	List(ctx context.Context, agentPoolID string, options AccessTokenListOptions) (*AccessTokenList, error)
	Create(ctx context.Context, agentPoolID string, options AccessTokenCreateOptions) (*AccessToken, error)
}

AgentPoolTokens describes all the access token related methods that the Scalr IACP API supports.

type AgentPoolUpdateOptions

type AgentPoolUpdateOptions struct {
	ID   string  `jsonapi:"primary,agent-pools"`
	Name *string `jsonapi:"attr,name,omitempty"`

	// Workspaces this pool is connected to
	Workspaces []*Workspace `jsonapi:"relation,workspaces"`
}

AgentPoolUpdateOptions represents the options for updating an agent pool.

type AgentPools

type AgentPools interface {
	List(ctx context.Context, options AgentPoolListOptions) (*AgentPoolList, error)
	Read(ctx context.Context, agentPoolID string) (*AgentPool, error)
	Create(ctx context.Context, options AgentPoolCreateOptions) (*AgentPool, error)
	Update(ctx context.Context, agentPoolID string, options AgentPoolUpdateOptions) (*AgentPool, error)
	Delete(ctx context.Context, agentPoolID string) error
}

AgentPools describes all the Agent Pool related methods that the Scalr IACP API supports.

type Apply

type Apply struct {
	ID string `jsonapi:"primary,applies"`
}

Apply represents a Scalr apply.

type AuthType

type AuthType string

AuthType represents the authorization type used in VCS provider.

const (
	Oauth2        AuthType = "oauth2"
	PersonalToken AuthType = "personal_token"
)

type CategoryType

type CategoryType string

CategoryType represents a category type.

const (
	CategoryEnv       CategoryType = "env"
	CategoryTerraform CategoryType = "terraform"
	CategoryShell     CategoryType = "shell"
)

List all available categories.

func Category

func Category(v CategoryType) *CategoryType

Category returns a pointer to the given category type.

type Client

type Client struct {
	AccessPolicies                  AccessPolicies
	AccessTokens                    AccessTokens
	AccountUsers                    AccountUsers
	Accounts                        Accounts
	AgentPoolTokens                 AgentPoolTokens
	AgentPools                      AgentPools
	ConfigurationVersions           ConfigurationVersions
	Endpoints                       Endpoints
	EnvironmentTags                 EnvironmentTags
	Environments                    Environments
	ModuleVersions                  ModuleVersions
	Modules                         Modules
	PolicyGroupEnvironments         PolicyGroupEnvironments
	PolicyGroups                    PolicyGroups
	ProviderConfigurationLinks      ProviderConfigurationLinks
	ProviderConfigurationParameters ProviderConfigurationParameters
	ProviderConfigurations          ProviderConfigurations
	Roles                           Roles
	RunTriggers                     RunTriggers
	Runs                            Runs
	ServiceAccountTokens            ServiceAccountTokens
	ServiceAccounts                 ServiceAccounts
	SlackIntegrations               SlackIntegrations
	Tags                            Tags
	Teams                           Teams
	Users                           Users
	Variables                       Variables
	VcsProviders                    VcsProviders
	VcsRevisions                    VcsRevisions
	Webhooks                        Webhooks
	WebhookIntegrations             WebhookIntegrations
	WorkspaceTags                   WorkspaceTags
	Workspaces                      Workspaces
	// contains filtered or unexported fields
}

Client is the Scalr API client. It provides the basic connectivity and configuration for accessing the Scalr API.

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates a new Scalr API client.

func (*Client) RetryServerErrors

func (c *Client) RetryServerErrors(retry bool)

RetryServerErrors configures the retry HTTP check to also retry unexpected errors or requests that failed with a server error.

type Config

type Config struct {
	// The address of the Scalr API.
	Address string

	// The base path on which the API is served.
	BasePath string

	// API token used to access the Scalr API.
	Token string

	// Headers that will be added to every request.
	Headers http.Header

	// A custom HTTP client to use.
	HTTPClient *http.Client

	// RetryLogHook is invoked each time a request is retried.
	RetryLogHook RetryLogHook
}

Config provides configuration details to the API client.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default config structure.

type ConfigurationStatus

type ConfigurationStatus string

ConfigurationStatus represents a configuration version status.

const (
	ConfigurationErrored  ConfigurationStatus = "errored"
	ConfigurationPending  ConfigurationStatus = "pending"
	ConfigurationUploaded ConfigurationStatus = "uploaded"
)

List all available configuration version statuses.

type ConfigurationVersion

type ConfigurationVersion struct {
	ID     string              `jsonapi:"primary,configuration-versions"`
	Status ConfigurationStatus `jsonapi:"attr,status"`
	// Relations
	Workspace *Workspace `jsonapi:"relation,workspace"`
}

ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration in Scalr. A workspace must have at least one configuration version before any runs may be queued on it.

type ConfigurationVersionCreateOptions

type ConfigurationVersionCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,configuration-versions"`

	Workspace *Workspace `jsonapi:"relation,workspace"`
}

ConfigurationVersionCreateOptions represents the options for creating a configuration version.

type ConfigurationVersions

type ConfigurationVersions interface {
	// Create is used to create a new configuration version. The created
	// configuration version will be usable once data is uploaded to it.
	Create(ctx context.Context, options ConfigurationVersionCreateOptions) (*ConfigurationVersion, error)

	// Read a configuration version by its ID.
	Read(ctx context.Context, cvID string) (*ConfigurationVersion, error)
}

ConfigurationVersions describes all the configuration version related methods that the Scalr API supports.

type CostEstimate

type CostEstimate struct {
	ID string `jsonapi:"primary,cost-estimates"`
}

CostEstimate represents a Scalr costEstimate.

type Downstream

type Downstream struct {
	ID string `jsonapi:"primary,workspaces"`
}

type Endpoint

type Endpoint struct {
	ID          string `jsonapi:"primary,endpoints"`
	MaxAttempts int    `jsonapi:"attr,max-attempts"`
	Name        string `jsonapi:"attr,name"`
	SecretKey   string `jsonapi:"attr,secret-key"`
	Timeout     int    `jsonapi:"attr,timeout"`
	Url         string `jsonapi:"attr,url"`

	// Relations
	Environment *Environment `jsonapi:"relation,environment"`
	Account     *Account     `jsonapi:"relation,account"`
}

Endpoint represents a Scalr IACP endpoint.

type EndpointCreateOptions

type EndpointCreateOptions struct {
	// For internal use only!
	ID          string  `jsonapi:"primary,endpoints"`
	MaxAttempts *int    `jsonapi:"attr,max-attempts,omitempty"`
	Name        *string `jsonapi:"attr,name"`
	Url         *string `jsonapi:"attr,url"`
	SecretKey   *string `jsonapi:"attr,secret-key,omitempty"`
	Timeout     *int    `jsonapi:"attr,timeout,omitempty"`

	// Relations
	Environment *Environment `jsonapi:"relation,environment,omitempty"`
	Account     *Account     `jsonapi:"relation,account"`
}

EndpointCreateOptions represents the options for creating a new endpoint.

type EndpointList

type EndpointList struct {
	*Pagination
	Items []*Endpoint
}

EndpointList represents a list of endpoints.

type EndpointListOptions

type EndpointListOptions struct {
	ListOptions

	// Query string.
	Query *string `url:"query,omitempty"`

	Name *string `url:"query,omitempty"`

	// The comma-separated list of attributes.
	Sort *string `url:"sort,omitempty"`

	// Scope filters.
	Environment *string `url:"filter[environment],omitempty"`
	Account     *string `url:"filter[account],omitempty"`
}

EndpointListOptions represents the options for listing endpoints.

type EndpointUpdateOptions

type EndpointUpdateOptions struct {
	ID          string  `jsonapi:"primary,endpoints"`
	Name        *string `jsonapi:"attr,name,omitempty"`
	MaxAttempts *int    `jsonapi:"attr,max-attempts,omitempty"`
	Url         *string `jsonapi:"attr,url,omitempty"`
	SecretKey   *string `jsonapi:"attr,secret-key,omitempty"`
	Timeout     *int    `jsonapi:"attr,timeout,omitempty"`
}

EndpointUpdateOptions represents the options for updating an endpoint.

type Endpoints

type Endpoints interface {
	// List the endpoints.
	List(ctx context.Context, options EndpointListOptions) (*EndpointList, error)
	Create(ctx context.Context, options EndpointCreateOptions) (*Endpoint, error)
	Read(ctx context.Context, endpoint string) (*Endpoint, error)
	Update(ctx context.Context, endpoint string, options EndpointUpdateOptions) (*Endpoint, error)
	Delete(ctx context.Context, endpoint string) error
}

Endpoints describes all the endpoints related methods that the Scalr IACP API supports.

IACP API docs: https://www.scalr.com/docs/en/latest/api/index.html

type Environment

type Environment struct {
	ID                    string            `jsonapi:"primary,environments"`
	Name                  string            `jsonapi:"attr,name"`
	CostEstimationEnabled bool              `jsonapi:"attr,cost-estimation-enabled"`
	CreatedAt             time.Time         `jsonapi:"attr,created-at,iso8601"`
	Status                EnvironmentStatus `jsonapi:"attr,status"`

	// Relations
	Account                       *Account                 `jsonapi:"relation,account"`
	PolicyGroups                  []*PolicyGroup           `jsonapi:"relation,policy-groups"`
	DefaultProviderConfigurations []*ProviderConfiguration `jsonapi:"relation,default-provider-configurations"`
	ProviderConfigurations        []*ProviderConfiguration `jsonapi:"relation,provider-configurations"`
	CreatedBy                     *User                    `jsonapi:"relation,created-by"`
	Tags                          []*Tag                   `jsonapi:"relation,tags"`
}

Environment represents a Scalr environment.

type EnvironmentCreateOptions

type EnvironmentCreateOptions struct {
	ID                    string  `jsonapi:"primary,environments"`
	Name                  *string `jsonapi:"attr,name"`
	CostEstimationEnabled *bool   `jsonapi:"attr,cost-estimation-enabled,omitempty"`

	// Relations
	Account                       *Account                 `jsonapi:"relation,account"`
	PolicyGroups                  []*PolicyGroup           `jsonapi:"relation,policy-groups,omitempty"`
	DefaultProviderConfigurations []*ProviderConfiguration `jsonapi:"relation,default-provider-configurations,omitempty"`

	// Specifies tags assigned to the environment
	Tags []*Tag `jsonapi:"relation,tags,omitempty"`
}

EnvironmentCreateOptions represents the options for creating a new Environment.

type EnvironmentFilter

type EnvironmentFilter struct {
	Id      *string `url:"environment,omitempty"`
	Account *string `url:"account,omitempty"`
	Name    *string `url:"name,omitempty"`
	Tag     *string `url:"tag,omitempty"`
}

EnvironmentFilter represents the options for filtering environments.

type EnvironmentList

type EnvironmentList struct {
	*Pagination
	Items []*Environment
}

EnvironmentList represents a list of environments.

type EnvironmentListOptions

type EnvironmentListOptions struct {
	ListOptions

	Include *string            `url:"include,omitempty"`
	Filter  *EnvironmentFilter `url:"filter,omitempty"`
}

type EnvironmentStatus

type EnvironmentStatus string

EnvironmentStatus represents an environment status.

const (
	EnvironmentStatusActive   EnvironmentStatus = "Active"
	EnvironmentStatusInactive EnvironmentStatus = "Inactive"
)

List of available environment statuses.

type EnvironmentTags

type EnvironmentTags interface {
	Add(ctx context.Context, envID string, tags []*TagRelation) error
	Replace(ctx context.Context, envID string, tags []*TagRelation) error
	Delete(ctx context.Context, envID string, tags []*TagRelation) error
}

EnvironmentTags describes all the environment tags related methods that the Scalr API supports.

type EnvironmentUpdateOptions

type EnvironmentUpdateOptions struct {
	// For internal use only!
	ID                    string  `jsonapi:"primary,environments"`
	Name                  *string `jsonapi:"attr,name,omitempty"`
	CostEstimationEnabled *bool   `jsonapi:"attr,cost-estimation-enabled,omitempty"`

	// Relations
	PolicyGroups                  []*PolicyGroup           `jsonapi:"relation,policy-groups"`
	DefaultProviderConfigurations []*ProviderConfiguration `jsonapi:"relation,default-provider-configurations"`
}

EnvironmentUpdateOptions represents the options for updating an environment.

type EnvironmentUpdateOptionsDefaultProviderConfigurationOnly

type EnvironmentUpdateOptionsDefaultProviderConfigurationOnly struct {
	ID string `jsonapi:"primary,environments"`
	// Relations
	DefaultProviderConfigurations []*ProviderConfiguration `jsonapi:"relation,default-provider-configurations"`
}

type Environments

type Environments interface {
	List(ctx context.Context, options EnvironmentListOptions) (*EnvironmentList, error)
	Read(ctx context.Context, environmentID string) (*Environment, error)
	Create(ctx context.Context, options EnvironmentCreateOptions) (*Environment, error)
	Update(ctx context.Context, environmentID string, options EnvironmentUpdateOptions) (*Environment, error)
	UpdateDefaultProviderConfigurationOnly(ctx context.Context, environmentID string, options EnvironmentUpdateOptionsDefaultProviderConfigurationOnly) (*Environment, error)
	Delete(ctx context.Context, environmentID string) error
}

Environments describes all the environment related methods that the Scalr IACP API supports.

type EventDefinition

type EventDefinition struct {
	ID string `jsonapi:"primary,event-definitions"`
}

type Hooks

type Hooks struct {
	PreInit   string `json:"pre-init"`
	PrePlan   string `json:"pre-plan"`
	PostPlan  string `json:"post-plan"`
	PreApply  string `json:"pre-apply"`
	PostApply string `json:"post-apply"`
}

Hooks contains the custom hooks field.

type HooksOptions

type HooksOptions struct {
	PreInit   *string `json:"pre-init,omitempty"`
	PrePlan   *string `json:"pre-plan,omitempty"`
	PostPlan  *string `json:"post-plan,omitempty"`
	PreApply  *string `json:"pre-apply,omitempty"`
	PostApply *string `json:"post-apply,omitempty"`
}

HooksOptions represents the WorkspaceHooks configuration.

type IdentityProvider

type IdentityProvider struct {
	ID string `jsonapi:"primary,identity-providers"`
}

IdentityProvider represents a Scalr identity provider.

type IntegrationStatus

type IntegrationStatus string
const (
	IntegrationStatusActive   IntegrationStatus = "active"
	IntegrationStatusDisabled IntegrationStatus = "disabled"
	IntegrationStatusFailed   IntegrationStatus = "failed"
)

type ListOptions

type ListOptions struct {
	// The page number to request. The results vary based on the PageSize.
	PageNumber int `url:"page[number],omitempty"`

	// The number of elements returned in a single page.
	PageSize int `url:"page[size],omitempty"`
}

ListOptions is used to specify pagination options when making API requests. Pagination allows breaking up large result sets into chunks, or "pages".

type Module

type Module struct {
	ID          string         `jsonapi:"primary,modules"`
	CreatedAt   time.Time      `jsonapi:"attr,created-at,iso8601"`
	Name        string         `jsonapi:"attr,name"`
	Provider    string         `jsonapi:"attr,provider"`
	Source      string         `jsonapi:"attr,source"`
	Description *string        `jsonapi:"attr,description,omitempty"`
	VCSRepo     *ModuleVCSRepo `jsonapi:"attr,vcs-repo"`
	Status      ModuleStatus   `jsonapi:"attr,status"`
	// Relation
	VcsProvider         *VcsProvider   `jsonapi:"relation,vcs-provider"`
	Account             *Account       `jsonapi:"relation,account,omitempty"`
	Environment         *Environment   `jsonapi:"relation,environment,omitempty"`
	CreatedBy           *User          `jsonapi:"relation,created-by,omitempty"`
	LatestModuleVersion *ModuleVersion `jsonapi:"relation,latest-module-version,omitempty"`
	ModuleVersion       *ModuleVersion `jsonapi:"relation,module-version,omitempty"`
}

type ModuleCreateOptions

type ModuleCreateOptions struct {
	//// For internal use only!
	ID string `jsonapi:"primary,modules"`

	// Settings for the module VCS repository.
	VCSRepo *ModuleVCSRepo `jsonapi:"attr,vcs-repo"`

	// Specifies the VcsProvider for module vcs-repo.
	VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider"`

	// Specifies the Account for module
	Account *Account `jsonapi:"relation,account,omitempty"`

	// Specifies the Environment for module
	Environment *Environment `jsonapi:"relation,environment,omitempty"`
}

type ModuleList

type ModuleList struct {
	*Pagination
	Items []*Module
}

ModuleList represents a list of module.

type ModuleListOptions

type ModuleListOptions struct {
	ListOptions
	Name        *string       `url:"filter[name],omitempty"`
	Status      *ModuleStatus `url:"filter[status],omitempty"`
	Source      *string       `url:"filter[source],omitempty"`
	Provider    *string       `url:"filter[provider],omitempty"`
	Account     *string       `url:"filter[account],omitempty"`
	Environment *string       `url:"filter[environment],omitempty"`
}

ModuleListOptions represents the options for listing modules.

type ModuleStatus

type ModuleStatus string

ModuleStatus represents a module state.

const (
	ModuleNoVersionTags ModuleStatus = "no_version_tag"
	ModulePending       ModuleStatus = "pending"
	ModuleSetupComplete ModuleStatus = "setup_complete"
	ModuleErrored       ModuleStatus = "errored"
)

List all available module statuses.

type ModuleVCSRepo

type ModuleVCSRepo struct {
	Identifier string  `json:"identifier"`
	Path       *string `json:"path"`
	TagPrefix  *string `json:"tag-prefix,omitempty"`
}

ModuleVCSRepo contains the configuration of a VCS integration.

type ModuleVersion

type ModuleVersion struct {
	ID           string              `jsonapi:"primary,module-versions"`
	IsRootModule bool                `jsonapi:"attr,is-root-module"`
	Status       ModuleVersionStatus `jsonapi:"attr,status"`
	Version      string              `jsonapi:"attr,version"`
}

ModuleVersion represents a Scalr module version.

type ModuleVersionList

type ModuleVersionList struct {
	*Pagination
	Items []*ModuleVersion
}

ModuleVersionList represents a list of module versions.

type ModuleVersionListOptions

type ModuleVersionListOptions struct {
	ListOptions
	Module  string  `url:"filter[module]"`
	Status  *string `url:"filter[status],omitempty"`
	Version *string `url:"filter[version],omitempty"`
	Include string  `url:"include,omitempty"`
}

type ModuleVersionStatus

type ModuleVersionStatus string
const (
	ModuleVersionNotUploaded   ModuleVersionStatus = "not_uploaded"
	ModuleVersionPending       ModuleVersionStatus = "pending"
	ModuleVersionOk            ModuleVersionStatus = "ok"
	ModuleVersionErrored       ModuleVersionStatus = "errored"
	ModuleVersionPendingDelete ModuleVersionStatus = "pending_delete"
)

type ModuleVersions

type ModuleVersions interface {
	// List all the module versions within a module.
	List(ctx context.Context, options ModuleVersionListOptions) (*ModuleVersionList, error)
	// Read a module version by its ID.
	Read(ctx context.Context, moduleVersionID string) (*ModuleVersion, error)
}

ModuleVersions describes all the run related methods that the Scalr API supports.

type Modules

type Modules interface {
	// List all the modules .
	List(ctx context.Context, options ModuleListOptions) (*ModuleList, error)
	// Create the module
	Create(ctx context.Context, options ModuleCreateOptions) (*Module, error)
	// Read a module by its ID.
	Read(ctx context.Context, moduleID string) (*Module, error)
	// ReadBySource Read the module by its Source.
	ReadBySource(ctx context.Context, moduleSource string) (*Module, error)
	// Delete a module by its ID.
	Delete(ctx context.Context, moduleID string) error
}

Modules describes all the module related methods that the Scalr API supports.

type OAuth

type OAuth struct {
	ClientId     string `json:"client-id"`
	ClientSecret string `json:"client-secret"`
}

OAuth contains the properties required for 'oauth2' authorization type.

type Organization

type Organization struct {
	ID                    string            `jsonapi:"primary,organizations"`
	Name                  string            `jsonapi:"attr,name"`
	CostEstimationEnabled bool              `jsonapi:"attr,cost-estimation-enabled"`
	CreatedAt             time.Time         `jsonapi:"attr,created-at,iso8601"`
	CreatedBy             string            `jsonapi:"attr,created-by"`
	Status                EnvironmentStatus `jsonapi:"attr,status"`

	// Relations
	Account *Account `jsonapi:"relation,account"`
}

Organization is Environment included in Workspace - always prefer Environment

type Pagination

type Pagination struct {
	CurrentPage  int `json:"current-page"`
	PreviousPage int `json:"prev-page"`
	NextPage     int `json:"next-page"`
	TotalPages   int `json:"total-pages"`
	TotalCount   int `json:"total-count"`
}

Pagination is used to return the pagination details of an API request.

type Permission

type Permission struct {
	ID string `jsonapi:"primary,permissions,omitempty"`
}

Permission relationship

type Plan

type Plan struct {
	ID string `jsonapi:"primary,plans"`
}

Plan represents a Scalr plan.

type Policy

type Policy struct {
	ID               string                 `jsonapi:"primary,policies"`
	Name             string                 `jsonapi:"attr,name"`
	Enabled          bool                   `jsonapi:"attr,enabled"`
	EnforcementLevel PolicyEnforcementLevel `jsonapi:"attr,enforced-level"`

	// Relations
	PolicyGroup *PolicyGroup `jsonapi:"relation,policy-groups"`
}

Policy represents a single OPA policy.

type PolicyCheck

type PolicyCheck struct {
	ID string `jsonapi:"primary,policy-checks"`
}

PolicyCheck represents a Scalr policy check..

type PolicyEnforcementLevel

type PolicyEnforcementLevel string

PolicyEnforcementLevel represents enforcement level of an OPA policy.

type PolicyGroup

type PolicyGroup struct {
	ID           string              `jsonapi:"primary,policy-groups"`
	Name         string              `jsonapi:"attr,name"`
	Status       PolicyGroupStatus   `jsonapi:"attr,status"`
	ErrorMessage string              `jsonapi:"attr,error-message"`
	OpaVersion   string              `jsonapi:"attr,opa-version"`
	VCSRepo      *PolicyGroupVCSRepo `jsonapi:"attr,vcs-repo"`

	// Relations
	Account      *Account       `jsonapi:"relation,account"`
	VcsProvider  *VcsProvider   `jsonapi:"relation,vcs-provider"`
	VcsRevision  *VcsRevision   `jsonapi:"relation,vcs-revision"`
	Policies     []*Policy      `jsonapi:"relation,policies"`
	Environments []*Environment `jsonapi:"relation,environments"`
}

PolicyGroup represents a Scalr policy group.

type PolicyGroupCreateOptions

type PolicyGroupCreateOptions struct {
	ID         string                     `jsonapi:"primary,policy-groups"`
	Name       *string                    `jsonapi:"attr,name"`
	OpaVersion *string                    `jsonapi:"attr,opa-version,omitempty"`
	VCSRepo    *PolicyGroupVCSRepoOptions `jsonapi:"attr,vcs-repo"`

	// Relations
	Account     *Account     `jsonapi:"relation,account"`
	VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider"`
}

PolicyGroupCreateOptions represents the options for creating a new PolicyGroup.

type PolicyGroupEnvironment

type PolicyGroupEnvironment struct {
	ID string `jsonapi:"primary,environments"`
}

PolicyGroupEnvironment represents a single policy group environment relation.

type PolicyGroupEnvironmentDeleteOptions

type PolicyGroupEnvironmentDeleteOptions struct {
	PolicyGroupID string
	EnvironmentID string
}

type PolicyGroupEnvironments

type PolicyGroupEnvironments interface {
	Create(ctx context.Context, options PolicyGroupEnvironmentsCreateOptions) error
	Delete(ctx context.Context, options PolicyGroupEnvironmentDeleteOptions) error
}

PolicyGroupEnvironments describes all the policy group environments related methods that the Scalr API supports.

type PolicyGroupEnvironmentsCreateOptions

type PolicyGroupEnvironmentsCreateOptions struct {
	PolicyGroupID           string
	PolicyGroupEnvironments []*PolicyGroupEnvironment
}

PolicyGroupEnvironmentsCreateOptions represents options for creating new policy group environment linkage

type PolicyGroupList

type PolicyGroupList struct {
	*Pagination
	Items []*PolicyGroup
}

PolicyGroupList represents a list of policy groups.

type PolicyGroupListOptions

type PolicyGroupListOptions struct {
	ListOptions

	Account     string `url:"filter[account],omitempty"`
	Environment string `url:"filter[environment],omitempty"`
	Name        string `url:"filter[name],omitempty"`
	PolicyGroup string `url:"filter[policy-group],omitempty"`
	Query       string `url:"query,omitempty"`
	Sort        string `url:"sort,omitempty"`
	Include     string `url:"include,omitempty"`
}

PolicyGroupListOptions represents the options for listing policy groups.

type PolicyGroupStatus

type PolicyGroupStatus string

PolicyGroupStatus represents a policy group status.

const (
	PolicyGroupStatusFetching PolicyGroupStatus = "fetching"
	PolicyGroupStatusActive   PolicyGroupStatus = "active"
	PolicyGroupStatusErrored  PolicyGroupStatus = "errored"
)

List of available policy group statuses.

type PolicyGroupUpdateOptions

type PolicyGroupUpdateOptions struct {
	ID         string                     `jsonapi:"primary,policy-groups"`
	Name       *string                    `jsonapi:"attr,name,omitempty"`
	OpaVersion *string                    `jsonapi:"attr,opa-version,omitempty"`
	VCSRepo    *PolicyGroupVCSRepoOptions `jsonapi:"attr,vcs-repo,omitempty"`

	// Relations
	VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider,omitempty"`
}

PolicyGroupUpdateOptions represents the options for updating a PolicyGroup.

type PolicyGroupVCSRepo

type PolicyGroupVCSRepo struct {
	Identifier string `json:"identifier"`
	Branch     string `json:"branch"`
	Path       string `json:"path"`
}

PolicyGroupVCSRepo contains the configuration of a VCS integration.

type PolicyGroupVCSRepoOptions

type PolicyGroupVCSRepoOptions struct {
	Identifier *string `json:"identifier"`
	Branch     *string `json:"branch,omitempty"`
	Path       *string `json:"path,omitempty"`
}

PolicyGroupVCSRepoOptions contains the configuration options of a VCS integration.

type PolicyGroups

type PolicyGroups interface {
	List(ctx context.Context, options PolicyGroupListOptions) (*PolicyGroupList, error)
	Read(ctx context.Context, policyGroupID string) (*PolicyGroup, error)
	Create(ctx context.Context, options PolicyGroupCreateOptions) (*PolicyGroup, error)
	Update(ctx context.Context, policyGroupID string, options PolicyGroupUpdateOptions) (*PolicyGroup, error)
	Delete(ctx context.Context, policyGroupID string) error
}

PolicyGroups describes all the policy group related methods that the Scalr API supports.

type ProviderConfiguration

type ProviderConfiguration struct {
	ID                         string `jsonapi:"primary,provider-configurations"`
	Name                       string `jsonapi:"attr,name"`
	ProviderName               string `jsonapi:"attr,provider-name"`
	ExportShellVariables       bool   `jsonapi:"attr,export-shell-variables"`
	IsShared                   bool   `jsonapi:"attr,is-shared"`
	IsCustom                   bool   `jsonapi:"attr,is-custom"`
	AwsAccessKey               string `jsonapi:"attr,aws-access-key"`
	AwsSecretKey               string `jsonapi:"attr,aws-secret-key"`
	AwsAccountType             string `jsonapi:"attr,aws-account-type"`
	AwsCredentialsType         string `jsonapi:"attr,aws-credentials-type"`
	AwsTrustedEntityType       string `jsonapi:"attr,aws-trusted-entity-type"`
	AwsRoleArn                 string `jsonapi:"attr,aws-role-arn"`
	AwsExternalId              string `jsonapi:"attr,aws-external-id"`
	AwsAudience                string `jsonapi:"attr,aws-audience"`
	AzurermClientId            string `jsonapi:"attr,azurerm-client-id"`
	AzurermClientSecret        string `jsonapi:"attr,azurerm-client-secret"`
	AzurermSubscriptionId      string `jsonapi:"attr,azurerm-subscription-id"`
	AzurermTenantId            string `jsonapi:"attr,azurerm-tenant-id"`
	AzurermAuthType            string `jsonapi:"attr,azurerm-auth-type"`
	AzurermAudience            string `jsonapi:"attr,azurerm-audience"`
	GoogleAuthType             string `jsonapi:"attr,google-auth-type"`
	GoogleServiceAccountEmail  string `jsonapi:"attr,google-service-account-email"`
	GoogleWorkloadProviderName string `jsonapi:"attr,google-workload-provider-name"`
	GoogleProject              string `jsonapi:"attr,google-project"`
	GoogleCredentials          string `jsonapi:"attr,google-credentials"`
	ScalrHostname              string `jsonapi:"attr,scalr-hostname"`
	ScalrToken                 string `jsonapi:"attr,scalr-token"`

	Account      *Account                          `jsonapi:"relation,account"`
	Parameters   []*ProviderConfigurationParameter `jsonapi:"relation,parameters"`
	Environments []*Environment                    `jsonapi:"relation,environments"`
}

ProviderConfiguration represents a Scalr provider configuration.

type ProviderConfigurationCreateOptions

type ProviderConfigurationCreateOptions struct {
	ID                         string  `jsonapi:"primary,provider-configurations"`
	Name                       *string `jsonapi:"attr,name"`
	ProviderName               *string `jsonapi:"attr,provider-name"`
	ExportShellVariables       *bool   `jsonapi:"attr,export-shell-variables,omitempty"`
	IsShared                   *bool   `jsonapi:"attr,is-shared,omitempty"`
	IsCustom                   *bool   `jsonapi:"attr,is-custom,omitempty"`
	AwsAccessKey               *string `jsonapi:"attr,aws-access-key,omitempty"`
	AwsSecretKey               *string `jsonapi:"attr,aws-secret-key,omitempty"`
	AwsAccountType             *string `jsonapi:"attr,aws-account-type"`
	AwsCredentialsType         *string `jsonapi:"attr,aws-credentials-type"`
	AwsTrustedEntityType       *string `jsonapi:"attr,aws-trusted-entity-type"`
	AwsAudience                *string `jsonapi:"attr,aws-audience"`
	AwsRoleArn                 *string `jsonapi:"attr,aws-role-arn"`
	AwsExternalId              *string `jsonapi:"attr,aws-external-id"`
	AzurermClientId            *string `jsonapi:"attr,azurerm-client-id,omitempty"`
	AzurermClientSecret        *string `jsonapi:"attr,azurerm-client-secret,omitempty"`
	AzurermSubscriptionId      *string `jsonapi:"attr,azurerm-subscription-id,omitempty"`
	AzurermTenantId            *string `jsonapi:"attr,azurerm-tenant-id,omitempty"`
	AzurermAuthType            *string `jsonapi:"attr,azurerm-auth-type,omitempty"`
	AzurermAudience            *string `jsonapi:"attr,azurerm-audience,omitempty"`
	GoogleAuthType             *string `jsonapi:"attr,google-auth-type,omitempty"`
	GoogleServiceAccountEmail  *string `jsonapi:"attr,google-service-account-email,omitempty"`
	GoogleWorkloadProviderName *string `jsonapi:"attr,google-workload-provider-name,omitempty"`
	GoogleProject              *string `jsonapi:"attr,google-project,omitempty"`
	GoogleCredentials          *string `jsonapi:"attr,google-credentials,omitempty"`
	ScalrHostname              *string `jsonapi:"attr,scalr-hostname,omitempty"`
	ScalrToken                 *string `jsonapi:"attr,scalr-token,omitempty"`

	Account      *Account       `jsonapi:"relation,account,omitempty"`
	Environments []*Environment `jsonapi:"relation,environments,omitempty"`
}

ProviderConfigurationCreateOptions represents the options for creating a new provider configuration.

type ProviderConfigurationFilter

type ProviderConfigurationFilter struct {
	ProviderConfiguration string `url:"provider-configuration,omitempty"`
	ProviderName          string `url:"provider-name,omitempty"`
	Name                  string `url:"name,omitempty"`
	AccountID             string `url:"account,omitempty"`
}

ProviderConfigurationFilter represents the options for filtering provider configurations.

type ProviderConfigurationLink struct {
	ID      string `jsonapi:"primary,provider-configuration-links"`
	Default bool   `jsonapi:"attr,default"`
	Alias   string `jsonapi:"attr,alias"`

	ProviderConfiguration *ProviderConfiguration `jsonapi:"relation,provider-configuration,omitempty"`
	Environment           *Environment           `jsonapi:"relation,environment,omitempty"`
	Workspace             *Workspace             `jsonapi:"relation,workspace,omitempty"`
}

ProviderConfigurationLink represents a Scalr provider configuration link.

type ProviderConfigurationLinkCreateOptions

type ProviderConfigurationLinkCreateOptions struct {
	ID    string  `jsonapi:"primary,provider-configuration-links"`
	Alias *string `jsonapi:"attr,alias"`

	ProviderConfiguration *ProviderConfiguration `jsonapi:"relation,provider-configuration"`
}

ProviderConfigurationLinkCreateOptions represents the options for creating a new provider configuration workspace link.

type ProviderConfigurationLinkUpdateOptions

type ProviderConfigurationLinkUpdateOptions struct {
	ID    string  `jsonapi:"primary,provider-configuration-links"`
	Alias *string `jsonapi:"attr,alias"`
}

ProviderConfigurationLinkUpdateOptions represents the options for updating a provider configuration link.

ProviderConfigurationLinks describes all the provider configurartion link related methods that the Scalr API supports.

type ProviderConfigurationLinksList struct {
	*Pagination
	Items []*ProviderConfigurationLink
}

ProviderConfigurationLinksList represents a list of provider configuration links.

type ProviderConfigurationLinksListOptions

type ProviderConfigurationLinksListOptions struct {
	ListOptions

	Include string `url:"include,omitempty"`
}

ProviderConfigurationLinksListOptions represents the options for listing provider configuration links.

type ProviderConfigurationParameter

type ProviderConfigurationParameter struct {
	ID          string `jsonapi:"primary,provider-configuration-parameters"`
	Key         string `jsonapi:"attr,key"`
	Sensitive   bool   `jsonapi:"attr,sensitive"`
	Value       string `jsonapi:"attr,value"`
	Description string `jsonapi:"attr,description"`
}

ProviderConfigurationParameter represents a Scalr provider configuration parameter.

type ProviderConfigurationParameterCreateOptions

type ProviderConfigurationParameterCreateOptions struct {
	ID          string  `jsonapi:"primary,provider-configuration-parameters"`
	Key         *string `jsonapi:"attr,key"`
	Sensitive   *bool   `jsonapi:"attr,sensitive,omitempty"`
	Value       *string `jsonapi:"attr,value"`
	Description *string `jsonapi:"attr,description,omitempty"`
}

ProviderConfigurationParameterCreateOptions represents the options for creating a new provider configuration parameter.

type ProviderConfigurationParameterUpdateOptions

type ProviderConfigurationParameterUpdateOptions struct {
	ID          string  `jsonapi:"primary,provider-configuration-parameters"`
	Key         *string `jsonapi:"attr,key,omitempty"`
	Sensitive   *bool   `jsonapi:"attr,sensitive,omitempty"`
	Value       *string `jsonapi:"attr,value,omitempty"`
	Description *string `jsonapi:"attr,description,omitempty"`
}

ProviderConfigurationParameterUpdateOptions represents the options for updating a provider configuration.

type ProviderConfigurationParameters

ProviderConfigurationParameters describes all the provider configurartion parameter related methods that the Scalr API supports.

type ProviderConfigurationParametersList

type ProviderConfigurationParametersList struct {
	*Pagination
	Items []*ProviderConfigurationParameter
}

ProviderConfigurationParametersList represents a list of provider configuration parameters.

type ProviderConfigurationParametersListOptions

type ProviderConfigurationParametersListOptions struct {
	ListOptions

	Sort string `url:"sort,omitempty"`
}

ProviderConfigurationParametersListOptions represents the options for listing provider configuration parameters.

type ProviderConfigurationUpdateOptions

type ProviderConfigurationUpdateOptions struct {
	ID string `jsonapi:"primary,provider-configurations"`

	Name                       *string        `jsonapi:"attr,name"`
	IsShared                   *bool          `jsonapi:"attr,is-shared,omitempty"`
	Environments               []*Environment `jsonapi:"relation,environments"`
	ExportShellVariables       *bool          `jsonapi:"attr,export-shell-variables"`
	AwsAccessKey               *string        `jsonapi:"attr,aws-access-key"`
	AwsSecretKey               *string        `jsonapi:"attr,aws-secret-key"`
	AwsAccountType             *string        `jsonapi:"attr,aws-account-type"`
	AwsCredentialsType         *string        `jsonapi:"attr,aws-credentials-type"`
	AwsTrustedEntityType       *string        `jsonapi:"attr,aws-trusted-entity-type"`
	AwsRoleArn                 *string        `jsonapi:"attr,aws-role-arn"`
	AwsExternalId              *string        `jsonapi:"attr,aws-external-id"`
	AwsAudience                *string        `jsonapi:"attr,aws-audience"`
	AzurermAuthType            *string        `jsonapi:"attr,azurerm-auth-type"`
	AzurermAudience            *string        `jsonapi:"attr,azurerm-audience"`
	AzurermClientId            *string        `jsonapi:"attr,azurerm-client-id"`
	AzurermClientSecret        *string        `jsonapi:"attr,azurerm-client-secret"`
	AzurermSubscriptionId      *string        `jsonapi:"attr,azurerm-subscription-id"`
	AzurermTenantId            *string        `jsonapi:"attr,azurerm-tenant-id"`
	GoogleAuthType             *string        `jsonapi:"attr,google-auth-type"`
	GoogleServiceAccountEmail  *string        `jsonapi:"attr,google-service-account-email"`
	GoogleWorkloadProviderName *string        `jsonapi:"attr,google-workload-provider-name"`
	GoogleProject              *string        `jsonapi:"attr,google-project"`
	GoogleCredentials          *string        `jsonapi:"attr,google-credentials"`
	ScalrHostname              *string        `jsonapi:"attr,scalr-hostname"`
	ScalrToken                 *string        `jsonapi:"attr,scalr-token"`
}

ProviderConfigurationUpdateOptions represents the options for updating a provider configuration.

type ProviderConfigurations

type ProviderConfigurations interface {
	List(ctx context.Context, options ProviderConfigurationsListOptions) (*ProviderConfigurationsList, error)
	Create(ctx context.Context, options ProviderConfigurationCreateOptions) (*ProviderConfiguration, error)
	Read(ctx context.Context, configurationID string) (*ProviderConfiguration, error)
	Delete(ctx context.Context, configurationID string) error
	Update(ctx context.Context, configurationID string, options ProviderConfigurationUpdateOptions) (*ProviderConfiguration, error)
}

ProviderConfigurations describes all the provider configuration related methods that the Scalr API supports.

type ProviderConfigurationsList

type ProviderConfigurationsList struct {
	*Pagination
	Items []*ProviderConfiguration
}

ProviderConfigurationsList represents a list of provider configurations.

type ProviderConfigurationsListOptions

type ProviderConfigurationsListOptions struct {
	ListOptions

	Sort    string                       `url:"sort,omitempty"`
	Include string                       `url:"include,omitempty"`
	Filter  *ProviderConfigurationFilter `url:"filter,omitempty"`
}

ProviderConfigurationsListOptions represents the options for listing provider configurations.

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Message string
}

func (ResourceNotFoundError) Error

func (e ResourceNotFoundError) Error() string

func (ResourceNotFoundError) Unwrap

func (e ResourceNotFoundError) Unwrap() error

type RetryLogHook

type RetryLogHook func(attemptNum int, resp *http.Response)

RetryLogHook allows a function to run before each retry.

type Role

type Role struct {
	ID          string `jsonapi:"primary,roles"`
	Name        string `jsonapi:"attr,name"`
	Description string `jsonapi:"attr,description"`
	IsSystem    bool   `jsonapi:"attr,is-system"`

	// Relations
	Account     *Account      `jsonapi:"relation,account"`
	Permissions []*Permission `jsonapi:"relation,permissions,omitempty"`
}

Role represents a Scalr role.

type RoleCreateOptions

type RoleCreateOptions struct {
	ID          string  `jsonapi:"primary,roles"`
	Name        *string `jsonapi:"attr,name"`
	Description *string `jsonapi:"attr,description,omitempty"`

	// Relations
	Account     *Account      `jsonapi:"relation,account"`
	Permissions []*Permission `jsonapi:"relation,permissions,omitempty"`
}

RoleCreateOptions represents the options for creating a new Role.

type RoleList

type RoleList struct {
	*Pagination
	Items []*Role
}

RoleList represents a list of roles.

type RoleListOptions

type RoleListOptions struct {
	ListOptions

	Account *string `url:"filter[account],omitempty"`
	Name    string  `url:"filter[name],omitempty"`
	Role    string  `url:"filter[role],omitempty"`
	Query   string  `url:"query,omitempty"`
	Include string  `url:"include,omitempty"`
}

RoleListOptions represents the options for listing roles.

type RoleUpdateOptions

type RoleUpdateOptions struct {
	// For internal use only!
	ID          string  `jsonapi:"primary,roles"`
	Name        *string `jsonapi:"attr,name,omitempty"`
	Description *string `jsonapi:"attr,description,omitempty"`

	// Relations
	Permissions []*Permission `jsonapi:"relation,permissions,omitempty"`
}

RoleUpdateOptions represents the options for updating an role.

type Roles

type Roles interface {
	List(ctx context.Context, options RoleListOptions) (*RoleList, error)
	Read(ctx context.Context, roleID string) (*Role, error)
	Create(ctx context.Context, options RoleCreateOptions) (*Role, error)
	Update(ctx context.Context, roleID string, options RoleUpdateOptions) (*Role, error)
	Delete(ctx context.Context, roleID string) error
}

Roles describes all the role related methods that the Scalr IACP API supports.

type Run

type Run struct {
	ID        string    `jsonapi:"primary,runs"`
	Source    RunSource `jsonapi:"attr,source"`
	Message   string    `jsonapi:"attr,message"`
	IsDestroy bool      `jsonapi:"attr,is-destroy"`
	CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
	Status    RunStatus `jsonapi:"attr,status"`

	// Relations
	VcsRevision          *VcsRevision          `jsonapi:"relation,vcs-revision"`
	Apply                *Apply                `jsonapi:"relation,apply"`
	ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"`
	CostEstimate         *CostEstimate         `jsonapi:"relation,cost-estimate"`
	Plan                 *Plan                 `jsonapi:"relation,plan"`
	PolicyChecks         []*PolicyCheck        `jsonapi:"relation,policy-checks"`
	Workspace            *Workspace            `jsonapi:"relation,workspace"`
}

Run represents a Scalr run.

type RunCreateOptions

type RunCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,runs"`

	// Specifies the configuration version to use for this run.
	ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"`
	// Specifies the workspace where the run will be executed.
	Workspace *Workspace `jsonapi:"relation,workspace"`
}

RunCreateOptions represents the options for creating a new run.

type RunSource

type RunSource string

RunSource represents a source type of a run.

const (
	RunSourceAPI                  RunSource = "api"
	RunSourceConfigurationVersion RunSource = "configuration-version"
	RunSourceUI                   RunSource = "ui"
	RunSourceVCS                  RunSource = "vcs"
	RunSourceCLI                  RunSource = "cli"
)

List all available run sources.

type RunStatus

type RunStatus string

RunStatus represents a run state.

const (
	RunApplied            RunStatus = "applied"
	RunApplyQueued        RunStatus = "apply_queued"
	RunApplying           RunStatus = "applying"
	RunCanceled           RunStatus = "canceled"
	RunConfirmed          RunStatus = "confirmed"
	RunCostEstimated      RunStatus = "cost_estimated"
	RunCostEstimating     RunStatus = "cost_estimating"
	RunDiscarded          RunStatus = "discarded"
	RunErrored            RunStatus = "errored"
	RunPending            RunStatus = "pending"
	RunPlanQueued         RunStatus = "plan_queued"
	RunPlanned            RunStatus = "planned"
	RunPlannedAndFinished RunStatus = "planned_and_finished"
	RunPlanning           RunStatus = "planning"
	RunPolicyChecked      RunStatus = "policy_checked"
	RunPolicyChecking     RunStatus = "policy_checking"
	RunPolicyOverride     RunStatus = "policy_override"
	RunPolicySoftFailed   RunStatus = "policy_soft_failed"
)

List all available run statuses.

type RunTrigger

type RunTrigger struct {
	ID        string    `jsonapi:"primary,run-triggers"`
	CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`

	// Relations
	Upstream   *Upstream   `jsonapi:"relation,upstream"`
	Downstream *Downstream `jsonapi:"relation,downstream"`
}

type RunTriggerCreateOptions

type RunTriggerCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,run-triggers"`

	Downstream *Downstream `jsonapi:"relation,downstream"`
	Upstream   *Upstream   `jsonapi:"relation,upstream"`
}

type RunTriggers

type RunTriggers interface {
	// Create is used to create a new run trigger.
	Create(ctx context.Context, options RunTriggerCreateOptions) (*RunTrigger, error)

	// Read RunTrigger by it's ID
	Read(ctx context.Context, runTriggerID string) (*RunTrigger, error)

	// Delete RunTrigger by it's ID
	Delete(ctx context.Context, runTriggerID string) error
}

type Runs

type Runs interface {

	// Read a run by its ID.
	Read(ctx context.Context, runID string) (*Run, error)
	// Create a new run with the given options.
	Create(ctx context.Context, options RunCreateOptions) (*Run, error)
}

Runs describes all the run related methods that the Scalr API supports.

type ServiceAccount

type ServiceAccount struct {
	ID          string               `jsonapi:"primary,service-accounts"`
	Name        string               `jsonapi:"attr,name"`
	Email       string               `jsonapi:"attr,email"`
	Description string               `jsonapi:"attr,description"`
	Status      ServiceAccountStatus `jsonapi:"attr,status"`
	CreatedAt   time.Time            `jsonapi:"attr,created-at,iso8601"`

	// Relations
	Account   *Account `jsonapi:"relation,account,omitempty"`
	CreatedBy *User    `jsonapi:"relation,created-by,omitempty"`
}

type ServiceAccountCreateOptions

type ServiceAccountCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,service-accounts"`

	// The name of the service account, it must be unique within the account.
	Name        *string               `jsonapi:"attr,name"`
	Description *string               `jsonapi:"attr,description,omitempty"`
	Status      *ServiceAccountStatus `jsonapi:"attr,status,omitempty"`
	Account     *Account              `jsonapi:"relation,account"`
}

ServiceAccountCreateOptions represents the options for creating a new service account.

type ServiceAccountList

type ServiceAccountList struct {
	*Pagination
	Items []*ServiceAccount
}

ServiceAccountList represents a list of service accounts.

type ServiceAccountListOptions

type ServiceAccountListOptions struct {
	ListOptions

	Account        *string `url:"filter[account],omitempty"`
	Email          *string `url:"filter[email],omitempty"`
	ServiceAccount *string `url:"filter[service-account],omitempty"`
	Query          *string `url:"query,omitempty"`
	Include        *string `url:"include,omitempty"`
}

ServiceAccountListOptions represents the options for listing service accounts.

type ServiceAccountStatus

type ServiceAccountStatus string

ServiceAccountStatus represents the status of service account.

const (
	ServiceAccountStatusActive   ServiceAccountStatus = "Active"
	ServiceAccountStatusInactive ServiceAccountStatus = "Inactive"
)

List of available service account statuses.

func ServiceAccountStatusPtr

func ServiceAccountStatusPtr(v ServiceAccountStatus) *ServiceAccountStatus

ServiceAccountStatusPtr returns a pointer to the given service account status value.

type ServiceAccountTokens

type ServiceAccountTokens interface {
	// List service account's access tokens
	List(ctx context.Context, serviceAccountID string, options AccessTokenListOptions) (*AccessTokenList, error)
	// Create new access token for service account
	Create(ctx context.Context, serviceAccountID string, options AccessTokenCreateOptions) (*AccessToken, error)
}

ServiceAccountTokens describes all the access token related methods that the Scalr IACP API supports.

type ServiceAccountUpdateOptions

type ServiceAccountUpdateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,service-accounts"`

	Description *string               `jsonapi:"attr,description,omitempty"`
	Status      *ServiceAccountStatus `jsonapi:"attr,status,omitempty"`
}

ServiceAccountUpdateOptions represents the options for updating a service account.

type ServiceAccounts

type ServiceAccounts interface {
	// List all the service accounts.
	List(ctx context.Context, options ServiceAccountListOptions) (*ServiceAccountList, error)
	// Create is used to create a new service account.
	Create(ctx context.Context, options ServiceAccountCreateOptions) (*ServiceAccount, error)
	// Read reads a service account by its ID.
	Read(ctx context.Context, serviceAccountID string) (*ServiceAccount, error)
	// Update existing service account by its ID.
	Update(ctx context.Context, serviceAccountID string, options ServiceAccountUpdateOptions) (*ServiceAccount, error)
	// Delete service account by its ID.
	Delete(ctx context.Context, serviceAccountID string) error
}

ServiceAccounts describes all the service account related methods that the Scalr API supports.

type SlackConnection

type SlackConnection struct {
	ID                 string `jsonapi:"primary,slack-connections"`
	SlackWorkspaceName string `jsonapi:"attr,slack-workspace-name"`

	// Relations
	Account *Account `jsonapi:"relation,account"`
}

type SlackIntegration

type SlackIntegration struct {
	ID        string            `jsonapi:"primary,slack-integrations"`
	Name      string            `jsonapi:"attr,name"`
	Status    IntegrationStatus `jsonapi:"attr,status"`
	ChannelId string            `jsonapi:"attr,channel-id"`
	Events    []string          `jsonapi:"attr,events"`

	// Relations
	Account      *Account       `jsonapi:"relation,account"`
	Environments []*Environment `jsonapi:"relation,environments"`
	Workspaces   []*Workspace   `jsonapi:"relation,workspaces"`
}

SlackIntegration represents a Scalr IACP slack integration.

type SlackIntegrationCreateOptions

type SlackIntegrationCreateOptions struct {
	ID        string   `jsonapi:"primary,slack-integrations"`
	Name      *string  `jsonapi:"attr,name"`
	ChannelId *string  `jsonapi:"attr,channel-id"`
	Events    []string `jsonapi:"attr,events"`

	Account      *Account         `jsonapi:"relation,account"`
	Connection   *SlackConnection `jsonapi:"relation,connection"`
	Environments []*Environment   `jsonapi:"relation,environments"`
	Workspaces   []*Workspace     `jsonapi:"relation,workspaces,omitempty"`
}

type SlackIntegrationFilter

type SlackIntegrationFilter struct {
	Account *string `url:"account,omitempty"`
}

SlackIntegrationFilter represents the options for filtering Slack integrations.

type SlackIntegrationList

type SlackIntegrationList struct {
	*Pagination
	Items []*SlackIntegration
}

type SlackIntegrationListOptions

type SlackIntegrationListOptions struct {
	ListOptions

	Filter *SlackIntegrationFilter `url:"filter,omitempty"`
}

type SlackIntegrationUpdateOptions

type SlackIntegrationUpdateOptions struct {
	ID        string             `jsonapi:"primary,slack-integrations"`
	Name      *string            `jsonapi:"attr,name,omitempty"`
	ChannelId *string            `jsonapi:"attr,channel-id,omitempty"`
	Status    *IntegrationStatus `jsonapi:"attr,status,omitempty"`
	Events    []string           `jsonapi:"attr,events,omitempty"`

	Environments []*Environment `jsonapi:"relation,environments,omitempty"`
	Workspaces   []*Workspace   `jsonapi:"relation,workspaces"`
}

type SlackIntegrations

type SlackIntegrations interface {
	List(ctx context.Context, options SlackIntegrationListOptions) (*SlackIntegrationList, error)
	Create(ctx context.Context, options SlackIntegrationCreateOptions) (*SlackIntegration, error)
	Read(ctx context.Context, slackIntegration string) (*SlackIntegration, error)
	Update(ctx context.Context, slackIntegration string, options SlackIntegrationUpdateOptions) (*SlackIntegration, error)
	Delete(ctx context.Context, slackIntegration string) error
	GetConnection(ctx context.Context, accID string) (*SlackConnection, error)
}

SlackIntegrations describes all the SlackIntegration related methods that the Scalr IACP API supports.

IACP API docs: https://www.scalr.com/docs/en/latest/api/index.html

type Tag

type Tag struct {
	ID   string `jsonapi:"primary,tags"`
	Name string `jsonapi:"attr,name"`

	// Relations
	Account *Account `jsonapi:"relation,account"`
}

type TagCreateOptions

type TagCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,tags"`
	// The name of the tag, it must be unique within the account.
	Name *string `jsonapi:"attr,name"`
	// Specifies the Account for the tag.
	Account *Account `jsonapi:"relation,account"`
}

TagCreateOptions represents the options for creating a new tag.

type TagList

type TagList struct {
	*Pagination
	Items []*Tag
}

TagList represents a list of tags.

type TagListOptions

type TagListOptions struct {
	ListOptions

	Tag     *string `url:"filter[tag],omitempty"`
	Account *string `url:"filter[account],omitempty"`
	Name    *string `url:"filter[name],omitempty"`
	Query   *string `url:"query,omitempty"`
}

TagListOptions represents the options for listing tags.

type TagRelation

type TagRelation struct {
	ID string `jsonapi:"primary,tags"`
}

type TagUpdateOptions

type TagUpdateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,tags"`
	// The name of the tag, it must be unique within the account.
	Name *string `jsonapi:"attr,name"`
}

TagUpdateOptions represents the options for updating a tag.

type Tags

type Tags interface {
	// List all the tags.
	List(ctx context.Context, options TagListOptions) (*TagList, error)
	// Create is used to create a new tag.
	Create(ctx context.Context, options TagCreateOptions) (*Tag, error)
	// Read reads a tag by its ID.
	Read(ctx context.Context, tagID string) (*Tag, error)
	// Update existing tag by its ID.
	Update(ctx context.Context, tagID string, options TagUpdateOptions) (*Tag, error)
	// Delete deletes a tag by its ID.
	Delete(ctx context.Context, tagID string) error
}

Tags describes all the tags related methods that the Scalr API supports.

type Team

type Team struct {
	ID          string `jsonapi:"primary,teams"`
	Name        string `jsonapi:"attr,name,omitempty"`
	Description string `jsonapi:"attr,description,omitempty"`

	// Relations
	Account          *Account          `jsonapi:"relation,account"`
	IdentityProvider *IdentityProvider `jsonapi:"relation,identity-provider"`
	Users            []*User           `jsonapi:"relation,users"`
}

type TeamCreateOptions

type TeamCreateOptions struct {
	ID          string  `jsonapi:"primary,teams"`
	Name        *string `jsonapi:"attr,name"`
	Description *string `jsonapi:"attr,description"`

	// Relations
	Account          *Account          `jsonapi:"relation,account,omitempty"`
	IdentityProvider *IdentityProvider `jsonapi:"relation,identity-provider,omitempty"`
	Users            []*User           `jsonapi:"relation,users,omitempty"`
}

TeamCreateOptions represents the options for creating a new team.

type TeamList

type TeamList struct {
	*Pagination
	Items []*Team
}

TeamList represents a list of teams.

type TeamListOptions

type TeamListOptions struct {
	ListOptions

	Team             *string `url:"filter[team],omitempty"`
	Name             *string `url:"filter[name],omitempty"`
	Account          *string `url:"filter[account],omitempty"`
	IdentityProvider *string `url:"filter[identity-provider],omitempty"`
	Query            *string `url:"query,omitempty"`
	Sort             *string `url:"sort,omitempty"`
	Include          *string `url:"include,omitempty"`
}

TeamListOptions represents the options for listing teams.

type TeamUpdateOptions

type TeamUpdateOptions struct {
	ID          string  `jsonapi:"primary,teams"`
	Name        *string `jsonapi:"attr,name,omitempty"`
	Description *string `jsonapi:"attr,description,omitempty"`

	// Relations
	Users []*User `jsonapi:"relation,users"`
}

TeamUpdateOptions represents the options for updating a team.

type Teams

type Teams interface {
	List(ctx context.Context, options TeamListOptions) (*TeamList, error)
	Create(ctx context.Context, options TeamCreateOptions) (*Team, error)
	Read(ctx context.Context, teamID string) (*Team, error)
	Update(ctx context.Context, teamID string, options TeamUpdateOptions) (*Team, error)
	Delete(ctx context.Context, teamID string) error
}

Teams describes all the team related methods that the Scalr API supports.

type Upstream

type Upstream struct {
	ID string `jsonapi:"primary,workspaces"`
}

type User

type User struct {
	ID          string     `jsonapi:"primary,users"`
	Status      UserStatus `jsonapi:"attr,status,omitempty"`
	Email       string     `jsonapi:"attr,email,omitempty"`
	Username    string     `jsonapi:"attr,username,omitempty"`
	FullName    string     `jsonapi:"attr,full-name,omitempty"`
	CreatedAt   time.Time  `jsonapi:"attr,created-at,iso8601"`
	LastLoginAt time.Time  `jsonapi:"attr,last-login-at,iso8601"`

	// Relations
	Teams             []*Team             `jsonapi:"relation,teams"`
	IdentityProviders []*IdentityProvider `jsonapi:"relation,identity-providers"`
}

User represents a Scalr IAM user.

type UserList

type UserList struct {
	*Pagination
	Items []*User
}

UserList represents a list of users.

type UserListOptions

type UserListOptions struct {
	ListOptions

	User             *string `url:"filter[user],omitempty"`
	Email            *string `url:"filter[email],omitempty"`
	IdentityProvider *string `url:"filter[identity-provider],omitempty"`
	Query            *string `url:"query,omitempty"`
	Sort             *string `url:"sort,omitempty"`
	Include          *string `url:"include,omitempty"`
}

UserListOptions represents the options for listing users.

type UserStatus

type UserStatus string

UserStatus represents a user status.

const (
	UserStatusActive   UserStatus = "Active"
	UserStatusInactive UserStatus = "Inactive"
	UserStatusPending  UserStatus = "Pending"
)

List of available user statuses.

type Users

type Users interface {
	List(ctx context.Context, options UserListOptions) (*UserList, error)
	Read(ctx context.Context, userID string) (*User, error)
}

Users describes all the user related methods that the Scalr API supports.

type Variable

type Variable struct {
	ID          string       `jsonapi:"primary,vars"`
	Key         string       `jsonapi:"attr,key"`
	Value       string       `jsonapi:"attr,value"`
	Category    CategoryType `jsonapi:"attr,category"`
	Description string       `jsonapi:"attr,description"`
	HCL         bool         `jsonapi:"attr,hcl"`
	Sensitive   bool         `jsonapi:"attr,sensitive"`
	Final       bool         `jsonapi:"attr,final"`

	// Relations
	Workspace   *Workspace   `jsonapi:"relation,workspace"`
	Environment *Environment `jsonapi:"relation,environment"`
	Account     *Account     `jsonapi:"relation,account"`
}

Variable represents a Scalr variable.

type VariableCreateOptions

type VariableCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attr,key"`

	// The value of the variable.
	Value *string `jsonapi:"attr,value,omitempty"`

	// Whether this is a Terraform or environment variable.
	Category *CategoryType `jsonapi:"attr,category"`

	// Variable description.
	Description *string `jsonapi:"attr,description"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attr,hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attr,sensitive,omitempty"`

	// Whether the value is final.
	Final *bool `jsonapi:"attr,final,omitempty"`

	// The workspace that owns the variable.
	Workspace *Workspace `jsonapi:"relation,workspace,omitempty"`

	// The environment that owns the variable.
	Environment *Environment `jsonapi:"relation,environment,omitempty"`

	// The account  that owns the variable.
	Account *Account `jsonapi:"relation,account,omitempty"`

	QueryOptions *VariableWriteQueryOptions
}

VariableCreateOptions represents the options for creating a new variable.

type VariableFilter

type VariableFilter struct {
	// Filter by ID
	Var *string `url:"var,omitempty"`

	// Filter by key
	Key *string `url:"key,omitempty"`

	// Filter by category
	Category *string `url:"category,omitempty"`

	// Scope filters.
	Workspace   *string `url:"workspace,omitempty"`
	Environment *string `url:"environment,omitempty"`
	Account     *string `url:"account,omitempty"`
}

type VariableList

type VariableList struct {
	*Pagination
	Items []*Variable
}

VariableList represents a list of variables.

type VariableListOptions

type VariableListOptions struct {
	ListOptions

	// The comma-separated list of attributes.
	Sort *string `url:"sort,omitempty"`

	// The comma-separated list of relationship paths.
	Include *string `url:"include,omitempty"`

	// Filters
	Filter *VariableFilter `url:"filter,omitempty"`
}

VariableListOptions represents the options for listing variables.

type VariableUpdateOptions

type VariableUpdateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attr,key,omitempty"`

	// The value of the variable.
	Value *string `jsonapi:"attr,value,omitempty"`

	// The description of the variable.
	Description *string `jsonapi:"attr,description,omitempty"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attr,hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attr,sensitive,omitempty"`

	// Whether the value is final.
	Final        *bool `jsonapi:"attr,final,omitempty"`
	QueryOptions *VariableWriteQueryOptions
}

VariableUpdateOptions represents the options for updating a variable.

type VariableWriteQueryOptions

type VariableWriteQueryOptions struct {
	Force *bool `url:"force,omitempty"`
}

type Variables

type Variables interface {
	// List variables by filter options.
	List(ctx context.Context, options VariableListOptions) (*VariableList, error)

	// Create is used to create a new variable.
	Create(ctx context.Context, options VariableCreateOptions) (*Variable, error)

	// Read a variable by its ID.
	Read(ctx context.Context, variableID string) (*Variable, error)

	// Update values of an existing variable.
	Update(ctx context.Context, variableID string, options VariableUpdateOptions) (*Variable, error)

	// Delete a variable by its ID.
	Delete(ctx context.Context, variableID string) error
}

Variables describes all the variable related methods that the Scalr API supports.

type VcsProvider

type VcsProvider struct {
	ID       string   `jsonapi:"primary,vcs-providers"`
	Name     string   `jsonapi:"attr,name"`
	Url      string   `jsonapi:"attr,url"`
	VcsType  VcsType  `jsonapi:"attr,vcs-type"`
	AuthType AuthType `jsonapi:"attr,auth-type"`
	OAuth    *OAuth   `jsonapi:"attr,oauth"`
	Token    *string  `jsonapi:"attr,token"`
	Username *string  `jsonapi:"attr,username"`
	IsShared bool     `jsonapi:"attr,is-shared"`

	// Relations
	Environments []*Environment `jsonapi:"relation,environments"`
	Account      *Account       `jsonapi:"relation,account"`
	AgentPool    *AgentPool     `jsonapi:"relation,agent-pool"`
}

VcsProvider represents a Scalr IACP VcsProvider.

type VcsProviderCreateOptions

type VcsProviderCreateOptions struct {
	ID       string   `jsonapi:"primary,vcs-providers"`
	Name     *string  `jsonapi:"attr,name"`
	VcsType  VcsType  `jsonapi:"attr,vcs-type"`
	AuthType AuthType `jsonapi:"attr,auth-type"`
	OAuth    *OAuth   `jsonapi:"attr,oauth"`
	Token    string   `jsonapi:"attr,token"`
	Url      *string  `jsonapi:"attr,url"`
	Username *string  `jsonapi:"attr,username"`
	IsShared *bool    `jsonapi:"attr,is-shared,omitempty"`

	// Relations
	Environments []*Environment `jsonapi:"relation,environments,omitempty"`
	Account      *Account       `jsonapi:"relation,account,omitempty"`
	AgentPool    *AgentPool     `jsonapi:"relation,agent-pool,omitempty"`
}

VcsProviderCreateOptions represents the options for creating a new vcs provider.

type VcsProviderUpdateOptions

type VcsProviderUpdateOptions struct {
	// For internal use only!
	ID       string  `jsonapi:"primary,vcs-providers"`
	Name     *string `jsonapi:"attr,name,omitempty"`
	Token    *string `jsonapi:"attr,token,omitempty"`
	Url      *string `jsonapi:"attr,url,omitempty"`
	Username *string `jsonapi:"attr,username,omitempty"`
	IsShared *bool   `jsonapi:"attr,is-shared,omitempty"`

	// Relations
	Environments []*Environment `jsonapi:"relation,environments"`
	AgentPool    *AgentPool     `jsonapi:"relation,agent-pool"`
}

VcsProviderUpdateOptions represents the options for updating a vcs provider.

type VcsProviders

type VcsProviders interface {
	// List the vcs providers.
	List(ctx context.Context, options VcsProvidersListOptions) (*VcsProvidersList, error)
	Create(ctx context.Context, options VcsProviderCreateOptions) (*VcsProvider, error)
	Read(ctx context.Context, vcsProvider string) (*VcsProvider, error)
	Update(ctx context.Context, vcsProvider string, options VcsProviderUpdateOptions) (*VcsProvider, error)
	Delete(ctx context.Context, vcsProvider string) error
}

VcsProviders describes all the VcsProviders related methods that the Scalr IACP API supports.

IACP API docs: https://www.scalr.com/docs/en/latest/api/index.html

type VcsProvidersList

type VcsProvidersList struct {
	*Pagination
	Items []*VcsProvider
}

VcsProvidersList represents a list of VCS providers.

type VcsProvidersListOptions

type VcsProvidersListOptions struct {
	ListOptions

	// Filter by identifier.
	ID *string `url:"filter[vcs-provider],omitempty"`

	// Query string.
	Query *string `url:"query,omitempty"`

	// The comma-separated list of attributes.
	Sort *string `url:"sort,omitempty"`

	// Filter by vcs-type
	VcsType *VcsType `url:"filter[vcs-type],omitempty"`

	// Scope filters.
	Environment *string `url:"filter[environment],omitempty"`
	Account     *string `url:"filter[account],omitempty"`
	AgentPool   *string `url:"filter[agent-pool],omitempty"`
}

VcsProvidersListOptions represents the options for listing vcs providers.

type VcsRevision

type VcsRevision struct {
	ID             string `jsonapi:"primary,vcs-revisions"`
	Branch         string `jsonapi:"attr,branch"`
	CommitSha      string `jsonapi:"attr,commit-sha"`
	CommitMessage  string `jsonapi:"attr,commit-message"`
	SenderUsername string `jsonapi:"attr,sender-username"`
}

VcsRevision represents the VCS metadata

type VcsRevisions

type VcsRevisions interface {
	// Read reads a VCS revision by its ID.
	Read(ctx context.Context, vcsRevisionID string) (*VcsRevision, error)
}

VcsRevisions describes all the vcs revisions related methods that the Scalr API supports.

type VcsType

type VcsType string

VcsType represents a type VCS provider.

const (
	Github              VcsType = "github"
	GithubEnterprise    VcsType = "github_enterprise"
	Gitlab              VcsType = "gitlab"
	GitlabEnterprise    VcsType = "gitlab_enterprise"
	Bitbucket           VcsType = "bitbucket"
	BitbucketEnterprise VcsType = "bitbucket_enterprise"
	AzureDevOpsServices VcsType = "azure_dev_ops_services"
)

type Webhook

type Webhook struct {
	ID              string     `jsonapi:"primary,webhooks"`
	Enabled         bool       `jsonapi:"attr,enabled"`
	LastTriggeredAt *time.Time `jsonapi:"attr,last-triggered-at,iso8601"`
	Name            string     `jsonapi:"attr,name"`

	// Relations
	Workspace   *Workspace         `jsonapi:"relation,workspace"`
	Environment *Environment       `jsonapi:"relation,environment"`
	Account     *Account           `jsonapi:"relation,account"`
	Endpoint    *Endpoint          `jsonapi:"relation,endpoint"`
	Events      []*EventDefinition `jsonapi:"relation,events"`
}

Webhook represents a Scalr IACP webhook.

type WebhookCreateOptions

type WebhookCreateOptions struct {
	ID      string  `jsonapi:"primary,webhooks"`
	Enabled *bool   `jsonapi:"attr,enabled,omitempty"`
	Name    *string `jsonapi:"attr,name"`

	// Relations
	Workspace   *Workspace         `jsonapi:"relation,workspace,omitempty"`
	Environment *Environment       `jsonapi:"relation,environment,omitempty"`
	Account     *Account           `jsonapi:"relation,account"`
	Endpoint    *Endpoint          `jsonapi:"relation,endpoint"`
	Events      []*EventDefinition `jsonapi:"relation,events"`
}

WebhookCreateOptions represents the options for creating a new webhook.

type WebhookHeader

type WebhookHeader struct {
	Name      string `json:"name"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive"`
}

type WebhookIntegration

type WebhookIntegration struct {
	ID              string           `jsonapi:"primary,webhook-integrations"`
	Name            string           `jsonapi:"attr,name"`
	Enabled         bool             `jsonapi:"attr,enabled"`
	IsShared        bool             `jsonapi:"attr,is-shared"`
	LastTriggeredAt *time.Time       `jsonapi:"attr,last-triggered-at,iso8601"`
	Url             string           `jsonapi:"attr,url"`
	SecretKey       string           `jsonapi:"attr,secret-key"`
	Timeout         int              `jsonapi:"attr,timeout"`
	MaxAttempts     int              `jsonapi:"attr,max-attempts"`
	HttpMethod      string           `jsonapi:"attr,http-method"`
	Headers         []*WebhookHeader `jsonapi:"attr,headers"`

	// Relations
	Environments []*Environment     `jsonapi:"relation,environments"`
	Account      *Account           `jsonapi:"relation,account"`
	Events       []*EventDefinition `jsonapi:"relation,events"`
}

WebhookIntegration represents a Scalr IACP webhook integration.

type WebhookIntegrationCreateOptions

type WebhookIntegrationCreateOptions struct {
	ID       string  `jsonapi:"primary,webhook-integrations"`
	Name     *string `jsonapi:"attr,name"`
	Enabled  *bool   `jsonapi:"attr,enabled,omitempty"`
	IsShared *bool   `jsonapi:"attr,is-shared,omitempty"`

	Url         *string          `jsonapi:"attr,url"`
	SecretKey   *string          `jsonapi:"attr,secret-key,omitempty"`
	Timeout     *int             `jsonapi:"attr,timeout,omitempty"`
	MaxAttempts *int             `jsonapi:"attr,max-attempts,omitempty"`
	Headers     []*WebhookHeader `jsonapi:"attr,headers,omitempty"`

	Environments []*Environment     `jsonapi:"relation,environments,omitempty"`
	Account      *Account           `jsonapi:"relation,account"`
	Events       []*EventDefinition `jsonapi:"relation,events,omitempty"`
}

type WebhookIntegrationList

type WebhookIntegrationList struct {
	*Pagination
	Items []*WebhookIntegration
}

type WebhookIntegrationListOptions

type WebhookIntegrationListOptions struct {
	ListOptions

	Query       *string `url:"query,omitempty"`
	Sort        *string `url:"sort,omitempty"`
	Enabled     *bool   `url:"filter[enabled],omitempty"`
	Event       *string `url:"filter[event],omitempty"`
	Environment *string `url:"filter[environment],omitempty"`
	Account     *string `url:"filter[account],omitempty"`
}

type WebhookIntegrationUpdateOptions

type WebhookIntegrationUpdateOptions struct {
	ID       string  `jsonapi:"primary,webhook-integrations"`
	Name     *string `jsonapi:"attr,name,omitempty"`
	Enabled  *bool   `jsonapi:"attr,enabled,omitempty"`
	IsShared *bool   `jsonapi:"attr,is-shared,omitempty"`

	Url         *string          `jsonapi:"attr,url,omitempty"`
	SecretKey   *string          `jsonapi:"attr,secret-key,omitempty"`
	Timeout     *int             `jsonapi:"attr,timeout,omitempty"`
	MaxAttempts *int             `jsonapi:"attr,max-attempts,omitempty"`
	Headers     []*WebhookHeader `jsonapi:"attr,headers,omitempty"`

	Environments []*Environment     `jsonapi:"relation,environments"`
	Events       []*EventDefinition `jsonapi:"relation,events"`
}

type WebhookList

type WebhookList struct {
	*Pagination
	Items []*Webhook
}

WebhookList represents a list of webhooks.

type WebhookListOptions

type WebhookListOptions struct {
	ListOptions

	// Query string.
	Query *string `url:"query,omitempty"`

	Name *string `url:"query,omitempty"`

	// The comma-separated list of attributes.
	Sort *string `url:"sort,omitempty"`

	// The comma-separated list of relationship paths.
	Include *string `url:"include,omitempty"`

	// Filter by enabled
	Enabled *bool `url:"filter[enabled],omitempty"`

	// Event filter
	Event *string `url:"filter[event],omitempty"`

	// Scope filters.
	Workspace   *string `url:"filter[workspace],omitempty"`
	Environment *string `url:"filter[environment],omitempty"`
	Account     *string `url:"filter[account],omitempty"`
}

WebhookListOptions represents the options for listing webhooks.

type WebhookUpdateOptions

type WebhookUpdateOptions struct {
	// For internal use only!
	ID      string  `jsonapi:"primary,webhooks"`
	Enabled *bool   `jsonapi:"attr,enabled,omitempty"`
	Name    *string `jsonapi:"attr,name"`

	// Relations
	Endpoint *Endpoint          `jsonapi:"relation,endpoint"`
	Events   []*EventDefinition `jsonapi:"relation,events"`
}

WebhookUpdateOptions represents the options for updating a webhook.

type Webhooks

type Webhooks interface {
	// List the webhooks.
	List(ctx context.Context, options WebhookListOptions) (*WebhookList, error)
	Create(ctx context.Context, options WebhookCreateOptions) (*Webhook, error)
	Read(ctx context.Context, webhook string) (*Webhook, error)
	Update(ctx context.Context, webhook string, options WebhookUpdateOptions) (*Webhook, error)
	Delete(ctx context.Context, webhook string) error
}

Webhooks describes all the webhooks related methods that the Scalr IACP API supports.

IACP API docs: https://www.scalr.com/docs/en/latest/api/index.html

type Workspace

type Workspace struct {
	ID                        string                 `jsonapi:"primary,workspaces"`
	Actions                   *WorkspaceActions      `jsonapi:"attr,actions"`
	AutoApply                 bool                   `jsonapi:"attr,auto-apply"`
	ForceLatestRun            bool                   `jsonapi:"attr,force-latest-run"`
	DeletionProtectionEnabled bool                   `jsonapi:"attr,deletion-protection-enabled"`
	CanQueueDestroyPlan       bool                   `jsonapi:"attr,can-queue-destroy-plan"`
	CreatedAt                 time.Time              `jsonapi:"attr,created-at,iso8601"`
	FileTriggersEnabled       bool                   `jsonapi:"attr,file-triggers-enabled"`
	Locked                    bool                   `jsonapi:"attr,locked"`
	MigrationEnvironment      string                 `jsonapi:"attr,migration-environment"`
	Name                      string                 `jsonapi:"attr,name"`
	Operations                bool                   `jsonapi:"attr,operations"`
	ExecutionMode             WorkspaceExecutionMode `jsonapi:"attr,execution-mode"`
	Permissions               *WorkspacePermissions  `jsonapi:"attr,permissions"`
	TerraformVersion          string                 `jsonapi:"attr,terraform-version"`
	VCSRepo                   *WorkspaceVCSRepo      `jsonapi:"attr,vcs-repo"`
	WorkingDirectory          string                 `jsonapi:"attr,working-directory"`
	ApplySchedule             string                 `jsonapi:"attr,apply-schedule"`
	DestroySchedule           string                 `jsonapi:"attr,destroy-schedule"`
	HasResources              bool                   `jsonapi:"attr,has-resources"`
	AutoQueueRuns             WorkspaceAutoQueueRuns `jsonapi:"attr,auto-queue-runs"`
	Hooks                     *Hooks                 `jsonapi:"attr,hooks"`
	RunOperationTimeout       *int                   `jsonapi:"attr,run-operation-timeout"`
	VarFiles                  []string               `jsonapi:"attr,var-files"`

	// Relations
	CurrentRun    *Run           `jsonapi:"relation,current-run"`
	Environment   *Environment   `jsonapi:"relation,environment"`
	CreatedBy     *User          `jsonapi:"relation,created-by"`
	VcsProvider   *VcsProvider   `jsonapi:"relation,vcs-provider"`
	AgentPool     *AgentPool     `jsonapi:"relation,agent-pool"`
	ModuleVersion *ModuleVersion `jsonapi:"relation,module-version,omitempty"`
	Tags          []*Tag         `jsonapi:"relation,tags"`
}

Workspace represents a Scalr workspace.

type WorkspaceActions

type WorkspaceActions struct {
	IsDestroyable bool `json:"is-destroyable"`
}

WorkspaceActions represents the workspace actions.

type WorkspaceAutoQueueRuns

type WorkspaceAutoQueueRuns string

WorkspaceAutoQueueRuns represents run triggering modes

const (
	AutoQueueRunsModeSkipFirst WorkspaceAutoQueueRuns = "skip_first"
	AutoQueueRunsModeAlways    WorkspaceAutoQueueRuns = "always"
	AutoQueueRunsModeNever     WorkspaceAutoQueueRuns = "never"
)

Available auto queue modes

func AutoQueueRunsModePtr

func AutoQueueRunsModePtr(v WorkspaceAutoQueueRuns) *WorkspaceAutoQueueRuns

AutoQueueRunsModePtr returns a pointer to the given auto queue runs mode

type WorkspaceCreateOptions

type WorkspaceCreateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,workspaces"`

	// Whether to automatically apply changes when a Terraform plan is successful.
	AutoApply *bool `jsonapi:"attr,auto-apply,omitempty"`

	// Whether to automatically raise the priority of the latest new run.
	ForceLatestRun *bool `jsonapi:"attr,force-latest-run,omitempty"`

	// Whether to prevent deletion when the workspace has resources.
	DeletionProtectionEnabled *bool `jsonapi:"attr,deletion-protection-enabled,omitempty"`

	// The name of the workspace, which can only include letters, numbers, -,
	// and _. This will be used as an identifier and must be unique in the
	// environment.
	Name *string `jsonapi:"attr,name"`

	// Whether the workspace will use remote or local execution mode.
	Operations    *bool                   `jsonapi:"attr,operations,omitempty"`
	ExecutionMode *WorkspaceExecutionMode `jsonapi:"attr,execution-mode,omitempty"`

	// The version of Terraform to use for this workspace. Upon creating a
	// workspace, the latest version is selected unless otherwise specified.
	TerraformVersion *string `jsonapi:"attr,terraform-version,omitempty"`

	// Settings for the workspace's VCS repository. If omitted, the workspace is
	// created without a VCS repo. If included, you must specify at least the
	// oauth-token-id and identifier keys below.
	VCSRepo *WorkspaceVCSRepoOptions `jsonapi:"attr,vcs-repo,omitempty"`

	// Contains configuration for custom hooks,
	// which can be triggered before or after plan or apply phases
	Hooks *HooksOptions `jsonapi:"attr,hooks,omitempty"`

	// A relative path that Terraform will execute within. This defaults to the
	// root of your repository and is typically set to a subdirectory matching the
	// environment when multiple environments exist within the same repository.
	WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`

	// Indicates if runs have to be queued automatically when a new configuration version is uploaded.
	AutoQueueRuns *WorkspaceAutoQueueRuns `jsonapi:"attr,auto-queue-runs,omitempty"`

	// Specifies the VcsProvider for workspace vcs-repo. Required if vcs-repo attr passed
	VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider,omitempty"`

	// Specifies the Environment for workspace.
	Environment *Environment `jsonapi:"relation,environment"`

	// Specifies the AgentPool for workspace.
	AgentPool *AgentPool `jsonapi:"relation,agent-pool,omitempty"`

	// Specifies the VarFiles for workspace.
	VarFiles []string `jsonapi:"attr,var-files"`

	// Specifies the ModuleVersion based on create workspace
	ModuleVersion *ModuleVersion `jsonapi:"relation,module-version,omitempty"`

	// Specifies the number of minutes run operation can be executed before termination.
	RunOperationTimeout *int `jsonapi:"attr,run-operation-timeout"`

	// Specifies tags assigned to the workspace
	Tags []*Tag `jsonapi:"relation,tags,omitempty"`
}

WorkspaceCreateOptions represents the options for creating a new workspace.

type WorkspaceExecutionMode

type WorkspaceExecutionMode string

WorkspaceExecutionMode represents an execution mode setting of the workspace.

const (
	WorkspaceExecutionModeRemote WorkspaceExecutionMode = "remote"
	WorkspaceExecutionModeLocal  WorkspaceExecutionMode = "local"
)

Available execution modes

func WorkspaceExecutionModePtr

func WorkspaceExecutionModePtr(v WorkspaceExecutionMode) *WorkspaceExecutionMode

WorkspaceExecutionModePtr returns a pointer to the given execution mode

type WorkspaceFilter

type WorkspaceFilter struct {
	Id          *string `url:"workspace,omitempty"`
	Account     *string `url:"account,omitempty"`
	Environment *string `url:"environment,omitempty"`
	Name        *string `url:"name,omitempty"`
	Tag         *string `url:"tag,omitempty"`
	AgentPool   *string `url:"agent-pool,omitempty"`
}

WorkspaceFilter represents the options for filtering workspaces.

type WorkspaceList

type WorkspaceList struct {
	*Pagination
	Items []*Workspace
}

WorkspaceList represents a list of workspaces.

type WorkspaceListOptions

type WorkspaceListOptions struct {
	ListOptions
	Include string           `url:"include,omitempty"`
	Filter  *WorkspaceFilter `url:"filter,omitempty"`
}

WorkspaceListOptions represents the options for listing workspaces.

type WorkspacePermissions

type WorkspacePermissions struct {
	CanDestroy        bool `json:"can-destroy"`
	CanForceUnlock    bool `json:"can-force-unlock"`
	CanLock           bool `json:"can-lock"`
	CanQueueApply     bool `json:"can-queue-apply"`
	CanQueueDestroy   bool `json:"can-queue-destroy"`
	CanQueueRun       bool `json:"can-queue-run"`
	CanReadSettings   bool `json:"can-read-settings"`
	CanUnlock         bool `json:"can-unlock"`
	CanUpdate         bool `json:"can-update"`
	CanUpdateVariable bool `json:"can-update-variable"`
}

WorkspacePermissions represents the workspace permissions.

type WorkspaceRunScheduleOptions

type WorkspaceRunScheduleOptions struct {
	ApplySchedule   *string `json:"apply-schedule"`
	DestroySchedule *string `json:"destroy-schedule"`
}

WorkspaceRunScheduleOptions represents option for setting run schedules for workspace

type WorkspaceTags

type WorkspaceTags interface {
	Add(ctx context.Context, wsID string, tags []*TagRelation) error
	Replace(ctx context.Context, wsID string, tags []*TagRelation) error
	Delete(ctx context.Context, wsID string, tags []*TagRelation) error
}

WorkspaceTags describes all the workspace tags related methods that the Scalr API supports.

type WorkspaceUpdateOptions

type WorkspaceUpdateOptions struct {
	// For internal use only!
	ID string `jsonapi:"primary,workspaces"`

	// Whether to automatically apply changes when a Terraform plan is successful.
	AutoApply *bool `jsonapi:"attr,auto-apply,omitempty"`

	// Whether to automatically raise the priority of the latest new run.
	ForceLatestRun *bool `jsonapi:"attr,force-latest-run,omitempty"`

	// Whether to prevent deletion when the workspace has resources.
	DeletionProtectionEnabled *bool `jsonapi:"attr,deletion-protection-enabled,omitempty"`

	// A new name for the workspace, which can only include letters, numbers, -,
	// and _. This will be used as an identifier and must be unique in the
	// environment. Warning: Changing a workspace's name changes its URL in the
	// API and UI.
	Name *string `jsonapi:"attr,name,omitempty"`

	// Whether to filter runs based on the changed files in a VCS push. If
	// enabled, the working directory and trigger prefixes describe a set of
	// paths which must contain changes for a VCS push to trigger a run. If
	// disabled, any push will trigger a run.
	FileTriggersEnabled *bool `jsonapi:"attr,file-triggers-enabled,omitempty"`

	// Whether the workspace will use remote or local execution mode.
	Operations    *bool                   `jsonapi:"attr,operations,omitempty"`
	ExecutionMode *WorkspaceExecutionMode `jsonapi:"attr,execution-mode,omitempty"`

	// The version of Terraform to use for this workspace.
	TerraformVersion *string `jsonapi:"attr,terraform-version,omitempty"`

	// To delete a workspace's existing VCS repo, specify null instead of an
	// object. To modify a workspace's existing VCS repo, include whichever of
	// the keys below you wish to modify. To add a new VCS repo to a workspace
	// that didn't previously have one, include at least the oauth-token-id and
	// identifier keys.
	VCSRepo *WorkspaceVCSRepoOptions `jsonapi:"attr,vcs-repo"`

	// Contains configuration for custom hooks,
	// which can be triggered before init, before or after plan or apply phases
	Hooks *HooksOptions `jsonapi:"attr,hooks,omitempty"`

	// A relative path that Terraform will execute within. This defaults to the
	// root of your repository and is typically set to a subdirectory matching
	// the environment when multiple environments exist within the same
	// repository.
	WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`

	// Indicates if runs have to be queued automatically when a new configuration version is uploaded.
	AutoQueueRuns *WorkspaceAutoQueueRuns `jsonapi:"attr,auto-queue-runs,omitempty"`

	// Specifies the VcsProvider for workspace vcs-repo.
	VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider"`

	// Specifies the AgentPool for workspace.
	AgentPool *AgentPool `jsonapi:"relation,agent-pool"`

	//Specifies the VarFiles for workspace.
	VarFiles []string `jsonapi:"attr,var_files"`

	// Specifies the ModuleVersion based on create workspace
	ModuleVersion *ModuleVersion `jsonapi:"relation,module-version"`

	// Specifies the number of minutes run operation can be executed before termination.
	RunOperationTimeout *int `jsonapi:"attr,run-operation-timeout"`
}

WorkspaceUpdateOptions represents the options for updating a workspace.

type WorkspaceVCSRepo

type WorkspaceVCSRepo struct {
	Branch            string   `json:"branch"`
	Identifier        string   `json:"identifier"`
	IngressSubmodules bool     `json:"ingress-submodules"`
	Path              string   `json:"path"`
	TriggerPrefixes   []string `json:"trigger-prefixes,omitempty"`
	DryRunsEnabled    bool     `json:"dry-runs-enabled"`
}

WorkspaceVCSRepo contains the configuration of a VCS integration.

type WorkspaceVCSRepoOptions

type WorkspaceVCSRepoOptions struct {
	Branch            *string   `json:"branch,omitempty"`
	Identifier        *string   `json:"identifier,omitempty"`
	IngressSubmodules *bool     `json:"ingress-submodules,omitempty"`
	Path              *string   `json:"path,omitempty"`
	TriggerPrefixes   *[]string `json:"trigger-prefixes,omitempty"`
	DryRunsEnabled    *bool     `json:"dry-runs-enabled,omitempty"`
}

WorkspaceVCSRepoOptions represents the configuration options of a VCS integration.

type Workspaces

type Workspaces interface {
	// List all the workspaces within an environment.
	List(ctx context.Context, options WorkspaceListOptions) (*WorkspaceList, error)

	// Create is used to create a new workspace.
	Create(ctx context.Context, options WorkspaceCreateOptions) (*Workspace, error)

	// Read a workspace by its environment ID and name.
	Read(ctx context.Context, environmentID, workspaceName string) (*Workspace, error)

	// ReadByID reads a workspace by its ID.
	ReadByID(ctx context.Context, workspaceID string) (*Workspace, error)

	// Update settings of an existing workspace.
	Update(ctx context.Context, workspaceID string, options WorkspaceUpdateOptions) (*Workspace, error)

	// Delete deletes a workspace by its ID.
	Delete(ctx context.Context, workspaceID string) error

	// SetSchedule sets run schedules for workspace.
	SetSchedule(ctx context.Context, workspaceID string, options WorkspaceRunScheduleOptions) (*Workspace, error)
}

Workspaces describes all the workspace related methods that the Scalr API supports.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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