-
Notifications
You must be signed in to change notification settings - Fork 187
/
storageaccount_types.go
151 lines (120 loc) · 5.88 KB
/
storageaccount_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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// StorageAccountSpec defines the desired state of Storage
type StorageAccountSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// +kubebuilder:validation:MinLength=0
Location string `json:"location,omitempty"`
// +kubebuilder:validation:Pattern=^[-\w\._\(\)]+$
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Required
ResourceGroup string `json:"resourceGroup"`
Sku StorageAccountSku `json:"sku,omitempty"`
Kind StorageAccountKind `json:"kind,omitempty"`
AccessTier StorageAccountAccessTier `json:"accessTier,omitempty"`
EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"`
DataLakeEnabled *bool `json:"dataLakeEnabled,omitempty"`
NetworkRule *StorageNetworkRuleSet `json:"networkRule,omitempty"`
}
// StorageAccountSku the SKU of the storage account.
type StorageAccountSku struct {
// Name - The SKU name. Required for account creation; optional for update.
// Possible values include: 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS', 'Standard_GZRS', 'Standard_RAGZRS'.
// For the full list of allowed options, see: https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts/create#skuname
Name StorageAccountSkuName `json:"name,omitempty"`
}
// StorageAccountSkuName enumerates the values for sku name.
// Only one of the following sku names may be specified.
// If none of the following sku names is specified, the default one
// is StorageV2.
// +kubebuilder:validation:Enum=Premium_LRS;Premium_ZRS;Standard_GRS;Standard_GZRS;Standard_LRS;Standard_RAGRS;Standard_RAGZRS;Standard_ZRS
type StorageAccountSkuName string
// StorageAccountKind enumerates the values for kind.
// Only one of the following kinds may be specified.
// If none of the following kinds is specified, the default one
// is StorageV2.
// +kubebuilder:validation:Enum=BlobStorage;BlockBlobStorage;FileStorage;Storage;StorageV2
type StorageAccountKind string
// StorageAccountAccessTier enumerates the values for access tier.
// Only one of the following access tiers may be specified.
// If none of the following access tiers is specified, the default one
// is Hot.
// +kubebuilder:validation:Enum=Cool;Hot
type StorageAccountAccessTier string
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// StorageAccount is the Schema for the storages API
// +kubebuilder:resource:shortName=sacct
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
type StorageAccount struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec StorageAccountSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Output StorageAccountOutput `json:"output,omitempty"`
AdditionalResources StorageAccountAdditionalResources `json:"additionalResources,omitempty"`
}
// StorageAccountOutput is the object that contains the output from creating a Storage Account object
type StorageAccountOutput struct {
StorageAccountName string `json:"storageAccountName,omitempty"`
Key1 string `json:"key1,omitempty"`
Key2 string `json:"key2,omitempty"`
ConnectionString1 string `json:"connectionString1,omitempty"`
ConnectionString2 string `json:"connectionString2,omitempty"`
}
// StorageAccountAdditionalResources holds the additional resources
type StorageAccountAdditionalResources struct {
Secrets []string `json:"secrets,omitempty"`
}
// +kubebuilder:object:root=true
// StorageAccountList contains a list of Storage
type StorageAccountList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []StorageAccount `json:"items"`
}
type Bypass string
type StorageNetworkRuleSet struct {
// Bypass - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices.
//Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics.
//Possible values include: 'None', 'Logging', 'Metrics', 'AzureServices'
Bypass Bypass `json:"bypass,omitempty"`
// VirtualNetworkRules - Sets the virtual network rules
VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"`
// IPRules - Sets the IP ACL rules
IPRules *[]IPRule `json:"ipRules,omitempty"`
// DefaultAction - Specifies the default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny'
DefaultAction string `json:"defaultAction,omitempty"`
}
const (
// AzureServices ...
AzureServices Bypass = "AzureServices"
// Logging ...
Logging Bypass = "Logging"
// Metrics ...
Metrics Bypass = "Metrics"
// None ...
None Bypass = "None"
)
type VirtualNetworkRule struct {
// SubnetId - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}.
SubnetId *string `json:"subnetId,omitempty"`
}
type IPRule struct {
// IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed.
IPAddressOrRange *string `json:"ipAddressOrRange,omitempty"`
}
func init() {
SchemeBuilder.Register(&StorageAccount{}, &StorageAccountList{})
}
func (storageAccount *StorageAccount) IsSubmitted() bool {
return storageAccount.Status.Provisioning || storageAccount.Status.Provisioned
}