forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
2708 lines (2464 loc) · 95.2 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 reservations
// 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 (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"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/preview/reservations/mgmt/2020-10-25/reservations"
// AppliedReservationList ...
type AppliedReservationList struct {
Value *[]string `json:"value,omitempty"`
// NextLink - Url to get the next page of reservations
NextLink *string `json:"nextLink,omitempty"`
}
// AppliedReservations ...
type AppliedReservations struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Identifier of the applied reservations
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Name of resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type of resource. "Microsoft.Capacity/AppliedReservations"
Type *string `json:"type,omitempty"`
*AppliedReservationsProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AppliedReservations.
func (ar AppliedReservations) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ar.AppliedReservationsProperties != nil {
objectMap["properties"] = ar.AppliedReservationsProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AppliedReservations struct.
func (ar *AppliedReservations) 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 "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ar.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ar.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ar.Type = &typeVar
}
case "properties":
if v != nil {
var appliedReservationsProperties AppliedReservationsProperties
err = json.Unmarshal(*v, &appliedReservationsProperties)
if err != nil {
return err
}
ar.AppliedReservationsProperties = &appliedReservationsProperties
}
}
}
return nil
}
// AppliedReservationsProperties ...
type AppliedReservationsProperties struct {
ReservationOrderIds *AppliedReservationList `json:"reservationOrderIds,omitempty"`
}
// AvailableScopeProperties ...
type AvailableScopeProperties struct {
autorest.Response `json:"-"`
Properties *SubscriptionScopeProperties `json:"properties,omitempty"`
}
// AvailableScopeRequest available scope
type AvailableScopeRequest struct {
Properties *AvailableScopeRequestProperties `json:"properties,omitempty"`
}
// AvailableScopeRequestProperties available scope request properties
type AvailableScopeRequestProperties struct {
Scopes *[]string `json:"scopes,omitempty"`
}
// BillingInformation billing information
type BillingInformation struct {
BillingCurrencyTotalPaidAmount *Price `json:"billingCurrencyTotalPaidAmount,omitempty"`
BillingCurrencyProratedAmount *Price `json:"billingCurrencyProratedAmount,omitempty"`
BillingCurrencyRemainingCommitmentAmount *Price `json:"billingCurrencyRemainingCommitmentAmount,omitempty"`
}
// CalculateExchangeOperationResultResponse calculateExchange operation result
type CalculateExchangeOperationResultResponse struct {
autorest.Response `json:"-"`
// ID - It should match what is used to GET the operation result.
ID *string `json:"id,omitempty"`
// Name - It must match the last segment of the id field, and will typically be a GUID / system generated value.
Name *string `json:"name,omitempty"`
// Status - Status of the operation. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending'
Status CalculateExchangeOperationResultStatus `json:"status,omitempty"`
Properties *CalculateExchangeResponseProperties `json:"properties,omitempty"`
Error *OperationResultError `json:"error,omitempty"`
}
// CalculateExchangePostFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type CalculateExchangePostFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CalculateExchangeClient) (CalculateExchangeOperationResultResponse, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *CalculateExchangePostFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for CalculateExchangePostFuture.Result.
func (future *CalculateExchangePostFuture) result(client CalculateExchangeClient) (ceorr CalculateExchangeOperationResultResponse, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "reservations.CalculateExchangePostFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ceorr.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("reservations.CalculateExchangePostFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ceorr.Response.Response, err = future.GetResult(sender); err == nil && ceorr.Response.Response.StatusCode != http.StatusNoContent {
ceorr, err = client.PostResponder(ceorr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "reservations.CalculateExchangePostFuture", "Result", ceorr.Response.Response, "Failure responding to request")
}
}
return
}
// CalculateExchangeRequest calculate exchange request
type CalculateExchangeRequest struct {
Properties *CalculateExchangeRequestProperties `json:"properties,omitempty"`
}
// CalculateExchangeRequestProperties calculate exchange request properties
type CalculateExchangeRequestProperties struct {
// ReservationsToPurchase - List of reservations that are being purchased in this exchange.
ReservationsToPurchase *[]PurchaseRequest `json:"reservationsToPurchase,omitempty"`
// ReservationsToExchange - List of reservations that are being returned in this exchange.
ReservationsToExchange *[]ToReturn `json:"reservationsToExchange,omitempty"`
}
// CalculateExchangeResponseProperties calculateExchange response properties
type CalculateExchangeResponseProperties struct {
// SessionID - Exchange session identifier
SessionID *string `json:"sessionId,omitempty"`
NetPayable *Price `json:"netPayable,omitempty"`
RefundsTotal *Price `json:"refundsTotal,omitempty"`
PurchasesTotal *Price `json:"purchasesTotal,omitempty"`
// ReservationsToPurchase - Details of the reservations being purchased
ReservationsToPurchase *[]ToPurchaseCalculateExchange `json:"reservationsToPurchase,omitempty"`
// ReservationsToExchange - Details of the reservations being returned
ReservationsToExchange *[]ToExchange `json:"reservationsToExchange,omitempty"`
PolicyResult *ExchangePolicyErrors `json:"policyResult,omitempty"`
}
// CalculatePriceResponse ...
type CalculatePriceResponse struct {
autorest.Response `json:"-"`
Properties *CalculatePriceResponseProperties `json:"properties,omitempty"`
}
// CalculatePriceResponseProperties ...
type CalculatePriceResponseProperties struct {
// BillingCurrencyTotal - Currency and amount that customer will be charged in customer's local currency. Tax is not included.
BillingCurrencyTotal *CalculatePriceResponsePropertiesBillingCurrencyTotal `json:"billingCurrencyTotal,omitempty"`
// IsBillingPartnerManaged - True if billing is managed by Microsoft Partner. Used only for CSP accounts.
IsBillingPartnerManaged *bool `json:"isBillingPartnerManaged,omitempty"`
// ReservationOrderID - GUID that represents reservation order that can be placed after calculating price.
ReservationOrderID *string `json:"reservationOrderId,omitempty"`
// SkuTitle - Title of SKU that is being purchased.
SkuTitle *string `json:"skuTitle,omitempty"`
// SkuDescription - Description of SKU that is being purchased.
SkuDescription *string `json:"skuDescription,omitempty"`
// PricingCurrencyTotal - Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included.
PricingCurrencyTotal *CalculatePriceResponsePropertiesPricingCurrencyTotal `json:"pricingCurrencyTotal,omitempty"`
PaymentSchedule *[]PaymentDetail `json:"paymentSchedule,omitempty"`
}
// CalculatePriceResponsePropertiesBillingCurrencyTotal currency and amount that customer will be charged
// in customer's local currency. Tax is not included.
type CalculatePriceResponsePropertiesBillingCurrencyTotal struct {
CurrencyCode *string `json:"currencyCode,omitempty"`
Amount *float64 `json:"amount,omitempty"`
}
// CalculatePriceResponsePropertiesPricingCurrencyTotal amount that Microsoft uses for record. Used during
// refund for calculating refund limit. Tax is not included.
type CalculatePriceResponsePropertiesPricingCurrencyTotal struct {
CurrencyCode *string `json:"currencyCode,omitempty"`
Amount *float64 `json:"amount,omitempty"`
}
// Catalog ...
type Catalog struct {
// ResourceType - READ-ONLY; The type of resource the SKU applies to.
ResourceType *string `json:"resourceType,omitempty"`
// Name - READ-ONLY; The name of SKU
Name *string `json:"name,omitempty"`
// BillingPlans - The billing plan options available for this SKU.
BillingPlans map[string][]ReservationBillingPlan `json:"billingPlans"`
// Terms - READ-ONLY; Available reservation terms for this resource
Terms *[]ReservationTerm `json:"terms,omitempty"`
// Locations - READ-ONLY
Locations *[]string `json:"locations,omitempty"`
// SkuProperties - READ-ONLY
SkuProperties *[]SkuProperty `json:"skuProperties,omitempty"`
// Restrictions - READ-ONLY
Restrictions *[]SkuRestriction `json:"restrictions,omitempty"`
}
// MarshalJSON is the custom marshaler for Catalog.
func (c Catalog) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.BillingPlans != nil {
objectMap["billingPlans"] = c.BillingPlans
}
return json.Marshal(objectMap)
}
// CreateGenericQuotaRequestParameters quota change requests information.
type CreateGenericQuotaRequestParameters struct {
// Value - Quota change requests.
Value *[]CurrentQuotaLimitBase `json:"value,omitempty"`
}
// CurrentQuotaLimit current quota limits.
type CurrentQuotaLimit struct {
// CurrentQuotaLimitBase - Quota details.
*CurrentQuotaLimitBase `json:"quotaInformation,omitempty"`
// QuotaRequestStatusDetails - Additional properties for the quota status for the resource.
*QuotaRequestStatusDetails `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for CurrentQuotaLimit.
func (cql CurrentQuotaLimit) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cql.CurrentQuotaLimitBase != nil {
objectMap["quotaInformation"] = cql.CurrentQuotaLimitBase
}
if cql.QuotaRequestStatusDetails != nil {
objectMap["properties"] = cql.QuotaRequestStatusDetails
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CurrentQuotaLimit struct.
func (cql *CurrentQuotaLimit) 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 "quotaInformation":
if v != nil {
var currentQuotaLimitBase CurrentQuotaLimitBase
err = json.Unmarshal(*v, ¤tQuotaLimitBase)
if err != nil {
return err
}
cql.CurrentQuotaLimitBase = ¤tQuotaLimitBase
}
case "properties":
if v != nil {
var quotaRequestStatusDetails QuotaRequestStatusDetails
err = json.Unmarshal(*v, "aRequestStatusDetails)
if err != nil {
return err
}
cql.QuotaRequestStatusDetails = "aRequestStatusDetails
}
}
}
return nil
}
// CurrentQuotaLimitBase quota properties.
type CurrentQuotaLimitBase struct {
autorest.Response `json:"-"`
// Properties - Quota properties for the resource.
Properties *QuotaProperties `json:"properties,omitempty"`
}
// Error ...
type Error struct {
Error *ExtendedErrorInfo `json:"error,omitempty"`
}
// ExceptionResponse the API error.
type ExceptionResponse struct {
// Error - The API error details.
Error *ServiceError `json:"error,omitempty"`
}
// ExchangeOperationResultResponse exchange operation result
type ExchangeOperationResultResponse struct {
autorest.Response `json:"-"`
// ID - It should match what is used to GET the operation result.
ID *string `json:"id,omitempty"`
// Name - It must match the last segment of the id field, and will typically be a GUID / system generated value.
Name *string `json:"name,omitempty"`
// Status - Status of the operation. Possible values include: 'ExchangeOperationResultStatusSucceeded', 'ExchangeOperationResultStatusFailed', 'ExchangeOperationResultStatusCancelled', 'ExchangeOperationResultStatusPendingRefunds', 'ExchangeOperationResultStatusPendingPurchases'
Status ExchangeOperationResultStatus `json:"status,omitempty"`
Properties *ExchangeResponseProperties `json:"properties,omitempty"`
Error *OperationResultError `json:"error,omitempty"`
}
// ExchangePolicyError error details
type ExchangePolicyError struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// ExchangePolicyErrors exchange policy errors
type ExchangePolicyErrors struct {
// PolicyErrors - Exchange Policy errors
PolicyErrors *[]ExchangePolicyError `json:"policyErrors,omitempty"`
}
// ExchangePostFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type ExchangePostFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ExchangeClient) (ExchangeOperationResultResponse, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ExchangePostFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ExchangePostFuture.Result.
func (future *ExchangePostFuture) result(client ExchangeClient) (eorr ExchangeOperationResultResponse, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "reservations.ExchangePostFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
eorr.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("reservations.ExchangePostFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if eorr.Response.Response, err = future.GetResult(sender); err == nil && eorr.Response.Response.StatusCode != http.StatusNoContent {
eorr, err = client.PostResponder(eorr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "reservations.ExchangePostFuture", "Result", eorr.Response.Response, "Failure responding to request")
}
}
return
}
// ExchangeRequest exchange request
type ExchangeRequest struct {
Properties *ExchangeRequestProperties `json:"properties,omitempty"`
}
// ExchangeRequestProperties exchange request properties
type ExchangeRequestProperties struct {
// SessionID - SessionId that was returned by CalculateExchange API.
SessionID *string `json:"sessionId,omitempty"`
}
// ExchangeResponseProperties exchange response properties
type ExchangeResponseProperties struct {
// SessionID - Exchange session identifier
SessionID *string `json:"sessionId,omitempty"`
NetPayable *Price `json:"netPayable,omitempty"`
RefundsTotal *Price `json:"refundsTotal,omitempty"`
PurchasesTotal *Price `json:"purchasesTotal,omitempty"`
// ReservationsToPurchase - Details of the reservations being purchased
ReservationsToPurchase *[]ToPurchaseExchange `json:"reservationsToPurchase,omitempty"`
// ReservationsToExchange - Details of the reservations being returned
ReservationsToExchange *[]ToReturnForExchange `json:"reservationsToExchange,omitempty"`
PolicyResult *ExchangePolicyErrors `json:"policyResult,omitempty"`
}
// ExtendedErrorInfo ...
type ExtendedErrorInfo struct {
// Code - Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', 'InvalidRequestContent', 'OperationFailed', 'HTTPMethodNotSupported', 'InvalidRequestURI', 'MissingTenantID', 'InvalidTenantID', 'InvalidReservationOrderID', 'InvalidReservationID', 'ReservationIDNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionID', 'InvalidAccessToken', 'InvalidLocationID', 'UnauthenticatedRequestsThrottled', 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIDCannotBeChanged', 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', 'ReservationOrderNotEnabled', 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', 'ReservationOrderIDAlreadyExists', 'RiskCheckFailed', 'CreateQuoteFailed', 'ActivateQuoteFailed', 'NonsupportedAccountID', 'PaymentInstrumentNotFound', 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', 'ReRateOnlyAllowedForEA', 'OperationCannotBePerformedInCurrentState', 'InvalidSingleAppliedScopesCount', 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', 'InvalidRefundQuantity', 'PurchaseError', 'BillingCustomerInputError', 'BillingPaymentInstrumentSoftError', 'BillingPaymentInstrumentHardError', 'BillingTransientError', 'BillingError', 'FulfillmentConfigurationError', 'FulfillmentOutOfStockError', 'FulfillmentTransientError', 'FulfillmentError', 'CalculatePriceFailed'
Code ErrorResponseCode `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// ExtendedStatusInfo ...
type ExtendedStatusInfo struct {
// StatusCode - Possible values include: 'StatusCodeNone', 'StatusCodePending', 'StatusCodeActive', 'StatusCodePurchaseError', 'StatusCodePaymentInstrumentError', 'StatusCodeSplit', 'StatusCodeMerged', 'StatusCodeExpired', 'StatusCodeSucceeded'
StatusCode StatusCode `json:"statusCode,omitempty"`
// Message - The message giving detailed information about the status code.
Message *string `json:"message,omitempty"`
}
// List ...
type List struct {
autorest.Response `json:"-"`
Value *[]Response `json:"value,omitempty"`
// NextLink - Url to get the next page of reservations.
NextLink *string `json:"nextLink,omitempty"`
}
// ListCatalog ...
type ListCatalog struct {
autorest.Response `json:"-"`
Value *[]Catalog `json:"value,omitempty"`
}
// ListIterator provides access to a complete listing of Response values.
type ListIterator struct {
i int
page ListPage
}
// 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 *ListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ListIterator.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 *ListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ListIterator) 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 ListIterator) Response() List {
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 ListIterator) Value() Response {
if !iter.page.NotDone() {
return Response{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the ListIterator type.
func NewListIterator(page ListPage) ListIterator {
return ListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (l List) IsEmpty() bool {
return l.Value == nil || len(*l.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (l List) hasNextLink() bool {
return l.NextLink != nil && len(*l.NextLink) != 0
}
// listPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (l List) listPreparer(ctx context.Context) (*http.Request, error) {
if !l.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(l.NextLink)))
}
// ListPage contains a page of Response values.
type ListPage struct {
fn func(context.Context, List) (List, error)
l List
}
// 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 *ListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ListPage.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.l)
if err != nil {
return err
}
page.l = 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 *ListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ListPage) NotDone() bool {
return !page.l.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page ListPage) Response() List {
return page.l
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page ListPage) Values() []Response {
if page.l.IsEmpty() {
return nil
}
return *page.l.Value
}
// Creates a new instance of the ListPage type.
func NewListPage(cur List, getNextPage func(context.Context, List) (List, error)) ListPage {
return ListPage{
fn: getNextPage,
l: cur,
}
}
// ListResponse ...
type ListResponse struct {
autorest.Response `json:"-"`
Value *[]Response `json:"value,omitempty"`
}
// MergeProperties ...
type MergeProperties struct {
// Sources - Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
Sources *[]string `json:"sources,omitempty"`
}
// MergePropertiesType ...
type MergePropertiesType struct {
// MergeDestination - Reservation Resource Id Created due to the merge. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
MergeDestination *string `json:"mergeDestination,omitempty"`
// MergeSources - Resource Ids of the Source Reservation's merged to form this Reservation. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
MergeSources *[]string `json:"mergeSources,omitempty"`
}
// MergeRequest ...
type MergeRequest struct {
*MergeProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for MergeRequest.
func (mr MergeRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if mr.MergeProperties != nil {
objectMap["properties"] = mr.MergeProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for MergeRequest struct.
func (mr *MergeRequest) 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 "properties":
if v != nil {
var mergeProperties MergeProperties
err = json.Unmarshal(*v, &mergeProperties)
if err != nil {
return err
}
mr.MergeProperties = &mergeProperties
}
}
}
return nil
}
// OperationDisplay ...
type OperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// OperationList ...
type OperationList struct {
autorest.Response `json:"-"`
Value *[]OperationResponse `json:"value,omitempty"`
// NextLink - Url to get the next page of items.
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListIterator provides access to a complete listing of OperationResponse values.
type OperationListIterator struct {
i int
page OperationListPage
}
// 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 *OperationListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.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 *OperationListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OperationListIterator) 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 OperationListIterator) Response() OperationList {
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 OperationListIterator) Value() OperationResponse {
if !iter.page.NotDone() {
return OperationResponse{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the OperationListIterator type.
func NewOperationListIterator(page OperationListPage) OperationListIterator {
return OperationListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ol OperationList) IsEmpty() bool {
return ol.Value == nil || len(*ol.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (ol OperationList) hasNextLink() bool {
return ol.NextLink != nil && len(*ol.NextLink) != 0
}
// operationListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {
if !ol.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ol.NextLink)))
}
// OperationListPage contains a page of OperationResponse values.
type OperationListPage struct {
fn func(context.Context, OperationList) (OperationList, error)
ol OperationList
}
// 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 *OperationListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.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.ol)
if err != nil {
return err
}
page.ol = 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 *OperationListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page OperationListPage) NotDone() bool {
return !page.ol.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page OperationListPage) Response() OperationList {
return page.ol
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page OperationListPage) Values() []OperationResponse {
if page.ol.IsEmpty() {
return nil
}
return *page.ol.Value
}
// Creates a new instance of the OperationListPage type.
func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {
return OperationListPage{
fn: getNextPage,
ol: cur,
}
}
// OperationResponse ...
type OperationResponse struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplay `json:"display,omitempty"`
Origin *string `json:"origin,omitempty"`
}
// OperationResultError required if status == failed or status == canceled.
type OperationResultError struct {
// Code - Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis.
Code *string `json:"code,omitempty"`
// Message - Required if status == failed. Localized. If status == failed, provide an actionable error message indicating what error occurred, and what the user can do to address the issue.
Message *string `json:"message,omitempty"`
}
// OrderBillingPlanInformation information describing the type of billing plan for this reservation.
type OrderBillingPlanInformation struct {
// PricingCurrencyTotal - Amount of money to be paid for the Order. Tax is not included.
PricingCurrencyTotal *Price `json:"pricingCurrencyTotal,omitempty"`
// StartDate - Date when the billing plan has started.
StartDate *date.Date `json:"startDate,omitempty"`
// NextPaymentDueDate - For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off.
NextPaymentDueDate *date.Date `json:"nextPaymentDueDate,omitempty"`
Transactions *[]PaymentDetail `json:"transactions,omitempty"`
}
// OrderList ...
type OrderList struct {
autorest.Response `json:"-"`
Value *[]OrderResponse `json:"value,omitempty"`
// NextLink - Url to get the next page of reservationOrders.
NextLink *string `json:"nextLink,omitempty"`
}
// OrderListIterator provides access to a complete listing of OrderResponse values.
type OrderListIterator struct {
i int
page OrderListPage
}
// 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 *OrderListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OrderListIterator.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 *OrderListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OrderListIterator) 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 OrderListIterator) Response() OrderList {
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 OrderListIterator) Value() OrderResponse {
if !iter.page.NotDone() {
return OrderResponse{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the OrderListIterator type.
func NewOrderListIterator(page OrderListPage) OrderListIterator {
return OrderListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ol OrderList) IsEmpty() bool {
return ol.Value == nil || len(*ol.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (ol OrderList) hasNextLink() bool {
return ol.NextLink != nil && len(*ol.NextLink) != 0
}
// orderListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ol OrderList) orderListPreparer(ctx context.Context) (*http.Request, error) {
if !ol.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ol.NextLink)))
}
// OrderListPage contains a page of OrderResponse values.
type OrderListPage struct {
fn func(context.Context, OrderList) (OrderList, error)
ol OrderList
}
// 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 *OrderListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OrderListPage.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.ol)
if err != nil {
return err
}
page.ol = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making