mws

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkspaceStatusNotProvisioned = "NOT_PROVISIONED"
	WorkspaceStatusProvisioning   = "PROVISIONING"
	WorkspaceStatusRunning        = "RUNNING"
	WorkspaceStatusFailed         = "FAILED"
	WorkspaceStatusCanceled       = "CANCELLED"
)

List of workspace statuses for provisioning the workspace

View Source
const DefaultProvisionTimeout = 20 * time.Minute

DefaultProvisionTimeout is the amount of minutes terraform will wait for workspace to be provisioned and DNS entry to be available. Increasing this may help with local DNS cache issues.

Variables

View Source
var WorkspaceStatusesNonRunnable = []string{WorkspaceStatusCanceled, WorkspaceStatusFailed}

WorkspaceStatusesNonRunnable is a list of statuses in which the workspace is not runnable

Functions

func CreateTokenIfNeeded

func CreateTokenIfNeeded(workspacesAPI WorkspacesAPI,
	workspaceSchema map[string]*schema.Schema, d *schema.ResourceData) error

func DataSourceMwsWorkspaces added in v1.2.0

func DataSourceMwsWorkspaces() *schema.Resource

func EnsureTokenExistsIfNeeded

func EnsureTokenExistsIfNeeded(a WorkspacesAPI,
	workspaceSchema map[string]*schema.Schema, d *schema.ResourceData) error

func ResourceCustomerManagedKeyV0

func ResourceCustomerManagedKeyV0() cty.Type

func ResourceMwsCredentials

func ResourceMwsCredentials() *schema.Resource

func ResourceMwsCustomerManagedKeys

func ResourceMwsCustomerManagedKeys() *schema.Resource

func ResourceMwsLogDelivery

func ResourceMwsLogDelivery() *schema.Resource

func ResourceMwsNetworks

func ResourceMwsNetworks() *schema.Resource

func ResourceMwsPermissionAssignment added in v1.2.0

func ResourceMwsPermissionAssignment() *schema.Resource

func ResourceMwsPrivateAccessSettings

func ResourceMwsPrivateAccessSettings() *schema.Resource

func ResourceMwsStorageConfigurations

func ResourceMwsStorageConfigurations() *schema.Resource

func ResourceMwsVpcEndpoint

func ResourceMwsVpcEndpoint() *schema.Resource

func ResourceMwsWorkspaces

func ResourceMwsWorkspaces() *schema.Resource

ResourceMwsWorkspaces manages E2 workspaces

func UpdateTokenIfNeeded

func UpdateTokenIfNeeded(workspacesAPI WorkspacesAPI,
	workspaceSchema map[string]*schema.Schema, d *schema.ResourceData) error

Types

type AwsCredentials

type AwsCredentials struct {
	StsRole *StsRole `json:"sts_role,omitempty"`
}

AwsCredentials is the object that points to the cross account role

type AwsKeyInfo

type AwsKeyInfo struct {
	KeyArn    string `json:"key_arn"`
	KeyAlias  string `json:"key_alias"`
	KeyRegion string `json:"key_region,omitempty" tf:"computed"`
}

AwsKeyInfo has information about the KMS key for BYOK

type CloudResourceBucket

type CloudResourceBucket struct {
	GCP *GCP `json:"gcp"`
}

type Credentials

type Credentials struct {
	CredentialsID   string          `json:"credentials_id,omitempty"`
	CredentialsName string          `json:"credentials_name,omitempty"`
	AwsCredentials  *AwsCredentials `json:"aws_credentials,omitempty"`
	AccountID       string          `json:"account_id,omitempty"`
	CreationTime    int64           `json:"creation_time,omitempty"`
}

Credentials is the object that contains all the information for the credentials to create a workspace

type CredentialsAPI

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

CredentialsAPI exposes the mws credentials API

func NewCredentialsAPI

func NewCredentialsAPI(ctx context.Context, m any) CredentialsAPI

NewCredentialsAPI creates MWSCredentialsAPI instance from provider meta

