forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.go
3502 lines (3179 loc) · 131 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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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 (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault"
// Action the action that will be executed.
type Action struct {
// ActionType - The type of the action. Possible values include: 'EmailContacts', 'AutoRenew'
ActionType ActionType `json:"action_type,omitempty"`
}
// AdministratorDetails details of the organization administrator of the certificate issuer.
type AdministratorDetails struct {
// FirstName - First name.
FirstName *string `json:"first_name,omitempty"`
// LastName - Last name.
LastName *string `json:"last_name,omitempty"`
// EmailAddress - Email address.
EmailAddress *string `json:"email,omitempty"`
// Phone - Phone number.
Phone *string `json:"phone,omitempty"`
}
// Attributes the object attributes managed by the KeyVault service.
type Attributes struct {
// Enabled - Determines whether the object is enabled.
Enabled *bool `json:"enabled,omitempty"`
// NotBefore - Not before date in UTC.
NotBefore *date.UnixTime `json:"nbf,omitempty"`
// Expires - Expiry date in UTC.
Expires *date.UnixTime `json:"exp,omitempty"`
// Created - READ-ONLY; Creation time in UTC.
Created *date.UnixTime `json:"created,omitempty"`
// Updated - READ-ONLY; Last updated time in UTC.
Updated *date.UnixTime `json:"updated,omitempty"`
}
// MarshalJSON is the custom marshaler for Attributes.
func (a Attributes) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.Enabled != nil {
objectMap["enabled"] = a.Enabled
}
if a.NotBefore != nil {
objectMap["nbf"] = a.NotBefore
}
if a.Expires != nil {
objectMap["exp"] = a.Expires
}
return json.Marshal(objectMap)
}
// BackupCertificateResult the backup certificate result, containing the backup blob.
type BackupCertificateResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The backup blob containing the backed up certificate. (a URL-encoded base64 string)
Value *string `json:"value,omitempty"`
}
// BackupKeyResult the backup key result, containing the backup blob.
type BackupKeyResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The backup blob containing the backed up key. (a URL-encoded base64 string)
Value *string `json:"value,omitempty"`
}
// BackupSecretResult the backup secret result, containing the backup blob.
type BackupSecretResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The backup blob containing the backed up secret. (a URL-encoded base64 string)
Value *string `json:"value,omitempty"`
}
// BackupStorageResult the backup storage result, containing the backup blob.
type BackupStorageResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The backup blob containing the backed up storage account. (a URL-encoded base64 string)
Value *string `json:"value,omitempty"`
}
// CertificateAttributes the certificate management attributes.
type CertificateAttributes struct {
// RecoverableDays - READ-ONLY; softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0.
RecoverableDays *int32 `json:"recoverableDays,omitempty"`
// RecoveryLevel - READ-ONLY; Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can purge the certificate, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription'
RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"`
// Enabled - Determines whether the object is enabled.
Enabled *bool `json:"enabled,omitempty"`
// NotBefore - Not before date in UTC.
NotBefore *date.UnixTime `json:"nbf,omitempty"`
// Expires - Expiry date in UTC.
Expires *date.UnixTime `json:"exp,omitempty"`
// Created - READ-ONLY; Creation time in UTC.
Created *date.UnixTime `json:"created,omitempty"`
// Updated - READ-ONLY; Last updated time in UTC.
Updated *date.UnixTime `json:"updated,omitempty"`
}
// MarshalJSON is the custom marshaler for CertificateAttributes.
func (ca CertificateAttributes) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ca.Enabled != nil {
objectMap["enabled"] = ca.Enabled
}
if ca.NotBefore != nil {
objectMap["nbf"] = ca.NotBefore
}
if ca.Expires != nil {
objectMap["exp"] = ca.Expires
}
return json.Marshal(objectMap)
}
// CertificateBundle a certificate bundle consists of a certificate (X509) plus its attributes.
type CertificateBundle struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; The certificate id.
ID *string `json:"id,omitempty"`
// Kid - READ-ONLY; The key id.
Kid *string `json:"kid,omitempty"`
// Sid - READ-ONLY; The secret id.
Sid *string `json:"sid,omitempty"`
// X509Thumbprint - READ-ONLY; Thumbprint of the certificate. (a URL-encoded base64 string)
X509Thumbprint *string `json:"x5t,omitempty"`
// Policy - READ-ONLY; The management policy.
Policy *CertificatePolicy `json:"policy,omitempty"`
// Cer - CER contents of x509 certificate.
Cer *[]byte `json:"cer,omitempty"`
// ContentType - The content type of the secret.
ContentType *string `json:"contentType,omitempty"`
// Attributes - The certificate attributes.
Attributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CertificateBundle.
func (cb CertificateBundle) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cb.Cer != nil {
objectMap["cer"] = cb.Cer
}
if cb.ContentType != nil {
objectMap["contentType"] = cb.ContentType
}
if cb.Attributes != nil {
objectMap["attributes"] = cb.Attributes
}
if cb.Tags != nil {
objectMap["tags"] = cb.Tags
}
return json.Marshal(objectMap)
}
// CertificateCreateParameters the certificate create parameters.
type CertificateCreateParameters struct {
// CertificatePolicy - The management policy for the certificate.
CertificatePolicy *CertificatePolicy `json:"policy,omitempty"`
// CertificateAttributes - The attributes of the certificate (optional).
CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CertificateCreateParameters.
func (ccp CertificateCreateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ccp.CertificatePolicy != nil {
objectMap["policy"] = ccp.CertificatePolicy
}
if ccp.CertificateAttributes != nil {
objectMap["attributes"] = ccp.CertificateAttributes
}
if ccp.Tags != nil {
objectMap["tags"] = ccp.Tags
}
return json.Marshal(objectMap)
}
// CertificateImportParameters the certificate import parameters.
type CertificateImportParameters struct {
// Base64EncodedCertificate - A PEM file or a base64-encoded PFX file. PEM files need to contain the private key.
Base64EncodedCertificate *string `json:"value,omitempty"`
// Password - If the private key in base64EncodedCertificate is encrypted, the password used for encryption.
Password *string `json:"pwd,omitempty"`
// CertificatePolicy - The management policy for the certificate.
CertificatePolicy *CertificatePolicy `json:"policy,omitempty"`
// CertificateAttributes - The attributes of the certificate (optional).
CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CertificateImportParameters.
func (cip CertificateImportParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cip.Base64EncodedCertificate != nil {
objectMap["value"] = cip.Base64EncodedCertificate
}
if cip.Password != nil {
objectMap["pwd"] = cip.Password
}
if cip.CertificatePolicy != nil {
objectMap["policy"] = cip.CertificatePolicy
}
if cip.CertificateAttributes != nil {
objectMap["attributes"] = cip.CertificateAttributes
}
if cip.Tags != nil {
objectMap["tags"] = cip.Tags
}
return json.Marshal(objectMap)
}
// CertificateIssuerItem the certificate issuer item containing certificate issuer metadata.
type CertificateIssuerItem struct {
// ID - Certificate Identifier.
ID *string `json:"id,omitempty"`
// Provider - The issuer provider.
Provider *string `json:"provider,omitempty"`
}
// CertificateIssuerListResult the certificate issuer list result.
type CertificateIssuerListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; A response message containing a list of certificate issuers in the key vault along with a link to the next page of certificate issuers.
Value *[]CertificateIssuerItem `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of certificate issuers.
NextLink *string `json:"nextLink,omitempty"`
}
// CertificateIssuerListResultIterator provides access to a complete listing of CertificateIssuerItem
// values.
type CertificateIssuerListResultIterator struct {
i int
page CertificateIssuerListResultPage
}
// NextWithContext 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 *CertificateIssuerListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CertificateIssuerListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *CertificateIssuerListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter CertificateIssuerListResultIterator) 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 CertificateIssuerListResultIterator) Response() CertificateIssuerListResult {
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 CertificateIssuerListResultIterator) Value() CertificateIssuerItem {
if !iter.page.NotDone() {
return CertificateIssuerItem{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the CertificateIssuerListResultIterator type.
func NewCertificateIssuerListResultIterator(page CertificateIssuerListResultPage) CertificateIssuerListResultIterator {
return CertificateIssuerListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (cilr CertificateIssuerListResult) IsEmpty() bool {
return cilr.Value == nil || len(*cilr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (cilr CertificateIssuerListResult) hasNextLink() bool {
return cilr.NextLink != nil && len(*cilr.NextLink) != 0
}
// certificateIssuerListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (cilr CertificateIssuerListResult) certificateIssuerListResultPreparer(ctx context.Context) (*http.Request, error) {
if !cilr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(cilr.NextLink)))
}
// CertificateIssuerListResultPage contains a page of CertificateIssuerItem values.
type CertificateIssuerListResultPage struct {
fn func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error)
cilr CertificateIssuerListResult
}
// NextWithContext 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 *CertificateIssuerListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CertificateIssuerListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.cilr)
if err != nil {
return err
}
page.cilr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// 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.
// Deprecated: Use NextWithContext() instead.
func (page *CertificateIssuerListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page CertificateIssuerListResultPage) NotDone() bool {
return !page.cilr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page CertificateIssuerListResultPage) Response() CertificateIssuerListResult {
return page.cilr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page CertificateIssuerListResultPage) Values() []CertificateIssuerItem {
if page.cilr.IsEmpty() {
return nil
}
return *page.cilr.Value
}
// Creates a new instance of the CertificateIssuerListResultPage type.
func NewCertificateIssuerListResultPage(cur CertificateIssuerListResult, getNextPage func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error)) CertificateIssuerListResultPage {
return CertificateIssuerListResultPage{
fn: getNextPage,
cilr: cur,
}
}
// CertificateIssuerSetParameters the certificate issuer set parameters.
type CertificateIssuerSetParameters struct {
// Provider - The issuer provider.
Provider *string `json:"provider,omitempty"`
// Credentials - The credentials to be used for the issuer.
Credentials *IssuerCredentials `json:"credentials,omitempty"`
// OrganizationDetails - Details of the organization as provided to the issuer.
OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"`
// Attributes - Attributes of the issuer object.
Attributes *IssuerAttributes `json:"attributes,omitempty"`
}
// CertificateIssuerUpdateParameters the certificate issuer update parameters.
type CertificateIssuerUpdateParameters struct {
// Provider - The issuer provider.
Provider *string `json:"provider,omitempty"`
// Credentials - The credentials to be used for the issuer.
Credentials *IssuerCredentials `json:"credentials,omitempty"`
// OrganizationDetails - Details of the organization as provided to the issuer.
OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"`
// Attributes - Attributes of the issuer object.
Attributes *IssuerAttributes `json:"attributes,omitempty"`
}
// CertificateItem the certificate item containing certificate metadata.
type CertificateItem struct {
// ID - Certificate identifier.
ID *string `json:"id,omitempty"`
// Attributes - The certificate management attributes.
Attributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
// X509Thumbprint - Thumbprint of the certificate. (a URL-encoded base64 string)
X509Thumbprint *string `json:"x5t,omitempty"`
}
// MarshalJSON is the custom marshaler for CertificateItem.
func (ci CertificateItem) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ci.ID != nil {
objectMap["id"] = ci.ID
}
if ci.Attributes != nil {
objectMap["attributes"] = ci.Attributes
}
if ci.Tags != nil {
objectMap["tags"] = ci.Tags
}
if ci.X509Thumbprint != nil {
objectMap["x5t"] = ci.X509Thumbprint
}
return json.Marshal(objectMap)
}
// CertificateListResult the certificate list result.
type CertificateListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; A response message containing a list of certificates in the key vault along with a link to the next page of certificates.
Value *[]CertificateItem `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of certificates.
NextLink *string `json:"nextLink,omitempty"`
}
// CertificateListResultIterator provides access to a complete listing of CertificateItem values.
type CertificateListResultIterator struct {
i int
page CertificateListResultPage
}
// NextWithContext 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 *CertificateListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *CertificateListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter CertificateListResultIterator) 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 CertificateListResultIterator) Response() CertificateListResult {
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 CertificateListResultIterator) Value() CertificateItem {
if !iter.page.NotDone() {
return CertificateItem{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the CertificateListResultIterator type.
func NewCertificateListResultIterator(page CertificateListResultPage) CertificateListResultIterator {
return CertificateListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (clr CertificateListResult) IsEmpty() bool {
return clr.Value == nil || len(*clr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (clr CertificateListResult) hasNextLink() bool {
return clr.NextLink != nil && len(*clr.NextLink) != 0
}
// certificateListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (clr CertificateListResult) certificateListResultPreparer(ctx context.Context) (*http.Request, error) {
if !clr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(clr.NextLink)))
}
// CertificateListResultPage contains a page of CertificateItem values.
type CertificateListResultPage struct {
fn func(context.Context, CertificateListResult) (CertificateListResult, error)
clr CertificateListResult
}
// NextWithContext 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 *CertificateListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.clr)
if err != nil {
return err
}
page.clr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// 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.
// Deprecated: Use NextWithContext() instead.
func (page *CertificateListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page CertificateListResultPage) NotDone() bool {
return !page.clr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page CertificateListResultPage) Response() CertificateListResult {
return page.clr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page CertificateListResultPage) Values() []CertificateItem {
if page.clr.IsEmpty() {
return nil
}
return *page.clr.Value
}
// Creates a new instance of the CertificateListResultPage type.
func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage {
return CertificateListResultPage{
fn: getNextPage,
clr: cur,
}
}
// CertificateMergeParameters the certificate merge parameters
type CertificateMergeParameters struct {
// X509Certificates - The certificate or the certificate chain to merge.
X509Certificates *[][]byte `json:"x5c,omitempty"`
// CertificateAttributes - The attributes of the certificate (optional).
CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CertificateMergeParameters.
func (cmp CertificateMergeParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cmp.X509Certificates != nil {
objectMap["x5c"] = cmp.X509Certificates
}
if cmp.CertificateAttributes != nil {
objectMap["attributes"] = cmp.CertificateAttributes
}
if cmp.Tags != nil {
objectMap["tags"] = cmp.Tags
}
return json.Marshal(objectMap)
}
// CertificateOperation a certificate operation is returned in case of asynchronous requests.
type CertificateOperation struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; The certificate id.
ID *string `json:"id,omitempty"`
// IssuerParameters - Parameters for the issuer of the X509 component of a certificate.
IssuerParameters *IssuerParameters `json:"issuer,omitempty"`
// Csr - The certificate signing request (CSR) that is being used in the certificate operation.
Csr *[]byte `json:"csr,omitempty"`
// CancellationRequested - Indicates if cancellation was requested on the certificate operation.
CancellationRequested *bool `json:"cancellation_requested,omitempty"`
// Status - Status of the certificate operation.
Status *string `json:"status,omitempty"`
// StatusDetails - The status details of the certificate operation.
StatusDetails *string `json:"status_details,omitempty"`
// Error - Error encountered, if any, during the certificate operation.
Error *Error `json:"error,omitempty"`
// Target - Location which contains the result of the certificate operation.
Target *string `json:"target,omitempty"`
// RequestID - Identifier for the certificate operation.
RequestID *string `json:"request_id,omitempty"`
}
// MarshalJSON is the custom marshaler for CertificateOperation.
func (co CertificateOperation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if co.IssuerParameters != nil {
objectMap["issuer"] = co.IssuerParameters
}
if co.Csr != nil {
objectMap["csr"] = co.Csr
}
if co.CancellationRequested != nil {
objectMap["cancellation_requested"] = co.CancellationRequested
}
if co.Status != nil {
objectMap["status"] = co.Status
}
if co.StatusDetails != nil {
objectMap["status_details"] = co.StatusDetails
}
if co.Error != nil {
objectMap["error"] = co.Error
}
if co.Target != nil {
objectMap["target"] = co.Target
}
if co.RequestID != nil {
objectMap["request_id"] = co.RequestID
}
return json.Marshal(objectMap)
}
// CertificateOperationUpdateParameter the certificate operation update parameters.
type CertificateOperationUpdateParameter struct {
// CancellationRequested - Indicates if cancellation was requested on the certificate operation.
CancellationRequested *bool `json:"cancellation_requested,omitempty"`
}
// CertificatePolicy management policy for a certificate.
type CertificatePolicy struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; The certificate id.
ID *string `json:"id,omitempty"`
// KeyProperties - Properties of the key backing a certificate.
KeyProperties *KeyProperties `json:"key_props,omitempty"`
// SecretProperties - Properties of the secret backing a certificate.
SecretProperties *SecretProperties `json:"secret_props,omitempty"`
// X509CertificateProperties - Properties of the X509 component of a certificate.
X509CertificateProperties *X509CertificateProperties `json:"x509_props,omitempty"`
// LifetimeActions - Actions that will be performed by Key Vault over the lifetime of a certificate.
LifetimeActions *[]LifetimeAction `json:"lifetime_actions,omitempty"`
// IssuerParameters - Parameters for the issuer of the X509 component of a certificate.
IssuerParameters *IssuerParameters `json:"issuer,omitempty"`
// Attributes - The certificate attributes.
Attributes *CertificateAttributes `json:"attributes,omitempty"`
}
// MarshalJSON is the custom marshaler for CertificatePolicy.
func (cp CertificatePolicy) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cp.KeyProperties != nil {
objectMap["key_props"] = cp.KeyProperties
}
if cp.SecretProperties != nil {
objectMap["secret_props"] = cp.SecretProperties
}
if cp.X509CertificateProperties != nil {
objectMap["x509_props"] = cp.X509CertificateProperties
}
if cp.LifetimeActions != nil {
objectMap["lifetime_actions"] = cp.LifetimeActions
}
if cp.IssuerParameters != nil {
objectMap["issuer"] = cp.IssuerParameters
}
if cp.Attributes != nil {
objectMap["attributes"] = cp.Attributes
}
return json.Marshal(objectMap)
}
// CertificateRestoreParameters the certificate restore parameters.
type CertificateRestoreParameters struct {
// CertificateBundleBackup - The backup blob associated with a certificate bundle. (a URL-encoded base64 string)
CertificateBundleBackup *string `json:"value,omitempty"`
}
// CertificateUpdateParameters the certificate update parameters.
type CertificateUpdateParameters struct {
// CertificatePolicy - The management policy for the certificate.
CertificatePolicy *CertificatePolicy `json:"policy,omitempty"`
// CertificateAttributes - The attributes of the certificate (optional).
CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CertificateUpdateParameters.
func (cup CertificateUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cup.CertificatePolicy != nil {
objectMap["policy"] = cup.CertificatePolicy
}
if cup.CertificateAttributes != nil {
objectMap["attributes"] = cup.CertificateAttributes
}
if cup.Tags != nil {
objectMap["tags"] = cup.Tags
}
return json.Marshal(objectMap)
}
// Contact the contact information for the vault certificates.
type Contact struct {
// EmailAddress - Email address.
EmailAddress *string `json:"email,omitempty"`
// Name - Name.
Name *string `json:"name,omitempty"`
// Phone - Phone number.
Phone *string `json:"phone,omitempty"`
}
// Contacts the contacts for the vault certificates.
type Contacts struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Identifier for the contacts collection.
ID *string `json:"id,omitempty"`
// ContactList - The contact list for the vault certificates.
ContactList *[]Contact `json:"contacts,omitempty"`
}
// MarshalJSON is the custom marshaler for Contacts.
func (c Contacts) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.ContactList != nil {
objectMap["contacts"] = c.ContactList
}
return json.Marshal(objectMap)
}
// DeletedCertificateBundle a Deleted Certificate consisting of its previous id, attributes and its tags,
// as well as information on when it will be purged.
type DeletedCertificateBundle struct {
autorest.Response `json:"-"`
// RecoveryID - The url of the recovery object, used to identify and recover the deleted certificate.
RecoveryID *string `json:"recoveryId,omitempty"`
// ScheduledPurgeDate - READ-ONLY; The time when the certificate is scheduled to be purged, in UTC
ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"`
// DeletedDate - READ-ONLY; The time when the certificate was deleted, in UTC
DeletedDate *date.UnixTime `json:"deletedDate,omitempty"`
// ID - READ-ONLY; The certificate id.
ID *string `json:"id,omitempty"`
// Kid - READ-ONLY; The key id.
Kid *string `json:"kid,omitempty"`
// Sid - READ-ONLY; The secret id.
Sid *string `json:"sid,omitempty"`
// X509Thumbprint - READ-ONLY; Thumbprint of the certificate. (a URL-encoded base64 string)
X509Thumbprint *string `json:"x5t,omitempty"`
// Policy - READ-ONLY; The management policy.
Policy *CertificatePolicy `json:"policy,omitempty"`
// Cer - CER contents of x509 certificate.
Cer *[]byte `json:"cer,omitempty"`
// ContentType - The content type of the secret.
ContentType *string `json:"contentType,omitempty"`
// Attributes - The certificate attributes.
Attributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for DeletedCertificateBundle.
func (dcb DeletedCertificateBundle) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if dcb.RecoveryID != nil {
objectMap["recoveryId"] = dcb.RecoveryID
}
if dcb.Cer != nil {
objectMap["cer"] = dcb.Cer
}
if dcb.ContentType != nil {
objectMap["contentType"] = dcb.ContentType
}
if dcb.Attributes != nil {
objectMap["attributes"] = dcb.Attributes
}
if dcb.Tags != nil {
objectMap["tags"] = dcb.Tags
}
return json.Marshal(objectMap)
}
// DeletedCertificateItem the deleted certificate item containing metadata about the deleted certificate.
type DeletedCertificateItem struct {
// RecoveryID - The url of the recovery object, used to identify and recover the deleted certificate.
RecoveryID *string `json:"recoveryId,omitempty"`
// ScheduledPurgeDate - READ-ONLY; The time when the certificate is scheduled to be purged, in UTC
ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"`
// DeletedDate - READ-ONLY; The time when the certificate was deleted, in UTC
DeletedDate *date.UnixTime `json:"deletedDate,omitempty"`
// ID - Certificate identifier.
ID *string `json:"id,omitempty"`
// Attributes - The certificate management attributes.
Attributes *CertificateAttributes `json:"attributes,omitempty"`
// Tags - Application specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
// X509Thumbprint - Thumbprint of the certificate. (a URL-encoded base64 string)
X509Thumbprint *string `json:"x5t,omitempty"`
}
// MarshalJSON is the custom marshaler for DeletedCertificateItem.
func (dci DeletedCertificateItem) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if dci.RecoveryID != nil {
objectMap["recoveryId"] = dci.RecoveryID
}
if dci.ID != nil {
objectMap["id"] = dci.ID
}
if dci.Attributes != nil {
objectMap["attributes"] = dci.Attributes
}
if dci.Tags != nil {
objectMap["tags"] = dci.Tags
}
if dci.X509Thumbprint != nil {
objectMap["x5t"] = dci.X509Thumbprint
}
return json.Marshal(objectMap)
}
// DeletedCertificateListResult a list of certificates that have been deleted in this vault.
type DeletedCertificateListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; A response message containing a list of deleted certificates in the vault along with a link to the next page of deleted certificates
Value *[]DeletedCertificateItem `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of deleted certificates.
NextLink *string `json:"nextLink,omitempty"`
}
// DeletedCertificateListResultIterator provides access to a complete listing of DeletedCertificateItem
// values.
type DeletedCertificateListResultIterator struct {
i int
page DeletedCertificateListResultPage
}
// NextWithContext 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 *DeletedCertificateListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/DeletedCertificateListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *DeletedCertificateListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter DeletedCertificateListResultIterator) 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 DeletedCertificateListResultIterator) Response() DeletedCertificateListResult {
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 DeletedCertificateListResultIterator) Value() DeletedCertificateItem {
if !iter.page.NotDone() {
return DeletedCertificateItem{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the DeletedCertificateListResultIterator type.
func NewDeletedCertificateListResultIterator(page DeletedCertificateListResultPage) DeletedCertificateListResultIterator {
return DeletedCertificateListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (dclr DeletedCertificateListResult) IsEmpty() bool {
return dclr.Value == nil || len(*dclr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (dclr DeletedCertificateListResult) hasNextLink() bool {
return dclr.NextLink != nil && len(*dclr.NextLink) != 0
}
// deletedCertificateListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dclr DeletedCertificateListResult) deletedCertificateListResultPreparer(ctx context.Context) (*http.Request, error) {
if !dclr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(dclr.NextLink)))
}
// DeletedCertificateListResultPage contains a page of DeletedCertificateItem values.
type DeletedCertificateListResultPage struct {
fn func(context.Context, DeletedCertificateListResult) (DeletedCertificateListResult, error)
dclr DeletedCertificateListResult
}
// NextWithContext advances to the next page of values. If there was an error making