forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
849 lines (761 loc) · 32 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
package commitmentplans
// 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/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans"
// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code.
type ResourceSkuRestrictionsReasonCode string
const (
// NotAvailableForSubscription ...
NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription"
// QuotaID ...
QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId"
)
// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type.
func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode {
return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID}
}
// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type.
type ResourceSkuRestrictionsType string
const (
// Location ...
Location ResourceSkuRestrictionsType = "location"
// Zone ...
Zone ResourceSkuRestrictionsType = "zone"
)
// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type.
func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType {
return []ResourceSkuRestrictionsType{Location, Zone}
}
// SkuCapacityScaleType enumerates the values for sku capacity scale type.
type SkuCapacityScaleType string
const (
// Automatic ...
Automatic SkuCapacityScaleType = "Automatic"
// Manual ...
Manual SkuCapacityScaleType = "Manual"
// None ...
None SkuCapacityScaleType = "None"
)
// PossibleSkuCapacityScaleTypeValues returns an array of possible values for the SkuCapacityScaleType const type.
func PossibleSkuCapacityScaleTypeValues() []SkuCapacityScaleType {
return []SkuCapacityScaleType{Automatic, Manual, None}
}
// CatalogSku details of a commitment plan SKU.
type CatalogSku struct {
// ResourceType - READ-ONLY; Resource type name
ResourceType *string `json:"resourceType,omitempty"`
// Name - READ-ONLY; SKU name
Name *string `json:"name,omitempty"`
// Tier - READ-ONLY; SKU tier
Tier *string `json:"tier,omitempty"`
// Locations - READ-ONLY; Regions where the SKU is available.
Locations *[]string `json:"locations,omitempty"`
// Capacity - READ-ONLY; SKU scaling information
Capacity *SkuCapacity `json:"capacity,omitempty"`
// Capabilities - READ-ONLY; The capability information for the specified SKU.
Capabilities *[]SkuCapability `json:"capabilities,omitempty"`
// Costs - READ-ONLY; The cost information for the specified SKU.
Costs *[]SkuCost `json:"costs,omitempty"`
// Restrictions - READ-ONLY; Restrictions which would prevent a SKU from being used. This is empty if there are no restrictions.
Restrictions *[]SkuRestrictions `json:"restrictions,omitempty"`
}
// CommitmentAssociation represents the association between a commitment plan and some other resource, such
// as a Machine Learning web service.
type CommitmentAssociation struct {
autorest.Response `json:"-"`
// Etag - An entity tag used to enforce optimistic concurrency.
Etag *string `json:"etag,omitempty"`
// Properties - The properties of the commitment association resource.
Properties *CommitmentAssociationProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource Id.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Tags - User-defined tags for the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CommitmentAssociation.
func (ca CommitmentAssociation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ca.Etag != nil {
objectMap["etag"] = ca.Etag
}
if ca.Properties != nil {
objectMap["properties"] = ca.Properties
}
if ca.Location != nil {
objectMap["location"] = ca.Location
}
if ca.Tags != nil {
objectMap["tags"] = ca.Tags
}
return json.Marshal(objectMap)
}
// CommitmentAssociationListResult a page of commitment association resources.
type CommitmentAssociationListResult struct {
autorest.Response `json:"-"`
// NextLink - A URI to retrieve the next page of results.
NextLink *string `json:"nextLink,omitempty"`
// Value - The set of results for this page.
Value *[]CommitmentAssociation `json:"value,omitempty"`
}
// CommitmentAssociationListResultIterator provides access to a complete listing of CommitmentAssociation
// values.
type CommitmentAssociationListResultIterator struct {
i int
page CommitmentAssociationListResultPage
}
// 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 *CommitmentAssociationListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentAssociationListResultIterator.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 *CommitmentAssociationListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter CommitmentAssociationListResultIterator) 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 CommitmentAssociationListResultIterator) Response() CommitmentAssociationListResult {
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 CommitmentAssociationListResultIterator) Value() CommitmentAssociation {
if !iter.page.NotDone() {
return CommitmentAssociation{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the CommitmentAssociationListResultIterator type.
func NewCommitmentAssociationListResultIterator(page CommitmentAssociationListResultPage) CommitmentAssociationListResultIterator {
return CommitmentAssociationListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (calr CommitmentAssociationListResult) IsEmpty() bool {
return calr.Value == nil || len(*calr.Value) == 0
}
// commitmentAssociationListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (calr CommitmentAssociationListResult) commitmentAssociationListResultPreparer(ctx context.Context) (*http.Request, error) {
if calr.NextLink == nil || len(to.String(calr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(calr.NextLink)))
}
// CommitmentAssociationListResultPage contains a page of CommitmentAssociation values.
type CommitmentAssociationListResultPage struct {
fn func(context.Context, CommitmentAssociationListResult) (CommitmentAssociationListResult, error)
calr CommitmentAssociationListResult
}
// 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 *CommitmentAssociationListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentAssociationListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.calr)
if err != nil {
return err
}
page.calr = next
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 *CommitmentAssociationListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page CommitmentAssociationListResultPage) NotDone() bool {
return !page.calr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page CommitmentAssociationListResultPage) Response() CommitmentAssociationListResult {
return page.calr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page CommitmentAssociationListResultPage) Values() []CommitmentAssociation {
if page.calr.IsEmpty() {
return nil
}
return *page.calr.Value
}
// Creates a new instance of the CommitmentAssociationListResultPage type.
func NewCommitmentAssociationListResultPage(getNextPage func(context.Context, CommitmentAssociationListResult) (CommitmentAssociationListResult, error)) CommitmentAssociationListResultPage {
return CommitmentAssociationListResultPage{fn: getNextPage}
}
// CommitmentAssociationProperties properties of an Azure ML commitment association.
type CommitmentAssociationProperties struct {
// AssociatedResourceID - READ-ONLY; The ID of the resource this association points to, such as the ARM ID of an Azure ML web service.
AssociatedResourceID *string `json:"associatedResourceId,omitempty"`
// CommitmentPlanID - READ-ONLY; The ARM ID of the parent Azure ML commitment plan.
CommitmentPlanID *string `json:"commitmentPlanId,omitempty"`
// CreationDate - READ-ONLY; The date at which this commitment association was created, in ISO 8601 format.
CreationDate *date.Time `json:"creationDate,omitempty"`
}
// CommitmentPlan an Azure ML commitment plan resource.
type CommitmentPlan struct {
autorest.Response `json:"-"`
// Etag - An entity tag used to enforce optimistic concurrency.
Etag *string `json:"etag,omitempty"`
// Properties - READ-ONLY; The commitment plan properties.
Properties *Properties `json:"properties,omitempty"`
// Sku - The commitment plan SKU.
Sku *ResourceSku `json:"sku,omitempty"`
// ID - READ-ONLY; Resource Id.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Tags - User-defined tags for the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for CommitmentPlan.
func (cp CommitmentPlan) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cp.Etag != nil {
objectMap["etag"] = cp.Etag
}
if cp.Sku != nil {
objectMap["sku"] = cp.Sku
}
if cp.Location != nil {
objectMap["location"] = cp.Location
}
if cp.Tags != nil {
objectMap["tags"] = cp.Tags
}
return json.Marshal(objectMap)
}
// ListResult a page of commitment plan resources.
type ListResult struct {
autorest.Response `json:"-"`
// NextLink - A URI to retrieve the next page of results.
NextLink *string `json:"nextLink,omitempty"`
// Value - The set of results for this page.
Value *[]CommitmentPlan `json:"value,omitempty"`
}
// ListResultIterator provides access to a complete listing of CommitmentPlan values.
type ListResultIterator struct {
i int
page ListResultPage
}
// 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 *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.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 *ListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ListResultIterator) 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 ListResultIterator) Response() ListResult {
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 ListResultIterator) Value() CommitmentPlan {
if !iter.page.NotDone() {
return CommitmentPlan{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the ListResultIterator type.
func NewListResultIterator(page ListResultPage) ListResultIterator {
return ListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (lr ListResult) IsEmpty() bool {
return lr.Value == nil || len(*lr.Value) == 0
}
// listResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(lr.NextLink)))
}
// ListResultPage contains a page of CommitmentPlan values.
type ListResultPage struct {
fn func(context.Context, ListResult) (ListResult, error)
lr ListResult
}
// 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 *ListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.lr)
if err != nil {
return err
}
page.lr = next
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 *ListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ListResultPage) NotDone() bool {
return !page.lr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page ListResultPage) Response() ListResult {
return page.lr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page ListResultPage) Values() []CommitmentPlan {
if page.lr.IsEmpty() {
return nil
}
return *page.lr.Value
}
// Creates a new instance of the ListResultPage type.
func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
return ListResultPage{fn: getNextPage}
}
// MoveCommitmentAssociationRequest specifies the destination Azure ML commitment plan for a move
// operation.
type MoveCommitmentAssociationRequest struct {
// DestinationPlanID - The ARM ID of the commitment plan to re-parent the commitment association to.
DestinationPlanID *string `json:"destinationPlanId,omitempty"`
}
// OperationDisplayInfo the API operation info.
type OperationDisplayInfo struct {
// Description - READ-ONLY; The description of the operation.
Description *string `json:"description,omitempty"`
// Operation - READ-ONLY; The action that users can perform, based on their permission level.
Operation *string `json:"operation,omitempty"`
// Provider - READ-ONLY; The service provider.
Provider *string `json:"provider,omitempty"`
// Resource - READ-ONLY; The resource on which the operation is performed.
Resource *string `json:"resource,omitempty"`
}
// OperationEntity an API operation.
type OperationEntity struct {
// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
Name *string `json:"name,omitempty"`
// Display - The API operation info.
Display *OperationDisplayInfo `json:"display,omitempty"`
}
// OperationEntityListResult the list of REST API operations.
type OperationEntityListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The list of operations.
Value *[]OperationEntity `json:"value,omitempty"`
}
// PatchPayload the properties of a commitment plan which may be updated via PATCH.
type PatchPayload struct {
// Tags - User-defined tags for the commitment plan.
Tags map[string]*string `json:"tags"`
// Sku - The commitment plan SKU.
Sku *ResourceSku `json:"sku,omitempty"`
}
// MarshalJSON is the custom marshaler for PatchPayload.
func (pp PatchPayload) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if pp.Tags != nil {
objectMap["tags"] = pp.Tags
}
if pp.Sku != nil {
objectMap["sku"] = pp.Sku
}
return json.Marshal(objectMap)
}
// PlanQuantity represents the quantity a commitment plan provides of a metered resource.
type PlanQuantity struct {
// Allowance - READ-ONLY; The quantity added to the commitment plan at an interval specified by its allowance frequency.
Allowance *float64 `json:"allowance,omitempty"`
// Amount - READ-ONLY; The quantity available to the plan the last time usage was calculated.
Amount *float64 `json:"amount,omitempty"`
// IncludedQuantityMeter - READ-ONLY; The Azure meter for usage against included quantities.
IncludedQuantityMeter *string `json:"includedQuantityMeter,omitempty"`
// OverageMeter - READ-ONLY; The Azure meter for usage which exceeds included quantities.
OverageMeter *string `json:"overageMeter,omitempty"`
}
// PlanUsageHistory represents historical information about usage of the Azure resources associated with a
// commitment plan.
type PlanUsageHistory struct {
// PlanDeletionOverage - Overage incurred as a result of deleting a commitment plan.
PlanDeletionOverage map[string]*float64 `json:"planDeletionOverage"`
// PlanMigrationOverage - Overage incurred as a result of migrating a commitment plan from one SKU to another.
PlanMigrationOverage map[string]*float64 `json:"planMigrationOverage"`
// PlanQuantitiesAfterUsage - Included quantities remaining after usage against the commitment plan's associated resources was calculated.
PlanQuantitiesAfterUsage map[string]*float64 `json:"planQuantitiesAfterUsage"`
// PlanQuantitiesBeforeUsage - Included quantities remaining before usage against the commitment plan's associated resources was calculated.
PlanQuantitiesBeforeUsage map[string]*float64 `json:"planQuantitiesBeforeUsage"`
// PlanUsageOverage - Usage against the commitment plan's associated resources which was not covered by included quantities and is therefore overage.
PlanUsageOverage map[string]*float64 `json:"planUsageOverage"`
// Usage - Usage against the commitment plan's associated resources.
Usage map[string]*float64 `json:"usage"`
// UsageDate - The date of usage, in ISO 8601 format.
UsageDate *date.Time `json:"usageDate,omitempty"`
}
// MarshalJSON is the custom marshaler for PlanUsageHistory.
func (puh PlanUsageHistory) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if puh.PlanDeletionOverage != nil {
objectMap["planDeletionOverage"] = puh.PlanDeletionOverage
}
if puh.PlanMigrationOverage != nil {
objectMap["planMigrationOverage"] = puh.PlanMigrationOverage
}
if puh.PlanQuantitiesAfterUsage != nil {
objectMap["planQuantitiesAfterUsage"] = puh.PlanQuantitiesAfterUsage
}
if puh.PlanQuantitiesBeforeUsage != nil {
objectMap["planQuantitiesBeforeUsage"] = puh.PlanQuantitiesBeforeUsage
}
if puh.PlanUsageOverage != nil {
objectMap["planUsageOverage"] = puh.PlanUsageOverage
}
if puh.Usage != nil {
objectMap["usage"] = puh.Usage
}
if puh.UsageDate != nil {
objectMap["usageDate"] = puh.UsageDate
}
return json.Marshal(objectMap)
}
// PlanUsageHistoryListResult a page of usage history.
type PlanUsageHistoryListResult struct {
autorest.Response `json:"-"`
// NextLink - A URI to retrieve the next page of results.
NextLink *string `json:"nextLink,omitempty"`
// Value - The set of results for this page.
Value *[]PlanUsageHistory `json:"value,omitempty"`
}
// PlanUsageHistoryListResultIterator provides access to a complete listing of PlanUsageHistory values.
type PlanUsageHistoryListResultIterator struct {
i int
page PlanUsageHistoryListResultPage
}
// 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 *PlanUsageHistoryListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PlanUsageHistoryListResultIterator.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 *PlanUsageHistoryListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter PlanUsageHistoryListResultIterator) 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 PlanUsageHistoryListResultIterator) Response() PlanUsageHistoryListResult {
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 PlanUsageHistoryListResultIterator) Value() PlanUsageHistory {
if !iter.page.NotDone() {
return PlanUsageHistory{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the PlanUsageHistoryListResultIterator type.
func NewPlanUsageHistoryListResultIterator(page PlanUsageHistoryListResultPage) PlanUsageHistoryListResultIterator {
return PlanUsageHistoryListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (puhlr PlanUsageHistoryListResult) IsEmpty() bool {
return puhlr.Value == nil || len(*puhlr.Value) == 0
}
// planUsageHistoryListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (puhlr PlanUsageHistoryListResult) planUsageHistoryListResultPreparer(ctx context.Context) (*http.Request, error) {
if puhlr.NextLink == nil || len(to.String(puhlr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(puhlr.NextLink)))
}
// PlanUsageHistoryListResultPage contains a page of PlanUsageHistory values.
type PlanUsageHistoryListResultPage struct {
fn func(context.Context, PlanUsageHistoryListResult) (PlanUsageHistoryListResult, error)
puhlr PlanUsageHistoryListResult
}
// 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 *PlanUsageHistoryListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PlanUsageHistoryListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.puhlr)
if err != nil {
return err
}
page.puhlr = next
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 *PlanUsageHistoryListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page PlanUsageHistoryListResultPage) NotDone() bool {
return !page.puhlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page PlanUsageHistoryListResultPage) Response() PlanUsageHistoryListResult {
return page.puhlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page PlanUsageHistoryListResultPage) Values() []PlanUsageHistory {
if page.puhlr.IsEmpty() {
return nil
}
return *page.puhlr.Value
}
// Creates a new instance of the PlanUsageHistoryListResultPage type.
func NewPlanUsageHistoryListResultPage(getNextPage func(context.Context, PlanUsageHistoryListResult) (PlanUsageHistoryListResult, error)) PlanUsageHistoryListResultPage {
return PlanUsageHistoryListResultPage{fn: getNextPage}
}
// Properties properties of an Azure ML commitment plan.
type Properties struct {
// ChargeForOverage - READ-ONLY; Indicates whether usage beyond the commitment plan's included quantities will be charged.
ChargeForOverage *bool `json:"chargeForOverage,omitempty"`
// ChargeForPlan - READ-ONLY; Indicates whether the commitment plan will incur a charge.
ChargeForPlan *bool `json:"chargeForPlan,omitempty"`
// CreationDate - READ-ONLY; The date at which this commitment plan was created, in ISO 8601 format.
CreationDate *date.Time `json:"creationDate,omitempty"`
// IncludedQuantities - READ-ONLY; The included resource quantities this plan gives you.
IncludedQuantities map[string]*PlanQuantity `json:"includedQuantities"`
// MaxAssociationLimit - READ-ONLY; The maximum number of commitment associations that can be children of this commitment plan.
MaxAssociationLimit *int32 `json:"maxAssociationLimit,omitempty"`
// MaxCapacityLimit - READ-ONLY; The maximum scale-out capacity for this commitment plan.
MaxCapacityLimit *int32 `json:"maxCapacityLimit,omitempty"`
// MinCapacityLimit - READ-ONLY; The minimum scale-out capacity for this commitment plan.
MinCapacityLimit *int32 `json:"minCapacityLimit,omitempty"`
// PlanMeter - READ-ONLY; The Azure meter which will be used to charge for this commitment plan.
PlanMeter *string `json:"planMeter,omitempty"`
// RefillFrequencyInDays - READ-ONLY; The frequency at which this commitment plan's included quantities are refilled.
RefillFrequencyInDays *int32 `json:"refillFrequencyInDays,omitempty"`
// SuspendPlanOnOverage - READ-ONLY; Indicates whether this commitment plan will be moved into a suspended state if usage goes beyond the commitment plan's included quantities.
SuspendPlanOnOverage *bool `json:"suspendPlanOnOverage,omitempty"`
}
// MarshalJSON is the custom marshaler for Properties.
func (p Properties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// Resource common properties of an ARM resource.
type Resource struct {
// ID - READ-ONLY; Resource Id.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Tags - User-defined tags for the resource.
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.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// ResourceSku the SKU of a resource.
type ResourceSku struct {
// Capacity - The scale-out capacity of the resource. 1 is 1x, 2 is 2x, etc. This impacts the quantities and cost of any commitment plan resource.
Capacity *int32 `json:"capacity,omitempty"`
// Name - The SKU name. Along with tier, uniquely identifies the SKU.
Name *string `json:"name,omitempty"`
// Tier - The SKU tier. Along with name, uniquely identifies the SKU.
Tier *string `json:"tier,omitempty"`
}
// SkuCapability describes The SKU capabilities object.
type SkuCapability struct {
// Name - READ-ONLY; The capability name.
Name *string `json:"name,omitempty"`
// Value - READ-ONLY; The capability value.
Value *string `json:"value,omitempty"`
}
// SkuCapacity describes scaling information of a SKU.
type SkuCapacity struct {
// Minimum - READ-ONLY; The minimum capacity.
Minimum *int64 `json:"minimum,omitempty"`
// Maximum - READ-ONLY; The maximum capacity that can be set.
Maximum *int64 `json:"maximum,omitempty"`
// Default - READ-ONLY; The default capacity.
Default *int64 `json:"default,omitempty"`
// ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'Automatic', 'Manual', 'None'
ScaleType SkuCapacityScaleType `json:"scaleType,omitempty"`
}
// SkuCost describes metadata for SKU cost info.
type SkuCost struct {
// MeterID - READ-ONLY; The meter used for this part of a SKU's cost.
MeterID *string `json:"meterID,omitempty"`
// Quantity - READ-ONLY; The multiplier for the meter ID.
Quantity *int64 `json:"quantity,omitempty"`
// ExtendedUnit - READ-ONLY; The overall duration represented by the quantity.
ExtendedUnit *string `json:"extendedUnit,omitempty"`
}
// SkuListResult the list of commitment plan SKUs.
type SkuListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY
Value *[]CatalogSku `json:"value,omitempty"`
}
// SkuRestrictions describes restrictions which would prevent a SKU from being used.
type SkuRestrictions struct {
// Type - READ-ONLY; The type of restrictions. Possible values include: 'Location', 'Zone'
Type ResourceSkuRestrictionsType `json:"type,omitempty"`
// Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted.
Values *[]string `json:"values,omitempty"`
// ReasonCode - READ-ONLY; The reason for restriction. Possible values include: 'QuotaID', 'NotAvailableForSubscription'
ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"`
}