...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans

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

View as plain text