forked from Azure/azure-sdk-for-go
/
models.go
314 lines (290 loc) · 9.91 KB
/
models.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
package cognitiveservices
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"github.com/Azure/go-autorest/autorest"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/mgmt/2016-02-01-preview/cognitiveservices"
// Account cognitive Services Account is an Azure resource representing the provisioned account, its type,
// location and SKU.
type Account struct {
autorest.Response `json:"-"`
// Etag - Entity Tag
Etag *string `json:"etag,omitempty"`
// ID - The id of the created account
ID *string `json:"id,omitempty"`
// Kind - Type of cognitive service account.
Kind *string `json:"kind,omitempty"`
// Location - The location of the resource
Location *string `json:"location,omitempty"`
// Name - The name of the created account
Name *string `json:"name,omitempty"`
*AccountProperties `json:"properties,omitempty"`
Sku *Sku `json:"sku,omitempty"`
// Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters.
Tags map[string]*string `json:"tags"`
// Type - Resource type
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Account.
func (a Account) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.Etag != nil {
objectMap["etag"] = a.Etag
}
if a.ID != nil {
objectMap["id"] = a.ID
}
if a.Kind != nil {
objectMap["kind"] = a.Kind
}
if a.Location != nil {
objectMap["location"] = a.Location
}
if a.Name != nil {
objectMap["name"] = a.Name
}
if a.AccountProperties != nil {
objectMap["properties"] = a.AccountProperties
}
if a.Sku != nil {
objectMap["sku"] = a.Sku
}
if a.Tags != nil {
objectMap["tags"] = a.Tags
}
if a.Type != nil {
objectMap["type"] = a.Type
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Account struct.
func (a *Account) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "etag":
if v != nil {
var etag string
err = json.Unmarshal(*v, &etag)
if err != nil {
return err
}
a.Etag = &etag
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
a.ID = &ID
}
case "kind":
if v != nil {
var kind string
err = json.Unmarshal(*v, &kind)
if err != nil {
return err
}
a.Kind = &kind
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
a.Location = &location
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
a.Name = &name
}
case "properties":
if v != nil {
var accountProperties AccountProperties
err = json.Unmarshal(*v, &accountProperties)
if err != nil {
return err
}
a.AccountProperties = &accountProperties
}
case "sku":
if v != nil {
var sku Sku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
a.Sku = &sku
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
a.Tags = tags
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
a.Type = &typeVar
}
}
}
return nil
}
// AccountCreateParameters the parameters to provide for the account.
type AccountCreateParameters struct {
Sku *Sku `json:"sku,omitempty"`
// Kind - Required. Indicates the type of cognitive service account. Possible values include: 'Academic', 'BingAutosuggest', 'BingSearch', 'BingSpeech', 'BingSpellCheck', 'ComputerVision', 'ContentModerator', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
Kind Kind `json:"kind,omitempty"`
// Location - Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed.
Location *string `json:"location,omitempty"`
// Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters.
Tags map[string]*string `json:"tags"`
// Properties - Must exist in the request. Must not be null.
Properties interface{} `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountCreateParameters.
func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if acp.Sku != nil {
objectMap["sku"] = acp.Sku
}
if acp.Kind != "" {
objectMap["kind"] = acp.Kind
}
if acp.Location != nil {
objectMap["location"] = acp.Location
}
if acp.Tags != nil {
objectMap["tags"] = acp.Tags
}
if acp.Properties != nil {
objectMap["properties"] = acp.Properties
}
return json.Marshal(objectMap)
}
// AccountEnumerateSkusResult the list of cognitive services accounts operation response.
type AccountEnumerateSkusResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; Gets the list of Cognitive Services accounts and their properties.
Value *[]ResourceAndSku `json:"value,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountEnumerateSkusResult.
func (aesr AccountEnumerateSkusResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// AccountKeys the access keys for the cognitive services account.
type AccountKeys struct {
autorest.Response `json:"-"`
// Key1 - Gets the value of key 1.
Key1 *string `json:"key1,omitempty"`
// Key2 - Gets the value of key 2.
Key2 *string `json:"key2,omitempty"`
}
// AccountListResult the list of cognitive services accounts operation response.
type AccountListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; Gets the list of Cognitive Services accounts and their properties.
Value *[]Account `json:"value,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountListResult.
func (alr AccountListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// AccountProperties ...
type AccountProperties struct {
// ProvisioningState - READ-ONLY; Gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Succeeded', 'Failed'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
// Endpoint - Endpoint of the created account
Endpoint *string `json:"endpoint,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountProperties.
func (ap AccountProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ap.Endpoint != nil {
objectMap["endpoint"] = ap.Endpoint
}
return json.Marshal(objectMap)
}
// AccountUpdateParameters the parameters to provide for the account.
type AccountUpdateParameters struct {
Sku *Sku `json:"sku,omitempty"`
// Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for AccountUpdateParameters.
func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aup.Sku != nil {
objectMap["sku"] = aup.Sku
}
if aup.Tags != nil {
objectMap["tags"] = aup.Tags
}
return json.Marshal(objectMap)
}
// Error ...
type Error struct {
Error *ErrorBody `json:"error,omitempty"`
}
// ErrorBody ...
type ErrorBody struct {
// Code - error code
Code *string `json:"code,omitempty"`
// Message - error message
Message *string `json:"message,omitempty"`
}
// RegenerateKeyParameters regenerate key parameters.
type RegenerateKeyParameters struct {
// KeyName - key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2'
KeyName KeyName `json:"keyName,omitempty"`
}
// ResourceAndSku ...
type ResourceAndSku struct {
// ResourceType - Resource Namespace and Type
ResourceType *string `json:"resourceType,omitempty"`
Sku *Sku `json:"sku,omitempty"`
}
// Sku the SKU of the cognitive services account.
type Sku struct {
// Name - Gets or sets the sku name. Required for account creation, optional for update. Possible values include: 'F0', 'P0', 'P1', 'P2', 'S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6'
Name SkuName `json:"name,omitempty"`
// Tier - READ-ONLY; Gets the sku tier. This is based on the SKU name. Possible values include: 'Free', 'Standard', 'Premium'
Tier SkuTier `json:"tier,omitempty"`
}
// MarshalJSON is the custom marshaler for Sku.
func (s Sku) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if s.Name != "" {
objectMap["name"] = s.Name
}
return json.Marshal(objectMap)
}