-
Notifications
You must be signed in to change notification settings - Fork 803
/
models.go
419 lines (385 loc) · 12.4 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
package cognitiveservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// 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"
)
// KeyName enumerates the values for key name.
type KeyName string
const (
// Key1 ...
Key1 KeyName = "Key1"
// Key2 ...
Key2 KeyName = "Key2"
)
// PossibleKeyNameValues returns an array of possible values for the KeyName const type.
func PossibleKeyNameValues() []KeyName {
return []KeyName{Key1, Key2}
}
// Kind enumerates the values for kind.
type Kind string
const (
// Academic ...
Academic Kind = "Academic"
// BingAutosuggest ...
BingAutosuggest Kind = "Bing.Autosuggest"
// BingSearch ...
BingSearch Kind = "Bing.Search"
// BingSpeech ...
BingSpeech Kind = "Bing.Speech"
// BingSpellCheck ...
BingSpellCheck Kind = "Bing.SpellCheck"
// ComputerVision ...
ComputerVision Kind = "ComputerVision"
// ContentModerator ...
ContentModerator Kind = "ContentModerator"
// Emotion ...
Emotion Kind = "Emotion"
// Face ...
Face Kind = "Face"
// LUIS ...
LUIS Kind = "LUIS"
// Recommendations ...
Recommendations Kind = "Recommendations"
// SpeakerRecognition ...
SpeakerRecognition Kind = "SpeakerRecognition"
// Speech ...
Speech Kind = "Speech"
// SpeechTranslation ...
SpeechTranslation Kind = "SpeechTranslation"
// TextAnalytics ...
TextAnalytics Kind = "TextAnalytics"
// TextTranslation ...
TextTranslation Kind = "TextTranslation"
// WebLM ...
WebLM Kind = "WebLM"
)
// PossibleKindValues returns an array of possible values for the Kind const type.
func PossibleKindValues() []Kind {
return []Kind{Academic, BingAutosuggest, BingSearch, BingSpeech, BingSpellCheck, ComputerVision, ContentModerator, Emotion, Face, LUIS, Recommendations, SpeakerRecognition, Speech, SpeechTranslation, TextAnalytics, TextTranslation, WebLM}
}
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Creating ...
Creating ProvisioningState = "Creating"
// Failed ...
Failed ProvisioningState = "Failed"
// ResolvingDNS ...
ResolvingDNS ProvisioningState = "ResolvingDNS"
// Succeeded ...
Succeeded ProvisioningState = "Succeeded"
)
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{Creating, Failed, ResolvingDNS, Succeeded}
}
// SkuName enumerates the values for sku name.
type SkuName string
const (
// F0 ...
F0 SkuName = "F0"
// P0 ...
P0 SkuName = "P0"
// P1 ...
P1 SkuName = "P1"
// P2 ...
P2 SkuName = "P2"
// S0 ...
S0 SkuName = "S0"
// S1 ...
S1 SkuName = "S1"
// S2 ...
S2 SkuName = "S2"
// S3 ...
S3 SkuName = "S3"
// S4 ...
S4 SkuName = "S4"
// S5 ...
S5 SkuName = "S5"
// S6 ...
S6 SkuName = "S6"
)
// PossibleSkuNameValues returns an array of possible values for the SkuName const type.
func PossibleSkuNameValues() []SkuName {
return []SkuName{F0, P0, P1, P2, S0, S1, S2, S3, S4, S5, S6}
}
// SkuTier enumerates the values for sku tier.
type SkuTier string
const (
// Free ...
Free SkuTier = "Free"
// Premium ...
Premium SkuTier = "Premium"
// Standard ...
Standard SkuTier = "Standard"
)
// PossibleSkuTierValues returns an array of possible values for the SkuTier const type.
func PossibleSkuTierValues() []SkuTier {
return []SkuTier{Free, Premium, Standard}
}
// 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
}
objectMap["properties"] = acp.Properties
return json.Marshal(objectMap)
}
// AccountEnumerateSkusResult the list of cognitive services accounts operation response.
type AccountEnumerateSkusResult struct {
autorest.Response `json:"-"`
// Value - Gets the list of Cognitive Services accounts and their properties.
Value *[]ResourceAndSku `json:"value,omitempty"`
}
// 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 - Gets the list of Cognitive Services accounts and their properties.
Value *[]Account `json:"value,omitempty"`
}
// AccountProperties ...
type AccountProperties struct {
// ProvisioningState - 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"`
}
// 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 - Gets the sku tier. This is based on the SKU name. Possible values include: 'Free', 'Standard', 'Premium'
Tier SkuTier `json:"tier,omitempty"`
}