diff --git a/profiles/preview/preview/visualstudio/mgmt/visualstudio/models.go b/profiles/preview/preview/visualstudio/mgmt/visualstudio/models.go index e0f9b2ec199b..a395d4e16984 100644 --- a/profiles/preview/preview/visualstudio/mgmt/visualstudio/models.go +++ b/profiles/preview/preview/visualstudio/mgmt/visualstudio/models.go @@ -32,6 +32,7 @@ type ExtensionsClient = original.ExtensionsClient type AccountResource = original.AccountResource type AccountResourceListResult = original.AccountResourceListResult type AccountResourceRequest = original.AccountResourceRequest +type AccountTagRequest = original.AccountTagRequest type CheckNameAvailabilityParameter = original.CheckNameAvailabilityParameter type CheckNameAvailabilityResult = original.CheckNameAvailabilityResult type ExtensionResource = original.ExtensionResource diff --git a/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/accounts.go b/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/accounts.go index d3ff239c7210..38b6798eb72d 100644 --- a/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/accounts.go +++ b/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/accounts.go @@ -428,3 +428,83 @@ func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) ( result.Response = autorest.Response{Response: resp} return } + +// Update updates tags for Visual Studio Team Services account resource. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// body - the request data. +// resourceName - name of the resource. +func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, body AccountTagRequest, resourceName string) (result AccountResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, body, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "visualstudio.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "visualstudio.AccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "visualstudio.AccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, body AccountTagRequest, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{resourceName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result AccountResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/models.go b/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/models.go index 113835936a6c..8cdf6e291506 100644 --- a/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/models.go +++ b/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio/models.go @@ -108,6 +108,21 @@ func (arr AccountResourceRequest) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AccountTagRequest the body of a Patch request to add tags to a Visual Studio account resource. +type AccountTagRequest struct { + // Tags - The custom tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AccountTagRequest. +func (atr AccountTagRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if atr.Tags != nil { + objectMap["tags"] = atr.Tags + } + return json.Marshal(objectMap) +} + // CheckNameAvailabilityParameter the body of a POST request to check name availability. type CheckNameAvailabilityParameter struct { // ResourceName - The name of the resource to check availability for.