func (CredentialsAPI) Create

func (a CredentialsAPI) Create(mwsAcctID, credentialsName string, roleArn string) (Credentials, error)

Create creates a set of MWS Credentials for the cross account role

func (CredentialsAPI) Delete

func (a CredentialsAPI) Delete(mwsAcctID, credentialsID string) error

Delete deletes the credentials object given a credentials id

func (CredentialsAPI) List

func (a CredentialsAPI) List(mwsAcctID string) ([]Credentials, error)

List lists all the available credentials object in the mws account

func (CredentialsAPI) Read

func (a CredentialsAPI) Read(mwsAcctID, credentialsID string) (Credentials, error)

Read returns the credentials object along with metadata

type CustomerManagedKey

type CustomerManagedKey struct {
	CustomerManagedKeyID string      `json:"customer_managed_key_id,omitempty" tf:"computed"`
	AwsKeyInfo           *AwsKeyInfo `json:"aws_key_info" tf:"force_new"`
	AccountID            string      `json:"account_id" tf:"force_new"`
	CreationTime         int64       `json:"creation_time,omitempty" tf:"computed"`
	UseCases             []string    `json:"use_cases"`
}

CustomerManagedKey contains key information and metadata for BYOK for E2

type CustomerManagedKeysAPI

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

CustomerManagedKeysAPI exposes the mws customerManagedKeys API

func NewCustomerManagedKeysAPI

func NewCustomerManagedKeysAPI(ctx context.Context, m any) CustomerManagedKeysAPI

NewCustomerManagedKeysAPI creates CustomerManagedKeysAPI instance from provider meta

func (CustomerManagedKeysAPI) Create

Create creates a set of MWS CustomerManagedKeys for the BYOVPC

func (CustomerManagedKeysAPI) Delete

func (a CustomerManagedKeysAPI) Delete(accountID, customerManagedKeyID string) error

Delete deletes the customer managed key object given a network id

func (CustomerManagedKeysAPI) List

func (a CustomerManagedKeysAPI) List(accountID string) (kl []CustomerManagedKey, err error)

List lists all the available customer managed key objects in the mws account

func (CustomerManagedKeysAPI) Read

func (a CustomerManagedKeysAPI) Read(
	accountID, customerManagedKeyID string) (k CustomerManagedKey, err error)

Read returns the customer managed key object along with metadata

type GCP

type GCP struct {
	ProjectID string `json:"project_id"`
}

type GCPCommonNetworkConfig

type GCPCommonNetworkConfig struct {
	GKEConnectivityType     string `json:"gke_connectivity_type"`
	GKEClusterMasterIPRange string `json:"gke_cluster_master_ip_range"`
}

type GCPManagedNetworkConfig

type GCPManagedNetworkConfig struct {
	SubnetCIDR               string `json:"subnet_cidr"`
	GKEClusterPodIPRange     string `json:"gke_cluster_pod_ip_range"`
	GKEClusterServiceIPRange string `json:"gke_cluster_service_ip_range"`
}

type GCPNetwork

type GCPNetwork struct {
	NetworkID               string                   `json:"network_id,omitempty"`
	GCPManagedNetworkConfig *GCPManagedNetworkConfig `json:"gcp_managed_network_config,omitempty"`
	GCPCommonNetworkConfig  *GCPCommonNetworkConfig  `json:"gcp_common_network_config"`
}

type LogDelivery

type LogDelivery struct {
	LogDeliveryConfiguration LogDeliveryConfiguration `json:"log_delivery_configuration"`
}

LogDelivery wrapper

type LogDeliveryAPI

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

LogDeliveryAPI ...

func NewLogDeliveryAPI

func NewLogDeliveryAPI(ctx context.Context, m any) LogDeliveryAPI

NewLogDeliveryAPI ...

func (LogDeliveryAPI) Create

Create new log delivery configuration

func (LogDeliveryAPI) Patch added in v1.0.2

