Vendor dependencies for azure backend

This commit is contained in:
Alexander Neumann 2017-08-05 20:30:20 +02:00
parent 3a85b6b7c6
commit d973aa82fe
985 changed files with 326579 additions and 1 deletions

View file

@ -0,0 +1,57 @@
// Package commitmentplans implements the Azure ARM Commitmentplans service API
// version 2016-05-01-preview.
//
// These APIs allow end users to operate on Azure Machine Learning Commitment
// Plans resources and their child Commitment Association resources. They
// support CRUD operations for commitment plans, get and list operations for
// commitment associations, moving commitment associations between commitment
// plans, and retrieving commitment plan usage history.
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Commitmentplans
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Commitmentplans.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}

View file

@ -0,0 +1,279 @@
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// CommitmentAssociationsClient is the these APIs allow end users to operate on
// Azure Machine Learning Commitment Plans resources and their child Commitment
// Association resources. They support CRUD operations for commitment plans,
// get and list operations for commitment associations, moving commitment
// associations between commitment plans, and retrieving commitment plan usage
// history.
type CommitmentAssociationsClient struct {
ManagementClient
}
// NewCommitmentAssociationsClient creates an instance of the
// CommitmentAssociationsClient client.
func NewCommitmentAssociationsClient(subscriptionID string) CommitmentAssociationsClient {
return NewCommitmentAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewCommitmentAssociationsClientWithBaseURI creates an instance of the
// CommitmentAssociationsClient client.
func NewCommitmentAssociationsClientWithBaseURI(baseURI string, subscriptionID string) CommitmentAssociationsClient {
return CommitmentAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get get a commitment association.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name. commitmentAssociationName is the commitment
// association name.
func (client CommitmentAssociationsClient) Get(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (result CommitmentAssociation, err error) {
req, err := client.GetPreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client CommitmentAssociationsClient) GetPreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentAssociationName": autorest.Encode("path", commitmentAssociationName),
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client CommitmentAssociationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client CommitmentAssociationsClient) GetResponder(resp *http.Response) (result CommitmentAssociation, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List get all commitment associations for a parent commitment plan.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name. skipToken is continuation token for
// pagination.
func (client CommitmentAssociationsClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result CommitmentAssociationListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client CommitmentAssociationsClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skipToken) > 0 {
queryParameters["$skipToken"] = autorest.Encode("query", skipToken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client CommitmentAssociationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client CommitmentAssociationsClient) ListResponder(resp *http.Response) (result CommitmentAssociationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client CommitmentAssociationsClient) ListNextResults(lastResults CommitmentAssociationListResult) (result CommitmentAssociationListResult, err error) {
req, err := lastResults.CommitmentAssociationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to next results request")
}
return
}
// Move re-parent a commitment association from one commitment plan to another.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name. commitmentAssociationName is the commitment
// association name. movePayload is the move request payload.
func (client CommitmentAssociationsClient) Move(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (result CommitmentAssociation, err error) {
req, err := client.MovePreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName, movePayload)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", nil, "Failure preparing request")
return
}
resp, err := client.MoveSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure sending request")
return
}
result, err = client.MoveResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure responding to request")
}
return
}
// MovePreparer prepares the Move request.
func (client CommitmentAssociationsClient) MovePreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentAssociationName": autorest.Encode("path", commitmentAssociationName),
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}/move", pathParameters),
autorest.WithJSON(movePayload),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// MoveSender sends the Move request. The method will close the
// http.Response Body if it receives an error.
func (client CommitmentAssociationsClient) MoveSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// MoveResponder handles the response to the Move request. The method always
// closes the http.Response Body.
func (client CommitmentAssociationsClient) MoveResponder(resp *http.Response) (result CommitmentAssociation, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View file

@ -0,0 +1,499 @@
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// GroupClient is the these APIs allow end users to operate on Azure Machine
// Learning Commitment Plans resources and their child Commitment Association
// resources. They support CRUD operations for commitment plans, get and list
// operations for commitment associations, moving commitment associations
// between commitment plans, and retrieving commitment plan usage history.
type GroupClient struct {
ManagementClient
}
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate create a new Azure ML commitment plan resource or updates an
// existing one.
//
// createOrUpdatePayload is the payload to create or update the Azure ML
// commitment plan. resourceGroupName is the resource group name.
// commitmentPlanName is the Azure ML commitment plan name.
func (client GroupClient) CreateOrUpdate(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) {
req, err := client.CreateOrUpdatePreparer(createOrUpdatePayload, resourceGroupName, commitmentPlanName)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupClient) CreateOrUpdatePreparer(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters),
autorest.WithJSON(createOrUpdatePayload),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result CommitmentPlan, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Get retrieve an Azure ML commitment plan by its subscription, resource group
// and name.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name.
func (client GroupClient) Get(resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) {
req, err := client.GetPreparer(resourceGroupName, commitmentPlanName)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client GroupClient) GetPreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupClient) GetResponder(resp *http.Response) (result CommitmentPlan, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List retrieve all Azure ML commitment plans in a subscription.
//
// skipToken is continuation token for pagination.
func (client GroupClient) List(skipToken string) (result ListResult, err error) {
req, err := client.ListPreparer(skipToken)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client GroupClient) ListPreparer(skipToken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skipToken) > 0 {
queryParameters["$skipToken"] = autorest.Encode("query", skipToken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListInResourceGroup retrieve all Azure ML commitment plans in a resource
// group.
//
// resourceGroupName is the resource group name. skipToken is continuation
// token for pagination.
func (client GroupClient) ListInResourceGroup(resourceGroupName string, skipToken string) (result ListResult, err error) {
req, err := client.ListInResourceGroupPreparer(resourceGroupName, skipToken)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListInResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListInResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to request")
}
return
}
// ListInResourceGroupPreparer prepares the ListInResourceGroup request.
func (client GroupClient) ListInResourceGroupPreparer(resourceGroupName string, skipToken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skipToken) > 0 {
queryParameters["$skipToken"] = autorest.Encode("query", skipToken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListInResourceGroupSender sends the ListInResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListInResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListInResourceGroupResponder handles the response to the ListInResourceGroup request. The method always
// closes the http.Response Body.
func (client GroupClient) ListInResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListInResourceGroupNextResults retrieves the next set of results, if any.
func (client GroupClient) ListInResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListInResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListInResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to next results request")
}
return
}
// Patch patch an existing Azure ML commitment plan resource.
//
// patchPayload is the payload to use to patch the Azure ML commitment plan.
// Only tags and SKU may be modified on an existing commitment plan.
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name.
func (client GroupClient) Patch(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) {
req, err := client.PatchPreparer(patchPayload, resourceGroupName, commitmentPlanName)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", nil, "Failure preparing request")
return
}
resp, err := client.PatchSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure sending request")
return
}
result, err = client.PatchResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure responding to request")
}
return
}
// PatchPreparer prepares the Patch request.
func (client GroupClient) PatchPreparer(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters),
autorest.WithJSON(patchPayload),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// PatchSender sends the Patch request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// PatchResponder handles the response to the Patch request. The method always
// closes the http.Response Body.
func (client GroupClient) PatchResponder(resp *http.Response) (result CommitmentPlan, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Remove remove an existing Azure ML commitment plan.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name.
func (client GroupClient) Remove(resourceGroupName string, commitmentPlanName string) (result autorest.Response, err error) {
req, err := client.RemovePreparer(resourceGroupName, commitmentPlanName)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", nil, "Failure preparing request")
return
}
resp, err := client.RemoveSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure sending request")
return
}
result, err = client.RemoveResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure responding to request")
}
return
}
// RemovePreparer prepares the Remove request.
func (client GroupClient) RemovePreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// RemoveSender sends the Remove request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RemoveResponder handles the response to the Remove request. The method always
// closes the http.Response Body.
func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}

