|
| 1 | +package model |
| 2 | + |
| 3 | +// StsRole is the object that contains cross account role arn and external app id |
| 4 | +type StsRole struct { |
| 5 | + RoleArn string `json:"role_arn,omitempty"` |
| 6 | + ExternalID string `json:"external_id,omitempty"` |
| 7 | +} |
| 8 | + |
| 9 | +// AwsCredentials is the object that points to the cross account role |
| 10 | +type AwsCredentials struct { |
| 11 | + StsRole *StsRole `json:"sts_role,omitempty"` |
| 12 | +} |
| 13 | + |
| 14 | +// MWSCredentials is the object that contains all the information for the credentials to create a workspace |
| 15 | +type MWSCredentials struct { |
| 16 | + CredentialsID string `json:"credentials_id,omitempty"` |
| 17 | + CredentialsName string `json:"credentials_name,omitempty"` |
| 18 | + AwsCredentials *AwsCredentials `json:"aws_credentials,omitempty"` |
| 19 | + AccountID string `json:"account_id,omitempty"` |
| 20 | + CreationTime int64 `json:"creation_time,omitempty"` |
| 21 | +} |
| 22 | + |
| 23 | +// RootBucketInfo points to a bucket name |
| 24 | +type RootBucketInfo struct { |
| 25 | + BucketName string `json:"bucket_name,omitempty"` |
| 26 | +} |
| 27 | + |
| 28 | +// MWSStorageConfigurations is the object that contains all the information for the root storage bucket |
| 29 | +type MWSStorageConfigurations struct { |
| 30 | + StorageConfigurationID string `json:"storage_configuration_id,omitempty"` |
| 31 | + StorageConfigurationName string `json:"storage_configuration_name,omitempty"` |
| 32 | + RootBucketInfo *RootBucketInfo `json:"root_bucket_info,omitempty"` |
| 33 | + AccountID string `json:"account_id,omitempty"` |
| 34 | + CreationTime int64 `json:"creation_time,omitempty"` |
| 35 | +} |
| 36 | + |
| 37 | +// NetworkHealth is the object that contains all the error message when attaching a network to workspace |
| 38 | +type NetworkHealth struct { |
| 39 | + ErrorType string `json:"error_type,omitempty"` |
| 40 | + ErrorMessage string `json:"error_message,omitempty"` |
| 41 | +} |
| 42 | + |
| 43 | +// MWSNetwork is the object that contains all the information for BYOVPC |
| 44 | +type MWSNetwork struct { |
| 45 | + NetworkID string `json:"network_id,omitempty"` |
| 46 | + NetworkName string `json:"network_name,omitempty"` |
| 47 | + VPCID string `json:"vpc_id,omitempty"` |
| 48 | + SubnetIds []string `json:"subnet_ids,omitempty"` |
| 49 | + SecurityGroupIds []string `json:"security_group_ids,omitempty"` |
| 50 | + VPCStatus string `json:"vpc_status,omitempty"` |
| 51 | + ErrorMessages []NetworkHealth `json:"error_messages,omitempty"` |
| 52 | + WorkspaceID int64 `json:"workspace_id,omitempty"` |
| 53 | + AccountID string `json:"account_id,omitempty"` |
| 54 | + CreationTime int64 `json:"creation_time,omitempty"` |
| 55 | +} |
| 56 | + |
| 57 | +// AwsKeyInfo has information about the KMS key for BYOK |
| 58 | +type AwsKeyInfo struct { |
| 59 | + KeyArn string `json:"key_arn,omitempty"` |
| 60 | + KeyAlias string `json:"key_alias,omitempty"` |
| 61 | + KeyRegion string `json:"key_region,omitempty"` |
| 62 | +} |
| 63 | + |
| 64 | +// MWSCustomerManagedKey contains key information and metadata for BYOK for E2 |
| 65 | +type MWSCustomerManagedKey struct { |
| 66 | + CustomerManagedKeyID string `json:"customer_managed_key_id,omitempty"` |
| 67 | + AwsKeyInfo *AwsKeyInfo `json:"aws_key_info,omitempty"` |
| 68 | + AccountID string `json:"account_id,omitempty"` |
| 69 | + CreationTime int64 `json:"creation_time,omitempty"` |
| 70 | +} |
| 71 | + |
| 72 | +// List of workspace statuses for provisioning the workspace |
| 73 | +const ( |
| 74 | + WorkspaceStatusNotProvisioned = "NOT_PROVISIONED" |
| 75 | + WorkspaceStatusProvisioning = "PROVISIONING" |
| 76 | + WorkspaceStatusRunning = "RUNNING" |
| 77 | + WorkspaceStatusFailed = "FAILED" |
| 78 | + WorkspaceStatusCanceled = "CANCELLED" |
| 79 | +) |
| 80 | + |
| 81 | +// WorkspaceStatusesNonRunnable is a list of statuses in which the workspace is not runnable |
| 82 | +var WorkspaceStatusesNonRunnable = []string{WorkspaceStatusCanceled, WorkspaceStatusFailed} |
| 83 | + |
| 84 | +// ContainsWorkspaceState given a list of workspaceStates and the search state |
| 85 | +// it will return true if it found the search state |
| 86 | +func ContainsWorkspaceState(workspaceStates []string, searchState string) bool { |
| 87 | + for _, state := range workspaceStates { |
| 88 | + if state == searchState { |
| 89 | + return true |
| 90 | + } |
| 91 | + } |
| 92 | + return false |
| 93 | +} |
| 94 | + |
| 95 | +// MWSWorkspace is the object that contains all the information for deploying a E2 workspace |
| 96 | +type MWSWorkspace struct { |
| 97 | + WorkspaceID int64 `json:"workspace_id,omitempty"` |
| 98 | + WorkspaceName string `json:"workspace_name,omitempty"` |
| 99 | + DeploymentName string `json:"deployment_name,omitempty"` |
| 100 | + AwsRegion string `json:"aws_region,omitempty"` |
| 101 | + CredentialsID string `json:"credentials_id,omitempty"` |
| 102 | + StorageConfigurationID string `json:"storage_configuration_id,omitempty"` |
| 103 | + NetworkID string `json:"network_id,omitempty"` |
| 104 | + CustomerManagedKeyID string `json:"customer_managed_key_id,omitempty"` |
| 105 | + IsNoPublicIpEnabled bool `json:"is_no_public_ip_enabled,omitempty"` |
| 106 | + AccountID string `json:"account_id,omitempty"` |
| 107 | + WorkspaceStatus string `json:"workspace_status,omitempty"` |
| 108 | + WorkspaceStatusMessage string `json:"workspace_status_message,omitempty"` |
| 109 | + CreationTime int64 `json:"creation_time,omitempty"` |
| 110 | +} |
0 commit comments