func (a LogDeliveryAPI) Patch(accountID, configID string, status string) error

patch log delivery configuration - i.e. can only enable or disable it

func (LogDeliveryAPI) Read

func (a LogDeliveryAPI) Read(accountID, configID string) (LogDeliveryConfiguration, error)

Read reads log delivery configuration

type LogDeliveryConfiguration

type LogDeliveryConfiguration struct {
	AccountID              string  `json:"account_id" tf:"force_new"`
	ConfigID               string  `json:"config_id,omitempty" tf:"computed,force_new"`
	CredentialsID          string  `json:"credentials_id" tf:"force_new"`
	StorageConfigurationID string  `json:"storage_configuration_id" tf:"force_new"`
	WorkspaceIdsFilter     []int64 `json:"workspace_ids_filter,omitempty" tf:"force_new"`
	ConfigName             string  `json:"config_name,omitempty" tf:"force_new"`
	Status                 string  `json:"status,omitempty" tf:"computed"`
	LogType                string  `json:"log_type" tf:"force_new"`
	OutputFormat           string  `json:"output_format" tf:"force_new"`
	DeliveryPathPrefix     string  `json:"delivery_path_prefix,omitempty" tf:"force_new"`
	DeliveryStartTime      string  `json:"delivery_start_time,omitempty" tf:"computed,force_new"`
}

LogDeliveryConfiguration describes log delivery

type Network

type Network struct {
	AccountID        string               `json:"account_id"`
	NetworkID        string               `json:"network_id,omitempty" tf:"computed"`
	NetworkName      string               `json:"network_name"`
	VPCID            string               `json:"vpc_id"`
	SubnetIds        []string             `json:"subnet_ids" tf:"slice_set"`
	VPCEndpoints     *NetworkVPCEndpoints `json:"vpc_endpoints,omitempty" tf:"computed,force_new"`
	SecurityGroupIds []string             `json:"security_group_ids" tf:"slice_set"`
	VPCStatus        string               `json:"vpc_status,omitempty" tf:"computed"`
	ErrorMessages    []NetworkHealth      `json:"error_messages,omitempty" tf:"computed"`
	WorkspaceID      int64                `json:"workspace_id,omitempty" tf:"computed"`
	CreationTime     int64                `json:"creation_time,omitempty" tf:"computed"`
}

Network is the object that contains all the information for BYOVPC

type NetworkHealth

type NetworkHealth struct {
	ErrorType    string `json:"error_type,omitempty"`
	ErrorMessage string `json:"error_message,omitempty"`
}

NetworkHealth is the object that contains all the error message when attaching a network to workspace

type NetworkVPCEndpoints

type NetworkVPCEndpoints struct {
	RestAPI           []string `json:"rest_api" tf:"slice_set"`
	DataplaneRelayAPI []string `json:"dataplane_relay" tf:"slice_set"`
}

NetworkVPCEndpoints is the object that contains VPC endpoints of a network

type NetworksAPI

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

NetworksAPI exposes the mws networks API

func NewNetworksAPI

func NewNetworksAPI(ctx context.Context, m any) NetworksAPI

NewNetworksAPI creates MWSNetworksAPI instance from provider meta

func (NetworksAPI) Create

func (a NetworksAPI) Create(network *Network) error

Create creates a set of MWS Networks for the BYOVPC

func (NetworksAPI) Delete

func (a NetworksAPI) Delete(mwsAcctID, networksID string) error

Delete deletes the network object given a network id

func (NetworksAPI) List

func (a NetworksAPI) List(mwsAcctID string) ([]Network, error)

List lists all the available network objects in the mws account

func (NetworksAPI) Read

func (a NetworksAPI) Read(mwsAcctID, networksID string) (Network, error)

Read returns the network object along with metadata and any additional errors when attaching to workspace

type PermissionAssignment added in v1.2.0

type PermissionAssignment struct {
	Permissions []string `json:"permissions"`
	Principal   Principal
}

type PermissionAssignmentAPI added in v1.2.0

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