View file

@ -0,0 +1,182 @@
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// CommitmentAssociation is represents the association between a commitment
// plan and some other resource, such as a Machine Learning web service.
type CommitmentAssociation struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Etag *string `json:"etag,omitempty"`
Properties *CommitmentAssociationProperties `json:"properties,omitempty"`
}
// CommitmentAssociationListResult is a page of commitment association
// resources.
type CommitmentAssociationListResult struct {
autorest.Response `json:"-"`
NextLink *string `json:"nextLink,omitempty"`
Value *[]CommitmentAssociation `json:"value,omitempty"`
}
// CommitmentAssociationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client CommitmentAssociationListResult) CommitmentAssociationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// CommitmentAssociationProperties is properties of an Azure ML commitment
// association.
type CommitmentAssociationProperties struct {
AssociatedResourceID *string `json:"associatedResourceId,omitempty"`
CommitmentPlanID *string `json:"commitmentPlanId,omitempty"`
CreationDate *date.Time `json:"creationDate,omitempty"`
}
// CommitmentPlan is an Azure ML commitment plan resource.
type CommitmentPlan struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Etag *string `json:"etag,omitempty"`
Properties *Properties `json:"properties,omitempty"`
Sku *ResourceSku `json:"sku,omitempty"`
}
// ListResult is a page of commitment plan resources.
type ListResult struct {
autorest.Response `json:"-"`
NextLink *string `json:"nextLink,omitempty"`
Value *[]CommitmentPlan `json:"value,omitempty"`
}
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ListResult) ListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MoveCommitmentAssociationRequest is specifies the destination Azure ML
// commitment plan for a move operation.
type MoveCommitmentAssociationRequest struct {
DestinationPlanID *string `json:"destinationPlanId,omitempty"`
}
// PatchPayload is the properties of a commitment plan which may be updated via
// PATCH.
type PatchPayload struct {
Tags *map[string]*string `json:"tags,omitempty"`
Sku *ResourceSku `json:"sku,omitempty"`
}
// PlanQuantity is represents the quantity a commitment plan provides of a
// metered resource.
type PlanQuantity struct {
Allowance *float64 `json:"allowance,omitempty"`
Amount *float64 `json:"amount,omitempty"`
IncludedQuantityMeter *string `json:"includedQuantityMeter,omitempty"`
OverageMeter *string `json:"overageMeter,omitempty"`
}
// PlanUsageHistory is represents historical information about usage of the
// Azure resources associated with a commitment plan.
type PlanUsageHistory struct {
PlanDeletionOverage *map[string]*float64 `json:"planDeletionOverage,omitempty"`
PlanMigrationOverage *map[string]*float64 `json:"planMigrationOverage,omitempty"`
PlanQuantitiesAfterUsage *map[string]*float64 `json:"planQuantitiesAfterUsage,omitempty"`
PlanQuantitiesBeforeUsage *map[string]*float64 `json:"planQuantitiesBeforeUsage,omitempty"`
PlanUsageOverage *map[string]*float64 `json:"planUsageOverage,omitempty"`
Usage *map[string]*float64 `json:"usage,omitempty"`
UsageDate *date.Time `json:"usageDate,omitempty"`
}
// PlanUsageHistoryListResult is a page of usage history.
type PlanUsageHistoryListResult struct {
autorest.Response `json:"-"`
NextLink *string `json:"nextLink,omitempty"`
Value *[]PlanUsageHistory `json:"value,omitempty"`
}
// PlanUsageHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client PlanUsageHistoryListResult) PlanUsageHistoryListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// Properties is properties of an Azure ML commitment plan.
type Properties struct {
ChargeForOverage *bool `json:"chargeForOverage,omitempty"`
ChargeForPlan *bool `json:"chargeForPlan,omitempty"`
CreationDate *date.Time `json:"creationDate,omitempty"`
IncludedQuantities *map[string]*PlanQuantity `json:"includedQuantities,omitempty"`
MaxAssociationLimit *int32 `json:"maxAssociationLimit,omitempty"`
MaxCapacityLimit *int32 `json:"maxCapacityLimit,omitempty"`
MinCapacityLimit *int32 `json:"minCapacityLimit,omitempty"`
PlanMeter *string `json:"planMeter,omitempty"`
RefillFrequencyInDays *int32 `json:"refillFrequencyInDays,omitempty"`
SuspendPlanOnOverage *bool `json:"suspendPlanOnOverage,omitempty"`
}
// Resource is common properties of an ARM resource.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// ResourceSku is the SKU of a resource.
type ResourceSku struct {
Capacity *int32 `json:"capacity,omitempty"`
Name *string `json:"name,omitempty"`
Tier *string `json:"tier,omitempty"`
}

