generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 15
/
gcpConstants.go
112 lines (86 loc) · 3.03 KB
/
gcpConstants.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
package client
import (
"fmt"
"regexp"
"time"
"github.com/kyma-project/cloud-manager/components/kcp/api/cloud-control/v1beta1"
)
const vPCPathPattern = "projects/%s/global/networks/%s"
const ServiceNetworkingServicePath = "services/servicenetworking.googleapis.com"
const ServiceNetworkingServiceConnectionName = "services/servicenetworking.googleapis.com/connections/servicenetworking-googleapis-com"
const networkFilter = "network=\"https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s\""
const PsaPeeringName = "servicenetworking-googleapis-com"
const filestoreInstancePattern = "projects/%s/locations/%s/instances/%s"
const filestoreParentPattern = "projects/%s/locations/%s"
const GcpRetryWaitTime = time.Second * 3
const GcpOperationWaitTime = time.Second * 5
var FilestoreInstanceRegEx *regexp.Regexp = regexp.MustCompile(`^projects\/([^/]+)\/locations\/([^/]+)\/instances\/([^/]+)$`)
func GetVPCPath(projectId, vpcId string) string {
return fmt.Sprintf(vPCPathPattern, projectId, vpcId)
}
func GetNetworkFilter(projectId, vpcId string) string {
return fmt.Sprintf(networkFilter, projectId, vpcId)
}
func GetFilestoreInstancePath(projectId, location, instanceId string) string {
return fmt.Sprintf(filestoreInstancePattern, projectId, location, instanceId)
}
func GetFilestoreParentPath(projectId, location string) string {
return fmt.Sprintf(filestoreParentPattern, projectId, location)
}
type networkTier string
const (
NetworkTierPremium networkTier = "PREMIUM"
NetworkTierStandard networkTier = "STANDARD"
)
type ipVersion string
const (
IpVersionIpV4 ipVersion = "IPV4"
IpVersionIpV6 ipVersion = "IPV6"
)
type addressType string
const (
AddressTypeExternal addressType = "EXTERNAL"
AddressTypeInternal addressType = "INTERNAL"
)
type ipRangePurpose string
const (
IpRangePurposeVPCPeering ipRangePurpose = "VPC_PEERING"
IpRangePurposePrivateServiceConnect ipRangePurpose = "PRIVATE_SERVICE_CONNECT"
)
type ipv6EndpointType string
const (
Ipv6EndpointTypeVm ipv6EndpointType = "VM"
Ipv6EndpointTypeNetlb ipv6EndpointType = "NETLB"
)
const (
//Common States
Deleted v1beta1.StatusState = "Deleted"
//IPRange States
SyncAddress v1beta1.StatusState = "SyncAddress"
SyncPsaConnection v1beta1.StatusState = "SyncPSAConnection"
DeletePsaConnection v1beta1.StatusState = "DeletePSAConnection"
DeleteAddress v1beta1.StatusState = "DeleteAddress"
//Filestore States
SyncFilestore v1beta1.StatusState = "SyncFilestore"
DeleteFilestore v1beta1.StatusState = "DeleteFilestore"
)
type FilestoreState string
const (
CREATING FilestoreState = "CREATING"
READY FilestoreState = "READY"
REPAIRING FilestoreState = "REPAIRING"
DELETING FilestoreState = "DELETING"
ERROR FilestoreState = "ERROR"
RESTORING FilestoreState = "RESTORING"
SUSPENDED FilestoreState = "SUSPENDED"
SUSPENDING FilestoreState = "SUSPENDING"
RESUMING FilestoreState = "RESUMING"
REVERTING FilestoreState = "REVERTING"
)
type OperationType int
const (
NONE OperationType = iota
ADD
MODIFY
DELETE
)