1package visualstudio 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "net/http" 25) 26 27// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 28// ExtensionsClient is the use these APIs to manage Visual Studio Team Services resources through the Azure Resource 29// Manager. All task operations conform to the HTTP/1.1 protocol specification and each operation returns an 30// x-ms-request-id header that can be used to obtain information about the request. You must make sure that requests 31// made to these resources are secure. For more information, see https://docs.microsoft.com/en-us/rest/api/index. 32type ExtensionsClient struct { 33 BaseClient 34} 35 36// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 37// NewExtensionsClient creates an instance of the ExtensionsClient client. 38func NewExtensionsClient(subscriptionID string) ExtensionsClient { 39 return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) 40} 41 42// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 43// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient client. 44func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { 45 return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} 46} 47 48// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 49// Create registers the extension with a Visual Studio Team Services account. 50// 51// resourceGroupName is name of the resource group within the Azure subscription. body is an object containing 52// additional information related to the extension request. accountResourceName is the name of the Visual Studio 53// Team Services account resource. extensionResourceName is the name of the extension. 54func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, body ExtensionResourceRequest, accountResourceName string, extensionResourceName string) (result ExtensionResource, err error) { 55 req, err := client.CreatePreparer(ctx, resourceGroupName, body, accountResourceName, extensionResourceName) 56 if err != nil { 57 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Create", nil, "Failure preparing request") 58 return 59 } 60 61 resp, err := client.CreateSender(req) 62 if err != nil { 63 result.Response = autorest.Response{Response: resp} 64 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Create", resp, "Failure sending request") 65 return 66 } 67 68 result, err = client.CreateResponder(resp) 69 if err != nil { 70 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Create", resp, "Failure responding to request") 71 } 72 73 return 74} 75 76// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 77// CreatePreparer prepares the Create request. 78func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, body ExtensionResourceRequest, accountResourceName string, extensionResourceName string) (*http.Request, error) { 79 pathParameters := map[string]interface{}{ 80 "accountResourceName": autorest.Encode("path", accountResourceName), 81 "extensionResourceName": autorest.Encode("path", extensionResourceName), 82 "resourceGroupName": autorest.Encode("path", resourceGroupName), 83 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 84 } 85 86 const APIVersion = "2014-04-01-preview" 87 queryParameters := map[string]interface{}{ 88 "api-version": APIVersion, 89 } 90 91 preparer := autorest.CreatePreparer( 92 autorest.AsContentType("application/json; charset=utf-8"), 93 autorest.AsPut(), 94 autorest.WithBaseURL(client.BaseURI), 95 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{accountResourceName}/extension/{extensionResourceName}", pathParameters), 96 autorest.WithJSON(body), 97 autorest.WithQueryParameters(queryParameters)) 98 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 99} 100 101// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 102// CreateSender sends the Create request. The method will close the 103// http.Response Body if it receives an error. 104func (client ExtensionsClient) CreateSender(req *http.Request) (*http.Response, error) { 105 return autorest.SendWithSender(client, req, 106 azure.DoRetryWithRegistration(client.Client)) 107} 108 109// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 110// CreateResponder handles the response to the Create request. The method always 111// closes the http.Response Body. 112func (client ExtensionsClient) CreateResponder(resp *http.Response) (result ExtensionResource, err error) { 113 err = autorest.Respond( 114 resp, 115 client.ByInspecting(), 116 azure.WithErrorUnlessStatusCode(http.StatusOK), 117 autorest.ByUnmarshallingJSON(&result), 118 autorest.ByClosing()) 119 result.Response = autorest.Response{Response: resp} 120 return 121} 122 123// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 124// Delete removes an extension resource registration for a Visual Studio Team Services account. 125// 126// resourceGroupName is name of the resource group within the Azure subscription. accountResourceName is the name 127// of the Visual Studio Team Services account resource. extensionResourceName is the name of the extension. 128func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, accountResourceName string, extensionResourceName string) (result autorest.Response, err error) { 129 req, err := client.DeletePreparer(ctx, resourceGroupName, accountResourceName, extensionResourceName) 130 if err != nil { 131 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Delete", nil, "Failure preparing request") 132 return 133 } 134 135 resp, err := client.DeleteSender(req) 136 if err != nil { 137 result.Response = resp 138 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Delete", resp, "Failure sending request") 139 return 140 } 141 142 result, err = client.DeleteResponder(resp) 143 if err != nil { 144 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Delete", resp, "Failure responding to request") 145 } 146 147 return 148} 149 150// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 151// DeletePreparer prepares the Delete request. 152func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountResourceName string, extensionResourceName string) (*http.Request, error) { 153 pathParameters := map[string]interface{}{ 154 "accountResourceName": autorest.Encode("path", accountResourceName), 155 "extensionResourceName": autorest.Encode("path", extensionResourceName), 156 "resourceGroupName": autorest.Encode("path", resourceGroupName), 157 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 158 } 159 160 const APIVersion = "2014-04-01-preview" 161 queryParameters := map[string]interface{}{ 162 "api-version": APIVersion, 163 } 164 165 preparer := autorest.CreatePreparer( 166 autorest.AsDelete(), 167 autorest.WithBaseURL(client.BaseURI), 168 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{accountResourceName}/extension/{extensionResourceName}", pathParameters), 169 autorest.WithQueryParameters(queryParameters)) 170 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 171} 172 173// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 174// DeleteSender sends the Delete request. The method will close the 175// http.Response Body if it receives an error. 176func (client ExtensionsClient) DeleteSender(req *http.Request) (*http.Response, error) { 177 return autorest.SendWithSender(client, req, 178 azure.DoRetryWithRegistration(client.Client)) 179} 180 181// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 182// DeleteResponder handles the response to the Delete request. The method always 183// closes the http.Response Body. 184func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 185 err = autorest.Respond( 186 resp, 187 client.ByInspecting(), 188 azure.WithErrorUnlessStatusCode(http.StatusOK), 189 autorest.ByClosing()) 190 result.Response = resp 191 return 192} 193 194// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 195// Get gets the details of an extension associated with a Visual Studio Team Services account resource. 196// 197// resourceGroupName is name of the resource group within the Azure subscription. accountResourceName is the name 198// of the Visual Studio Team Services account resource. extensionResourceName is the name of the extension. 199func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, accountResourceName string, extensionResourceName string) (result ExtensionResource, err error) { 200 req, err := client.GetPreparer(ctx, resourceGroupName, accountResourceName, extensionResourceName) 201 if err != nil { 202 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Get", nil, "Failure preparing request") 203 return 204 } 205 206 resp, err := client.GetSender(req) 207 if err != nil { 208 result.Response = autorest.Response{Response: resp} 209 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Get", resp, "Failure sending request") 210 return 211 } 212 213 result, err = client.GetResponder(resp) 214 if err != nil { 215 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Get", resp, "Failure responding to request") 216 } 217 218 return 219} 220 221// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 222// GetPreparer prepares the Get request. 223func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountResourceName string, extensionResourceName string) (*http.Request, error) { 224 pathParameters := map[string]interface{}{ 225 "accountResourceName": autorest.Encode("path", accountResourceName), 226 "extensionResourceName": autorest.Encode("path", extensionResourceName), 227 "resourceGroupName": autorest.Encode("path", resourceGroupName), 228 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 229 } 230 231 const APIVersion = "2014-04-01-preview" 232 queryParameters := map[string]interface{}{ 233 "api-version": APIVersion, 234 } 235 236 preparer := autorest.CreatePreparer( 237 autorest.AsGet(), 238 autorest.WithBaseURL(client.BaseURI), 239 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{accountResourceName}/extension/{extensionResourceName}", pathParameters), 240 autorest.WithQueryParameters(queryParameters)) 241 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 242} 243 244// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 245// GetSender sends the Get request. The method will close the 246// http.Response Body if it receives an error. 247func (client ExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { 248 return autorest.SendWithSender(client, req, 249 azure.DoRetryWithRegistration(client.Client)) 250} 251 252// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 253// GetResponder handles the response to the Get request. The method always 254// closes the http.Response Body. 255func (client ExtensionsClient) GetResponder(resp *http.Response) (result ExtensionResource, err error) { 256 err = autorest.Respond( 257 resp, 258 client.ByInspecting(), 259 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 260 autorest.ByUnmarshallingJSON(&result), 261 autorest.ByClosing()) 262 result.Response = autorest.Response{Response: resp} 263 return 264} 265 266// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 267// ListByAccount gets the details of the extension resources created within the resource group. 268// 269// resourceGroupName is name of the resource group within the Azure subscription. accountResourceName is the name 270// of the Visual Studio Team Services account resource. 271func (client ExtensionsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountResourceName string) (result ExtensionResourceListResult, err error) { 272 req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountResourceName) 273 if err != nil { 274 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "ListByAccount", nil, "Failure preparing request") 275 return 276 } 277 278 resp, err := client.ListByAccountSender(req) 279 if err != nil { 280 result.Response = autorest.Response{Response: resp} 281 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "ListByAccount", resp, "Failure sending request") 282 return 283 } 284 285 result, err = client.ListByAccountResponder(resp) 286 if err != nil { 287 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "ListByAccount", resp, "Failure responding to request") 288 } 289 290 return 291} 292 293// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 294// ListByAccountPreparer prepares the ListByAccount request. 295func (client ExtensionsClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountResourceName string) (*http.Request, error) { 296 pathParameters := map[string]interface{}{ 297 "accountResourceName": autorest.Encode("path", accountResourceName), 298 "resourceGroupName": autorest.Encode("path", resourceGroupName), 299 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 300 } 301 302 const APIVersion = "2014-04-01-preview" 303 queryParameters := map[string]interface{}{ 304 "api-version": APIVersion, 305 } 306 307 preparer := autorest.CreatePreparer( 308 autorest.AsGet(), 309 autorest.WithBaseURL(client.BaseURI), 310 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{accountResourceName}/extension", pathParameters), 311 autorest.WithQueryParameters(queryParameters)) 312 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 313} 314 315// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 316// ListByAccountSender sends the ListByAccount request. The method will close the 317// http.Response Body if it receives an error. 318func (client ExtensionsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { 319 return autorest.SendWithSender(client, req, 320 azure.DoRetryWithRegistration(client.Client)) 321} 322 323// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 324// ListByAccountResponder handles the response to the ListByAccount request. The method always 325// closes the http.Response Body. 326func (client ExtensionsClient) ListByAccountResponder(resp *http.Response) (result ExtensionResourceListResult, err error) { 327 err = autorest.Respond( 328 resp, 329 client.ByInspecting(), 330 azure.WithErrorUnlessStatusCode(http.StatusOK), 331 autorest.ByUnmarshallingJSON(&result), 332 autorest.ByClosing()) 333 result.Response = autorest.Response{Response: resp} 334 return 335} 336 337// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 338// Update updates an existing extension registration for the Visual Studio Team Services account. 339// 340// resourceGroupName is name of the resource group within the Azure subscription. body is an object containing 341// additional information related to the extension request. accountResourceName is the name of the Visual Studio 342// Team Services account resource. extensionResourceName is the name of the extension. 343func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, body ExtensionResourceRequest, accountResourceName string, extensionResourceName string) (result ExtensionResource, err error) { 344 req, err := client.UpdatePreparer(ctx, resourceGroupName, body, accountResourceName, extensionResourceName) 345 if err != nil { 346 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Update", nil, "Failure preparing request") 347 return 348 } 349 350 resp, err := client.UpdateSender(req) 351 if err != nil { 352 result.Response = autorest.Response{Response: resp} 353 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Update", resp, "Failure sending request") 354 return 355 } 356 357 result, err = client.UpdateResponder(resp) 358 if err != nil { 359 err = autorest.NewErrorWithError(err, "visualstudio.ExtensionsClient", "Update", resp, "Failure responding to request") 360 } 361 362 return 363} 364 365// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 366// UpdatePreparer prepares the Update request. 367func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, body ExtensionResourceRequest, accountResourceName string, extensionResourceName string) (*http.Request, error) { 368 pathParameters := map[string]interface{}{ 369 "accountResourceName": autorest.Encode("path", accountResourceName), 370 "extensionResourceName": autorest.Encode("path", extensionResourceName), 371 "resourceGroupName": autorest.Encode("path", resourceGroupName), 372 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 373 } 374 375 const APIVersion = "2014-04-01-preview" 376 queryParameters := map[string]interface{}{ 377 "api-version": APIVersion, 378 } 379 380 preparer := autorest.CreatePreparer( 381 autorest.AsContentType("application/json; charset=utf-8"), 382 autorest.AsPatch(), 383 autorest.WithBaseURL(client.BaseURI), 384 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{accountResourceName}/extension/{extensionResourceName}", pathParameters), 385 autorest.WithJSON(body), 386 autorest.WithQueryParameters(queryParameters)) 387 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 388} 389 390// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 391// UpdateSender sends the Update request. The method will close the 392// http.Response Body if it receives an error. 393func (client ExtensionsClient) UpdateSender(req *http.Request) (*http.Response, error) { 394 return autorest.SendWithSender(client, req, 395 azure.DoRetryWithRegistration(client.Client)) 396} 397 398// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead. 399// UpdateResponder handles the response to the Update request. The method always 400// closes the http.Response Body. 401func (client ExtensionsClient) UpdateResponder(resp *http.Response) (result ExtensionResource, err error) { 402 err = autorest.Respond( 403 resp, 404 client.ByInspecting(), 405 azure.WithErrorUnlessStatusCode(http.StatusOK), 406 autorest.ByUnmarshallingJSON(&result), 407 autorest.ByClosing()) 408 result.Response = autorest.Response{Response: resp} 409 return 410} 411