1// +build go1.7
2
3package sql
4
5// Copyright (c) Microsoft Corporation. All rights reserved.
6// Licensed under the MIT License. See License.txt in the project root for license information.
7
8import (
9	"encoding/xml"
10)
11
12// DatabaseServerCreateParams represents the set of possible parameters
13// when issuing a database server creation request to Azure.
14//
15// https://msdn.microsoft.com/en-us/library/azure/dn505699.aspx
16type DatabaseServerCreateParams struct {
17	XMLName                    xml.Name `xml:"http://schemas.microsoft.com/sqlazure/2010/12/ Server"`
18	AdministratorLogin         string
19	AdministratorLoginPassword string
20	Location                   string
21	Version                    string
22}
23
24// DatabaseServerCreateResponse represents the response following the creation of
25// a database server on Azure.
26type DatabaseServerCreateResponse struct {
27	ServerName string
28}
29
30const (
31	DatabaseServerVersion11 = "2.0"
32	DatabaseServerVersion12 = "12.0"
33)
34
35// DatabaseServer represents the set of data received from
36// a database server list operation.
37//
38// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx
39type DatabaseServer struct {
40	Name                     string
41	AdministratorLogin       string
42	Location                 string
43	FullyQualifiedDomainName string
44	Version                  string
45	State                    string
46}
47
48type ListServersResponse struct {
49	DatabaseServers []DatabaseServer `xml:"Server"`
50}
51
52// FirewallRuleCreateParams represents the set of possible
53// parameters when creating a firewall rule on an Azure database server.
54//
55// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx
56type FirewallRuleCreateParams struct {
57	XMLName        xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"`
58	Name           string
59	StartIPAddress string
60	EndIPAddress   string
61}
62
63// FirewallRuleResponse represents the set of data received from
64// an Azure database server firewall rule get response.
65//
66// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx
67type FirewallRuleResponse struct {
68	Name           string
69	StartIPAddress string
70	EndIPAddress   string
71}
72
73type ListFirewallRulesResponse struct {
74	FirewallRules []FirewallRuleResponse `xml:"ServiceResource"`
75}
76
77// FirewallRuleUpdateParams represents the set of possible
78// parameters when issuing an update of a database server firewall rule.
79//
80// https://msdn.microsoft.com/en-us/library/azure/dn505707.aspx
81type FirewallRuleUpdateParams struct {
82	XMLName        xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"`
83	Name           string
84	StartIPAddress string
85	EndIPAddress   string
86}
87
88// DatabaseCreateParams represents the set of possible parameters when issuing
89// a database creation to Azure, and reading a list response from Azure.
90//
91// https://msdn.microsoft.com/en-us/library/azure/dn505701.aspx
92type DatabaseCreateParams struct {
93	XMLName            xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"`
94	Name               string
95	Edition            string `xml:",omitempty"`
96	CollationName      string `xml:",omitempty"`
97	MaxSizeBytes       int64  `xml:",omitempty"`
98	ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"`
99}
100
101// ServiceResource represents the set of parameters obtained from a database
102// get or list call.
103//
104// https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx
105type ServiceResource struct {
106	Name               string
107	State              string
108	SelfLink           string
109	Edition            string
110	CollationName      string
111	MaxSizeBytes       int64
112	ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"`
113}
114
115type ListDatabasesResponse struct {
116	ServiceResources []ServiceResource `xml:"ServiceResource"`
117}
118
119// ServiceResourceUpdateParams represents the set of parameters available
120// for a database service update operation.
121//
122// https://msdn.microsoft.com/en-us/library/azure/dn505718.aspx
123type ServiceResourceUpdateParams struct {
124	XMLName            xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"`
125	Name               string
126	Edition            string `xml:",omitempty"`
127	MaxSizeBytes       int64  `xml:",omitempty"`
128	ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"`
129}
130