/
shared_types.go
163 lines (108 loc) · 6.47 KB
/
shared_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package v1alpha1
import (
"errors"
)
type AmiSpec struct {
Ami string
InstanceType string
}
// Custom errors
// ErrAwsAccountLimitExceeded indicates the orgnization account limit has been reached.
var ErrAwsAccountLimitExceeded = errors.New("AccountLimitExceeded")
// ErrAccountWatcherNoTotal indicates the TotalAccountWatcher has not run successfully yet.
var ErrAccountWatcherNoTotal = errors.New("AccountWatcherHasNoTotal")
// ErrAwsInternalFailure indicates that there was an internal failure on the aws api
var ErrAwsInternalFailure = errors.New("InternalFailure")
// ErrAwsFailedCreateAccount indicates that an account creation failed
var ErrAwsFailedCreateAccount = errors.New("FailedCreateAccount")
// ErrAwsConcurrentModification indicates that a resource is currently being modified and the request should be retried
var ErrAwsConcurrentModification = errors.New("ConcurrentModificationOfOU")
// ErrAwsTooManyRequests indicates that to many requests were sent in a short period
var ErrAwsTooManyRequests = errors.New("TooManyRequestsException")
// ErrAwsCaseCreationLimitExceeded indicates that the support case limit for the account has been reached
var ErrAwsCaseCreationLimitExceeded = errors.New("SupportCaseLimitExceeded")
// ErrAwsFailedCreateSupportCase indicates that a support case creation failed
var ErrAwsFailedCreateSupportCase = errors.New("FailedCreateSupportCase")
// ErrAwsSupportCaseIDNotFound indicates that the support case ID was not found
var ErrAwsSupportCaseIDNotFound = errors.New("SupportCaseIdNotfound")
// ErrAwsFailedDescribeSupportCase indicates that the support case describe failed
var ErrAwsFailedDescribeSupportCase = errors.New("FailedDescribeSupportCase")
// ErrFederationTokenOutputNil indicates that getting a federation token from AWS failed
var ErrFederationTokenOutputNil = errors.New("FederationTokenOutputNil")
// ErrCreateEC2Instance indicates that the CreateEC2Instance function timed out
var ErrCreateEC2Instance = errors.New("EC2CreationTimeout")
// ErrFailedAWSTypecast indicates that there was a failure while typecasting to aws error
var ErrFailedAWSTypecast = errors.New("FailedToTypecastAWSError")
// ErrMissingDefaultConfigMap indicates that the expected default confimap was not found
var ErrMissingDefaultConfigMap = errors.New("MissingDefaultConfigMap")
// ErrInvalidConfigMap indicates that the ConfigMap has invalid fields
var ErrInvalidConfigMap = errors.New("ConfigMapInvalid")
// ErrNonexistentOU indicates that an OU does not exist
var ErrNonexistentOU = errors.New("OUWithNameNotFound")
// ErrAccAlreadyInOU indicates that an account is already in an OU
var ErrAccAlreadyInOU = errors.New("ErrAccAlreadyInOU")
// ErrAccMoveRaceCondition indicates a race condition while moving the account
var ErrAccMoveRaceCondition = errors.New("ErrAccMoveRaceCondition")
// ErrChildNotFound indicates that a child was not found inside an OU
var ErrChildNotFound = errors.New("ChildNotFoundInOU")
// ErrUnexpectedValue indicates that a given variable has an unespected nil value
var ErrUnexpectedValue = errors.New("UnexpectedValue")
// ErrInvalidToken indiacates an invalid token
var ErrInvalidToken = errors.New("InvalidClientTokenId")
// ErrAccessDenied indicates an AWS error from an API call
var ErrAccessDenied = errors.New("AuthorizationError")
// ErrFailedToCreateVpc indicates that there was a failure while trying to create a VPC
var ErrFailedToCreateVpc = errors.New("FailedToCreateVpc")
// ErrFailedToDeleteVpc indicates that there was a failure while trying to delete a VPC
var ErrFailedToDeleteVpc = errors.New("FailedToDeleteVpc")
// ErrFailedToCreateSubnet indicates that there was a failure while trying to create subnet
var ErrFailedToCreateSubnet = errors.New("FailedToCreateSubnet")
// ErrFailedToDeleteSubnet indicates that there was a failure while trying to delete subnet
var ErrFailedToDeleteSubnet = errors.New("FailedToDeleteSubnet")
// Shared variables
// UIDLabel is the string for the uid label on AWS Federated Account Access CRs
var UIDLabel = "uid"
var FederatedRoleNameLabel = "awsFederatedRoleName"
var LastRoleUpdateAnnotation = "lastRoleUpdate"
// AccountIDLabel is the string for the AWS Account ID label on AWS Federated Account Access CRs
var AccountIDLabel = "awsAccountID"
// ClusterAccountNameTagKey is the AWS key name for cluster account name
var ClusterAccountNameTagKey = "clusterAccountName"
// ClusterNamespaceTagKey is the AWS key name for cluster namespace
var ClusterNamespaceTagKey = "clusterNamespace"
// ClusterClaimLinkTagKey is the AWS key name for cluster claim
var ClusterClaimLinkTagKey = "clusterClaimLink"
// ClusterClaimLinkNamespaceTagKey is the AWS key name for cluster claim namespace
var ClusterClaimLinkNamespaceTagKey = "clusterClaimLinkNamespace"
// Used to name the EC2 instance we spin up when initializing an AWS region
var EC2InstanceNameTagKey = "Name"
var EC2InstanceNameTagValue = "red-hat-region-init"
// IAMUserIDLabel label key for IAM user suffix
var IAMUserIDLabel = "iamUserId"
// EmailID is the ID used for prefixing Account CR names
var EmailID = "osd-creds-mgmt"
// InstanceResourceType is the resource type used when building Instance tags
var InstanceResourceType = "instance"
// VolumeResourceType is the resource type used when building Volume tags
var VolumeResourceType = "volume"
// VpcResourceType is the resource type used when building Vpc tags
var VpcResourceType = "vpc"
// SubnetResourceType is the resource type used when building Subnet tags
var SubnetResourceType = "subnet"
// DefaultConfigMap holds the expected name for the operator's ConfigMap
var DefaultConfigMap = "aws-account-operator-configmap"
// DefaultConfigMapAccountLimit holds the fallback limit of aws-accounts
var DefaultConfigMapAccountLimit = 100
// AwsUSEastOneRegion holds the key for the aws east one region
var AwsUSEastOneRegion = "us-east-1"
// AwsUSGovEastOneRegion holds the key for the aws us gov east one region
var AwsUSGovEastOneRegion = "us-gov-east-1"
// ManagedTagsConfigMapKey defines the default key for the configmap to add the defined tags to AWS resources
var ManagedTagsConfigMapKey = "aws-managed-tags"
// ManagedOpenShift-Support role used to access non-STS clusters.
var ManagedOpenShiftSupportRole = "ManagedOpenShift-Support"
var ManagedOpenShiftSupportRoleARN = "arn:aws:iam::%s:role/ManagedOpenShift-Support-%s"
// fedramp arn
var FedrampManagedOpenShiftSupportRoleARN = "arn:aws-us-gov:iam::%s:role/ManagedOpenShift-Support-%s"
var CCSAccessARN = "CCS-Access-Arn"
var SupportJumpRole = "support-jump-role"