func NewPermissionAssignmentAPI added in v1.2.0

func NewPermissionAssignmentAPI(ctx context.Context, m any) PermissionAssignmentAPI

func (PermissionAssignmentAPI) CreateOrUpdate added in v1.2.0

func (a PermissionAssignmentAPI) CreateOrUpdate(workspaceId, principalId int64, r Permissions) error

func (PermissionAssignmentAPI) List added in v1.2.0

func (a PermissionAssignmentAPI) List(workspaceId int64) (list PermissionAssignmentList, err error)

func (PermissionAssignmentAPI) Remove added in v1.2.0

func (a PermissionAssignmentAPI) Remove(workspaceId, principalId string) error

type PermissionAssignmentList added in v1.2.0

type PermissionAssignmentList struct {
	PermissionAssignments []PermissionAssignment `json:"permission_assignments"`
}

func (PermissionAssignmentList) ForPrincipal added in v1.2.0

func (l PermissionAssignmentList) ForPrincipal(principalId int64) (res Permissions, err error)

type Permissions added in v1.2.0

type Permissions struct {
	Permissions []string `json:"permissions"`
}

type Principal added in v1.2.0

type Principal struct {
	DisplayName          string `json:"display_name"`
	PrincipalID          int64  `json:"principal_id"`
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	UserName             string `json:"user_name,omitempty"`
	GroupName            string `json:"group_name,omitempty"`
}

type PrivateAccessSettings

type PrivateAccessSettings struct {
	AccountID             string   `json:"account_id,omitempty"`
	PasID                 string   `json:"private_access_settings_id,omitempty" tf:"computed"`
	PasName               string   `json:"private_access_settings_name"`
	Region                string   `json:"region"`
	Status                string   `json:"status,omitempty" tf:"computed"`
	PublicAccessEnabled   bool     `json:"public_access_enabled,omitempty"`
	PrivateAccessLevel    string   `json:"private_access_level,omitempty" tf:"default:ACCOUNT"`
	AllowedVpcEndpointIDS []string `json:"allowed_vpc_endpoint_ids,omitempty"`
}

PrivateAccessSettings (PAS) is the object that contains all the information for creating an PrivateAccessSettings (PAS)

type PrivateAccessSettingsAPI

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

PrivateAccessSettingsAPI exposes the PAS API

func NewPrivateAccessSettingsAPI

func NewPrivateAccessSettingsAPI(ctx context.Context, m any) PrivateAccessSettingsAPI

NewPrivateAccessSettingsAPI creates VPCEndpointAPI instance from provider meta

func (PrivateAccessSettingsAPI) Create

Create creates the PAS ceation process

func (PrivateAccessSettingsAPI) Delete

func (a PrivateAccessSettingsAPI) Delete(mwsAcctID, pasID string) error

Delete deletes the PAS object given a pas id

func (PrivateAccessSettingsAPI) List

List lists all the available PAS objects in the mws account

func (PrivateAccessSettingsAPI) Read

func (a PrivateAccessSettingsAPI) Read(mwsAcctID, pasID string) (PrivateAccessSettings, error)

Read returns the PAS object along with metadata and any additional errors

func (PrivateAccessSettingsAPI) Update

type RootBucketInfo

type RootBucketInfo struct {
	BucketName string `json:"bucket_name,omitempty"`
}

RootBucketInfo points to a bucket name

type StorageConfiguration

type StorageConfiguration struct {
	StorageConfigurationID   string          `json:"storage_configuration_id,omitempty"`
	StorageConfigurationName string          `json:"storage_configuration_name,omitempty"`
	RootBucketInfo           *RootBucketInfo `json:"root_bucket_info,omitempty"`
	AccountID                string          `json:"account_id,omitempty"`
	CreationTime             int64           `json:"creation_time,omitempty"`
}

StorageConfiguration is the object that contains all the information for the root storage bucket

type StorageConfigurationsAPI

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

StorageConfigurationsAPI exposes the mws storageConfiguration API

