...

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

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

     1  package experimentation
     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/2017-05-01-preview/experimentation"
    21  
    22  // Account an object that represents a machine learning team account.
    23  type Account struct {
    24  	autorest.Response `json:"-"`
    25  	// AccountProperties - The properties of the machine learning team account.
    26  	*AccountProperties `json:"properties,omitempty"`
    27  	// ID - READ-ONLY; The resource ID.
    28  	ID *string `json:"id,omitempty"`
    29  	// Name - READ-ONLY; The name of the resource.
    30  	Name *string `json:"name,omitempty"`
    31  	// Type - READ-ONLY; The type of the resource.
    32  	Type *string `json:"type,omitempty"`
    33  	// Location - The location of the resource. This cannot be changed after the resource is created.
    34  	Location *string `json:"location,omitempty"`
    35  	// Tags - The tags of the resource.
    36  	Tags map[string]*string `json:"tags"`
    37  }
    38  
    39  // MarshalJSON is the custom marshaler for Account.
    40  func (a Account) MarshalJSON() ([]byte, error) {
    41  	objectMap := make(map[string]interface{})
    42  	if a.AccountProperties != nil {
    43  		objectMap["properties"] = a.AccountProperties
    44  	}
    45  	if a.Location != nil {
    46  		objectMap["location"] = a.Location
    47  	}
    48  	if a.Tags != nil {
    49  		objectMap["tags"] = a.Tags
    50  	}
    51  	return json.Marshal(objectMap)
    52  }
    53  
    54  // UnmarshalJSON is the custom unmarshaler for Account struct.
    55  func (a *Account) UnmarshalJSON(body []byte) error {
    56  	var m map[string]*json.RawMessage
    57  	err := json.Unmarshal(body, &m)
    58  	if err != nil {
    59  		return err
    60  	}
    61  	for k, v := range m {
    62  		switch k {
    63  		case "properties":
    64  			if v != nil {
    65  				var accountProperties AccountProperties
    66  				err = json.Unmarshal(*v, &accountProperties)
    67  				if err != nil {
    68  					return err
    69  				}
    70  				a.AccountProperties = &accountProperties
    71  			}
    72  		case "id":
    73  			if v != nil {
    74  				var ID string
    75  				err = json.Unmarshal(*v, &ID)
    76  				if err != nil {
    77  					return err
    78  				}
    79  				a.ID = &ID
    80  			}
    81  		case "name":
    82  			if v != nil {
    83  				var name string
    84  				err = json.Unmarshal(*v, &name)
    85  				if err != nil {
    86  					return err
    87  				}
    88  				a.Name = &name
    89  			}
    90  		case "type":
    91  			if v != nil {
    92  				var typeVar string
    93  				err = json.Unmarshal(*v, &typeVar)
    94  				if err != nil {
    95  					return err
    96  				}
    97  				a.Type = &typeVar
    98  			}
    99  		case "location":
   100  			if v != nil {
   101  				var location string
   102  				err = json.Unmarshal(*v, &location)
   103  				if err != nil {
   104  					return err
   105  				}
   106  				a.Location = &location
   107  			}
   108  		case "tags":
   109  			if v != nil {
   110  				var tags map[string]*string
   111  				err = json.Unmarshal(*v, &tags)
   112  				if err != nil {
   113  					return err
   114  				}
   115  				a.Tags = tags
   116  			}
   117  		}
   118  	}
   119  
   120  	return nil
   121  }
   122  
   123  // AccountListResult the result of a request to list machine learning team accounts.
   124  type AccountListResult struct {
   125  	autorest.Response `json:"-"`
   126  	// Value - The list of machine learning team accounts. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning team accounts.
   127  	Value *[]Account `json:"value,omitempty"`
   128  	// NextLink - The URI that can be used to request the next list of machine learning team accounts.
   129  	NextLink *string `json:"nextLink,omitempty"`
   130  }
   131  
   132  // AccountListResultIterator provides access to a complete listing of Account values.
   133  type AccountListResultIterator struct {
   134  	i    int
   135  	page AccountListResultPage
   136  }
   137  
   138  // NextWithContext advances to the next value.  If there was an error making
   139  // the request the iterator does not advance and the error is returned.
   140  func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
   141  	if tracing.IsEnabled() {
   142  		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext")
   143  		defer func() {
   144  			sc := -1
   145  			if iter.Response().Response.Response != nil {
   146  				sc = iter.Response().Response.Response.StatusCode
   147  			}
   148  			tracing.EndSpan(ctx, sc, err)
   149  		}()
   150  	}
   151  	iter.i++
   152  	if iter.i < len(iter.page.Values()) {
   153  		return nil
   154  	}
   155  	err = iter.page.NextWithContext(ctx)
   156  	if err != nil {
   157  		iter.i--
   158  		return err
   159  	}
   160  	iter.i = 0
   161  	return nil
   162  }
   163  
   164  // Next advances to the next value.  If there was an error making
   165  // the request the iterator does not advance and the error is returned.
   166  // Deprecated: Use NextWithContext() instead.
   167  func (iter *AccountListResultIterator) Next() error {
   168  	return iter.NextWithContext(context.Background())
   169  }
   170  
   171  // NotDone returns true if the enumeration should be started or is not yet complete.
   172  func (iter AccountListResultIterator) NotDone() bool {
   173  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   174  }
   175  
   176  // Response returns the raw server response from the last page request.
   177  func (iter AccountListResultIterator) Response() AccountListResult {
   178  	return iter.page.Response()
   179  }
   180  
   181  // Value returns the current value or a zero-initialized value if the
   182  // iterator has advanced beyond the end of the collection.
   183  func (iter AccountListResultIterator) Value() Account {
   184  	if !iter.page.NotDone() {
   185  		return Account{}
   186  	}
   187  	return iter.page.Values()[iter.i]
   188  }
   189  
   190  // Creates a new instance of the AccountListResultIterator type.
   191  func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator {
   192  	return AccountListResultIterator{page: page}
   193  }
   194  
   195  // IsEmpty returns true if the ListResult contains no values.
   196  func (alr AccountListResult) IsEmpty() bool {
   197  	return alr.Value == nil || len(*alr.Value) == 0
   198  }
   199  
   200  // hasNextLink returns true if the NextLink is not empty.
   201  func (alr AccountListResult) hasNextLink() bool {
   202  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   203  }
   204  
   205  // accountListResultPreparer prepares a request to retrieve the next set of results.
   206  // It returns nil if no more results exist.
   207  func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) {
   208  	if !alr.hasNextLink() {
   209  		return nil, nil
   210  	}
   211  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   212  		autorest.AsJSON(),
   213  		autorest.AsGet(),
   214  		autorest.WithBaseURL(to.String(alr.NextLink)))
   215  }
   216  
   217  // AccountListResultPage contains a page of Account values.
   218  type AccountListResultPage struct {
   219  	fn  func(context.Context, AccountListResult) (AccountListResult, error)
   220  	alr AccountListResult
   221  }
   222  
   223  // NextWithContext advances to the next page of values.  If there was an error making
   224  // the request the page does not advance and the error is returned.
   225  func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) {
   226  	if tracing.IsEnabled() {
   227  		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext")
   228  		defer func() {
   229  			sc := -1
   230  			if page.Response().Response.Response != nil {
   231  				sc = page.Response().Response.Response.StatusCode
   232  			}
   233  			tracing.EndSpan(ctx, sc, err)
   234  		}()
   235  	}
   236  	for {
   237  		next, err := page.fn(ctx, page.alr)
   238  		if err != nil {
   239  			return err
   240  		}
   241  		page.alr = next
   242  		if !next.hasNextLink() || !next.IsEmpty() {
   243  			break
   244  		}
   245  	}
   246  	return nil
   247  }
   248  
   249  // Next advances to the next page of values.  If there was an error making
   250  // the request the page does not advance and the error is returned.
   251  // Deprecated: Use NextWithContext() instead.
   252  func (page *AccountListResultPage) Next() error {
   253  	return page.NextWithContext(context.Background())
   254  }
   255  
   256  // NotDone returns true if the page enumeration should be started or is not yet complete.
   257  func (page AccountListResultPage) NotDone() bool {
   258  	return !page.alr.IsEmpty()
   259  }
   260  
   261  // Response returns the raw server response from the last page request.
   262  func (page AccountListResultPage) Response() AccountListResult {
   263  	return page.alr
   264  }
   265  
   266  // Values returns the slice of values for the current page or nil if there are no values.
   267  func (page AccountListResultPage) Values() []Account {
   268  	if page.alr.IsEmpty() {
   269  		return nil
   270  	}
   271  	return *page.alr.Value
   272  }
   273  
   274  // Creates a new instance of the AccountListResultPage type.
   275  func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage {
   276  	return AccountListResultPage{
   277  		fn:  getNextPage,
   278  		alr: cur,
   279  	}
   280  }
   281  
   282  // AccountProperties the properties of a machine learning team account.
   283  type AccountProperties struct {
   284  	// VsoAccountID - The fully qualified arm id of the vso account to be used for this team account.
   285  	VsoAccountID *string `json:"vsoAccountId,omitempty"`
   286  	// AccountID - READ-ONLY; The immutable id associated with this team account.
   287  	AccountID *string `json:"accountId,omitempty"`
   288  	// Description - The description of this workspace.
   289  	Description *string `json:"description,omitempty"`
   290  	// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
   291  	FriendlyName *string `json:"friendlyName,omitempty"`
   292  	// KeyVaultID - The fully qualified arm id of the user key vault.
   293  	KeyVaultID *string `json:"keyVaultId,omitempty"`
   294  	// Seats - The no of users/seats who can access this team account. This property defines the charge on the team account.
   295  	Seats *string `json:"seats,omitempty"`
   296  	// DiscoveryURI - READ-ONLY; The uri for this machine learning team account.
   297  	DiscoveryURI *string `json:"discoveryUri,omitempty"`
   298  	// CreationDate - READ-ONLY; The creation date of the machine learning team account in ISO8601 format.
   299  	CreationDate *date.Time `json:"creationDate,omitempty"`
   300  	// StorageAccount - The properties of the storage account for the machine learning team account.
   301  	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
   302  	// ProvisioningState - READ-ONLY; The current deployment state of team account resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
   303  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   304  }
   305  
   306  // MarshalJSON is the custom marshaler for AccountProperties.
   307  func (ap AccountProperties) MarshalJSON() ([]byte, error) {
   308  	objectMap := make(map[string]interface{})
   309  	if ap.VsoAccountID != nil {
   310  		objectMap["vsoAccountId"] = ap.VsoAccountID
   311  	}
   312  	if ap.Description != nil {
   313  		objectMap["description"] = ap.Description
   314  	}
   315  	if ap.FriendlyName != nil {
   316  		objectMap["friendlyName"] = ap.FriendlyName
   317  	}
   318  	if ap.KeyVaultID != nil {
   319  		objectMap["keyVaultId"] = ap.KeyVaultID
   320  	}
   321  	if ap.Seats != nil {
   322  		objectMap["seats"] = ap.Seats
   323  	}
   324  	if ap.StorageAccount != nil {
   325  		objectMap["storageAccount"] = ap.StorageAccount
   326  	}
   327  	return json.Marshal(objectMap)
   328  }
   329  
   330  // AccountPropertiesUpdateParameters the parameters for updating the properties of a machine learning team
   331  // account.
   332  type AccountPropertiesUpdateParameters struct {
   333  	// Description - The description of this workspace.
   334  	Description *string `json:"description,omitempty"`
   335  	// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
   336  	FriendlyName *string `json:"friendlyName,omitempty"`
   337  	// Seats - The no of users/seats who can access this team account. This property defines the charge on the team account.
   338  	Seats *string `json:"seats,omitempty"`
   339  	// StorageAccountKey - The key for storage account associated with this team account
   340  	StorageAccountKey *string `json:"storageAccountKey,omitempty"`
   341  }
   342  
   343  // AccountUpdateParameters the parameters for updating a machine learning team account.
   344  type AccountUpdateParameters struct {
   345  	// Tags - The resource tags for the machine learning team account.
   346  	Tags map[string]*string `json:"tags"`
   347  	// AccountPropertiesUpdateParameters - The properties that the machine learning team account will be updated with.
   348  	*AccountPropertiesUpdateParameters `json:"properties,omitempty"`
   349  }
   350  
   351  // MarshalJSON is the custom marshaler for AccountUpdateParameters.
   352  func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
   353  	objectMap := make(map[string]interface{})
   354  	if aup.Tags != nil {
   355  		objectMap["tags"] = aup.Tags
   356  	}
   357  	if aup.AccountPropertiesUpdateParameters != nil {
   358  		objectMap["properties"] = aup.AccountPropertiesUpdateParameters
   359  	}
   360  	return json.Marshal(objectMap)
   361  }
   362  
   363  // UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
   364  func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error {
   365  	var m map[string]*json.RawMessage
   366  	err := json.Unmarshal(body, &m)
   367  	if err != nil {
   368  		return err
   369  	}
   370  	for k, v := range m {
   371  		switch k {
   372  		case "tags":
   373  			if v != nil {
   374  				var tags map[string]*string
   375  				err = json.Unmarshal(*v, &tags)
   376  				if err != nil {
   377  					return err
   378  				}
   379  				aup.Tags = tags
   380  			}
   381  		case "properties":
   382  			if v != nil {
   383  				var accountPropertiesUpdateParameters AccountPropertiesUpdateParameters
   384  				err = json.Unmarshal(*v, &accountPropertiesUpdateParameters)
   385  				if err != nil {
   386  					return err
   387  				}
   388  				aup.AccountPropertiesUpdateParameters = &accountPropertiesUpdateParameters
   389  			}
   390  		}
   391  	}
   392  
   393  	return nil
   394  }
   395  
   396  // ErrorResponse the error response send when an operation fails.
   397  type ErrorResponse struct {
   398  	// Code - error code
   399  	Code *string `json:"code,omitempty"`
   400  	// Message - error message
   401  	Message *string `json:"message,omitempty"`
   402  }
   403  
   404  // Operation azure Machine Learning team account REST API operation
   405  type Operation struct {
   406  	// Name - Operation name: {provider}/{resource}/{operation}
   407  	Name *string `json:"name,omitempty"`
   408  	// Display - Display name of operation
   409  	Display *OperationDisplay `json:"display,omitempty"`
   410  }
   411  
   412  // OperationDisplay display name of operation
   413  type OperationDisplay struct {
   414  	// Provider - The resource provider name: Microsoft.MachineLearningExperimentation
   415  	Provider *string `json:"provider,omitempty"`
   416  	// Resource - The resource on which the operation is performed.
   417  	Resource *string `json:"resource,omitempty"`
   418  	// Operation - The operation that users can perform.
   419  	Operation *string `json:"operation,omitempty"`
   420  	// Description - The description for the operation.
   421  	Description *string `json:"description,omitempty"`
   422  }
   423  
   424  // OperationListResult an array of operations supported by the resource provider.
   425  type OperationListResult struct {
   426  	autorest.Response `json:"-"`
   427  	// Value - List of AML team account operations supported by the AML team account resource provider.
   428  	Value *[]Operation `json:"value,omitempty"`
   429  }
   430  
   431  // Project an object that represents a machine learning project.
   432  type Project struct {
   433  	autorest.Response `json:"-"`
   434  	// ProjectProperties - The properties of the Project.
   435  	*ProjectProperties `json:"properties,omitempty"`
   436  	// ID - READ-ONLY; The resource ID.
   437  	ID *string `json:"id,omitempty"`
   438  	// Name - READ-ONLY; The name of the resource.
   439  	Name *string `json:"name,omitempty"`
   440  	// Type - READ-ONLY; The type of the resource.
   441  	Type *string `json:"type,omitempty"`
   442  	// Location - The location of the resource. This cannot be changed after the resource is created.
   443  	Location *string `json:"location,omitempty"`
   444  	// Tags - The tags of the resource.
   445  	Tags map[string]*string `json:"tags"`
   446  }
   447  
   448  // MarshalJSON is the custom marshaler for Project.
   449  func (p Project) MarshalJSON() ([]byte, error) {
   450  	objectMap := make(map[string]interface{})
   451  	if p.ProjectProperties != nil {
   452  		objectMap["properties"] = p.ProjectProperties
   453  	}
   454  	if p.Location != nil {
   455  		objectMap["location"] = p.Location
   456  	}
   457  	if p.Tags != nil {
   458  		objectMap["tags"] = p.Tags
   459  	}
   460  	return json.Marshal(objectMap)
   461  }
   462  
   463  // UnmarshalJSON is the custom unmarshaler for Project struct.
   464  func (p *Project) UnmarshalJSON(body []byte) error {
   465  	var m map[string]*json.RawMessage
   466  	err := json.Unmarshal(body, &m)
   467  	if err != nil {
   468  		return err
   469  	}
   470  	for k, v := range m {
   471  		switch k {
   472  		case "properties":
   473  			if v != nil {
   474  				var projectProperties ProjectProperties
   475  				err = json.Unmarshal(*v, &projectProperties)
   476  				if err != nil {
   477  					return err
   478  				}
   479  				p.ProjectProperties = &projectProperties
   480  			}
   481  		case "id":
   482  			if v != nil {
   483  				var ID string
   484  				err = json.Unmarshal(*v, &ID)
   485  				if err != nil {
   486  					return err
   487  				}
   488  				p.ID = &ID
   489  			}
   490  		case "name":
   491  			if v != nil {
   492  				var name string
   493  				err = json.Unmarshal(*v, &name)
   494  				if err != nil {
   495  					return err
   496  				}
   497  				p.Name = &name
   498  			}
   499  		case "type":
   500  			if v != nil {
   501  				var typeVar string
   502  				err = json.Unmarshal(*v, &typeVar)
   503  				if err != nil {
   504  					return err
   505  				}
   506  				p.Type = &typeVar
   507  			}
   508  		case "location":
   509  			if v != nil {
   510  				var location string
   511  				err = json.Unmarshal(*v, &location)
   512  				if err != nil {
   513  					return err
   514  				}
   515  				p.Location = &location
   516  			}
   517  		case "tags":
   518  			if v != nil {
   519  				var tags map[string]*string
   520  				err = json.Unmarshal(*v, &tags)
   521  				if err != nil {
   522  					return err
   523  				}
   524  				p.Tags = tags
   525  			}
   526  		}
   527  	}
   528  
   529  	return nil
   530  }
   531  
   532  // ProjectListResult the result of a request to list projects.
   533  type ProjectListResult struct {
   534  	autorest.Response `json:"-"`
   535  	// Value - The list of projects. Since this list may be incomplete, the nextLink field should be used to request the next list of projects.
   536  	Value *[]Project `json:"value,omitempty"`
   537  	// NextLink - The URI that can be used to request the next list of projects.
   538  	NextLink *string `json:"nextLink,omitempty"`
   539  }
   540  
   541  // ProjectListResultIterator provides access to a complete listing of Project values.
   542  type ProjectListResultIterator struct {
   543  	i    int
   544  	page ProjectListResultPage
   545  }
   546  
   547  // NextWithContext advances to the next value.  If there was an error making
   548  // the request the iterator does not advance and the error is returned.
   549  func (iter *ProjectListResultIterator) NextWithContext(ctx context.Context) (err error) {
   550  	if tracing.IsEnabled() {
   551  		ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListResultIterator.NextWithContext")
   552  		defer func() {
   553  			sc := -1
   554  			if iter.Response().Response.Response != nil {
   555  				sc = iter.Response().Response.Response.StatusCode
   556  			}
   557  			tracing.EndSpan(ctx, sc, err)
   558  		}()
   559  	}
   560  	iter.i++
   561  	if iter.i < len(iter.page.Values()) {
   562  		return nil
   563  	}
   564  	err = iter.page.NextWithContext(ctx)
   565  	if err != nil {
   566  		iter.i--
   567  		return err
   568  	}
   569  	iter.i = 0
   570  	return nil
   571  }
   572  
   573  // Next advances to the next value.  If there was an error making
   574  // the request the iterator does not advance and the error is returned.
   575  // Deprecated: Use NextWithContext() instead.
   576  func (iter *ProjectListResultIterator) Next() error {
   577  	return iter.NextWithContext(context.Background())
   578  }
   579  
   580  // NotDone returns true if the enumeration should be started or is not yet complete.
   581  func (iter ProjectListResultIterator) NotDone() bool {
   582  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   583  }
   584  
   585  // Response returns the raw server response from the last page request.
   586  func (iter ProjectListResultIterator) Response() ProjectListResult {
   587  	return iter.page.Response()
   588  }
   589  
   590  // Value returns the current value or a zero-initialized value if the
   591  // iterator has advanced beyond the end of the collection.
   592  func (iter ProjectListResultIterator) Value() Project {
   593  	if !iter.page.NotDone() {
   594  		return Project{}
   595  	}
   596  	return iter.page.Values()[iter.i]
   597  }
   598  
   599  // Creates a new instance of the ProjectListResultIterator type.
   600  func NewProjectListResultIterator(page ProjectListResultPage) ProjectListResultIterator {
   601  	return ProjectListResultIterator{page: page}
   602  }
   603  
   604  // IsEmpty returns true if the ListResult contains no values.
   605  func (plr ProjectListResult) IsEmpty() bool {
   606  	return plr.Value == nil || len(*plr.Value) == 0
   607  }
   608  
   609  // hasNextLink returns true if the NextLink is not empty.
   610  func (plr ProjectListResult) hasNextLink() bool {
   611  	return plr.NextLink != nil && len(*plr.NextLink) != 0
   612  }
   613  
   614  // projectListResultPreparer prepares a request to retrieve the next set of results.
   615  // It returns nil if no more results exist.
   616  func (plr ProjectListResult) projectListResultPreparer(ctx context.Context) (*http.Request, error) {
   617  	if !plr.hasNextLink() {
   618  		return nil, nil
   619  	}
   620  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   621  		autorest.AsJSON(),
   622  		autorest.AsGet(),
   623  		autorest.WithBaseURL(to.String(plr.NextLink)))
   624  }
   625  
   626  // ProjectListResultPage contains a page of Project values.
   627  type ProjectListResultPage struct {
   628  	fn  func(context.Context, ProjectListResult) (ProjectListResult, error)
   629  	plr ProjectListResult
   630  }
   631  
   632  // NextWithContext advances to the next page of values.  If there was an error making
   633  // the request the page does not advance and the error is returned.
   634  func (page *ProjectListResultPage) NextWithContext(ctx context.Context) (err error) {
   635  	if tracing.IsEnabled() {
   636  		ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListResultPage.NextWithContext")
   637  		defer func() {
   638  			sc := -1
   639  			if page.Response().Response.Response != nil {
   640  				sc = page.Response().Response.Response.StatusCode
   641  			}
   642  			tracing.EndSpan(ctx, sc, err)
   643  		}()
   644  	}
   645  	for {
   646  		next, err := page.fn(ctx, page.plr)
   647  		if err != nil {
   648  			return err
   649  		}
   650  		page.plr = next
   651  		if !next.hasNextLink() || !next.IsEmpty() {
   652  			break
   653  		}
   654  	}
   655  	return nil
   656  }
   657  
   658  // Next advances to the next page of values.  If there was an error making
   659  // the request the page does not advance and the error is returned.
   660  // Deprecated: Use NextWithContext() instead.
   661  func (page *ProjectListResultPage) Next() error {
   662  	return page.NextWithContext(context.Background())
   663  }
   664  
   665  // NotDone returns true if the page enumeration should be started or is not yet complete.
   666  func (page ProjectListResultPage) NotDone() bool {
   667  	return !page.plr.IsEmpty()
   668  }
   669  
   670  // Response returns the raw server response from the last page request.
   671  func (page ProjectListResultPage) Response() ProjectListResult {
   672  	return page.plr
   673  }
   674  
   675  // Values returns the slice of values for the current page or nil if there are no values.
   676  func (page ProjectListResultPage) Values() []Project {
   677  	if page.plr.IsEmpty() {
   678  		return nil
   679  	}
   680  	return *page.plr.Value
   681  }
   682  
   683  // Creates a new instance of the ProjectListResultPage type.
   684  func NewProjectListResultPage(cur ProjectListResult, getNextPage func(context.Context, ProjectListResult) (ProjectListResult, error)) ProjectListResultPage {
   685  	return ProjectListResultPage{
   686  		fn:  getNextPage,
   687  		plr: cur,
   688  	}
   689  }
   690  
   691  // ProjectProperties the properties of a machine learning project.
   692  type ProjectProperties struct {
   693  	// Description - The description of this project.
   694  	Description *string `json:"description,omitempty"`
   695  	// AccountID - READ-ONLY; The immutable id of the team account which contains this project.
   696  	AccountID *string `json:"accountId,omitempty"`
   697  	// WorkspaceID - READ-ONLY; The immutable id of the workspace which contains this project.
   698  	WorkspaceID *string `json:"workspaceId,omitempty"`
   699  	// ProjectID - READ-ONLY; The immutable id of this project.
   700  	ProjectID *string `json:"projectId,omitempty"`
   701  	// Gitrepo - The reference to git repo for this project.
   702  	Gitrepo *string `json:"gitrepo,omitempty"`
   703  	// FriendlyName - The friendly name for this project.
   704  	FriendlyName *string `json:"friendlyName,omitempty"`
   705  	// CreationDate - READ-ONLY; The creation date of the project in ISO8601 format.
   706  	CreationDate *date.Time `json:"creationDate,omitempty"`
   707  	// ProvisioningState - READ-ONLY; The current deployment state of project resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
   708  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   709  }
   710  
   711  // MarshalJSON is the custom marshaler for ProjectProperties.
   712  func (pp ProjectProperties) MarshalJSON() ([]byte, error) {
   713  	objectMap := make(map[string]interface{})
   714  	if pp.Description != nil {
   715  		objectMap["description"] = pp.Description
   716  	}
   717  	if pp.Gitrepo != nil {
   718  		objectMap["gitrepo"] = pp.Gitrepo
   719  	}
   720  	if pp.FriendlyName != nil {
   721  		objectMap["friendlyName"] = pp.FriendlyName
   722  	}
   723  	return json.Marshal(objectMap)
   724  }
   725  
   726  // ProjectPropertiesUpdateParameters the parameters for updating the properties of a project.
   727  type ProjectPropertiesUpdateParameters struct {
   728  	// FriendlyName - The friendly name for this project.
   729  	FriendlyName *string `json:"friendlyName,omitempty"`
   730  	// Description - The description of this project.
   731  	Description *string `json:"description,omitempty"`
   732  	// Gitrepo - The reference to git repo for this project.
   733  	Gitrepo *string `json:"gitrepo,omitempty"`
   734  }
   735  
   736  // ProjectUpdateParameters the parameters for updating a machine learning project.
   737  type ProjectUpdateParameters struct {
   738  	// Tags - The resource tags for the machine learning project.
   739  	Tags map[string]*string `json:"tags"`
   740  	// ProjectPropertiesUpdateParameters - The properties that the project will be updated with.
   741  	*ProjectPropertiesUpdateParameters `json:"properties,omitempty"`
   742  }
   743  
   744  // MarshalJSON is the custom marshaler for ProjectUpdateParameters.
   745  func (pup ProjectUpdateParameters) MarshalJSON() ([]byte, error) {
   746  	objectMap := make(map[string]interface{})
   747  	if pup.Tags != nil {
   748  		objectMap["tags"] = pup.Tags
   749  	}
   750  	if pup.ProjectPropertiesUpdateParameters != nil {
   751  		objectMap["properties"] = pup.ProjectPropertiesUpdateParameters
   752  	}
   753  	return json.Marshal(objectMap)
   754  }
   755  
   756  // UnmarshalJSON is the custom unmarshaler for ProjectUpdateParameters struct.
   757  func (pup *ProjectUpdateParameters) UnmarshalJSON(body []byte) error {
   758  	var m map[string]*json.RawMessage
   759  	err := json.Unmarshal(body, &m)
   760  	if err != nil {
   761  		return err
   762  	}
   763  	for k, v := range m {
   764  		switch k {
   765  		case "tags":
   766  			if v != nil {
   767  				var tags map[string]*string
   768  				err = json.Unmarshal(*v, &tags)
   769  				if err != nil {
   770  					return err
   771  				}
   772  				pup.Tags = tags
   773  			}
   774  		case "properties":
   775  			if v != nil {
   776  				var projectPropertiesUpdateParameters ProjectPropertiesUpdateParameters
   777  				err = json.Unmarshal(*v, &projectPropertiesUpdateParameters)
   778  				if err != nil {
   779  					return err
   780  				}
   781  				pup.ProjectPropertiesUpdateParameters = &projectPropertiesUpdateParameters
   782  			}
   783  		}
   784  	}
   785  
   786  	return nil
   787  }
   788  
   789  // Resource an Azure resource.
   790  type Resource struct {
   791  	// ID - READ-ONLY; The resource ID.
   792  	ID *string `json:"id,omitempty"`
   793  	// Name - READ-ONLY; The name of the resource.
   794  	Name *string `json:"name,omitempty"`
   795  	// Type - READ-ONLY; The type of the resource.
   796  	Type *string `json:"type,omitempty"`
   797  	// Location - The location of the resource. This cannot be changed after the resource is created.
   798  	Location *string `json:"location,omitempty"`
   799  	// Tags - The tags of the resource.
   800  	Tags map[string]*string `json:"tags"`
   801  }
   802  
   803  // MarshalJSON is the custom marshaler for Resource.
   804  func (r Resource) MarshalJSON() ([]byte, error) {
   805  	objectMap := make(map[string]interface{})
   806  	if r.Location != nil {
   807  		objectMap["location"] = r.Location
   808  	}
   809  	if r.Tags != nil {
   810  		objectMap["tags"] = r.Tags
   811  	}
   812  	return json.Marshal(objectMap)
   813  }
   814  
   815  // StorageAccountProperties the properties of a storage account for a machine learning team account.
   816  type StorageAccountProperties struct {
   817  	// StorageAccountID - The fully qualified arm Id of the storage account.
   818  	StorageAccountID *string `json:"storageAccountId,omitempty"`
   819  	// AccessKey - The access key to the storage account.
   820  	AccessKey *string `json:"accessKey,omitempty"`
   821  }
   822  
   823  // Workspace an object that represents a machine learning team account workspace.
   824  type Workspace struct {
   825  	autorest.Response `json:"-"`
   826  	// WorkspaceProperties - The properties of the machine learning team account workspace.
   827  	*WorkspaceProperties `json:"properties,omitempty"`
   828  	// ID - READ-ONLY; The resource ID.
   829  	ID *string `json:"id,omitempty"`
   830  	// Name - READ-ONLY; The name of the resource.
   831  	Name *string `json:"name,omitempty"`
   832  	// Type - READ-ONLY; The type of the resource.
   833  	Type *string `json:"type,omitempty"`
   834  	// Location - The location of the resource. This cannot be changed after the resource is created.
   835  	Location *string `json:"location,omitempty"`
   836  	// Tags - The tags of the resource.
   837  	Tags map[string]*string `json:"tags"`
   838  }
   839  
   840  // MarshalJSON is the custom marshaler for Workspace.
   841  func (w Workspace) MarshalJSON() ([]byte, error) {
   842  	objectMap := make(map[string]interface{})
   843  	if w.WorkspaceProperties != nil {
   844  		objectMap["properties"] = w.WorkspaceProperties
   845  	}
   846  	if w.Location != nil {
   847  		objectMap["location"] = w.Location
   848  	}
   849  	if w.Tags != nil {
   850  		objectMap["tags"] = w.Tags
   851  	}
   852  	return json.Marshal(objectMap)
   853  }
   854  
   855  // UnmarshalJSON is the custom unmarshaler for Workspace struct.
   856  func (w *Workspace) UnmarshalJSON(body []byte) error {
   857  	var m map[string]*json.RawMessage
   858  	err := json.Unmarshal(body, &m)
   859  	if err != nil {
   860  		return err
   861  	}
   862  	for k, v := range m {
   863  		switch k {
   864  		case "properties":
   865  			if v != nil {
   866  				var workspaceProperties WorkspaceProperties
   867  				err = json.Unmarshal(*v, &workspaceProperties)
   868  				if err != nil {
   869  					return err
   870  				}
   871  				w.WorkspaceProperties = &workspaceProperties
   872  			}
   873  		case "id":
   874  			if v != nil {
   875  				var ID string
   876  				err = json.Unmarshal(*v, &ID)
   877  				if err != nil {
   878  					return err
   879  				}
   880  				w.ID = &ID
   881  			}
   882  		case "name":
   883  			if v != nil {
   884  				var name string
   885  				err = json.Unmarshal(*v, &name)
   886  				if err != nil {
   887  					return err
   888  				}
   889  				w.Name = &name
   890  			}
   891  		case "type":
   892  			if v != nil {
   893  				var typeVar string
   894  				err = json.Unmarshal(*v, &typeVar)
   895  				if err != nil {
   896  					return err
   897  				}
   898  				w.Type = &typeVar
   899  			}
   900  		case "location":
   901  			if v != nil {
   902  				var location string
   903  				err = json.Unmarshal(*v, &location)
   904  				if err != nil {
   905  					return err
   906  				}
   907  				w.Location = &location
   908  			}
   909  		case "tags":
   910  			if v != nil {
   911  				var tags map[string]*string
   912  				err = json.Unmarshal(*v, &tags)
   913  				if err != nil {
   914  					return err
   915  				}
   916  				w.Tags = tags
   917  			}
   918  		}
   919  	}
   920  
   921  	return nil
   922  }
   923  
   924  // WorkspaceListResult the result of a request to list machine learning team account workspaces.
   925  type WorkspaceListResult struct {
   926  	autorest.Response `json:"-"`
   927  	// Value - The list of machine learning team account workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning team accounts.
   928  	Value *[]Workspace `json:"value,omitempty"`
   929  	// NextLink - The URI that can be used to request the next list of machine learning workspaces.
   930  	NextLink *string `json:"nextLink,omitempty"`
   931  }
   932  
   933  // WorkspaceListResultIterator provides access to a complete listing of Workspace values.
   934  type WorkspaceListResultIterator struct {
   935  	i    int
   936  	page WorkspaceListResultPage
   937  }
   938  
   939  // NextWithContext advances to the next value.  If there was an error making
   940  // the request the iterator does not advance and the error is returned.
   941  func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) {
   942  	if tracing.IsEnabled() {
   943  		ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext")
   944  		defer func() {
   945  			sc := -1
   946  			if iter.Response().Response.Response != nil {
   947  				sc = iter.Response().Response.Response.StatusCode
   948  			}
   949  			tracing.EndSpan(ctx, sc, err)
   950  		}()
   951  	}
   952  	iter.i++
   953  	if iter.i < len(iter.page.Values()) {
   954  		return nil
   955  	}
   956  	err = iter.page.NextWithContext(ctx)
   957  	if err != nil {
   958  		iter.i--
   959  		return err
   960  	}
   961  	iter.i = 0
   962  	return nil
   963  }
   964  
   965  // Next advances to the next value.  If there was an error making
   966  // the request the iterator does not advance and the error is returned.
   967  // Deprecated: Use NextWithContext() instead.
   968  func (iter *WorkspaceListResultIterator) Next() error {
   969  	return iter.NextWithContext(context.Background())
   970  }
   971  
   972  // NotDone returns true if the enumeration should be started or is not yet complete.
   973  func (iter WorkspaceListResultIterator) NotDone() bool {
   974  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   975  }
   976  
   977  // Response returns the raw server response from the last page request.
   978  func (iter WorkspaceListResultIterator) Response() WorkspaceListResult {
   979  	return iter.page.Response()
   980  }
   981  
   982  // Value returns the current value or a zero-initialized value if the
   983  // iterator has advanced beyond the end of the collection.
   984  func (iter WorkspaceListResultIterator) Value() Workspace {
   985  	if !iter.page.NotDone() {
   986  		return Workspace{}
   987  	}
   988  	return iter.page.Values()[iter.i]
   989  }
   990  
   991  // Creates a new instance of the WorkspaceListResultIterator type.
   992  func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator {
   993  	return WorkspaceListResultIterator{page: page}
   994  }
   995  
   996  // IsEmpty returns true if the ListResult contains no values.
   997  func (wlr WorkspaceListResult) IsEmpty() bool {
   998  	return wlr.Value == nil || len(*wlr.Value) == 0
   999  }
  1000  
  1001  // hasNextLink returns true if the NextLink is not empty.
  1002  func (wlr WorkspaceListResult) hasNextLink() bool {
  1003  	return wlr.NextLink != nil && len(*wlr.NextLink) != 0
  1004  }
  1005  
  1006  // workspaceListResultPreparer prepares a request to retrieve the next set of results.
  1007  // It returns nil if no more results exist.
  1008  func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) {
  1009  	if !wlr.hasNextLink() {
  1010  		return nil, nil
  1011  	}
  1012  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1013  		autorest.AsJSON(),
  1014  		autorest.AsGet(),
  1015  		autorest.WithBaseURL(to.String(wlr.NextLink)))
  1016  }
  1017  
  1018  // WorkspaceListResultPage contains a page of Workspace values.
  1019  type WorkspaceListResultPage struct {
  1020  	fn  func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)
  1021  	wlr WorkspaceListResult
  1022  }
  1023  
  1024  // NextWithContext advances to the next page of values.  If there was an error making
  1025  // the request the page does not advance and the error is returned.
  1026  func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) {
  1027  	if tracing.IsEnabled() {
  1028  		ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext")
  1029  		defer func() {
  1030  			sc := -1
  1031  			if page.Response().Response.Response != nil {
  1032  				sc = page.Response().Response.Response.StatusCode
  1033  			}
  1034  			tracing.EndSpan(ctx, sc, err)
  1035  		}()
  1036  	}
  1037  	for {
  1038  		next, err := page.fn(ctx, page.wlr)
  1039  		if err != nil {
  1040  			return err
  1041  		}
  1042  		page.wlr = next
  1043  		if !next.hasNextLink() || !next.IsEmpty() {
  1044  			break
  1045  		}
  1046  	}
  1047  	return nil
  1048  }
  1049  
  1050  // Next advances to the next page of values.  If there was an error making
  1051  // the request the page does not advance and the error is returned.
  1052  // Deprecated: Use NextWithContext() instead.
  1053  func (page *WorkspaceListResultPage) Next() error {
  1054  	return page.NextWithContext(context.Background())
  1055  }
  1056  
  1057  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1058  func (page WorkspaceListResultPage) NotDone() bool {
  1059  	return !page.wlr.IsEmpty()
  1060  }
  1061  
  1062  // Response returns the raw server response from the last page request.
  1063  func (page WorkspaceListResultPage) Response() WorkspaceListResult {
  1064  	return page.wlr
  1065  }
  1066  
  1067  // Values returns the slice of values for the current page or nil if there are no values.
  1068  func (page WorkspaceListResultPage) Values() []Workspace {
  1069  	if page.wlr.IsEmpty() {
  1070  		return nil
  1071  	}
  1072  	return *page.wlr.Value
  1073  }
  1074  
  1075  // Creates a new instance of the WorkspaceListResultPage type.
  1076  func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage {
  1077  	return WorkspaceListResultPage{
  1078  		fn:  getNextPage,
  1079  		wlr: cur,
  1080  	}
  1081  }
  1082  
  1083  // WorkspaceProperties the properties of a machine learning team account workspace.
  1084  type WorkspaceProperties struct {
  1085  	// Description - The description of this workspace.
  1086  	Description *string `json:"description,omitempty"`
  1087  	// AccountID - READ-ONLY; The immutable id of the team account which contains this workspace.
  1088  	AccountID *string `json:"accountId,omitempty"`
  1089  	// WorkspaceID - READ-ONLY; The immutable id of this workspace.
  1090  	WorkspaceID *string `json:"workspaceId,omitempty"`
  1091  	// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
  1092  	FriendlyName *string `json:"friendlyName,omitempty"`
  1093  	// CreationDate - READ-ONLY; The creation date of the machine learning workspace in ISO8601 format.
  1094  	CreationDate *date.Time `json:"creationDate,omitempty"`
  1095  	// ProvisioningState - READ-ONLY; The current deployment state of team account workspace resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
  1096  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1097  }
  1098  
  1099  // MarshalJSON is the custom marshaler for WorkspaceProperties.
  1100  func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) {
  1101  	objectMap := make(map[string]interface{})
  1102  	if wp.Description != nil {
  1103  		objectMap["description"] = wp.Description
  1104  	}
  1105  	if wp.FriendlyName != nil {
  1106  		objectMap["friendlyName"] = wp.FriendlyName
  1107  	}
  1108  	return json.Marshal(objectMap)
  1109  }
  1110  
  1111  // WorkspacePropertiesUpdateParameters the parameters for updating the properties of a machine learning
  1112  // team account workspace.
  1113  type WorkspacePropertiesUpdateParameters struct {
  1114  	// FriendlyName - Friendly name of this workspace.
  1115  	FriendlyName *string `json:"friendlyName,omitempty"`
  1116  	// Description - Description for this workspace.
  1117  	Description *string `json:"description,omitempty"`
  1118  }
  1119  
  1120  // WorkspaceUpdateParameters the parameters for updating a machine learning team account workspace.
  1121  type WorkspaceUpdateParameters struct {
  1122  	// Tags - The resource tags for the machine learning team account workspace.
  1123  	Tags map[string]*string `json:"tags"`
  1124  	// WorkspacePropertiesUpdateParameters - The properties that the machine learning workspace will be updated with.
  1125  	*WorkspacePropertiesUpdateParameters `json:"properties,omitempty"`
  1126  }
  1127  
  1128  // MarshalJSON is the custom marshaler for WorkspaceUpdateParameters.
  1129  func (wup WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) {
  1130  	objectMap := make(map[string]interface{})
  1131  	if wup.Tags != nil {
  1132  		objectMap["tags"] = wup.Tags
  1133  	}
  1134  	if wup.WorkspacePropertiesUpdateParameters != nil {
  1135  		objectMap["properties"] = wup.WorkspacePropertiesUpdateParameters
  1136  	}
  1137  	return json.Marshal(objectMap)
  1138  }
  1139  
  1140  // UnmarshalJSON is the custom unmarshaler for WorkspaceUpdateParameters struct.
  1141  func (wup *WorkspaceUpdateParameters) UnmarshalJSON(body []byte) error {
  1142  	var m map[string]*json.RawMessage
  1143  	err := json.Unmarshal(body, &m)
  1144  	if err != nil {
  1145  		return err
  1146  	}
  1147  	for k, v := range m {
  1148  		switch k {
  1149  		case "tags":
  1150  			if v != nil {
  1151  				var tags map[string]*string
  1152  				err = json.Unmarshal(*v, &tags)
  1153  				if err != nil {
  1154  					return err
  1155  				}
  1156  				wup.Tags = tags
  1157  			}
  1158  		case "properties":
  1159  			if v != nil {
  1160  				var workspacePropertiesUpdateParameters WorkspacePropertiesUpdateParameters
  1161  				err = json.Unmarshal(*v, &workspacePropertiesUpdateParameters)
  1162  				if err != nil {
  1163  					return err
  1164  				}
  1165  				wup.WorkspacePropertiesUpdateParameters = &workspacePropertiesUpdateParameters
  1166  			}
  1167  		}
  1168  	}
  1169  
  1170  	return nil
  1171  }
  1172  

View as plain text