View file

@ -0,0 +1,140 @@
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// UsageHistoryClient is the these APIs allow end users to operate on Azure
// Machine Learning Commitment Plans resources and their child Commitment
// Association resources. They support CRUD operations for commitment plans,
// get and list operations for commitment associations, moving commitment
// associations between commitment plans, and retrieving commitment plan usage
// history.
type UsageHistoryClient struct {
ManagementClient
}
// NewUsageHistoryClient creates an instance of the UsageHistoryClient client.
func NewUsageHistoryClient(subscriptionID string) UsageHistoryClient {
return NewUsageHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageHistoryClientWithBaseURI creates an instance of the
// UsageHistoryClient client.
func NewUsageHistoryClientWithBaseURI(baseURI string, subscriptionID string) UsageHistoryClient {
return UsageHistoryClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List retrieve the usage history for an Azure ML commitment plan.
//
// resourceGroupName is the resource group name. commitmentPlanName is the
// Azure ML commitment plan name. skipToken is continuation token for
// pagination.
func (client UsageHistoryClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result PlanUsageHistoryListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageHistoryClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commitmentPlanName": autorest.Encode("path", commitmentPlanName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-05-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skipToken) > 0 {
queryParameters["$skipToken"] = autorest.Encode("query", skipToken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/usageHistory", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageHistoryClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client UsageHistoryClient) ListResponder(resp *http.Response) (result PlanUsageHistoryListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client UsageHistoryClient) ListNextResults(lastResults PlanUsageHistoryListResult) (result PlanUsageHistoryListResult, err error) {
req, err := lastResults.PlanUsageHistoryListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to next results request")
}
return
}

View file

@ -0,0 +1,28 @@
package commitmentplans
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.2.0-beta arm-commitmentplans/2016-05-01-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.2.0-beta"
}

View file

@ -0,0 +1,58 @@
// Package webservices implements the Azure ARM Webservices service API version
// 2017-01-01.
//
// These APIs allow end users to operate on Azure Machine Learning Web Services
// resources. They support the following operations:<ul><li>Create or update a
// web service</li><li>Get a web service</li><li>Patch a web
// service</li><li>Delete a web service</li><li>Get All Web Services in a
// Resource Group </li><li>Get All Web Services in a Subscription</li><li>Get
// Web Services Keys</li></ul>
package webservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Webservices
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Webservices.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}