func NewStorageConfigurationsAPI

func NewStorageConfigurationsAPI(ctx context.Context, m any) StorageConfigurationsAPI

NewStorageConfigurationsAPI creates MWSStorageConfigurationsAPI instance from provider meta

func (StorageConfigurationsAPI) Create

func (a StorageConfigurationsAPI) Create(mwsAcctID, storageConfigurationName string, bucketName string) (StorageConfiguration, error)

Create creates a configuration for the root s3 bucket

func (StorageConfigurationsAPI) Delete

func (a StorageConfigurationsAPI) Delete(mwsAcctID, storageConfigurationID string) error

Delete deletes the configuration for the root s3 bucket

func (StorageConfigurationsAPI) List

List lists all the storage configurations for the root s3 buckets in the account ID provided to the client config

func (StorageConfigurationsAPI) Read

func (a StorageConfigurationsAPI) Read(mwsAcctID, storageConfigurationID string) (StorageConfiguration, error)

Read returns the configuration for the root s3 bucket and metadata for the storage configuration

type StsRole

type StsRole struct {
	RoleArn    string `json:"role_arn,omitempty"`
	ExternalID string `json:"external_id,omitempty"`
}

StsRole is the object that contains cross account role arn and external app id

type Token

type Token struct {
	LifetimeSeconds int32  `json:"lifetime_seconds,omitempty" tf:"default:2592000"`
	Comment         string `json:"comment,omitempty" tf:"default:Terraform PAT"`
	TokenID         string `json:"token_id,omitempty" tf:"computed"`
	TokenValue      string `json:"token_value,omitempty" tf:"computed,sensitive"`
}

type VPCEndpoint

type VPCEndpoint struct {
	VPCEndpointID           string `json:"vpc_endpoint_id,omitempty" tf:"computed"`
	AwsVPCEndpointID        string `json:"aws_vpc_endpoint_id"`
	AccountID               string `json:"account_id,omitempty"`
	VPCEndpointName         string `json:"vpc_endpoint_name"`
	AwsVPCEndpointServiceID string `json:"aws_endpoint_service_id,omitempty" tf:"computed"`
	AWSAccountID            string `json:"aws_account_id,omitempty" tf:"computed"`
	UseCase                 string `json:"use_case,omitempty" tf:"computed"`
	Region                  string `json:"region"`
	State                   string `json:"state,omitempty" tf:"computed"`
}

VPCEndpoint is the object that contains all the information for registering an VPC endpoint

type VPCEndpointAPI

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

VPCEndpointAPI exposes the mws VPC endpoint API

func NewVPCEndpointAPI

func NewVPCEndpointAPI(ctx context.Context, m any) VPCEndpointAPI

NewVPCEndpointAPI creates VPCEndpointAPI instance from provider meta

func (VPCEndpointAPI) Create

func (a VPCEndpointAPI) Create(vpcEndpoint *VPCEndpoint) error

Create creates the VPC endpoint registeration process

func (VPCEndpointAPI) Delete

func (a VPCEndpointAPI) Delete(mwsAcctID, vpcEndpointID string) error

Delete deletes the VPCEndpoint object given a VPCEndpoint id

func (VPCEndpointAPI) List

func (a VPCEndpointAPI) List(mwsAcctID string) ([]VPCEndpoint, error)

List lists all the available network objects in the mws account

func (VPCEndpointAPI) Read

func (a VPCEndpointAPI) Read(mwsAcctID, vpcEndpointID string) (ve VPCEndpoint, err error)

Read returns the VPCEndpoint object along with metadata and any additional errors when attaching to workspace

type Workspace

