...

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

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

     1  package webservices
     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/azure"
    14  	"github.com/Azure/go-autorest/autorest/date"
    15  	"github.com/Azure/go-autorest/autorest/to"
    16  	"github.com/Azure/go-autorest/tracing"
    17  	"net/http"
    18  )
    19  
    20  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/machinelearning/mgmt/2017-01-01/webservices"
    22  
    23  // AssetItem information about an asset associated with the web service.
    24  type AssetItem struct {
    25  	// Name - Asset's friendly name.
    26  	Name *string `json:"name,omitempty"`
    27  	// ID - Asset's Id.
    28  	ID *string `json:"id,omitempty"`
    29  	// Type - Asset's type. Possible values include: 'AssetTypeModule', 'AssetTypeResource'
    30  	Type AssetType `json:"type,omitempty"`
    31  	// LocationInfo - Access information for the asset.
    32  	LocationInfo *BlobLocation `json:"locationInfo,omitempty"`
    33  	// InputPorts - Information about the asset's input ports.
    34  	InputPorts map[string]*InputPort `json:"inputPorts"`
    35  	// OutputPorts - Information about the asset's output ports.
    36  	OutputPorts map[string]*OutputPort `json:"outputPorts"`
    37  	// Metadata - If the asset is a custom module, this holds the module's metadata.
    38  	Metadata map[string]*string `json:"metadata"`
    39  	// Parameters - If the asset is a custom module, this holds the module's parameters.
    40  	Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
    41  }
    42  
    43  // MarshalJSON is the custom marshaler for AssetItem.
    44  func (ai AssetItem) MarshalJSON() ([]byte, error) {
    45  	objectMap := make(map[string]interface{})
    46  	if ai.Name != nil {
    47  		objectMap["name"] = ai.Name
    48  	}
    49  	if ai.ID != nil {
    50  		objectMap["id"] = ai.ID
    51  	}
    52  	if ai.Type != "" {
    53  		objectMap["type"] = ai.Type
    54  	}
    55  	if ai.LocationInfo != nil {
    56  		objectMap["locationInfo"] = ai.LocationInfo
    57  	}
    58  	if ai.InputPorts != nil {
    59  		objectMap["inputPorts"] = ai.InputPorts
    60  	}
    61  	if ai.OutputPorts != nil {
    62  		objectMap["outputPorts"] = ai.OutputPorts
    63  	}
    64  	if ai.Metadata != nil {
    65  		objectMap["metadata"] = ai.Metadata
    66  	}
    67  	if ai.Parameters != nil {
    68  		objectMap["parameters"] = ai.Parameters
    69  	}
    70  	return json.Marshal(objectMap)
    71  }
    72  
    73  // AsyncOperationErrorInfo the error detail information for async operation
    74  type AsyncOperationErrorInfo struct {
    75  	// Code - READ-ONLY; The error code.
    76  	Code *string `json:"code,omitempty"`
    77  	// Target - READ-ONLY; The error target.
    78  	Target *string `json:"target,omitempty"`
    79  	// Message - READ-ONLY; The error message.
    80  	Message *string `json:"message,omitempty"`
    81  	// Details - READ-ONLY; An array containing error information.
    82  	Details *[]AsyncOperationErrorInfo `json:"details,omitempty"`
    83  }
    84  
    85  // MarshalJSON is the custom marshaler for AsyncOperationErrorInfo.
    86  func (aoei AsyncOperationErrorInfo) MarshalJSON() ([]byte, error) {
    87  	objectMap := make(map[string]interface{})
    88  	return json.Marshal(objectMap)
    89  }
    90  
    91  // AsyncOperationStatus azure async operation status.
    92  type AsyncOperationStatus struct {
    93  	autorest.Response `json:"-"`
    94  	// ID - READ-ONLY; Async operation id.
    95  	ID *string `json:"id,omitempty"`
    96  	// Name - READ-ONLY; Async operation name.
    97  	Name *string `json:"name,omitempty"`
    98  	// ProvisioningState - READ-ONLY; Read Only: The provisioning state of the web service. Valid values are Unknown, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Provisioning', 'Succeeded', 'Failed'
    99  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   100  	// StartTime - READ-ONLY; The date time that the async operation started.
   101  	StartTime *date.Time `json:"startTime,omitempty"`
   102  	// EndTime - READ-ONLY; The date time that the async operation finished.
   103  	EndTime *date.Time `json:"endTime,omitempty"`
   104  	// PercentComplete - READ-ONLY; Async operation progress.
   105  	PercentComplete *float64 `json:"percentComplete,omitempty"`
   106  	// ErrorInfo - READ-ONLY; If the async operation fails, this structure contains the error details.
   107  	ErrorInfo *AsyncOperationErrorInfo `json:"errorInfo,omitempty"`
   108  }
   109  
   110  // MarshalJSON is the custom marshaler for AsyncOperationStatus.
   111  func (aos AsyncOperationStatus) MarshalJSON() ([]byte, error) {
   112  	objectMap := make(map[string]interface{})
   113  	return json.Marshal(objectMap)
   114  }
   115  
   116  // BlobLocation describes the access location for a blob.
   117  type BlobLocation struct {
   118  	// URI - The URI from which the blob is accessible from. For example, aml://abc for system assets or https://xyz for user assets or payload.
   119  	URI *string `json:"uri,omitempty"`
   120  	// Credentials - Access credentials for the blob, if applicable (e.g. blob specified by storage account connection string + blob URI)
   121  	Credentials *string `json:"credentials,omitempty"`
   122  }
   123  
   124  // ColumnSpecification swagger 2.0 schema for a column within the data table representing a web service
   125  // input or output. See Swagger specification: http://swagger.io/specification/
   126  type ColumnSpecification struct {
   127  	// Type - Data type of the column. Possible values include: 'Boolean', 'Integer', 'Number', 'String'
   128  	Type ColumnType `json:"type,omitempty"`
   129  	// Format - Additional format information for the data type. Possible values include: 'Byte', 'Char', 'Complex64', 'Complex128', 'DateTime', 'DateTimeOffset', 'Double', 'Duration', 'Float', 'Int8', 'Int16', 'Int32', 'Int64', 'Uint8', 'Uint16', 'Uint32', 'Uint64'
   130  	Format ColumnFormat `json:"format,omitempty"`
   131  	// Enum - If the data type is categorical, this provides the list of accepted categories.
   132  	Enum *[]interface{} `json:"enum,omitempty"`
   133  	// XMsIsnullable - Flag indicating if the type supports null values or not.
   134  	XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"`
   135  	// XMsIsordered - Flag indicating whether the categories are treated as an ordered set or not, if this is a categorical column.
   136  	XMsIsordered *bool `json:"x-ms-isordered,omitempty"`
   137  }
   138  
   139  // CommitmentPlan information about the machine learning commitment plan associated with the web service.
   140  type CommitmentPlan struct {
   141  	// ID - Specifies the Azure Resource Manager ID of the commitment plan associated with the web service.
   142  	ID *string `json:"id,omitempty"`
   143  }
   144  
   145  // CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   146  // operation.
   147  type CreateOrUpdateFuture struct {
   148  	azure.FutureAPI
   149  	// Result returns the result of the asynchronous operation.
   150  	// If the operation has not completed it will return an error.
   151  	Result func(Client) (WebService, error)
   152  }
   153  
   154  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   155  func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   156  	var azFuture azure.Future
   157  	if err := json.Unmarshal(body, &azFuture); err != nil {
   158  		return err
   159  	}
   160  	future.FutureAPI = &azFuture
   161  	future.Result = future.result
   162  	return nil
   163  }
   164  
   165  // result is the default implementation for CreateOrUpdateFuture.Result.
   166  func (future *CreateOrUpdateFuture) result(client Client) (ws WebService, err error) {
   167  	var done bool
   168  	done, err = future.DoneWithContext(context.Background(), client)
   169  	if err != nil {
   170  		err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   171  		return
   172  	}
   173  	if !done {
   174  		ws.Response.Response = future.Response()
   175  		err = azure.NewAsyncOpIncompleteError("webservices.CreateOrUpdateFuture")
   176  		return
   177  	}
   178  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   179  	if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
   180  		ws, err = client.CreateOrUpdateResponder(ws.Response.Response)
   181  		if err != nil {
   182  			err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", ws.Response.Response, "Failure responding to request")
   183  		}
   184  	}
   185  	return
   186  }
   187  
   188  // CreateRegionalPropertiesFuture an abstraction for monitoring and retrieving the results of a
   189  // long-running operation.
   190  type CreateRegionalPropertiesFuture struct {
   191  	azure.FutureAPI
   192  	// Result returns the result of the asynchronous operation.
   193  	// If the operation has not completed it will return an error.
   194  	Result func(Client) (AsyncOperationStatus, error)
   195  }
   196  
   197  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   198  func (future *CreateRegionalPropertiesFuture) UnmarshalJSON(body []byte) error {
   199  	var azFuture azure.Future
   200  	if err := json.Unmarshal(body, &azFuture); err != nil {
   201  		return err
   202  	}
   203  	future.FutureAPI = &azFuture
   204  	future.Result = future.result
   205  	return nil
   206  }
   207  
   208  // result is the default implementation for CreateRegionalPropertiesFuture.Result.
   209  func (future *CreateRegionalPropertiesFuture) result(client Client) (aos AsyncOperationStatus, err error) {
   210  	var done bool
   211  	done, err = future.DoneWithContext(context.Background(), client)
   212  	if err != nil {
   213  		err = autorest.NewErrorWithError(err, "webservices.CreateRegionalPropertiesFuture", "Result", future.Response(), "Polling failure")
   214  		return
   215  	}
   216  	if !done {
   217  		aos.Response.Response = future.Response()
   218  		err = azure.NewAsyncOpIncompleteError("webservices.CreateRegionalPropertiesFuture")
   219  		return
   220  	}
   221  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   222  	if aos.Response.Response, err = future.GetResult(sender); err == nil && aos.Response.Response.StatusCode != http.StatusNoContent {
   223  		aos, err = client.CreateRegionalPropertiesResponder(aos.Response.Response)
   224  		if err != nil {
   225  			err = autorest.NewErrorWithError(err, "webservices.CreateRegionalPropertiesFuture", "Result", aos.Response.Response, "Failure responding to request")
   226  		}
   227  	}
   228  	return
   229  }
   230  
   231  // DiagnosticsConfiguration diagnostics settings for an Azure ML web service.
   232  type DiagnosticsConfiguration struct {
   233  	// Level - Specifies the verbosity of the diagnostic output. Valid values are: None - disables tracing; Error - collects only error (stderr) traces; All - collects all traces (stdout and stderr). Possible values include: 'None', 'Error', 'All'
   234  	Level DiagnosticsLevel `json:"level,omitempty"`
   235  	// Expiry - Specifies the date and time when the logging will cease. If null, diagnostic collection is not time limited.
   236  	Expiry *date.Time `json:"expiry,omitempty"`
   237  }
   238  
   239  // ExampleRequest sample input data for the service's input(s).
   240  type ExampleRequest struct {
   241  	// Inputs - Sample input data for the web service's input(s) given as an input name to sample input values matrix map.
   242  	Inputs map[string][][]interface{} `json:"inputs"`
   243  	// GlobalParameters - Sample input data for the web service's global parameters
   244  	GlobalParameters map[string]interface{} `json:"globalParameters"`
   245  }
   246  
   247  // MarshalJSON is the custom marshaler for ExampleRequest.
   248  func (er ExampleRequest) MarshalJSON() ([]byte, error) {
   249  	objectMap := make(map[string]interface{})
   250  	if er.Inputs != nil {
   251  		objectMap["inputs"] = er.Inputs
   252  	}
   253  	if er.GlobalParameters != nil {
   254  		objectMap["globalParameters"] = er.GlobalParameters
   255  	}
   256  	return json.Marshal(objectMap)
   257  }
   258  
   259  // GraphEdge defines an edge within the web service's graph.
   260  type GraphEdge struct {
   261  	// SourceNodeID - The source graph node's identifier.
   262  	SourceNodeID *string `json:"sourceNodeId,omitempty"`
   263  	// SourcePortID - The identifier of the source node's port that the edge connects from.
   264  	SourcePortID *string `json:"sourcePortId,omitempty"`
   265  	// TargetNodeID - The destination graph node's identifier.
   266  	TargetNodeID *string `json:"targetNodeId,omitempty"`
   267  	// TargetPortID - The identifier of the destination node's port that the edge connects into.
   268  	TargetPortID *string `json:"targetPortId,omitempty"`
   269  }
   270  
   271  // GraphNode specifies a node in the web service graph. The node can either be an input, output or asset
   272  // node, so only one of the corresponding id properties is populated at any given time.
   273  type GraphNode struct {
   274  	// AssetID - The id of the asset represented by this node.
   275  	AssetID *string `json:"assetId,omitempty"`
   276  	// InputID - The id of the input element represented by this node.
   277  	InputID *string `json:"inputId,omitempty"`
   278  	// OutputID - The id of the output element represented by this node.
   279  	OutputID *string `json:"outputId,omitempty"`
   280  	// Parameters - If applicable, parameters of the node. Global graph parameters map into these, with values set at runtime.
   281  	Parameters map[string]*Parameter `json:"parameters"`
   282  }
   283  
   284  // MarshalJSON is the custom marshaler for GraphNode.
   285  func (gn GraphNode) MarshalJSON() ([]byte, error) {
   286  	objectMap := make(map[string]interface{})
   287  	if gn.AssetID != nil {
   288  		objectMap["assetId"] = gn.AssetID
   289  	}
   290  	if gn.InputID != nil {
   291  		objectMap["inputId"] = gn.InputID
   292  	}
   293  	if gn.OutputID != nil {
   294  		objectMap["outputId"] = gn.OutputID
   295  	}
   296  	if gn.Parameters != nil {
   297  		objectMap["parameters"] = gn.Parameters
   298  	}
   299  	return json.Marshal(objectMap)
   300  }
   301  
   302  // GraphPackage defines the graph of modules making up the machine learning solution.
   303  type GraphPackage struct {
   304  	// Nodes - The set of nodes making up the graph, provided as a nodeId to GraphNode map
   305  	Nodes map[string]*GraphNode `json:"nodes"`
   306  	// Edges - The list of edges making up the graph.
   307  	Edges *[]GraphEdge `json:"edges,omitempty"`
   308  	// GraphParameters - The collection of global parameters for the graph, given as a global parameter name to GraphParameter map. Each parameter here has a 1:1 match with the global parameters values map declared at the WebServiceProperties level.
   309  	GraphParameters map[string]*GraphParameter `json:"graphParameters"`
   310  }
   311  
   312  // MarshalJSON is the custom marshaler for GraphPackage.
   313  func (gp GraphPackage) MarshalJSON() ([]byte, error) {
   314  	objectMap := make(map[string]interface{})
   315  	if gp.Nodes != nil {
   316  		objectMap["nodes"] = gp.Nodes
   317  	}
   318  	if gp.Edges != nil {
   319  		objectMap["edges"] = gp.Edges
   320  	}
   321  	if gp.GraphParameters != nil {
   322  		objectMap["graphParameters"] = gp.GraphParameters
   323  	}
   324  	return json.Marshal(objectMap)
   325  }
   326  
   327  // GraphParameter defines a global parameter in the graph.
   328  type GraphParameter struct {
   329  	// Description - Description of this graph parameter.
   330  	Description *string `json:"description,omitempty"`
   331  	// Type - Graph parameter's type. Possible values include: 'ParameterTypeString', 'ParameterTypeInt', 'ParameterTypeFloat', 'ParameterTypeEnumerated', 'ParameterTypeScript', 'ParameterTypeMode', 'ParameterTypeCredential', 'ParameterTypeBoolean', 'ParameterTypeDouble', 'ParameterTypeColumnPicker', 'ParameterTypeParameterRange', 'ParameterTypeDataGatewayName'
   332  	Type ParameterType `json:"type,omitempty"`
   333  	// Links - Association links for this parameter to nodes in the graph.
   334  	Links *[]GraphParameterLink `json:"links,omitempty"`
   335  }
   336  
   337  // GraphParameterLink association link for a graph global parameter to a node in the graph.
   338  type GraphParameterLink struct {
   339  	// NodeID - The graph node's identifier
   340  	NodeID *string `json:"nodeId,omitempty"`
   341  	// ParameterKey - The identifier of the node parameter that the global parameter maps to.
   342  	ParameterKey *string `json:"parameterKey,omitempty"`
   343  }
   344  
   345  // InputPort asset input port
   346  type InputPort struct {
   347  	// Type - Port data type. Possible values include: 'Dataset'
   348  	Type InputPortType `json:"type,omitempty"`
   349  }
   350  
   351  // Keys access keys for the web service calls.
   352  type Keys struct {
   353  	autorest.Response `json:"-"`
   354  	// Primary - The primary access key.
   355  	Primary *string `json:"primary,omitempty"`
   356  	// Secondary - The secondary access key.
   357  	Secondary *string `json:"secondary,omitempty"`
   358  }
   359  
   360  // MachineLearningWorkspace information about the machine learning workspace containing the experiment that
   361  // is source for the web service.
   362  type MachineLearningWorkspace struct {
   363  	// ID - Specifies the workspace ID of the machine learning workspace associated with the web service
   364  	ID *string `json:"id,omitempty"`
   365  }
   366  
   367  // ModeValueInfo nested parameter definition.
   368  type ModeValueInfo struct {
   369  	// InterfaceString - The interface string name for the nested parameter.
   370  	InterfaceString *string `json:"interfaceString,omitempty"`
   371  	// Parameters - The definition of the parameter.
   372  	Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
   373  }
   374  
   375  // ModuleAssetParameter parameter definition for a module asset.
   376  type ModuleAssetParameter struct {
   377  	// Name - Parameter name.
   378  	Name *string `json:"name,omitempty"`
   379  	// ParameterType - Parameter type.
   380  	ParameterType *string `json:"parameterType,omitempty"`
   381  	// ModeValuesInfo - Definitions for nested interface parameters if this is a complex module parameter.
   382  	ModeValuesInfo map[string]*ModeValueInfo `json:"modeValuesInfo"`
   383  }
   384  
   385  // MarshalJSON is the custom marshaler for ModuleAssetParameter.
   386  func (mapVar ModuleAssetParameter) MarshalJSON() ([]byte, error) {
   387  	objectMap := make(map[string]interface{})
   388  	if mapVar.Name != nil {
   389  		objectMap["name"] = mapVar.Name
   390  	}
   391  	if mapVar.ParameterType != nil {
   392  		objectMap["parameterType"] = mapVar.ParameterType
   393  	}
   394  	if mapVar.ModeValuesInfo != nil {
   395  		objectMap["modeValuesInfo"] = mapVar.ModeValuesInfo
   396  	}
   397  	return json.Marshal(objectMap)
   398  }
   399  
   400  // OperationDisplayInfo the API operation info.
   401  type OperationDisplayInfo struct {
   402  	// Description - READ-ONLY; The description of the operation.
   403  	Description *string `json:"description,omitempty"`
   404  	// Operation - READ-ONLY; The action that users can perform, based on their permission level.
   405  	Operation *string `json:"operation,omitempty"`
   406  	// Provider - READ-ONLY; The service provider.
   407  	Provider *string `json:"provider,omitempty"`
   408  	// Resource - READ-ONLY; The resource on which the operation is performed.
   409  	Resource *string `json:"resource,omitempty"`
   410  }
   411  
   412  // MarshalJSON is the custom marshaler for OperationDisplayInfo.
   413  func (odi OperationDisplayInfo) MarshalJSON() ([]byte, error) {
   414  	objectMap := make(map[string]interface{})
   415  	return json.Marshal(objectMap)
   416  }
   417  
   418  // OperationEntity an API operation.
   419  type OperationEntity struct {
   420  	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
   421  	Name *string `json:"name,omitempty"`
   422  	// Display - The API operation info.
   423  	Display *OperationDisplayInfo `json:"display,omitempty"`
   424  }
   425  
   426  // MarshalJSON is the custom marshaler for OperationEntity.
   427  func (oe OperationEntity) MarshalJSON() ([]byte, error) {
   428  	objectMap := make(map[string]interface{})
   429  	if oe.Display != nil {
   430  		objectMap["display"] = oe.Display
   431  	}
   432  	return json.Marshal(objectMap)
   433  }
   434  
   435  // OperationEntityListResult the list of REST API operations.
   436  type OperationEntityListResult struct {
   437  	autorest.Response `json:"-"`
   438  	// Value - READ-ONLY; The list of operations.
   439  	Value *[]OperationEntity `json:"value,omitempty"`
   440  }
   441  
   442  // MarshalJSON is the custom marshaler for OperationEntityListResult.
   443  func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) {
   444  	objectMap := make(map[string]interface{})
   445  	return json.Marshal(objectMap)
   446  }
   447  
   448  // OutputPort asset output port
   449  type OutputPort struct {
   450  	// Type - Port data type. Possible values include: 'OutputPortTypeDataset'
   451  	Type OutputPortType `json:"type,omitempty"`
   452  }
   453  
   454  // PaginatedWebServicesList paginated list of web services.
   455  type PaginatedWebServicesList struct {
   456  	autorest.Response `json:"-"`
   457  	// Value - An array of web service objects.
   458  	Value *[]WebService `json:"value,omitempty"`
   459  	// NextLink - A continuation link (absolute URI) to the next page of results in the list.
   460  	NextLink *string `json:"nextLink,omitempty"`
   461  }
   462  
   463  // PaginatedWebServicesListIterator provides access to a complete listing of WebService values.
   464  type PaginatedWebServicesListIterator struct {
   465  	i    int
   466  	page PaginatedWebServicesListPage
   467  }
   468  
   469  // NextWithContext advances to the next value.  If there was an error making
   470  // the request the iterator does not advance and the error is returned.
   471  func (iter *PaginatedWebServicesListIterator) NextWithContext(ctx context.Context) (err error) {
   472  	if tracing.IsEnabled() {
   473  		ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListIterator.NextWithContext")
   474  		defer func() {
   475  			sc := -1
   476  			if iter.Response().Response.Response != nil {
   477  				sc = iter.Response().Response.Response.StatusCode
   478  			}
   479  			tracing.EndSpan(ctx, sc, err)
   480  		}()
   481  	}
   482  	iter.i++
   483  	if iter.i < len(iter.page.Values()) {
   484  		return nil
   485  	}
   486  	err = iter.page.NextWithContext(ctx)
   487  	if err != nil {
   488  		iter.i--
   489  		return err
   490  	}
   491  	iter.i = 0
   492  	return nil
   493  }
   494  
   495  // Next advances to the next value.  If there was an error making
   496  // the request the iterator does not advance and the error is returned.
   497  // Deprecated: Use NextWithContext() instead.
   498  func (iter *PaginatedWebServicesListIterator) Next() error {
   499  	return iter.NextWithContext(context.Background())
   500  }
   501  
   502  // NotDone returns true if the enumeration should be started or is not yet complete.
   503  func (iter PaginatedWebServicesListIterator) NotDone() bool {
   504  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   505  }
   506  
   507  // Response returns the raw server response from the last page request.
   508  func (iter PaginatedWebServicesListIterator) Response() PaginatedWebServicesList {
   509  	return iter.page.Response()
   510  }
   511  
   512  // Value returns the current value or a zero-initialized value if the
   513  // iterator has advanced beyond the end of the collection.
   514  func (iter PaginatedWebServicesListIterator) Value() WebService {
   515  	if !iter.page.NotDone() {
   516  		return WebService{}
   517  	}
   518  	return iter.page.Values()[iter.i]
   519  }
   520  
   521  // Creates a new instance of the PaginatedWebServicesListIterator type.
   522  func NewPaginatedWebServicesListIterator(page PaginatedWebServicesListPage) PaginatedWebServicesListIterator {
   523  	return PaginatedWebServicesListIterator{page: page}
   524  }
   525  
   526  // IsEmpty returns true if the ListResult contains no values.
   527  func (pwsl PaginatedWebServicesList) IsEmpty() bool {
   528  	return pwsl.Value == nil || len(*pwsl.Value) == 0
   529  }
   530  
   531  // hasNextLink returns true if the NextLink is not empty.
   532  func (pwsl PaginatedWebServicesList) hasNextLink() bool {
   533  	return pwsl.NextLink != nil && len(*pwsl.NextLink) != 0
   534  }
   535  
   536  // paginatedWebServicesListPreparer prepares a request to retrieve the next set of results.
   537  // It returns nil if no more results exist.
   538  func (pwsl PaginatedWebServicesList) paginatedWebServicesListPreparer(ctx context.Context) (*http.Request, error) {
   539  	if !pwsl.hasNextLink() {
   540  		return nil, nil
   541  	}
   542  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   543  		autorest.AsJSON(),
   544  		autorest.AsGet(),
   545  		autorest.WithBaseURL(to.String(pwsl.NextLink)))
   546  }
   547  
   548  // PaginatedWebServicesListPage contains a page of WebService values.
   549  type PaginatedWebServicesListPage struct {
   550  	fn   func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)
   551  	pwsl PaginatedWebServicesList
   552  }
   553  
   554  // NextWithContext advances to the next page of values.  If there was an error making
   555  // the request the page does not advance and the error is returned.
   556  func (page *PaginatedWebServicesListPage) NextWithContext(ctx context.Context) (err error) {
   557  	if tracing.IsEnabled() {
   558  		ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListPage.NextWithContext")
   559  		defer func() {
   560  			sc := -1
   561  			if page.Response().Response.Response != nil {
   562  				sc = page.Response().Response.Response.StatusCode
   563  			}
   564  			tracing.EndSpan(ctx, sc, err)
   565  		}()
   566  	}
   567  	for {
   568  		next, err := page.fn(ctx, page.pwsl)
   569  		if err != nil {
   570  			return err
   571  		}
   572  		page.pwsl = next
   573  		if !next.hasNextLink() || !next.IsEmpty() {
   574  			break
   575  		}
   576  	}
   577  	return nil
   578  }
   579  
   580  // Next advances to the next page of values.  If there was an error making
   581  // the request the page does not advance and the error is returned.
   582  // Deprecated: Use NextWithContext() instead.
   583  func (page *PaginatedWebServicesListPage) Next() error {
   584  	return page.NextWithContext(context.Background())
   585  }
   586  
   587  // NotDone returns true if the page enumeration should be started or is not yet complete.
   588  func (page PaginatedWebServicesListPage) NotDone() bool {
   589  	return !page.pwsl.IsEmpty()
   590  }
   591  
   592  // Response returns the raw server response from the last page request.
   593  func (page PaginatedWebServicesListPage) Response() PaginatedWebServicesList {
   594  	return page.pwsl
   595  }
   596  
   597  // Values returns the slice of values for the current page or nil if there are no values.
   598  func (page PaginatedWebServicesListPage) Values() []WebService {
   599  	if page.pwsl.IsEmpty() {
   600  		return nil
   601  	}
   602  	return *page.pwsl.Value
   603  }
   604  
   605  // Creates a new instance of the PaginatedWebServicesListPage type.
   606  func NewPaginatedWebServicesListPage(cur PaginatedWebServicesList, getNextPage func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)) PaginatedWebServicesListPage {
   607  	return PaginatedWebServicesListPage{
   608  		fn:   getNextPage,
   609  		pwsl: cur,
   610  	}
   611  }
   612  
   613  // Parameter web Service Parameter object for node and global parameter
   614  type Parameter struct {
   615  	// Value - The parameter value
   616  	Value interface{} `json:"value,omitempty"`
   617  	// CertificateThumbprint - If the parameter value in 'value' field is encrypted, the thumbprint of the certificate should be put here.
   618  	CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
   619  }
   620  
   621  // PatchedResource azure resource.
   622  type PatchedResource struct {
   623  	// ID - READ-ONLY; Specifies the resource ID.
   624  	ID *string `json:"id,omitempty"`
   625  	// Name - READ-ONLY; Specifies the name of the resource.
   626  	Name *string `json:"name,omitempty"`
   627  	// Location - READ-ONLY; Specifies the location of the resource.
   628  	Location *string `json:"location,omitempty"`
   629  	// Type - READ-ONLY; Specifies the type of the resource.
   630  	Type *string `json:"type,omitempty"`
   631  	// Tags - Contains resource tags defined as key/value pairs.
   632  	Tags map[string]*string `json:"tags"`
   633  }
   634  
   635  // MarshalJSON is the custom marshaler for PatchedResource.
   636  func (pr PatchedResource) MarshalJSON() ([]byte, error) {
   637  	objectMap := make(map[string]interface{})
   638  	if pr.Tags != nil {
   639  		objectMap["tags"] = pr.Tags
   640  	}
   641  	return json.Marshal(objectMap)
   642  }
   643  
   644  // PatchedWebService instance of an Patched Azure ML web service resource.
   645  type PatchedWebService struct {
   646  	// Properties - Contains the property payload that describes the web service.
   647  	Properties BasicProperties `json:"properties,omitempty"`
   648  	// ID - READ-ONLY; Specifies the resource ID.
   649  	ID *string `json:"id,omitempty"`
   650  	// Name - READ-ONLY; Specifies the name of the resource.
   651  	Name *string `json:"name,omitempty"`
   652  	// Location - READ-ONLY; Specifies the location of the resource.
   653  	Location *string `json:"location,omitempty"`
   654  	// Type - READ-ONLY; Specifies the type of the resource.
   655  	Type *string `json:"type,omitempty"`
   656  	// Tags - Contains resource tags defined as key/value pairs.
   657  	Tags map[string]*string `json:"tags"`
   658  }
   659  
   660  // MarshalJSON is the custom marshaler for PatchedWebService.
   661  func (pws PatchedWebService) MarshalJSON() ([]byte, error) {
   662  	objectMap := make(map[string]interface{})
   663  	objectMap["properties"] = pws.Properties
   664  	if pws.Tags != nil {
   665  		objectMap["tags"] = pws.Tags
   666  	}
   667  	return json.Marshal(objectMap)
   668  }
   669  
   670  // UnmarshalJSON is the custom unmarshaler for PatchedWebService struct.
   671  func (pws *PatchedWebService) UnmarshalJSON(body []byte) error {
   672  	var m map[string]*json.RawMessage
   673  	err := json.Unmarshal(body, &m)
   674  	if err != nil {
   675  		return err
   676  	}
   677  	for k, v := range m {
   678  		switch k {
   679  		case "properties":
   680  			if v != nil {
   681  				properties, err := unmarshalBasicProperties(*v)
   682  				if err != nil {
   683  					return err
   684  				}
   685  				pws.Properties = properties
   686  			}
   687  		case "id":
   688  			if v != nil {
   689  				var ID string
   690  				err = json.Unmarshal(*v, &ID)
   691  				if err != nil {
   692  					return err
   693  				}
   694  				pws.ID = &ID
   695  			}
   696  		case "name":
   697  			if v != nil {
   698  				var name string
   699  				err = json.Unmarshal(*v, &name)
   700  				if err != nil {
   701  					return err
   702  				}
   703  				pws.Name = &name
   704  			}
   705  		case "location":
   706  			if v != nil {
   707  				var location string
   708  				err = json.Unmarshal(*v, &location)
   709  				if err != nil {
   710  					return err
   711  				}
   712  				pws.Location = &location
   713  			}
   714  		case "type":
   715  			if v != nil {
   716  				var typeVar string
   717  				err = json.Unmarshal(*v, &typeVar)
   718  				if err != nil {
   719  					return err
   720  				}
   721  				pws.Type = &typeVar
   722  			}
   723  		case "tags":
   724  			if v != nil {
   725  				var tags map[string]*string
   726  				err = json.Unmarshal(*v, &tags)
   727  				if err != nil {
   728  					return err
   729  				}
   730  				pws.Tags = tags
   731  			}
   732  		}
   733  	}
   734  
   735  	return nil
   736  }
   737  
   738  // PatchFuture an abstraction for monitoring and retrieving the results of a long-running operation.
   739  type PatchFuture struct {
   740  	azure.FutureAPI
   741  	// Result returns the result of the asynchronous operation.
   742  	// If the operation has not completed it will return an error.
   743  	Result func(Client) (WebService, error)
   744  }
   745  
   746  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   747  func (future *PatchFuture) UnmarshalJSON(body []byte) error {
   748  	var azFuture azure.Future
   749  	if err := json.Unmarshal(body, &azFuture); err != nil {
   750  		return err
   751  	}
   752  	future.FutureAPI = &azFuture
   753  	future.Result = future.result
   754  	return nil
   755  }
   756  
   757  // result is the default implementation for PatchFuture.Result.
   758  func (future *PatchFuture) result(client Client) (ws WebService, err error) {
   759  	var done bool
   760  	done, err = future.DoneWithContext(context.Background(), client)
   761  	if err != nil {
   762  		err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", future.Response(), "Polling failure")
   763  		return
   764  	}
   765  	if !done {
   766  		ws.Response.Response = future.Response()
   767  		err = azure.NewAsyncOpIncompleteError("webservices.PatchFuture")
   768  		return
   769  	}
   770  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   771  	if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
   772  		ws, err = client.PatchResponder(ws.Response.Response)
   773  		if err != nil {
   774  			err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", ws.Response.Response, "Failure responding to request")
   775  		}
   776  	}
   777  	return
   778  }
   779  
   780  // BasicProperties the set of properties specific to the Azure ML web service resource.
   781  type BasicProperties interface {
   782  	AsPropertiesForGraph() (*PropertiesForGraph, bool)
   783  	AsProperties() (*Properties, bool)
   784  }
   785  
   786  // Properties the set of properties specific to the Azure ML web service resource.
   787  type Properties struct {
   788  	// Title - The title of the web service.
   789  	Title *string `json:"title,omitempty"`
   790  	// Description - The description of the web service.
   791  	Description *string `json:"description,omitempty"`
   792  	// CreatedOn - READ-ONLY; Read Only: The date and time when the web service was created.
   793  	CreatedOn *date.Time `json:"createdOn,omitempty"`
   794  	// ModifiedOn - READ-ONLY; Read Only: The date and time when the web service was last modified.
   795  	ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
   796  	// ProvisioningState - READ-ONLY; Read Only: The provision state of the web service. Valid values are Unknown, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Provisioning', 'Succeeded', 'Failed'
   797  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   798  	// Keys - Contains the web service provisioning keys. If you do not specify provisioning keys, the Azure Machine Learning system generates them for you. Note: The keys are not returned from calls to GET operations.
   799  	Keys *Keys `json:"keys,omitempty"`
   800  	// ReadOnly - When set to true, indicates that the web service is read-only and can no longer be updated or patched, only removed. Default, is false. Note: Once set to true, you cannot change its value.
   801  	ReadOnly *bool `json:"readOnly,omitempty"`
   802  	// SwaggerLocation - READ-ONLY; Read Only: Contains the URI of the swagger spec associated with this web service.
   803  	SwaggerLocation *string `json:"swaggerLocation,omitempty"`
   804  	// ExposeSampleData - When set to true, sample data is included in the web service's swagger definition. The default value is true.
   805  	ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
   806  	// RealtimeConfiguration - Contains the configuration settings for the web service endpoint.
   807  	RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
   808  	// Diagnostics - Settings controlling the diagnostics traces collection for the web service.
   809  	Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
   810  	// StorageAccount - Specifies the storage account that Azure Machine Learning uses to store information about the web service. Only the name of the storage account is returned from calls to GET operations. When updating the storage account information, you must ensure that all necessary assets are available in the new storage account or calls to your web service will fail.
   811  	StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
   812  	// MachineLearningWorkspace - Specifies the Machine Learning workspace containing the experiment that is source for the web service.
   813  	MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
   814  	// CommitmentPlan - Contains the commitment plan associated with this web service. Set at creation time. Once set, this value cannot be changed. Note: The commitment plan is not returned from calls to GET operations.
   815  	CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
   816  	// Input - Contains the Swagger 2.0 schema describing one or more of the web service's inputs. For more information, see the Swagger specification.
   817  	Input *ServiceInputOutputSpecification `json:"input,omitempty"`
   818  	// Output - Contains the Swagger 2.0 schema describing one or more of the web service's outputs. For more information, see the Swagger specification.
   819  	Output *ServiceInputOutputSpecification `json:"output,omitempty"`
   820  	// ExampleRequest - Defines sample input data for one or more of the service's inputs.
   821  	ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
   822  	// Assets - Contains user defined properties describing web service assets. Properties are expressed as Key/Value pairs.
   823  	Assets map[string]*AssetItem `json:"assets"`
   824  	// Parameters - The set of global parameters values defined for the web service, given as a global parameter name to default value map. If no default value is specified, the parameter is considered to be required.
   825  	Parameters map[string]*Parameter `json:"parameters"`
   826  	// PayloadsInBlobStorage - When set to true, indicates that the payload size is larger than 3 MB. Otherwise false. If the payload size exceed 3 MB, the payload is stored in a blob and the PayloadsLocation parameter contains the URI of the blob. Otherwise, this will be set to false and Assets, Input, Output, Package, Parameters, ExampleRequest are inline. The Payload sizes is determined by adding the size of the Assets, Input, Output, Package, Parameters, and the ExampleRequest.
   827  	PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
   828  	// PayloadsLocation - The URI of the payload blob. This parameter contains a value only if the payloadsInBlobStorage parameter is set to true. Otherwise is set to null.
   829  	PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
   830  	// PackageType - Possible values include: 'PackageTypeWebServiceProperties', 'PackageTypeGraph'
   831  	PackageType PackageType `json:"packageType,omitempty"`
   832  }
   833  
   834  func unmarshalBasicProperties(body []byte) (BasicProperties, error) {
   835  	var m map[string]interface{}
   836  	err := json.Unmarshal(body, &m)
   837  	if err != nil {
   838  		return nil, err
   839  	}
   840  
   841  	switch m["packageType"] {
   842  	case string(PackageTypeGraph):
   843  		var pfg PropertiesForGraph
   844  		err := json.Unmarshal(body, &pfg)
   845  		return pfg, err
   846  	default:
   847  		var p Properties
   848  		err := json.Unmarshal(body, &p)
   849  		return p, err
   850  	}
   851  }
   852  func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) {
   853  	var rawMessages []*json.RawMessage
   854  	err := json.Unmarshal(body, &rawMessages)
   855  	if err != nil {
   856  		return nil, err
   857  	}
   858  
   859  	pArray := make([]BasicProperties, len(rawMessages))
   860  
   861  	for index, rawMessage := range rawMessages {
   862  		p, err := unmarshalBasicProperties(*rawMessage)
   863  		if err != nil {
   864  			return nil, err
   865  		}
   866  		pArray[index] = p
   867  	}
   868  	return pArray, nil
   869  }
   870  
   871  // MarshalJSON is the custom marshaler for Properties.
   872  func (p Properties) MarshalJSON() ([]byte, error) {
   873  	p.PackageType = PackageTypeWebServiceProperties
   874  	objectMap := make(map[string]interface{})
   875  	if p.Title != nil {
   876  		objectMap["title"] = p.Title
   877  	}
   878  	if p.Description != nil {
   879  		objectMap["description"] = p.Description
   880  	}
   881  	if p.Keys != nil {
   882  		objectMap["keys"] = p.Keys
   883  	}
   884  	if p.ReadOnly != nil {
   885  		objectMap["readOnly"] = p.ReadOnly
   886  	}
   887  	if p.ExposeSampleData != nil {
   888  		objectMap["exposeSampleData"] = p.ExposeSampleData
   889  	}
   890  	if p.RealtimeConfiguration != nil {
   891  		objectMap["realtimeConfiguration"] = p.RealtimeConfiguration
   892  	}
   893  	if p.Diagnostics != nil {
   894  		objectMap["diagnostics"] = p.Diagnostics
   895  	}
   896  	if p.StorageAccount != nil {
   897  		objectMap["storageAccount"] = p.StorageAccount
   898  	}
   899  	if p.MachineLearningWorkspace != nil {
   900  		objectMap["machineLearningWorkspace"] = p.MachineLearningWorkspace
   901  	}
   902  	if p.CommitmentPlan != nil {
   903  		objectMap["commitmentPlan"] = p.CommitmentPlan
   904  	}
   905  	if p.Input != nil {
   906  		objectMap["input"] = p.Input
   907  	}
   908  	if p.Output != nil {
   909  		objectMap["output"] = p.Output
   910  	}
   911  	if p.ExampleRequest != nil {
   912  		objectMap["exampleRequest"] = p.ExampleRequest
   913  	}
   914  	if p.Assets != nil {
   915  		objectMap["assets"] = p.Assets
   916  	}
   917  	if p.Parameters != nil {
   918  		objectMap["parameters"] = p.Parameters
   919  	}
   920  	if p.PayloadsInBlobStorage != nil {
   921  		objectMap["payloadsInBlobStorage"] = p.PayloadsInBlobStorage
   922  	}
   923  	if p.PayloadsLocation != nil {
   924  		objectMap["payloadsLocation"] = p.PayloadsLocation
   925  	}
   926  	if p.PackageType != "" {
   927  		objectMap["packageType"] = p.PackageType
   928  	}
   929  	return json.Marshal(objectMap)
   930  }
   931  
   932  // AsPropertiesForGraph is the BasicProperties implementation for Properties.
   933  func (p Properties) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
   934  	return nil, false
   935  }
   936  
   937  // AsProperties is the BasicProperties implementation for Properties.
   938  func (p Properties) AsProperties() (*Properties, bool) {
   939  	return &p, true
   940  }
   941  
   942  // AsBasicProperties is the BasicProperties implementation for Properties.
   943  func (p Properties) AsBasicProperties() (BasicProperties, bool) {
   944  	return &p, true
   945  }
   946  
   947  // PropertiesForGraph properties specific to a Graph based web service.
   948  type PropertiesForGraph struct {
   949  	// Package - The definition of the graph package making up this web service.
   950  	Package *GraphPackage `json:"package,omitempty"`
   951  	// Title - The title of the web service.
   952  	Title *string `json:"title,omitempty"`
   953  	// Description - The description of the web service.
   954  	Description *string `json:"description,omitempty"`
   955  	// CreatedOn - READ-ONLY; Read Only: The date and time when the web service was created.
   956  	CreatedOn *date.Time `json:"createdOn,omitempty"`
   957  	// ModifiedOn - READ-ONLY; Read Only: The date and time when the web service was last modified.
   958  	ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
   959  	// ProvisioningState - READ-ONLY; Read Only: The provision state of the web service. Valid values are Unknown, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Provisioning', 'Succeeded', 'Failed'
   960  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   961  	// Keys - Contains the web service provisioning keys. If you do not specify provisioning keys, the Azure Machine Learning system generates them for you. Note: The keys are not returned from calls to GET operations.
   962  	Keys *Keys `json:"keys,omitempty"`
   963  	// ReadOnly - When set to true, indicates that the web service is read-only and can no longer be updated or patched, only removed. Default, is false. Note: Once set to true, you cannot change its value.
   964  	ReadOnly *bool `json:"readOnly,omitempty"`
   965  	// SwaggerLocation - READ-ONLY; Read Only: Contains the URI of the swagger spec associated with this web service.
   966  	SwaggerLocation *string `json:"swaggerLocation,omitempty"`
   967  	// ExposeSampleData - When set to true, sample data is included in the web service's swagger definition. The default value is true.
   968  	ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
   969  	// RealtimeConfiguration - Contains the configuration settings for the web service endpoint.
   970  	RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
   971  	// Diagnostics - Settings controlling the diagnostics traces collection for the web service.
   972  	Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
   973  	// StorageAccount - Specifies the storage account that Azure Machine Learning uses to store information about the web service. Only the name of the storage account is returned from calls to GET operations. When updating the storage account information, you must ensure that all necessary assets are available in the new storage account or calls to your web service will fail.
   974  	StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
   975  	// MachineLearningWorkspace - Specifies the Machine Learning workspace containing the experiment that is source for the web service.
   976  	MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
   977  	// CommitmentPlan - Contains the commitment plan associated with this web service. Set at creation time. Once set, this value cannot be changed. Note: The commitment plan is not returned from calls to GET operations.
   978  	CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
   979  	// Input - Contains the Swagger 2.0 schema describing one or more of the web service's inputs. For more information, see the Swagger specification.
   980  	Input *ServiceInputOutputSpecification `json:"input,omitempty"`
   981  	// Output - Contains the Swagger 2.0 schema describing one or more of the web service's outputs. For more information, see the Swagger specification.
   982  	Output *ServiceInputOutputSpecification `json:"output,omitempty"`
   983  	// ExampleRequest - Defines sample input data for one or more of the service's inputs.
   984  	ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
   985  	// Assets - Contains user defined properties describing web service assets. Properties are expressed as Key/Value pairs.
   986  	Assets map[string]*AssetItem `json:"assets"`
   987  	// Parameters - The set of global parameters values defined for the web service, given as a global parameter name to default value map. If no default value is specified, the parameter is considered to be required.
   988  	Parameters map[string]*Parameter `json:"parameters"`
   989  	// PayloadsInBlobStorage - When set to true, indicates that the payload size is larger than 3 MB. Otherwise false. If the payload size exceed 3 MB, the payload is stored in a blob and the PayloadsLocation parameter contains the URI of the blob. Otherwise, this will be set to false and Assets, Input, Output, Package, Parameters, ExampleRequest are inline. The Payload sizes is determined by adding the size of the Assets, Input, Output, Package, Parameters, and the ExampleRequest.
   990  	PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
   991  	// PayloadsLocation - The URI of the payload blob. This parameter contains a value only if the payloadsInBlobStorage parameter is set to true. Otherwise is set to null.
   992  	PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
   993  	// PackageType - Possible values include: 'PackageTypeWebServiceProperties', 'PackageTypeGraph'
   994  	PackageType PackageType `json:"packageType,omitempty"`
   995  }
   996  
   997  // MarshalJSON is the custom marshaler for PropertiesForGraph.
   998  func (pfg PropertiesForGraph) MarshalJSON() ([]byte, error) {
   999  	pfg.PackageType = PackageTypeGraph
  1000  	objectMap := make(map[string]interface{})
  1001  	if pfg.Package != nil {
  1002  		objectMap["package"] = pfg.Package
  1003  	}
  1004  	if pfg.Title != nil {
  1005  		objectMap["title"] = pfg.Title
  1006  	}
  1007  	if pfg.Description != nil {
  1008  		objectMap["description"] = pfg.Description
  1009  	}
  1010  	if pfg.Keys != nil {
  1011  		objectMap["keys"] = pfg.Keys
  1012  	}
  1013  	if pfg.ReadOnly != nil {
  1014  		objectMap["readOnly"] = pfg.ReadOnly
  1015  	}
  1016  	if pfg.ExposeSampleData != nil {
  1017  		objectMap["exposeSampleData"] = pfg.ExposeSampleData
  1018  	}
  1019  	if pfg.RealtimeConfiguration != nil {
  1020  		objectMap["realtimeConfiguration"] = pfg.RealtimeConfiguration
  1021  	}
  1022  	if pfg.Diagnostics != nil {
  1023  		objectMap["diagnostics"] = pfg.Diagnostics
  1024  	}
  1025  	if pfg.StorageAccount != nil {
  1026  		objectMap["storageAccount"] = pfg.StorageAccount
  1027  	}
  1028  	if pfg.MachineLearningWorkspace != nil {
  1029  		objectMap["machineLearningWorkspace"] = pfg.MachineLearningWorkspace
  1030  	}
  1031  	if pfg.CommitmentPlan != nil {
  1032  		objectMap["commitmentPlan"] = pfg.CommitmentPlan
  1033  	}
  1034  	if pfg.Input != nil {
  1035  		objectMap["input"] = pfg.Input
  1036  	}
  1037  	if pfg.Output != nil {
  1038  		objectMap["output"] = pfg.Output
  1039  	}
  1040  	if pfg.ExampleRequest != nil {
  1041  		objectMap["exampleRequest"] = pfg.ExampleRequest
  1042  	}
  1043  	if pfg.Assets != nil {
  1044  		objectMap["assets"] = pfg.Assets
  1045  	}
  1046  	if pfg.Parameters != nil {
  1047  		objectMap["parameters"] = pfg.Parameters
  1048  	}
  1049  	if pfg.PayloadsInBlobStorage != nil {
  1050  		objectMap["payloadsInBlobStorage"] = pfg.PayloadsInBlobStorage
  1051  	}
  1052  	if pfg.PayloadsLocation != nil {
  1053  		objectMap["payloadsLocation"] = pfg.PayloadsLocation
  1054  	}
  1055  	if pfg.PackageType != "" {
  1056  		objectMap["packageType"] = pfg.PackageType
  1057  	}
  1058  	return json.Marshal(objectMap)
  1059  }
  1060  
  1061  // AsPropertiesForGraph is the BasicProperties implementation for PropertiesForGraph.
  1062  func (pfg PropertiesForGraph) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
  1063  	return &pfg, true
  1064  }
  1065  
  1066  // AsProperties is the BasicProperties implementation for PropertiesForGraph.
  1067  func (pfg PropertiesForGraph) AsProperties() (*Properties, bool) {
  1068  	return nil, false
  1069  }
  1070  
  1071  // AsBasicProperties is the BasicProperties implementation for PropertiesForGraph.
  1072  func (pfg PropertiesForGraph) AsBasicProperties() (BasicProperties, bool) {
  1073  	return &pfg, true
  1074  }
  1075  
  1076  // RealtimeConfiguration holds the available configuration options for an Azure ML web service endpoint.
  1077  type RealtimeConfiguration struct {
  1078  	// MaxConcurrentCalls - Specifies the maximum concurrent calls that can be made to the web service. Minimum value: 4, Maximum value: 200.
  1079  	MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"`
  1080  }
  1081  
  1082  // RemoveFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  1083  type RemoveFuture struct {
  1084  	azure.FutureAPI
  1085  	// Result returns the result of the asynchronous operation.
  1086  	// If the operation has not completed it will return an error.
  1087  	Result func(Client) (autorest.Response, error)
  1088  }
  1089  
  1090  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1091  func (future *RemoveFuture) UnmarshalJSON(body []byte) error {
  1092  	var azFuture azure.Future
  1093  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1094  		return err
  1095  	}
  1096  	future.FutureAPI = &azFuture
  1097  	future.Result = future.result
  1098  	return nil
  1099  }
  1100  
  1101  // result is the default implementation for RemoveFuture.Result.
  1102  func (future *RemoveFuture) result(client Client) (ar autorest.Response, err error) {
  1103  	var done bool
  1104  	done, err = future.DoneWithContext(context.Background(), client)
  1105  	if err != nil {
  1106  		err = autorest.NewErrorWithError(err, "webservices.RemoveFuture", "Result", future.Response(), "Polling failure")
  1107  		return
  1108  	}
  1109  	if !done {
  1110  		ar.Response = future.Response()
  1111  		err = azure.NewAsyncOpIncompleteError("webservices.RemoveFuture")
  1112  		return
  1113  	}
  1114  	ar.Response = future.Response()
  1115  	return
  1116  }
  1117  
  1118  // Resource azure resource.
  1119  type Resource struct {
  1120  	// ID - READ-ONLY; Specifies the resource ID.
  1121  	ID *string `json:"id,omitempty"`
  1122  	// Name - READ-ONLY; Specifies the name of the resource.
  1123  	Name *string `json:"name,omitempty"`
  1124  	// Location - Specifies the location of the resource.
  1125  	Location *string `json:"location,omitempty"`
  1126  	// Type - READ-ONLY; Specifies the type of the resource.
  1127  	Type *string `json:"type,omitempty"`
  1128  	// Tags - Contains resource tags defined as key/value pairs.
  1129  	Tags map[string]*string `json:"tags"`
  1130  }
  1131  
  1132  // MarshalJSON is the custom marshaler for Resource.
  1133  func (r Resource) MarshalJSON() ([]byte, error) {
  1134  	objectMap := make(map[string]interface{})
  1135  	if r.Location != nil {
  1136  		objectMap["location"] = r.Location
  1137  	}
  1138  	if r.Tags != nil {
  1139  		objectMap["tags"] = r.Tags
  1140  	}
  1141  	return json.Marshal(objectMap)
  1142  }
  1143  
  1144  // ServiceInputOutputSpecification the swagger 2.0 schema describing the service's inputs or outputs. See
  1145  // Swagger specification: http://swagger.io/specification/
  1146  type ServiceInputOutputSpecification struct {
  1147  	// Title - The title of your Swagger schema.
  1148  	Title *string `json:"title,omitempty"`
  1149  	// Description - The description of the Swagger schema.
  1150  	Description *string `json:"description,omitempty"`
  1151  	// Type - The type of the entity described in swagger. Always 'object'.
  1152  	Type *string `json:"type,omitempty"`
  1153  	// Properties - Specifies a collection that contains the column schema for each input or output of the web service. For more information, see the Swagger specification.
  1154  	Properties map[string]*TableSpecification `json:"properties"`
  1155  }
  1156  
  1157  // MarshalJSON is the custom marshaler for ServiceInputOutputSpecification.
  1158  func (sios ServiceInputOutputSpecification) MarshalJSON() ([]byte, error) {
  1159  	objectMap := make(map[string]interface{})
  1160  	if sios.Title != nil {
  1161  		objectMap["title"] = sios.Title
  1162  	}
  1163  	if sios.Description != nil {
  1164  		objectMap["description"] = sios.Description
  1165  	}
  1166  	if sios.Type != nil {
  1167  		objectMap["type"] = sios.Type
  1168  	}
  1169  	if sios.Properties != nil {
  1170  		objectMap["properties"] = sios.Properties
  1171  	}
  1172  	return json.Marshal(objectMap)
  1173  }
  1174  
  1175  // StorageAccount access information for a storage account.
  1176  type StorageAccount struct {
  1177  	// Name - Specifies the name of the storage account.
  1178  	Name *string `json:"name,omitempty"`
  1179  	// Key - Specifies the key used to access the storage account.
  1180  	Key *string `json:"key,omitempty"`
  1181  }
  1182  
  1183  // TableSpecification the swagger 2.0 schema describing a single service input or output. See Swagger
  1184  // specification: http://swagger.io/specification/
  1185  type TableSpecification struct {
  1186  	// Title - Swagger schema title.
  1187  	Title *string `json:"title,omitempty"`
  1188  	// Description - Swagger schema description.
  1189  	Description *string `json:"description,omitempty"`
  1190  	// Type - The type of the entity described in swagger.
  1191  	Type *string `json:"type,omitempty"`
  1192  	// Format - The format, if 'type' is not 'object'
  1193  	Format *string `json:"format,omitempty"`
  1194  	// Properties - The set of columns within the data table.
  1195  	Properties map[string]*ColumnSpecification `json:"properties"`
  1196  }
  1197  
  1198  // MarshalJSON is the custom marshaler for TableSpecification.
  1199  func (ts TableSpecification) MarshalJSON() ([]byte, error) {
  1200  	objectMap := make(map[string]interface{})
  1201  	if ts.Title != nil {
  1202  		objectMap["title"] = ts.Title
  1203  	}
  1204  	if ts.Description != nil {
  1205  		objectMap["description"] = ts.Description
  1206  	}
  1207  	if ts.Type != nil {
  1208  		objectMap["type"] = ts.Type
  1209  	}
  1210  	if ts.Format != nil {
  1211  		objectMap["format"] = ts.Format
  1212  	}
  1213  	if ts.Properties != nil {
  1214  		objectMap["properties"] = ts.Properties
  1215  	}
  1216  	return json.Marshal(objectMap)
  1217  }
  1218  
  1219  // WebService instance of an Azure ML web service resource.
  1220  type WebService struct {
  1221  	autorest.Response `json:"-"`
  1222  	// Properties - Contains the property payload that describes the web service.
  1223  	Properties BasicProperties `json:"properties,omitempty"`
  1224  	// ID - READ-ONLY; Specifies the resource ID.
  1225  	ID *string `json:"id,omitempty"`
  1226  	// Name - READ-ONLY; Specifies the name of the resource.
  1227  	Name *string `json:"name,omitempty"`
  1228  	// Location - Specifies the location of the resource.
  1229  	Location *string `json:"location,omitempty"`
  1230  	// Type - READ-ONLY; Specifies the type of the resource.
  1231  	Type *string `json:"type,omitempty"`
  1232  	// Tags - Contains resource tags defined as key/value pairs.
  1233  	Tags map[string]*string `json:"tags"`
  1234  }
  1235  
  1236  // MarshalJSON is the custom marshaler for WebService.
  1237  func (ws WebService) MarshalJSON() ([]byte, error) {
  1238  	objectMap := make(map[string]interface{})
  1239  	objectMap["properties"] = ws.Properties
  1240  	if ws.Location != nil {
  1241  		objectMap["location"] = ws.Location
  1242  	}
  1243  	if ws.Tags != nil {
  1244  		objectMap["tags"] = ws.Tags
  1245  	}
  1246  	return json.Marshal(objectMap)
  1247  }
  1248  
  1249  // UnmarshalJSON is the custom unmarshaler for WebService struct.
  1250  func (ws *WebService) UnmarshalJSON(body []byte) error {
  1251  	var m map[string]*json.RawMessage
  1252  	err := json.Unmarshal(body, &m)
  1253  	if err != nil {
  1254  		return err
  1255  	}
  1256  	for k, v := range m {
  1257  		switch k {
  1258  		case "properties":
  1259  			if v != nil {
  1260  				properties, err := unmarshalBasicProperties(*v)
  1261  				if err != nil {
  1262  					return err
  1263  				}
  1264  				ws.Properties = properties
  1265  			}
  1266  		case "id":
  1267  			if v != nil {
  1268  				var ID string
  1269  				err = json.Unmarshal(*v, &ID)
  1270  				if err != nil {
  1271  					return err
  1272  				}
  1273  				ws.ID = &ID
  1274  			}
  1275  		case "name":
  1276  			if v != nil {
  1277  				var name string
  1278  				err = json.Unmarshal(*v, &name)
  1279  				if err != nil {
  1280  					return err
  1281  				}
  1282  				ws.Name = &name
  1283  			}
  1284  		case "location":
  1285  			if v != nil {
  1286  				var location string
  1287  				err = json.Unmarshal(*v, &location)
  1288  				if err != nil {
  1289  					return err
  1290  				}
  1291  				ws.Location = &location
  1292  			}
  1293  		case "type":
  1294  			if v != nil {
  1295  				var typeVar string
  1296  				err = json.Unmarshal(*v, &typeVar)
  1297  				if err != nil {
  1298  					return err
  1299  				}
  1300  				ws.Type = &typeVar
  1301  			}
  1302  		case "tags":
  1303  			if v != nil {
  1304  				var tags map[string]*string
  1305  				err = json.Unmarshal(*v, &tags)
  1306  				if err != nil {
  1307  					return err
  1308  				}
  1309  				ws.Tags = tags
  1310  			}
  1311  		}
  1312  	}
  1313  
  1314  	return nil
  1315  }
  1316  

View as plain text