...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2017-08-01-preview/compute/machinelearningcompute.go

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

     1  package compute
     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  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/tracing"
    14  	"net/http"
    15  )
    16  
    17  // MachineLearningComputeClient is the these APIs allow end users to operate on Azure Machine Learning Compute
    18  // resources. They support the following operations:<ul><li>Create or update a cluster</li><li>Get a
    19  // cluster</li><li>Patch a cluster</li><li>Delete a cluster</li><li>Get keys for a cluster</li><li>Check if updates are
    20  // available for system services in a cluster</li><li>Update system services in a cluster</li><li>Get all clusters in a
    21  // resource group</li><li>Get all clusters in a subscription</li></ul>
    22  type MachineLearningComputeClient struct {
    23  	BaseClient
    24  }
    25  
    26  // NewMachineLearningComputeClient creates an instance of the MachineLearningComputeClient client.
    27  func NewMachineLearningComputeClient(subscriptionID string) MachineLearningComputeClient {
    28  	return NewMachineLearningComputeClientWithBaseURI(DefaultBaseURI, subscriptionID)
    29  }
    30  
    31  // NewMachineLearningComputeClientWithBaseURI creates an instance of the MachineLearningComputeClient client using a
    32  // custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds,
    33  // Azure stack).
    34  func NewMachineLearningComputeClientWithBaseURI(baseURI string, subscriptionID string) MachineLearningComputeClient {
    35  	return MachineLearningComputeClient{NewWithBaseURI(baseURI, subscriptionID)}
    36  }
    37  
    38  // ListAvailableOperations gets all available operations.
    39  func (client MachineLearningComputeClient) ListAvailableOperations(ctx context.Context) (result AvailableOperations, err error) {
    40  	if tracing.IsEnabled() {
    41  		ctx = tracing.StartSpan(ctx, fqdn+"/MachineLearningComputeClient.ListAvailableOperations")
    42  		defer func() {
    43  			sc := -1
    44  			if result.Response.Response != nil {
    45  				sc = result.Response.Response.StatusCode
    46  			}
    47  			tracing.EndSpan(ctx, sc, err)
    48  		}()
    49  	}
    50  	req, err := client.ListAvailableOperationsPreparer(ctx)
    51  	if err != nil {
    52  		err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", nil, "Failure preparing request")
    53  		return
    54  	}
    55  
    56  	resp, err := client.ListAvailableOperationsSender(req)
    57  	if err != nil {
    58  		result.Response = autorest.Response{Response: resp}
    59  		err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", resp, "Failure sending request")
    60  		return
    61  	}
    62  
    63  	result, err = client.ListAvailableOperationsResponder(resp)
    64  	if err != nil {
    65  		err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", resp, "Failure responding to request")
    66  		return
    67  	}
    68  
    69  	return
    70  }
    71  
    72  // ListAvailableOperationsPreparer prepares the ListAvailableOperations request.
    73  func (client MachineLearningComputeClient) ListAvailableOperationsPreparer(ctx context.Context) (*http.Request, error) {
    74  	const APIVersion = "2017-08-01-preview"
    75  	queryParameters := map[string]interface{}{
    76  		"api-version": APIVersion,
    77  	}
    78  
    79  	preparer := autorest.CreatePreparer(
    80  		autorest.AsGet(),
    81  		autorest.WithBaseURL(client.BaseURI),
    82  		autorest.WithPath("/providers/Microsoft.MachineLearningCompute/operations"),
    83  		autorest.WithQueryParameters(queryParameters))
    84  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    85  }
    86  
    87  // ListAvailableOperationsSender sends the ListAvailableOperations request. The method will close the
    88  // http.Response Body if it receives an error.
    89  func (client MachineLearningComputeClient) ListAvailableOperationsSender(req *http.Request) (*http.Response, error) {
    90  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
    91  }
    92  
    93  // ListAvailableOperationsResponder handles the response to the ListAvailableOperations request. The method always
    94  // closes the http.Response Body.
    95  func (client MachineLearningComputeClient) ListAvailableOperationsResponder(resp *http.Response) (result AvailableOperations, err error) {
    96  	err = autorest.Respond(
    97  		resp,
    98  		azure.WithErrorUnlessStatusCode(http.StatusOK),
    99  		autorest.ByUnmarshallingJSON(&result),
   100  		autorest.ByClosing())
   101  	result.Response = autorest.Response{Response: resp}
   102  	return
   103  }
   104  

View as plain text