-
Notifications
You must be signed in to change notification settings - Fork 187
/
azuresqldatabase_types.go
95 lines (82 loc) · 2.88 KB
/
azuresqldatabase_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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package v1alpha1
import (
helpers "github.com/Azure/azure-service-operator/pkg/helpers"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// AzureSqlDatabaseSpec defines the desired state of AzureSqlDatabase
type AzureSqlDatabaseSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Location string `json:"location"`
// +kubebuilder:validation:Pattern=^[-\w\._\(\)]+$
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Required
ResourceGroup string `json:"resourcegroup"`
Server string `json:"server"`
Edition DBEdition `json:"edition"`
// optional
DbName string `json:"dbName,omitempty"`
}
// AzureSqlDatabase is the Schema for the azuresqldatabases API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=asqldb
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
type AzureSqlDatabase struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AzureSqlDatabaseSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// AzureSqlDatabaseList contains a list of AzureSqlDatabase
type AzureSqlDatabaseList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AzureSqlDatabase `json:"items"`
}
// DBEdition - wraps: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql#DatabaseEdition
type DBEdition byte
const (
// Basic ...
SQLEditionBasic DBEdition = 0
// Business ...
SQLEditionBusiness DBEdition = 1
// BusinessCritical ...
SQLEditionBusinessCritical DBEdition = 2
// DataWarehouse ...
SQLEditionDataWarehouse DBEdition = 3
// Free ...
SQLEditionFree DBEdition = 4
// GeneralPurpose ...
SQLEditionGeneralPurpose DBEdition = 5
// Hyperscale ...
SQLEditionHyperscale DBEdition = 6
// Premium ...
SQLEditionPremium DBEdition = 7
// PremiumRS ...
SQLEditionPremiumRS DBEdition = 8
// Standard ...
SQLEditionStandard DBEdition = 9
// Stretch ...
SQLEditionStretch DBEdition = 10
// System ...
SQLEditionSystem DBEdition = 11
// System2 ...
SQLEditionSystem2 DBEdition = 12
// Web ...
SQLEditionWeb DBEdition = 13
)
func init() {
SchemeBuilder.Register(&AzureSqlDatabase{}, &AzureSqlDatabaseList{})
}
func (s *AzureSqlDatabase) IsSubmitted() bool {
return s.Status.Provisioned
}
func (s *AzureSqlDatabase) HasFinalizer(finalizerName string) bool {
return helpers.ContainsString(s.ObjectMeta.Finalizers, finalizerName)
}