1package commitmentplans
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/date"
25	"github.com/Azure/go-autorest/autorest/to"
26	"github.com/Azure/go-autorest/tracing"
27	"net/http"
28)
29
30// The package's fully qualified name.
31const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans"
32
33// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code.
34type ResourceSkuRestrictionsReasonCode string
35
36const (
37	// NotAvailableForSubscription ...
38	NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription"
39	// QuotaID ...
40	QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId"
41)
42
43// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type.
44func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode {
45	return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID}
46}
47
48// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type.
49type ResourceSkuRestrictionsType string
50
51const (
52	// Location ...
53	Location ResourceSkuRestrictionsType = "location"
54	// Zone ...
55	Zone ResourceSkuRestrictionsType = "zone"
56)
57
58// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type.
59func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType {
60	return []ResourceSkuRestrictionsType{Location, Zone}
61}
62
63// SkuCapacityScaleType enumerates the values for sku capacity scale type.
64type SkuCapacityScaleType string
65
66const (
67	// Automatic ...
68	Automatic SkuCapacityScaleType = "Automatic"
69	// Manual ...
70	Manual SkuCapacityScaleType = "Manual"
71	// None ...
72	None SkuCapacityScaleType = "None"
73)
74
75// PossibleSkuCapacityScaleTypeValues returns an array of possible values for the SkuCapacityScaleType const type.
76func PossibleSkuCapacityScaleTypeValues() []SkuCapacityScaleType {
77	return []SkuCapacityScaleType{Automatic, Manual, None}
78}
79
80// CatalogSku details of a commitment plan SKU.
81type CatalogSku struct {
82	// ResourceType - READ-ONLY; Resource type name
83	ResourceType *string `json:"resourceType,omitempty"`
84	// Name - READ-ONLY; SKU name
85	Name *string `json:"name,omitempty"`
86	// Tier - READ-ONLY; SKU tier
87	Tier *string `json:"tier,omitempty"`
88	// Locations - READ-ONLY; Regions where the SKU is available.
89	Locations *[]string `json:"locations,omitempty"`
90	// Capacity - READ-ONLY; SKU scaling information
91	Capacity *SkuCapacity `json:"capacity,omitempty"`
92	// Capabilities - READ-ONLY; The capability information for the specified SKU.
93	Capabilities *[]SkuCapability `json:"capabilities,omitempty"`
94	// Costs - READ-ONLY; The cost information for the specified SKU.
95	Costs *[]SkuCost `json:"costs,omitempty"`
96	// Restrictions - READ-ONLY; Restrictions which would prevent a SKU from being used. This is empty if there are no restrictions.
97	Restrictions *[]SkuRestrictions `json:"restrictions,omitempty"`
98}
99
100// CommitmentAssociation represents the association between a commitment plan and some other resource, such
101// as a Machine Learning web service.
102type CommitmentAssociation struct {
103	autorest.Response `json:"-"`
104	// Etag - An entity tag used to enforce optimistic concurrency.
105	Etag *string `json:"etag,omitempty"`
106	// Properties - The properties of the commitment association resource.
107	Properties *CommitmentAssociationProperties `json:"properties,omitempty"`
108	// ID - READ-ONLY; Resource Id.
109	ID *string `json:"id,omitempty"`
110	// Name - READ-ONLY; Resource name.
111	Name *string `json:"name,omitempty"`
112	// Location - Resource location.
113	Location *string `json:"location,omitempty"`
114	// Type - READ-ONLY; Resource type.
115	Type *string `json:"type,omitempty"`
116	// Tags - User-defined tags for the resource.
117	Tags map[string]*string `json:"tags"`
118}
119
120// MarshalJSON is the custom marshaler for CommitmentAssociation.
121func (ca CommitmentAssociation) MarshalJSON() ([]byte, error) {
122	objectMap := make(map[string]interface{})
123	if ca.Etag != nil {
124		objectMap["etag"] = ca.Etag
125	}
126	if ca.Properties != nil {
127		objectMap["properties"] = ca.Properties
128	}
129	if ca.Location != nil {
130		objectMap["location"] = ca.Location
131	}
132	if ca.Tags != nil {
133		objectMap["tags"] = ca.Tags
134	}
135	return json.Marshal(objectMap)
136}
137
138// CommitmentAssociationListResult a page of commitment association resources.
139type CommitmentAssociationListResult struct {
140	autorest.Response `json:"-"`
141	// NextLink - A URI to retrieve the next page of results.
142	NextLink *string `json:"nextLink,omitempty"`
143	// Value - The set of results for this page.
144	Value *[]CommitmentAssociation `json:"value,omitempty"`
145}
146
147// CommitmentAssociationListResultIterator provides access to a complete listing of CommitmentAssociation
148// values.
149type CommitmentAssociationListResultIterator struct {
150	i    int
151	page CommitmentAssociationListResultPage
152}
153
154// NextWithContext advances to the next value.  If there was an error making
155// the request the iterator does not advance and the error is returned.
156func (iter *CommitmentAssociationListResultIterator) NextWithContext(ctx context.Context) (err error) {
157	if tracing.IsEnabled() {
158		ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentAssociationListResultIterator.NextWithContext")
159		defer func() {
160			sc := -1
161			if iter.Response().Response.Response != nil {
162				sc = iter.Response().Response.Response.StatusCode
163			}
164			tracing.EndSpan(ctx, sc, err)
165		}()
166	}
167	iter.i++
168	if iter.i < len(iter.page.Values()) {
169		return nil
170	}
171	err = iter.page.NextWithContext(ctx)
172	if err != nil {
173		iter.i--
174		return err
175	}
176	iter.i = 0
177	return nil
178}
179
180// Next advances to the next value.  If there was an error making
181// the request the iterator does not advance and the error is returned.
182// Deprecated: Use NextWithContext() instead.
183func (iter *CommitmentAssociationListResultIterator) Next() error {
184	return iter.NextWithContext(context.Background())
185}
186
187// NotDone returns true if the enumeration should be started or is not yet complete.
188func (iter CommitmentAssociationListResultIterator) NotDone() bool {
189	return iter.page.NotDone() && iter.i < len(iter.page.Values())
190}
191
192// Response returns the raw server response from the last page request.
193func (iter CommitmentAssociationListResultIterator) Response() CommitmentAssociationListResult {
194	return iter.page.Response()
195}
196
197// Value returns the current value or a zero-initialized value if the
198// iterator has advanced beyond the end of the collection.
199func (iter CommitmentAssociationListResultIterator) Value() CommitmentAssociation {
200	if !iter.page.NotDone() {
201		return CommitmentAssociation{}
202	}
203	return iter.page.Values()[iter.i]
204}
205
206// Creates a new instance of the CommitmentAssociationListResultIterator type.
207func NewCommitmentAssociationListResultIterator(page CommitmentAssociationListResultPage) CommitmentAssociationListResultIterator {
208	return CommitmentAssociationListResultIterator{page: page}
209}
210
211// IsEmpty returns true if the ListResult contains no values.
212func (calr CommitmentAssociationListResult) IsEmpty() bool {
213	return calr.Value == nil || len(*calr.Value) == 0
214}
215
216// commitmentAssociationListResultPreparer prepares a request to retrieve the next set of results.
217// It returns nil if no more results exist.
218func (calr CommitmentAssociationListResult) commitmentAssociationListResultPreparer(ctx context.Context) (*http.Request, error) {
219	if calr.NextLink == nil || len(to.String(calr.NextLink)) < 1 {
220		return nil, nil
221	}
222	return autorest.Prepare((&http.Request{}).WithContext(ctx),
223		autorest.AsJSON(),
224		autorest.AsGet(),
225		autorest.WithBaseURL(to.String(calr.NextLink)))
226}
227
228// CommitmentAssociationListResultPage contains a page of CommitmentAssociation values.
229type CommitmentAssociationListResultPage struct {
230	fn   func(context.Context, CommitmentAssociationListResult) (CommitmentAssociationListResult, error)
231	calr CommitmentAssociationListResult
232}
233
234// NextWithContext advances to the next page of values.  If there was an error making
235// the request the page does not advance and the error is returned.
236func (page *CommitmentAssociationListResultPage) NextWithContext(ctx context.Context) (err error) {
237	if tracing.IsEnabled() {
238		ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentAssociationListResultPage.NextWithContext")
239		defer func() {
240			sc := -1
241			if page.Response().Response.Response != nil {
242				sc = page.Response().Response.Response.StatusCode
243			}
244			tracing.EndSpan(ctx, sc, err)
245		}()
246	}
247	next, err := page.fn(ctx, page.calr)
248	if err != nil {
249		return err
250	}
251	page.calr = next
252	return nil
253}
254
255// Next advances to the next page of values.  If there was an error making
256// the request the page does not advance and the error is returned.
257// Deprecated: Use NextWithContext() instead.
258func (page *CommitmentAssociationListResultPage) Next() error {
259	return page.NextWithContext(context.Background())
260}
261
262// NotDone returns true if the page enumeration should be started or is not yet complete.
263func (page CommitmentAssociationListResultPage) NotDone() bool {
264	return !page.calr.IsEmpty()
265}
266
267// Response returns the raw server response from the last page request.
268func (page CommitmentAssociationListResultPage) Response() CommitmentAssociationListResult {
269	return page.calr
270}
271
272// Values returns the slice of values for the current page or nil if there are no values.
273func (page CommitmentAssociationListResultPage) Values() []CommitmentAssociation {
274	if page.calr.IsEmpty() {
275		return nil
276	}
277	return *page.calr.Value
278}
279
280// Creates a new instance of the CommitmentAssociationListResultPage type.
281func NewCommitmentAssociationListResultPage(getNextPage func(context.Context, CommitmentAssociationListResult) (CommitmentAssociationListResult, error)) CommitmentAssociationListResultPage {
282	return CommitmentAssociationListResultPage{fn: getNextPage}
283}
284
285// CommitmentAssociationProperties properties of an Azure ML commitment association.
286type CommitmentAssociationProperties struct {
287	// AssociatedResourceID - READ-ONLY; The ID of the resource this association points to, such as the ARM ID of an Azure ML web service.
288	AssociatedResourceID *string `json:"associatedResourceId,omitempty"`
289	// CommitmentPlanID - READ-ONLY; The ARM ID of the parent Azure ML commitment plan.
290	CommitmentPlanID *string `json:"commitmentPlanId,omitempty"`
291	// CreationDate - READ-ONLY; The date at which this commitment association was created, in ISO 8601 format.
292	CreationDate *date.Time `json:"creationDate,omitempty"`
293}
294
295// CommitmentPlan an Azure ML commitment plan resource.
296type CommitmentPlan struct {
297	autorest.Response `json:"-"`
298	// Etag - An entity tag used to enforce optimistic concurrency.
299	Etag *string `json:"etag,omitempty"`
300	// Properties - READ-ONLY; The commitment plan properties.
301	Properties *Properties `json:"properties,omitempty"`
302	// Sku - The commitment plan SKU.
303	Sku *ResourceSku `json:"sku,omitempty"`
304	// ID - READ-ONLY; Resource Id.
305	ID *string `json:"id,omitempty"`
306	// Name - READ-ONLY; Resource name.
307	Name *string `json:"name,omitempty"`
308	// Location - Resource location.
309	Location *string `json:"location,omitempty"`
310	// Type - READ-ONLY; Resource type.
311	Type *string `json:"type,omitempty"`
312	// Tags - User-defined tags for the resource.
313	Tags map[string]*string `json:"tags"`
314}
315
316// MarshalJSON is the custom marshaler for CommitmentPlan.
317func (cp CommitmentPlan) MarshalJSON() ([]byte, error) {
318	objectMap := make(map[string]interface{})
319	if cp.Etag != nil {
320		objectMap["etag"] = cp.Etag
321	}
322	if cp.Sku != nil {
323		objectMap["sku"] = cp.Sku
324	}
325	if cp.Location != nil {
326		objectMap["location"] = cp.Location
327	}
328	if cp.Tags != nil {
329		objectMap["tags"] = cp.Tags
330	}
331	return json.Marshal(objectMap)
332}
333
334// ListResult a page of commitment plan resources.
335type ListResult struct {
336	autorest.Response `json:"-"`
337	// NextLink - A URI to retrieve the next page of results.
338	NextLink *string `json:"nextLink,omitempty"`
339	// Value - The set of results for this page.
340	Value *[]CommitmentPlan `json:"value,omitempty"`
341}
342
343// ListResultIterator provides access to a complete listing of CommitmentPlan values.
344type ListResultIterator struct {
345	i    int
346	page ListResultPage
347}
348
349// NextWithContext advances to the next value.  If there was an error making
350// the request the iterator does not advance and the error is returned.
351func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
352	if tracing.IsEnabled() {
353		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
354		defer func() {
355			sc := -1
356			if iter.Response().Response.Response != nil {
357				sc = iter.Response().Response.Response.StatusCode
358			}
359			tracing.EndSpan(ctx, sc, err)
360		}()
361	}
362	iter.i++
363	if iter.i < len(iter.page.Values()) {
364		return nil
365	}
366	err = iter.page.NextWithContext(ctx)
367	if err != nil {
368		iter.i--
369		return err
370	}
371	iter.i = 0
372	return nil
373}
374
375// Next advances to the next value.  If there was an error making
376// the request the iterator does not advance and the error is returned.
377// Deprecated: Use NextWithContext() instead.
378func (iter *ListResultIterator) Next() error {
379	return iter.NextWithContext(context.Background())
380}
381
382// NotDone returns true if the enumeration should be started or is not yet complete.
383func (iter ListResultIterator) NotDone() bool {
384	return iter.page.NotDone() && iter.i < len(iter.page.Values())
385}
386
387// Response returns the raw server response from the last page request.
388func (iter ListResultIterator) Response() ListResult {
389	return iter.page.Response()
390}
391
392// Value returns the current value or a zero-initialized value if the
393// iterator has advanced beyond the end of the collection.
394func (iter ListResultIterator) Value() CommitmentPlan {
395	if !iter.page.NotDone() {
396		return CommitmentPlan{}
397	}
398	return iter.page.Values()[iter.i]
399}
400
401// Creates a new instance of the ListResultIterator type.
402func NewListResultIterator(page ListResultPage) ListResultIterator {
403	return ListResultIterator{page: page}
404}
405
406// IsEmpty returns true if the ListResult contains no values.
407func (lr ListResult) IsEmpty() bool {
408	return lr.Value == nil || len(*lr.Value) == 0
409}
410
411// listResultPreparer prepares a request to retrieve the next set of results.
412// It returns nil if no more results exist.
413func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
414	if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 {
415		return nil, nil
416	}
417	return autorest.Prepare((&http.Request{}).WithContext(ctx),
418		autorest.AsJSON(),
419		autorest.AsGet(),
420		autorest.WithBaseURL(to.String(lr.NextLink)))
421}
422
423// ListResultPage contains a page of CommitmentPlan values.
424type ListResultPage struct {
425	fn func(context.Context, ListResult) (ListResult, error)
426	lr ListResult
427}
428
429// NextWithContext advances to the next page of values.  If there was an error making
430// the request the page does not advance and the error is returned.
431func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
432	if tracing.IsEnabled() {
433		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
434		defer func() {
435			sc := -1
436			if page.Response().Response.Response != nil {
437				sc = page.Response().Response.Response.StatusCode
438			}
439			tracing.EndSpan(ctx, sc, err)
440		}()
441	}
442	next, err := page.fn(ctx, page.lr)
443	if err != nil {
444		return err
445	}
446	page.lr = next
447	return nil
448}
449
450// Next advances to the next page of values.  If there was an error making
451// the request the page does not advance and the error is returned.
452// Deprecated: Use NextWithContext() instead.
453func (page *ListResultPage) Next() error {
454	return page.NextWithContext(context.Background())
455}
456
457// NotDone returns true if the page enumeration should be started or is not yet complete.
458func (page ListResultPage) NotDone() bool {
459	return !page.lr.IsEmpty()
460}
461
462// Response returns the raw server response from the last page request.
463func (page ListResultPage) Response() ListResult {
464	return page.lr
465}
466
467// Values returns the slice of values for the current page or nil if there are no values.
468func (page ListResultPage) Values() []CommitmentPlan {
469	if page.lr.IsEmpty() {
470		return nil
471	}
472	return *page.lr.Value
473}
474
475// Creates a new instance of the ListResultPage type.
476func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
477	return ListResultPage{fn: getNextPage}
478}
479
480// MoveCommitmentAssociationRequest specifies the destination Azure ML commitment plan for a move
481// operation.
482type MoveCommitmentAssociationRequest struct {
483	// DestinationPlanID - The ARM ID of the commitment plan to re-parent the commitment association to.
484	DestinationPlanID *string `json:"destinationPlanId,omitempty"`
485}
486
487// OperationDisplayInfo the API operation info.
488type OperationDisplayInfo struct {
489	// Description - READ-ONLY; The description of the operation.
490	Description *string `json:"description,omitempty"`
491	// Operation - READ-ONLY; The action that users can perform, based on their permission level.
492	Operation *string `json:"operation,omitempty"`
493	// Provider - READ-ONLY; The service provider.
494	Provider *string `json:"provider,omitempty"`
495	// Resource - READ-ONLY; The resource on which the operation is performed.
496	Resource *string `json:"resource,omitempty"`
497}
498
499// OperationEntity an API operation.
500type OperationEntity struct {
501	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
502	Name *string `json:"name,omitempty"`
503	// Display - The API operation info.
504	Display *OperationDisplayInfo `json:"display,omitempty"`
505}
506
507// OperationEntityListResult the list of REST API operations.
508type OperationEntityListResult struct {
509	autorest.Response `json:"-"`
510	// Value - READ-ONLY; The list of operations.
511	Value *[]OperationEntity `json:"value,omitempty"`
512}
513
514// PatchPayload the properties of a commitment plan which may be updated via PATCH.
515type PatchPayload struct {
516	// Tags - User-defined tags for the commitment plan.
517	Tags map[string]*string `json:"tags"`
518	// Sku - The commitment plan SKU.
519	Sku *ResourceSku `json:"sku,omitempty"`
520}
521
522// MarshalJSON is the custom marshaler for PatchPayload.
523func (pp PatchPayload) MarshalJSON() ([]byte, error) {
524	objectMap := make(map[string]interface{})
525	if pp.Tags != nil {
526		objectMap["tags"] = pp.Tags
527	}
528	if pp.Sku != nil {
529		objectMap["sku"] = pp.Sku
530	}
531	return json.Marshal(objectMap)
532}
533
534// PlanQuantity represents the quantity a commitment plan provides of a metered resource.
535type PlanQuantity struct {
536	// Allowance - READ-ONLY; The quantity added to the commitment plan at an interval specified by its allowance frequency.
537	Allowance *float64 `json:"allowance,omitempty"`
538	// Amount - READ-ONLY; The quantity available to the plan the last time usage was calculated.
539	Amount *float64 `json:"amount,omitempty"`
540	// IncludedQuantityMeter - READ-ONLY; The Azure meter for usage against included quantities.
541	IncludedQuantityMeter *string `json:"includedQuantityMeter,omitempty"`
542	// OverageMeter - READ-ONLY; The Azure meter for usage which exceeds included quantities.
543	OverageMeter *string `json:"overageMeter,omitempty"`
544}
545
546// PlanUsageHistory represents historical information about usage of the Azure resources associated with a
547// commitment plan.
548type PlanUsageHistory struct {
549	// PlanDeletionOverage - Overage incurred as a result of deleting a commitment plan.
550	PlanDeletionOverage map[string]*float64 `json:"planDeletionOverage"`
551	// PlanMigrationOverage - Overage incurred as a result of migrating a commitment plan from one SKU to another.
552	PlanMigrationOverage map[string]*float64 `json:"planMigrationOverage"`
553	// PlanQuantitiesAfterUsage - Included quantities remaining after usage against the commitment plan's associated resources was calculated.
554	PlanQuantitiesAfterUsage map[string]*float64 `json:"planQuantitiesAfterUsage"`
555	// PlanQuantitiesBeforeUsage - Included quantities remaining before usage against the commitment plan's associated resources was calculated.
556	PlanQuantitiesBeforeUsage map[string]*float64 `json:"planQuantitiesBeforeUsage"`
557	// PlanUsageOverage - Usage against the commitment plan's associated resources which was not covered by included quantities and is therefore overage.
558	PlanUsageOverage map[string]*float64 `json:"planUsageOverage"`
559	// Usage - Usage against the commitment plan's associated resources.
560	Usage map[string]*float64 `json:"usage"`
561	// UsageDate - The date of usage, in ISO 8601 format.
562	UsageDate *date.Time `json:"usageDate,omitempty"`
563}
564
565// MarshalJSON is the custom marshaler for PlanUsageHistory.
566func (puh PlanUsageHistory) MarshalJSON() ([]byte, error) {
567	objectMap := make(map[string]interface{})
568	if puh.PlanDeletionOverage != nil {
569		objectMap["planDeletionOverage"] = puh.PlanDeletionOverage
570	}
571	if puh.PlanMigrationOverage != nil {
572		objectMap["planMigrationOverage"] = puh.PlanMigrationOverage
573	}
574	if puh.PlanQuantitiesAfterUsage != nil {
575		objectMap["planQuantitiesAfterUsage"] = puh.PlanQuantitiesAfterUsage
576	}
577	if puh.PlanQuantitiesBeforeUsage != nil {
578		objectMap["planQuantitiesBeforeUsage"] = puh.PlanQuantitiesBeforeUsage
579	}
580	if puh.PlanUsageOverage != nil {
581		objectMap["planUsageOverage"] = puh.PlanUsageOverage
582	}
583	if puh.Usage != nil {
584		objectMap["usage"] = puh.Usage
585	}
586	if puh.UsageDate != nil {
587		objectMap["usageDate"] = puh.UsageDate
588	}
589	return json.Marshal(objectMap)
590}
591
592// PlanUsageHistoryListResult a page of usage history.
593type PlanUsageHistoryListResult struct {
594	autorest.Response `json:"-"`
595	// NextLink - A URI to retrieve the next page of results.
596	NextLink *string `json:"nextLink,omitempty"`
597	// Value - The set of results for this page.
598	Value *[]PlanUsageHistory `json:"value,omitempty"`
599}
600
601// PlanUsageHistoryListResultIterator provides access to a complete listing of PlanUsageHistory values.
602type PlanUsageHistoryListResultIterator struct {
603	i    int
604	page PlanUsageHistoryListResultPage
605}
606
607// NextWithContext advances to the next value.  If there was an error making
608// the request the iterator does not advance and the error is returned.
609func (iter *PlanUsageHistoryListResultIterator) NextWithContext(ctx context.Context) (err error) {
610	if tracing.IsEnabled() {
611		ctx = tracing.StartSpan(ctx, fqdn+"/PlanUsageHistoryListResultIterator.NextWithContext")
612		defer func() {
613			sc := -1
614			if iter.Response().Response.Response != nil {
615				sc = iter.Response().Response.Response.StatusCode
616			}
617			tracing.EndSpan(ctx, sc, err)
618		}()
619	}
620	iter.i++
621	if iter.i < len(iter.page.Values()) {
622		return nil
623	}
624	err = iter.page.NextWithContext(ctx)
625	if err != nil {
626		iter.i--
627		return err
628	}
629	iter.i = 0
630	return nil
631}
632
633// Next advances to the next value.  If there was an error making
634// the request the iterator does not advance and the error is returned.
635// Deprecated: Use NextWithContext() instead.
636func (iter *PlanUsageHistoryListResultIterator) Next() error {
637	return iter.NextWithContext(context.Background())
638}
639
640// NotDone returns true if the enumeration should be started or is not yet complete.
641func (iter PlanUsageHistoryListResultIterator) NotDone() bool {
642	return iter.page.NotDone() && iter.i < len(iter.page.Values())
643}
644
645// Response returns the raw server response from the last page request.
646func (iter PlanUsageHistoryListResultIterator) Response() PlanUsageHistoryListResult {
647	return iter.page.Response()
648}
649
650// Value returns the current value or a zero-initialized value if the
651// iterator has advanced beyond the end of the collection.
652func (iter PlanUsageHistoryListResultIterator) Value() PlanUsageHistory {
653	if !iter.page.NotDone() {
654		return PlanUsageHistory{}
655	}
656	return iter.page.Values()[iter.i]
657}
658
659// Creates a new instance of the PlanUsageHistoryListResultIterator type.
660func NewPlanUsageHistoryListResultIterator(page PlanUsageHistoryListResultPage) PlanUsageHistoryListResultIterator {
661	return PlanUsageHistoryListResultIterator{page: page}
662}
663
664// IsEmpty returns true if the ListResult contains no values.
665func (puhlr PlanUsageHistoryListResult) IsEmpty() bool {
666	return puhlr.Value == nil || len(*puhlr.Value) == 0
667}
668
669// planUsageHistoryListResultPreparer prepares a request to retrieve the next set of results.
670// It returns nil if no more results exist.
671func (puhlr PlanUsageHistoryListResult) planUsageHistoryListResultPreparer(ctx context.Context) (*http.Request, error) {
672	if puhlr.NextLink == nil || len(to.String(puhlr.NextLink)) < 1 {
673		return nil, nil
674	}
675	return autorest.Prepare((&http.Request{}).WithContext(ctx),
676		autorest.AsJSON(),
677		autorest.AsGet(),
678		autorest.WithBaseURL(to.String(puhlr.NextLink)))
679}
680
681// PlanUsageHistoryListResultPage contains a page of PlanUsageHistory values.
682type PlanUsageHistoryListResultPage struct {
683	fn    func(context.Context, PlanUsageHistoryListResult) (PlanUsageHistoryListResult, error)
684	puhlr PlanUsageHistoryListResult
685}
686
687// NextWithContext advances to the next page of values.  If there was an error making
688// the request the page does not advance and the error is returned.
689func (page *PlanUsageHistoryListResultPage) NextWithContext(ctx context.Context) (err error) {
690	if tracing.IsEnabled() {
691		ctx = tracing.StartSpan(ctx, fqdn+"/PlanUsageHistoryListResultPage.NextWithContext")
692		defer func() {
693			sc := -1
694			if page.Response().Response.Response != nil {
695				sc = page.Response().Response.Response.StatusCode
696			}
697			tracing.EndSpan(ctx, sc, err)
698		}()
699	}
700	next, err := page.fn(ctx, page.puhlr)
701	if err != nil {
702		return err
703	}
704	page.puhlr = next
705	return nil
706}
707
708// Next advances to the next page of values.  If there was an error making
709// the request the page does not advance and the error is returned.
710// Deprecated: Use NextWithContext() instead.
711func (page *PlanUsageHistoryListResultPage) Next() error {
712	return page.NextWithContext(context.Background())
713}
714
715// NotDone returns true if the page enumeration should be started or is not yet complete.
716func (page PlanUsageHistoryListResultPage) NotDone() bool {
717	return !page.puhlr.IsEmpty()
718}
719
720// Response returns the raw server response from the last page request.
721func (page PlanUsageHistoryListResultPage) Response() PlanUsageHistoryListResult {
722	return page.puhlr
723}
724
725// Values returns the slice of values for the current page or nil if there are no values.
726func (page PlanUsageHistoryListResultPage) Values() []PlanUsageHistory {
727	if page.puhlr.IsEmpty() {
728		return nil
729	}
730	return *page.puhlr.Value
731}
732
733// Creates a new instance of the PlanUsageHistoryListResultPage type.
734func NewPlanUsageHistoryListResultPage(getNextPage func(context.Context, PlanUsageHistoryListResult) (PlanUsageHistoryListResult, error)) PlanUsageHistoryListResultPage {
735	return PlanUsageHistoryListResultPage{fn: getNextPage}
736}
737
738// Properties properties of an Azure ML commitment plan.
739type Properties struct {
740	// ChargeForOverage - READ-ONLY; Indicates whether usage beyond the commitment plan's included quantities will be charged.
741	ChargeForOverage *bool `json:"chargeForOverage,omitempty"`
742	// ChargeForPlan - READ-ONLY; Indicates whether the commitment plan will incur a charge.
743	ChargeForPlan *bool `json:"chargeForPlan,omitempty"`
744	// CreationDate - READ-ONLY; The date at which this commitment plan was created, in ISO 8601 format.
745	CreationDate *date.Time `json:"creationDate,omitempty"`
746	// IncludedQuantities - READ-ONLY; The included resource quantities this plan gives you.
747	IncludedQuantities map[string]*PlanQuantity `json:"includedQuantities"`
748	// MaxAssociationLimit - READ-ONLY; The maximum number of commitment associations that can be children of this commitment plan.
749	MaxAssociationLimit *int32 `json:"maxAssociationLimit,omitempty"`
750	// MaxCapacityLimit - READ-ONLY; The maximum scale-out capacity for this commitment plan.
751	MaxCapacityLimit *int32 `json:"maxCapacityLimit,omitempty"`
752	// MinCapacityLimit - READ-ONLY; The minimum scale-out capacity for this commitment plan.
753	MinCapacityLimit *int32 `json:"minCapacityLimit,omitempty"`
754	// PlanMeter - READ-ONLY; The Azure meter which will be used to charge for this commitment plan.
755	PlanMeter *string `json:"planMeter,omitempty"`
756	// RefillFrequencyInDays - READ-ONLY; The frequency at which this commitment plan's included quantities are refilled.
757	RefillFrequencyInDays *int32 `json:"refillFrequencyInDays,omitempty"`
758	// 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.
759	SuspendPlanOnOverage *bool `json:"suspendPlanOnOverage,omitempty"`
760}
761
762// MarshalJSON is the custom marshaler for Properties.
763func (p Properties) MarshalJSON() ([]byte, error) {
764	objectMap := make(map[string]interface{})
765	return json.Marshal(objectMap)
766}
767
768// Resource common properties of an ARM resource.
769type Resource struct {
770	// ID - READ-ONLY; Resource Id.
771	ID *string `json:"id,omitempty"`
772	// Name - READ-ONLY; Resource name.
773	Name *string `json:"name,omitempty"`
774	// Location - Resource location.
775	Location *string `json:"location,omitempty"`
776	// Type - READ-ONLY; Resource type.
777	Type *string `json:"type,omitempty"`
778	// Tags - User-defined tags for the resource.
779	Tags map[string]*string `json:"tags"`
780}
781
782// MarshalJSON is the custom marshaler for Resource.
783func (r Resource) MarshalJSON() ([]byte, error) {
784	objectMap := make(map[string]interface{})
785	if r.Location != nil {
786		objectMap["location"] = r.Location
787	}
788	if r.Tags != nil {
789		objectMap["tags"] = r.Tags
790	}
791	return json.Marshal(objectMap)
792}
793
794// ResourceSku the SKU of a resource.
795type ResourceSku struct {
796	// 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.
797	Capacity *int32 `json:"capacity,omitempty"`
798	// Name - The SKU name. Along with tier, uniquely identifies the SKU.
799	Name *string `json:"name,omitempty"`
800	// Tier - The SKU tier. Along with name, uniquely identifies the SKU.
801	Tier *string `json:"tier,omitempty"`
802}
803
804// SkuCapability describes The SKU capabilities object.
805type SkuCapability struct {
806	// Name - READ-ONLY; The capability name.
807	Name *string `json:"name,omitempty"`
808	// Value - READ-ONLY; The capability value.
809	Value *string `json:"value,omitempty"`
810}
811
812// SkuCapacity describes scaling information of a SKU.
813type SkuCapacity struct {
814	// Minimum - READ-ONLY; The minimum capacity.
815	Minimum *int64 `json:"minimum,omitempty"`
816	// Maximum - READ-ONLY; The maximum capacity that can be set.
817	Maximum *int64 `json:"maximum,omitempty"`
818	// Default - READ-ONLY; The default capacity.
819	Default *int64 `json:"default,omitempty"`
820	// ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'Automatic', 'Manual', 'None'
821	ScaleType SkuCapacityScaleType `json:"scaleType,omitempty"`
822}
823
824// SkuCost describes metadata for SKU cost info.
825type SkuCost struct {
826	// MeterID - READ-ONLY; The meter used for this part of a SKU's cost.
827	MeterID *string `json:"meterID,omitempty"`
828	// Quantity - READ-ONLY; The multiplier for the meter ID.
829	Quantity *int64 `json:"quantity,omitempty"`
830	// ExtendedUnit - READ-ONLY; The overall duration represented by the quantity.
831	ExtendedUnit *string `json:"extendedUnit,omitempty"`
832}
833
834// SkuListResult the list of commitment plan SKUs.
835type SkuListResult struct {
836	autorest.Response `json:"-"`
837	// Value - READ-ONLY
838	Value *[]CatalogSku `json:"value,omitempty"`
839}
840
841// SkuRestrictions describes restrictions which would prevent a SKU from being used.
842type SkuRestrictions struct {
843	// Type - READ-ONLY; The type of restrictions. Possible values include: 'Location', 'Zone'
844	Type ResourceSkuRestrictionsType `json:"type,omitempty"`
845	// 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.
846	Values *[]string `json:"values,omitempty"`
847	// ReasonCode - READ-ONLY; The reason for restriction. Possible values include: 'QuotaID', 'NotAvailableForSubscription'
848	ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"`
849}
850