-
Notifications
You must be signed in to change notification settings - Fork 815
/
models.go
512 lines (462 loc) · 17.9 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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
package keyvault
// 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"
"github.com/Azure/go-autorest/autorest/to"
"github.com/satori/go.uuid"
"net/http"
)
// CertificatePermissions enumerates the values for certificate permissions.
type CertificatePermissions string
const (
// All ...
All CertificatePermissions = "all"
// Create ...
Create CertificatePermissions = "create"
// Delete ...
Delete CertificatePermissions = "delete"
// Deleteissuers ...
Deleteissuers CertificatePermissions = "deleteissuers"
// Get ...
Get CertificatePermissions = "get"
// Getissuers ...
Getissuers CertificatePermissions = "getissuers"
// Import ...
Import CertificatePermissions = "import"
// List ...
List CertificatePermissions = "list"
// Listissuers ...
Listissuers CertificatePermissions = "listissuers"
// Managecontacts ...
Managecontacts CertificatePermissions = "managecontacts"
// Manageissuers ...
Manageissuers CertificatePermissions = "manageissuers"
// Purge ...
Purge CertificatePermissions = "purge"
// Recover ...
Recover CertificatePermissions = "recover"
// Setissuers ...
Setissuers CertificatePermissions = "setissuers"
// Update ...
Update CertificatePermissions = "update"
)
// PossibleCertificatePermissionsValues returns an array of possible values for the CertificatePermissions const type.
func PossibleCertificatePermissionsValues() []CertificatePermissions {
return []CertificatePermissions{All, Create, Delete, Deleteissuers, Get, Getissuers, Import, List, Listissuers, Managecontacts, Manageissuers, Purge, Recover, Setissuers, Update}
}
// KeyPermissions enumerates the values for key permissions.
type KeyPermissions string
const (
// KeyPermissionsAll ...
KeyPermissionsAll KeyPermissions = "all"
// KeyPermissionsBackup ...
KeyPermissionsBackup KeyPermissions = "backup"
// KeyPermissionsCreate ...
KeyPermissionsCreate KeyPermissions = "create"
// KeyPermissionsDecrypt ...
KeyPermissionsDecrypt KeyPermissions = "decrypt"
// KeyPermissionsDelete ...
KeyPermissionsDelete KeyPermissions = "delete"
// KeyPermissionsEncrypt ...
KeyPermissionsEncrypt KeyPermissions = "encrypt"
// KeyPermissionsGet ...
KeyPermissionsGet KeyPermissions = "get"
// KeyPermissionsImport ...
KeyPermissionsImport KeyPermissions = "import"
// KeyPermissionsList ...
KeyPermissionsList KeyPermissions = "list"
// KeyPermissionsPurge ...
KeyPermissionsPurge KeyPermissions = "purge"
// KeyPermissionsRecover ...
KeyPermissionsRecover KeyPermissions = "recover"
// KeyPermissionsRestore ...
KeyPermissionsRestore KeyPermissions = "restore"
// KeyPermissionsSign ...
KeyPermissionsSign KeyPermissions = "sign"
// KeyPermissionsUnwrapKey ...
KeyPermissionsUnwrapKey KeyPermissions = "unwrapKey"
// KeyPermissionsUpdate ...
KeyPermissionsUpdate KeyPermissions = "update"
// KeyPermissionsVerify ...
KeyPermissionsVerify KeyPermissions = "verify"
// KeyPermissionsWrapKey ...
KeyPermissionsWrapKey KeyPermissions = "wrapKey"
)
// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type.
func PossibleKeyPermissionsValues() []KeyPermissions {
return []KeyPermissions{KeyPermissionsAll, KeyPermissionsBackup, KeyPermissionsCreate, KeyPermissionsDecrypt, KeyPermissionsDelete, KeyPermissionsEncrypt, KeyPermissionsGet, KeyPermissionsImport, KeyPermissionsList, KeyPermissionsPurge, KeyPermissionsRecover, KeyPermissionsRestore, KeyPermissionsSign, KeyPermissionsUnwrapKey, KeyPermissionsUpdate, KeyPermissionsVerify, KeyPermissionsWrapKey}
}
// SecretPermissions enumerates the values for secret permissions.
type SecretPermissions string
const (
// SecretPermissionsAll ...
SecretPermissionsAll SecretPermissions = "all"
// SecretPermissionsBackup ...
SecretPermissionsBackup SecretPermissions = "backup"
// SecretPermissionsDelete ...
SecretPermissionsDelete SecretPermissions = "delete"
// SecretPermissionsGet ...
SecretPermissionsGet SecretPermissions = "get"
// SecretPermissionsList ...
SecretPermissionsList SecretPermissions = "list"
// SecretPermissionsPurge ...
SecretPermissionsPurge SecretPermissions = "purge"
// SecretPermissionsRecover ...
SecretPermissionsRecover SecretPermissions = "recover"
// SecretPermissionsRestore ...
SecretPermissionsRestore SecretPermissions = "restore"
// SecretPermissionsSet ...
SecretPermissionsSet SecretPermissions = "set"
)
// PossibleSecretPermissionsValues returns an array of possible values for the SecretPermissions const type.
func PossibleSecretPermissionsValues() []SecretPermissions {
return []SecretPermissions{SecretPermissionsAll, SecretPermissionsBackup, SecretPermissionsDelete, SecretPermissionsGet, SecretPermissionsList, SecretPermissionsPurge, SecretPermissionsRecover, SecretPermissionsRestore, SecretPermissionsSet}
}
// SkuName enumerates the values for sku name.
type SkuName string
const (
// Premium ...
Premium SkuName = "premium"
// Standard ...
Standard SkuName = "standard"
)
// PossibleSkuNameValues returns an array of possible values for the SkuName const type.
func PossibleSkuNameValues() []SkuName {
return []SkuName{Premium, Standard}
}
// AccessPolicyEntry an identity that have access to the key vault. All identities in the array must use the same
// tenant ID as the key vault's tenant ID.
type AccessPolicyEntry struct {
// TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
TenantID *uuid.UUID `json:"tenantId,omitempty"`
// ObjectID - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies.
ObjectID *string `json:"objectId,omitempty"`
// ApplicationID - Application ID of the client making request on behalf of a principal
ApplicationID *uuid.UUID `json:"applicationId,omitempty"`
// Permissions - Permissions the identity has for keys, secrets and certificates.
Permissions *Permissions `json:"permissions,omitempty"`
}
// Permissions permissions the identity has for keys, secrets and certificates.
type Permissions struct {
// Keys - Permissions to keys
Keys *[]KeyPermissions `json:"keys,omitempty"`
// Secrets - Permissions to secrets
Secrets *[]SecretPermissions `json:"secrets,omitempty"`
// Certificates - Permissions to certificates
Certificates *[]CertificatePermissions `json:"certificates,omitempty"`
}
// Resource key Vault resource
type Resource struct {
// ID - The Azure Resource Manager resource ID for the key vault.
ID *string `json:"id,omitempty"`
// Name - The name of the key vault.
Name *string `json:"name,omitempty"`
// Type - The resource type of the key vault.
Type *string `json:"type,omitempty"`
// Location - The supported Azure location where the key vault should be created.
Location *string `json:"location,omitempty"`
// Tags - The tags that will be assigned to the key vault.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.ID != nil {
objectMap["id"] = r.ID
}
if r.Name != nil {
objectMap["name"] = r.Name
}
if r.Type != nil {
objectMap["type"] = r.Type
}
if r.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// ResourceListResult list of vault resources.
type ResourceListResult struct {
autorest.Response `json:"-"`
// Value - Gets the list of vault resources.
Value *[]Resource `json:"value,omitempty"`
// NextLink - Gets the URL to get the next set of vault resources.
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceListResultIterator provides access to a complete listing of Resource values.
type ResourceListResultIterator struct {
i int
page ResourceListResultPage
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *ResourceListResultIterator) Next() error {
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err := iter.page.Next()
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ResourceListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter ResourceListResultIterator) Response() ResourceListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter ResourceListResultIterator) Value() Resource {
if !iter.page.NotDone() {
return Resource{}
}
return iter.page.Values()[iter.i]
}
// IsEmpty returns true if the ListResult contains no values.
func (rlr ResourceListResult) IsEmpty() bool {
return rlr.Value == nil || len(*rlr.Value) == 0
}
// resourceListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (rlr ResourceListResult) resourceListResultPreparer() (*http.Request, error) {
if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(rlr.NextLink)))
}
// ResourceListResultPage contains a page of Resource values.
type ResourceListResultPage struct {
fn func(ResourceListResult) (ResourceListResult, error)
rlr ResourceListResult
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *ResourceListResultPage) Next() error {
next, err := page.fn(page.rlr)
if err != nil {
return err
}
page.rlr = next
return nil
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ResourceListResultPage) NotDone() bool {
return !page.rlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page ResourceListResultPage) Response() ResourceListResult {
return page.rlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page ResourceListResultPage) Values() []Resource {
if page.rlr.IsEmpty() {
return nil
}
return *page.rlr.Value
}
// Sku SKU details
type Sku struct {
// Family - SKU family name
Family *string `json:"family,omitempty"`
// Name - SKU name to specify whether the key vault is a standard vault or a premium vault. Possible values include: 'Standard', 'Premium'
Name SkuName `json:"name,omitempty"`
}
// Vault resource information with extended details.
type Vault struct {
autorest.Response `json:"-"`
// Properties - Properties of the vault
Properties *VaultProperties `json:"properties,omitempty"`
// ID - The Azure Resource Manager resource ID for the key vault.
ID *string `json:"id,omitempty"`
// Name - The name of the key vault.
Name *string `json:"name,omitempty"`
// Type - The resource type of the key vault.
Type *string `json:"type,omitempty"`
// Location - The supported Azure location where the key vault should be created.
Location *string `json:"location,omitempty"`
// Tags - The tags that will be assigned to the key vault.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Vault.
func (vVar Vault) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if vVar.Properties != nil {
objectMap["properties"] = vVar.Properties
}
if vVar.ID != nil {
objectMap["id"] = vVar.ID
}
if vVar.Name != nil {
objectMap["name"] = vVar.Name
}
if vVar.Type != nil {
objectMap["type"] = vVar.Type
}
if vVar.Location != nil {
objectMap["location"] = vVar.Location
}
if vVar.Tags != nil {
objectMap["tags"] = vVar.Tags
}
return json.Marshal(objectMap)
}
// VaultCreateOrUpdateParameters parameters for creating or updating a vault
type VaultCreateOrUpdateParameters struct {
// Location - The supported Azure location where the key vault should be created.
Location *string `json:"location,omitempty"`
// Tags - The tags that will be assigned to the key vault.
Tags map[string]*string `json:"tags"`
// Properties - Properties of the vault
Properties *VaultProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for VaultCreateOrUpdateParameters.
func (vcoup VaultCreateOrUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if vcoup.Location != nil {
objectMap["location"] = vcoup.Location
}
if vcoup.Tags != nil {
objectMap["tags"] = vcoup.Tags
}
if vcoup.Properties != nil {
objectMap["properties"] = vcoup.Properties
}
return json.Marshal(objectMap)
}
// VaultListResult list of vaults
type VaultListResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets the list of vaults.
Value *[]Vault `json:"value,omitempty"`
// NextLink - Gets or sets the URL to get the next set of vaults.
NextLink *string `json:"nextLink,omitempty"`
}
// VaultListResultIterator provides access to a complete listing of Vault values.
type VaultListResultIterator struct {
i int
page VaultListResultPage
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *VaultListResultIterator) Next() error {
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err := iter.page.Next()
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter VaultListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter VaultListResultIterator) Response() VaultListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter VaultListResultIterator) Value() Vault {
if !iter.page.NotDone() {
return Vault{}
}
return iter.page.Values()[iter.i]
}
// IsEmpty returns true if the ListResult contains no values.
func (vlr VaultListResult) IsEmpty() bool {
return vlr.Value == nil || len(*vlr.Value) == 0
}
// vaultListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (vlr VaultListResult) vaultListResultPreparer() (*http.Request, error) {
if vlr.NextLink == nil || len(to.String(vlr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(vlr.NextLink)))
}
// VaultListResultPage contains a page of Vault values.
type VaultListResultPage struct {
fn func(VaultListResult) (VaultListResult, error)
vlr VaultListResult
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *VaultListResultPage) Next() error {
next, err := page.fn(page.vlr)
if err != nil {
return err
}
page.vlr = next
return nil
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page VaultListResultPage) NotDone() bool {
return !page.vlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page VaultListResultPage) Response() VaultListResult {
return page.vlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page VaultListResultPage) Values() []Vault {
if page.vlr.IsEmpty() {
return nil
}
return *page.vlr.Value
}
// VaultProperties properties of the vault
type VaultProperties struct {
// VaultURI - The URI of the vault for performing operations on keys and secrets.
VaultURI *string `json:"vaultUri,omitempty"`
// TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
TenantID *uuid.UUID `json:"tenantId,omitempty"`
// Sku - SKU details
Sku *Sku `json:"sku,omitempty"`
// AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID.
AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"`
// EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.
EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"`
// EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.
EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"`
// EnabledForTemplateDeployment - Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.
EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"`
// EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault.
EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"`
}