type Workspace struct {
	AccountID                           string                `json:"account_id"`
	WorkspaceName                       string                `json:"workspace_name"`
	DeploymentName                      string                `json:"deployment_name,omitempty"`
	AwsRegion                           string                `json:"aws_region,omitempty"`               // required for AWS, not allowed for GCP
	CredentialsID                       string                `json:"credentials_id,omitempty"`           // required for AWS, not allowed for GCP
	CustomerManagedKeyID                string                `json:"customer_managed_key_id,omitempty"`  // just for compatibility, will be removed
	StorageConfigurationID              string                `json:"storage_configuration_id,omitempty"` // required for AWS, not allowed for GCP
	ManagedServicesCustomerManagedKeyID string                `json:"managed_services_customer_managed_key_id,omitempty"`
	StorageCustomerManagedKeyID         string                `json:"storage_customer_managed_key_id,omitempty"`
	PricingTier                         string                `json:"pricing_tier,omitempty" tf:"computed"`
	PrivateAccessSettingsID             string                `json:"private_access_settings_id,omitempty"`
	NetworkID                           string                `json:"network_id,omitempty"`
	IsNoPublicIPEnabled                 bool                  `json:"is_no_public_ip_enabled" tf:"optional,default:true"`
	WorkspaceID                         int64                 `json:"workspace_id,omitempty" tf:"computed"`
	WorkspaceURL                        string                `json:"workspace_url,omitempty" tf:"computed"`
	WorkspaceStatus                     string                `json:"workspace_status,omitempty" tf:"computed"`
	WorkspaceStatusMessage              string                `json:"workspace_status_message,omitempty" tf:"computed"`
	CreationTime                        int64                 `json:"creation_time,omitempty" tf:"computed"`
	ExternalCustomerInfo                *externalCustomerInfo `json:"external_customer_info,omitempty"`
	CloudResourceBucket                 *CloudResourceBucket  `json:"cloud_resource_bucket,omitempty"`
	Network                             *GCPNetwork           `json:"network,omitempty"`
	Cloud                               string                `json:"cloud,omitempty" tf:"computed"`
	Location                            string                `json:"location,omitempty"`
}

Workspace is the object that contains all the information for deploying a workspace

func (*Workspace) MarshalJSON

func (w *Workspace) MarshalJSON() ([]byte, error)

MarshalJSON is required to overcome the limitations of `omitempty` usage with reflect_resource.go for workspace creation in Accounts API for AWS and GCP. It exits early on AWS and picks only the relevant fields for GCP.

type WorkspaceToken

type WorkspaceToken struct {
	WorkspaceURL string `json:"workspace_url,omitempty"`
	Token        *Token `json:"token,omitempty"`
}

ephemeral entity to use with StructToData()

type WorkspacesAPI

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

WorkspacesAPI exposes the mws workspaces API

func NewWorkspacesAPI

func NewWorkspacesAPI(ctx context.Context, m any) WorkspacesAPI

NewWorkspacesAPI creates MWSWorkspacesAPI instance from provider meta

func (WorkspacesAPI) Create

func (a WorkspacesAPI) Create(ws *Workspace, timeout time.Duration) error

Create deploys the workspace and waits till it's properly running. In case of error, it removes the failed deployment and returns the message

func (WorkspacesAPI) Delete

func (a WorkspacesAPI) Delete(mwsAcctID, workspaceID string) error

Delete will delete the configuration for the workspace given a workspace id and wait till it's properly removed

func (WorkspacesAPI) List

func (a WorkspacesAPI) List(mwsAcctID string) ([]Workspace, error)

List will list all workspaces in a given mws account

func (WorkspacesAPI) Read

func (a WorkspacesAPI) Read(mwsAcctID, workspaceID string) (Workspace, error)

Read will return the mws workspace metadata and status of the workspace deployment

func (WorkspacesAPI) UpdateRunning

func (a WorkspacesAPI) UpdateRunning(ws Workspace, timeout time.Duration) error

UpdateRunning will update running workspace with couple of possible fields

func (WorkspacesAPI) WaitForRunning

func (a WorkspacesAPI) WaitForRunning(ws Workspace, timeout time.Duration) error

WaitForRunning will wait until workspace is running, otherwise will try to explain why it failed

Jump to

Keyboard shortcuts

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