View file

@ -0,0 +1,449 @@
package webservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// AssetType enumerates the values for asset type.
type AssetType string
const (
// AssetTypeModule specifies the asset type module state for asset type.
AssetTypeModule AssetType = "Module"
// AssetTypeResource specifies the asset type resource state for asset
// type.
AssetTypeResource AssetType = "Resource"
)
// ColumnFormat enumerates the values for column format.
type ColumnFormat string
const (
// Byte specifies the byte state for column format.
Byte ColumnFormat = "Byte"
// Char specifies the char state for column format.
Char ColumnFormat = "Char"
// Complex128 specifies the complex 128 state for column format.
Complex128 ColumnFormat = "Complex128"
// Complex64 specifies the complex 64 state for column format.
Complex64 ColumnFormat = "Complex64"
// DateTime specifies the date time state for column format.
DateTime ColumnFormat = "Date-time"
// DateTimeOffset specifies the date time offset state for column format.
DateTimeOffset ColumnFormat = "Date-timeOffset"
// Double specifies the double state for column format.
Double ColumnFormat = "Double"
// Duration specifies the duration state for column format.
Duration ColumnFormat = "Duration"
// Float specifies the float state for column format.
Float ColumnFormat = "Float"
// Int16 specifies the int 16 state for column format.
Int16 ColumnFormat = "Int16"
// Int32 specifies the int 32 state for column format.
Int32 ColumnFormat = "Int32"
// Int64 specifies the int 64 state for column format.
Int64 ColumnFormat = "Int64"
// Int8 specifies the int 8 state for column format.
Int8 ColumnFormat = "Int8"
// Uint16 specifies the uint 16 state for column format.
Uint16 ColumnFormat = "Uint16"
// Uint32 specifies the uint 32 state for column format.
Uint32 ColumnFormat = "Uint32"
// Uint64 specifies the uint 64 state for column format.
Uint64 ColumnFormat = "Uint64"
// Uint8 specifies the uint 8 state for column format.
Uint8 ColumnFormat = "Uint8"
)
// ColumnType enumerates the values for column type.
type ColumnType string
const (
// Boolean specifies the boolean state for column type.
Boolean ColumnType = "Boolean"
// Integer specifies the integer state for column type.
Integer ColumnType = "Integer"
// Number specifies the number state for column type.
Number ColumnType = "Number"
// String specifies the string state for column type.
String ColumnType = "String"
)
// DiagnosticsLevel enumerates the values for diagnostics level.
type DiagnosticsLevel string
const (
// All specifies the all state for diagnostics level.
All DiagnosticsLevel = "All"
// Error specifies the error state for diagnostics level.
Error DiagnosticsLevel = "Error"
// None specifies the none state for diagnostics level.
None DiagnosticsLevel = "None"
)
// InputPortType enumerates the values for input port type.
type InputPortType string
const (
// Dataset specifies the dataset state for input port type.
Dataset InputPortType = "Dataset"
)
// OutputPortType enumerates the values for output port type.
type OutputPortType string
const (
// OutputPortTypeDataset specifies the output port type dataset state for
// output port type.
OutputPortTypeDataset OutputPortType = "Dataset"
)
// ParameterType enumerates the values for parameter type.
type ParameterType string
const (
// ParameterTypeBoolean specifies the parameter type boolean state for
// parameter type.
ParameterTypeBoolean ParameterType = "Boolean"
// ParameterTypeColumnPicker specifies the parameter type column picker
// state for parameter type.
ParameterTypeColumnPicker ParameterType = "ColumnPicker"
// ParameterTypeCredential specifies the parameter type credential state
// for parameter type.
ParameterTypeCredential ParameterType = "Credential"
// ParameterTypeDataGatewayName specifies the parameter type data gateway
// name state for parameter type.
ParameterTypeDataGatewayName ParameterType = "DataGatewayName"
// ParameterTypeDouble specifies the parameter type double state for
// parameter type.
ParameterTypeDouble ParameterType = "Double"
// ParameterTypeEnumerated specifies the parameter type enumerated state
// for parameter type.
ParameterTypeEnumerated ParameterType = "Enumerated"
// ParameterTypeFloat specifies the parameter type float state for
// parameter type.
ParameterTypeFloat ParameterType = "Float"
// ParameterTypeInt specifies the parameter type int state for parameter
// type.
ParameterTypeInt ParameterType = "Int"
// ParameterTypeMode specifies the parameter type mode state for parameter
// type.
ParameterTypeMode ParameterType = "Mode"
// ParameterTypeParameterRange specifies the parameter type parameter range
// state for parameter type.
ParameterTypeParameterRange ParameterType = "ParameterRange"
// ParameterTypeScript specifies the parameter type script state for
// parameter type.
ParameterTypeScript ParameterType = "Script"
// ParameterTypeString specifies the parameter type string state for
// parameter type.
ParameterTypeString ParameterType = "String"
)
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Failed specifies the failed state for provisioning state.
Failed ProvisioningState = "Failed"
// Provisioning specifies the provisioning state for provisioning state.
Provisioning ProvisioningState = "Provisioning"
// Succeeded specifies the succeeded state for provisioning state.
Succeeded ProvisioningState = "Succeeded"
// Unknown specifies the unknown state for provisioning state.
Unknown ProvisioningState = "Unknown"
)
// AssetItem is information about an asset associated with the web service.
type AssetItem struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type AssetType `json:"type,omitempty"`
LocationInfo *BlobLocation `json:"locationInfo,omitempty"`
InputPorts *map[string]*InputPort `json:"inputPorts,omitempty"`
OutputPorts *map[string]*OutputPort `json:"outputPorts,omitempty"`
Metadata *map[string]*string `json:"metadata,omitempty"`
Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
}
// AsyncOperationErrorInfo is the error detail information for async operation
type AsyncOperationErrorInfo struct {
Code *string `json:"code,omitempty"`
Target *string `json:"target,omitempty"`
Message *string `json:"message,omitempty"`
Details *[]AsyncOperationErrorInfo `json:"details,omitempty"`
}
// AsyncOperationStatus is azure async operation status.
type AsyncOperationStatus struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
PercentComplete *float64 `json:"percentComplete,omitempty"`
ErrorInfo *AsyncOperationErrorInfo `json:"errorInfo,omitempty"`
}
// BlobLocation is describes the access location for a blob.
type BlobLocation struct {
URI *string `json:"uri,omitempty"`
Credentials *string `json:"credentials,omitempty"`
}
// ColumnSpecification is swagger 2.0 schema for a column within the data table
// representing a web service input or output. See Swagger specification:
// http://swagger.io/specification/
type ColumnSpecification struct {
Type ColumnType `json:"type,omitempty"`
Format ColumnFormat `json:"format,omitempty"`
Enum *[]map[string]interface{} `json:"enum,omitempty"`
XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"`
XMsIsordered *bool `json:"x-ms-isordered,omitempty"`
}
// CommitmentPlan is information about the machine learning commitment plan
// associated with the web service.
type CommitmentPlan struct {
ID *string `json:"id,omitempty"`
}
// DiagnosticsConfiguration is diagnostics settings for an Azure ML web
// service.
type DiagnosticsConfiguration struct {
Level DiagnosticsLevel `json:"level,omitempty"`
Expiry *date.Time `json:"expiry,omitempty"`
}
// ExampleRequest is sample input data for the service's input(s).
type ExampleRequest struct {
Inputs *map[string][][]map[string]interface{} `json:"inputs,omitempty"`
GlobalParameters *map[string]*map[string]interface{} `json:"globalParameters,omitempty"`
}
// GraphEdge is defines an edge within the web service's graph.
type GraphEdge struct {
SourceNodeID *string `json:"sourceNodeId,omitempty"`
SourcePortID *string `json:"sourcePortId,omitempty"`
TargetNodeID *string `json:"targetNodeId,omitempty"`
TargetPortID *string `json:"targetPortId,omitempty"`
}
// GraphNode is specifies a node in the web service graph. The node can either
// be an input, output or asset node, so only one of the corresponding id
// properties is populated at any given time.
type GraphNode struct {
AssetID *string `json:"assetId,omitempty"`
InputID *string `json:"inputId,omitempty"`
OutputID *string `json:"outputId,omitempty"`
Parameters *map[string]*Parameter `json:"parameters,omitempty"`
}
// GraphPackage is defines the graph of modules making up the machine learning
// solution.
type GraphPackage struct {
Nodes *map[string]*GraphNode `json:"nodes,omitempty"`
Edges *[]GraphEdge `json:"edges,omitempty"`
GraphParameters *map[string]*GraphParameter `json:"graphParameters,omitempty"`
}
// GraphParameter is defines a global parameter in the graph.
type GraphParameter struct {
Description *string `json:"description,omitempty"`
Type ParameterType `json:"type,omitempty"`
Links *[]GraphParameterLink `json:"links,omitempty"`
}
// GraphParameterLink is association link for a graph global parameter to a
// node in the graph.
type GraphParameterLink struct {
NodeID *string `json:"nodeId,omitempty"`
ParameterKey *string `json:"parameterKey,omitempty"`
}
// InputPort is asset input port
type InputPort struct {
Type InputPortType `json:"type,omitempty"`
}
// Keys is access keys for the web service calls.
type Keys struct {
autorest.Response `json:"-"`
Primary *string `json:"primary,omitempty"`
Secondary *string `json:"secondary,omitempty"`
}
// MachineLearningWorkspace is information about the machine learning workspace
// containing the experiment that is source for the web service.
type MachineLearningWorkspace struct {
ID *string `json:"id,omitempty"`
}
// ModeValueInfo is nested parameter definition.
type ModeValueInfo struct {
InterfaceString *string `json:"interfaceString,omitempty"`
Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
}
// ModuleAssetParameter is parameter definition for a module asset.
type ModuleAssetParameter struct {
Name *string `json:"name,omitempty"`
ParameterType *string `json:"parameterType,omitempty"`
ModeValuesInfo *map[string]*ModeValueInfo `json:"modeValuesInfo,omitempty"`
}
// OutputPort is asset output port
type OutputPort struct {
Type OutputPortType `json:"type,omitempty"`
}
// PaginatedWebServicesList is paginated list of web services.
type PaginatedWebServicesList struct {
autorest.Response `json:"-"`
Value *[]WebService `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// PaginatedWebServicesListPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client PaginatedWebServicesList) PaginatedWebServicesListPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// Parameter is web Service Parameter object for node and global parameter
type Parameter struct {
Value *map[string]interface{} `json:"value,omitempty"`
CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
}
// Properties is the set of properties specific to the Azure ML web service
// resource.
type Properties struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
CreatedOn *date.Time `json:"createdOn,omitempty"`
ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
Keys *Keys `json:"keys,omitempty"`
ReadOnly *bool `json:"readOnly,omitempty"`
SwaggerLocation *string `json:"swaggerLocation,omitempty"`
ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
Input *ServiceInputOutputSpecification `json:"input,omitempty"`
Output *ServiceInputOutputSpecification `json:"output,omitempty"`
ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
Assets *map[string]*AssetItem `json:"assets,omitempty"`
Parameters *map[string]*Parameter `json:"parameters,omitempty"`
PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
}
// PropertiesForGraph is properties specific to a Graph based web service.
type PropertiesForGraph struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
CreatedOn *date.Time `json:"createdOn,omitempty"`
ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
Keys *Keys `json:"keys,omitempty"`
ReadOnly *bool `json:"readOnly,omitempty"`
SwaggerLocation *string `json:"swaggerLocation,omitempty"`
ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
Input *ServiceInputOutputSpecification `json:"input,omitempty"`
Output *ServiceInputOutputSpecification `json:"output,omitempty"`
ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
Assets *map[string]*AssetItem `json:"assets,omitempty"`
Parameters *map[string]*Parameter `json:"parameters,omitempty"`
PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
Package *GraphPackage `json:"package,omitempty"`
}
// RealtimeConfiguration is holds the available configuration options for an
// Azure ML web service endpoint.
type RealtimeConfiguration struct {
MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"`
}
// Resource is azure resource.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// ServiceInputOutputSpecification is the swagger 2.0 schema describing the
// service's inputs or outputs. See Swagger specification:
// http://swagger.io/specification/
type ServiceInputOutputSpecification struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Type *string `json:"type,omitempty"`
Properties *map[string]*TableSpecification `json:"properties,omitempty"`
}
// StorageAccount is access information for a storage account.
type StorageAccount struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// TableSpecification is the swagger 2.0 schema describing a single service
// input or output. See Swagger specification: http://swagger.io/specification/
type TableSpecification struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Type *string `json:"type,omitempty"`
Format *string `json:"format,omitempty"`
Properties *map[string]*ColumnSpecification `json:"properties,omitempty"`
}
// WebService is instance of an Azure ML web service resource.
type WebService struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Properties *Properties `json:"properties,omitempty"`
}

View file

@ -0,0 +1,28 @@
package webservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.2.0-beta arm-webservices/2017-01-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.2.0-beta"
}

View file

@ -0,0 +1,741 @@
package webservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// GroupClient is the these APIs allow end users to operate on Azure Machine
// Learning Web Services resources. They support the following
// operations:<ul><li>Create or update a web service</li><li>Get a web
// service</li><li>Patch a web service</li><li>Delete a web service</li><li>Get
// All Web Services in a Resource Group </li><li>Get All Web Services in a
// Subscription</li><li>Get Web Services Keys</li></ul>
type GroupClient struct {
ManagementClient
}
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate create or update a web service. This call will overwrite an
// existing web service. Note that there is no warning or confirmation. This is
// a nonrecoverable operation. If your intent is to create a new web service,
// call the Get operation first to verify that it does not exist. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service.
// createOrUpdatePayload is the payload that is used to create or update the
// web service.
func (client GroupClient) CreateOrUpdate(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) {
resultChan := make(chan WebService, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{
{TargetValue: createOrUpdatePayload,
Constraints: []validation.Constraint{{Target: "createOrUpdatePayload.Properties", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil},
{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMinimum, Rule: 4, Chain: nil},
}},
}},
{Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace.ID", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "createOrUpdatePayload.Properties.CommitmentPlan", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.CommitmentPlan.ID", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "createOrUpdatePayload.Properties.Input", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Input.Type", Name: validation.Null, Rule: true, Chain: nil},
{Target: "createOrUpdatePayload.Properties.Input.Properties", Name: validation.Null, Rule: true, Chain: nil},
}},
{Target: "createOrUpdatePayload.Properties.Output", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Output.Type", Name: validation.Null, Rule: true, Chain: nil},
{Target: "createOrUpdatePayload.Properties.Output.Properties", Name: validation.Null, Rule: true, Chain: nil},
}},
{Target: "createOrUpdatePayload.Properties.PayloadsLocation", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.PayloadsLocation.URI", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "webservices.GroupClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
}
go func() {
var err error
var result WebService
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, webServiceName, createOrUpdatePayload, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters),
autorest.WithJSON(createOrUpdatePayload),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result WebService, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateRegionalProperties creates an encrypted credentials parameter blob for
// the specified region. To get the web service from a region other than the
// region in which it has been created, you must first call Create Regional Web
// Services Properties to create a copy of the encrypted credential parameter
// blob in that region. You only need to do this before the first time that you
// get the web service in the new region. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service. region is the region
// for which encrypted credential parameters are created.
func (client GroupClient) CreateRegionalProperties(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (<-chan AsyncOperationStatus, <-chan error) {
resultChan := make(chan AsyncOperationStatus, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result AsyncOperationStatus
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreateRegionalPropertiesPreparer(resourceGroupName, webServiceName, region, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", nil, "Failure preparing request")
return
}
resp, err := client.CreateRegionalPropertiesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure sending request")
return
}
result, err = client.CreateRegionalPropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreateRegionalPropertiesPreparer prepares the CreateRegionalProperties request.
func (client GroupClient) CreateRegionalPropertiesPreparer(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
"region": autorest.Encode("query", region),
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/CreateRegionalBlob", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateRegionalPropertiesSender sends the CreateRegionalProperties request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateRegionalPropertiesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateRegionalPropertiesResponder handles the response to the CreateRegionalProperties request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateRegionalPropertiesResponder(resp *http.Response) (result AsyncOperationStatus, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Get gets the Web Service Definition as specified by a subscription, resource
// group, and name. Note that the storage credentials and web service keys are
// not returned by this call. To get the web service access keys, call List
// Keys.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service. region is the region
// for which encrypted credential parameters are valid.
func (client GroupClient) Get(resourceGroupName string, webServiceName string, region string) (result WebService, err error) {
req, err := client.GetPreparer(resourceGroupName, webServiceName, region)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client GroupClient) GetPreparer(resourceGroupName string, webServiceName string, region string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(region) > 0 {
queryParameters["region"] = autorest.Encode("query", region)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupClient) GetResponder(resp *http.Response) (result WebService, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroup gets the web services in the specified resource group.
//
// resourceGroupName is name of the resource group in which the web service is
// located. skiptoken is continuation token for pagination.
func (client GroupClient) ListByResourceGroup(resourceGroupName string, skiptoken string) (result PaginatedWebServicesList, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName, skiptoken)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, skiptoken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skiptoken) > 0 {
queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result PaginatedWebServicesList, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client GroupClient) ListByResourceGroupNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) {
req, err := lastResults.PaginatedWebServicesListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// ListBySubscriptionID gets the web services in the specified subscription.
//
// skiptoken is continuation token for pagination.
func (client GroupClient) ListBySubscriptionID(skiptoken string) (result PaginatedWebServicesList, err error) {
req, err := client.ListBySubscriptionIDPreparer(skiptoken)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing request")
return
}
resp, err := client.ListBySubscriptionIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending request")
return
}
result, err = client.ListBySubscriptionIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to request")
}
return
}
// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request.
func (client GroupClient) ListBySubscriptionIDPreparer(skiptoken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(skiptoken) > 0 {
queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/webServices", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always
// closes the http.Response Body.
func (client GroupClient) ListBySubscriptionIDResponder(resp *http.Response) (result PaginatedWebServicesList, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListBySubscriptionIDNextResults retrieves the next set of results, if any.
func (client GroupClient) ListBySubscriptionIDNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) {
req, err := lastResults.PaginatedWebServicesListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListBySubscriptionIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending next results request")
}
result, err = client.ListBySubscriptionIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to next results request")
}
return
}
// ListKeys gets the access keys for the specified web service.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service.
func (client GroupClient) ListKeys(resourceGroupName string, webServiceName string) (result Keys, err error) {
req, err := client.ListKeysPreparer(resourceGroupName, webServiceName)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", nil, "Failure preparing request")
return
}
resp, err := client.ListKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure sending request")
return
}
result, err = client.ListKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure responding to request")
}
return
}
// ListKeysPreparer prepares the ListKeys request.
func (client GroupClient) ListKeysPreparer(resourceGroupName string, webServiceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/listKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListKeysSender sends the ListKeys request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListKeysResponder handles the response to the ListKeys request. The method always
// closes the http.Response Body.
func (client GroupClient) ListKeysResponder(resp *http.Response) (result Keys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Patch modifies an existing web service resource. The PATCH API call is an
// asynchronous operation. To determine whether it has completed successfully,
// you must perform a Get operation. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service. patchPayload is the
// payload to use to patch the web service.
func (client GroupClient) Patch(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) {
resultChan := make(chan WebService, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result WebService
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.PatchPreparer(resourceGroupName, webServiceName, patchPayload, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", nil, "Failure preparing request")
return
}
resp, err := client.PatchSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure sending request")
return
}
result, err = client.PatchResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// PatchPreparer prepares the Patch request.
func (client GroupClient) PatchPreparer(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters),
autorest.WithJSON(patchPayload),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// PatchSender sends the Patch request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// PatchResponder handles the response to the Patch request. The method always
// closes the http.Response Body.
func (client GroupClient) PatchResponder(resp *http.Response) (result WebService, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Remove deletes the specified web service. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is name of the resource group in which the web service is
// located. webServiceName is the name of the web service.
func (client GroupClient) Remove(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.RemovePreparer(resourceGroupName, webServiceName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", nil, "Failure preparing request")
return
}
resp, err := client.RemoveSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure sending request")
return
}
result, err = client.RemoveResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// RemovePreparer prepares the Remove request.
func (client GroupClient) RemovePreparer(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"webServiceName": autorest.Encode("path", webServiceName),
}
const APIVersion = "2017-01-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// RemoveSender sends the Remove request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// RemoveResponder handles the response to the Remove request. The method always
// closes the http.Response Body.
func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}