1package web 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// AppServicePlansClient is the webSite Management Client 19type AppServicePlansClient struct { 20 BaseClient 21} 22 23// NewAppServicePlansClient creates an instance of the AppServicePlansClient client. 24func NewAppServicePlansClient(subscriptionID string) AppServicePlansClient { 25 return NewAppServicePlansClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewAppServicePlansClientWithBaseURI creates an instance of the AppServicePlansClient client using a custom endpoint. 29// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 30func NewAppServicePlansClientWithBaseURI(baseURI string, subscriptionID string) AppServicePlansClient { 31 return AppServicePlansClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// CreateOrUpdate description for Creates or updates an App Service Plan. 35// Parameters: 36// resourceGroupName - name of the resource group to which the resource belongs. 37// name - name of the App Service plan. 38// appServicePlan - details of the App Service plan. 39func (client AppServicePlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlan) (result AppServicePlansCreateOrUpdateFuture, err error) { 40 if tracing.IsEnabled() { 41 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.CreateOrUpdate") 42 defer func() { 43 sc := -1 44 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 45 sc = result.FutureAPI.Response().StatusCode 46 } 47 tracing.EndSpan(ctx, sc, err) 48 }() 49 } 50 if err := validation.Validate([]validation.Validation{ 51 {TargetValue: resourceGroupName, 52 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 53 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 54 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 55 return result, validation.NewError("web.AppServicePlansClient", "CreateOrUpdate", err.Error()) 56 } 57 58 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, appServicePlan) 59 if err != nil { 60 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure preparing request") 61 return 62 } 63 64 result, err = client.CreateOrUpdateSender(req) 65 if err != nil { 66 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure sending request") 67 return 68 } 69 70 return 71} 72 73// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 74func (client AppServicePlansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlan) (*http.Request, error) { 75 pathParameters := map[string]interface{}{ 76 "name": autorest.Encode("path", name), 77 "resourceGroupName": autorest.Encode("path", resourceGroupName), 78 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 79 } 80 81 const APIVersion = "2020-09-01" 82 queryParameters := map[string]interface{}{ 83 "api-version": APIVersion, 84 } 85 86 preparer := autorest.CreatePreparer( 87 autorest.AsContentType("application/json; charset=utf-8"), 88 autorest.AsPut(), 89 autorest.WithBaseURL(client.BaseURI), 90 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), 91 autorest.WithJSON(appServicePlan), 92 autorest.WithQueryParameters(queryParameters)) 93 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 94} 95 96// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 97// http.Response Body if it receives an error. 98func (client AppServicePlansClient) CreateOrUpdateSender(req *http.Request) (future AppServicePlansCreateOrUpdateFuture, err error) { 99 var resp *http.Response 100 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 101 if err != nil { 102 return 103 } 104 var azf azure.Future 105 azf, err = azure.NewFutureFromResponse(resp) 106 future.FutureAPI = &azf 107 future.Result = future.result 108 return 109} 110 111// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 112// closes the http.Response Body. 113func (client AppServicePlansClient) CreateOrUpdateResponder(resp *http.Response) (result AppServicePlan, err error) { 114 err = autorest.Respond( 115 resp, 116 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 117 autorest.ByUnmarshallingJSON(&result), 118 autorest.ByClosing()) 119 result.Response = autorest.Response{Response: resp} 120 return 121} 122 123// CreateOrUpdateVnetRoute description for Create or update a Virtual Network route in an App Service plan. 124// Parameters: 125// resourceGroupName - name of the resource group to which the resource belongs. 126// name - name of the App Service plan. 127// vnetName - name of the Virtual Network. 128// routeName - name of the Virtual Network route. 129// route - definition of the Virtual Network route. 130func (client AppServicePlansClient) CreateOrUpdateVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { 131 if tracing.IsEnabled() { 132 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.CreateOrUpdateVnetRoute") 133 defer func() { 134 sc := -1 135 if result.Response.Response != nil { 136 sc = result.Response.Response.StatusCode 137 } 138 tracing.EndSpan(ctx, sc, err) 139 }() 140 } 141 if err := validation.Validate([]validation.Validation{ 142 {TargetValue: resourceGroupName, 143 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 144 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 145 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 146 return result, validation.NewError("web.AppServicePlansClient", "CreateOrUpdateVnetRoute", err.Error()) 147 } 148 149 req, err := client.CreateOrUpdateVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName, route) 150 if err != nil { 151 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") 152 return 153 } 154 155 resp, err := client.CreateOrUpdateVnetRouteSender(req) 156 if err != nil { 157 result.Response = autorest.Response{Response: resp} 158 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") 159 return 160 } 161 162 result, err = client.CreateOrUpdateVnetRouteResponder(resp) 163 if err != nil { 164 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") 165 return 166 } 167 168 return 169} 170 171// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. 172func (client AppServicePlansClient) CreateOrUpdateVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { 173 pathParameters := map[string]interface{}{ 174 "name": autorest.Encode("path", name), 175 "resourceGroupName": autorest.Encode("path", resourceGroupName), 176 "routeName": autorest.Encode("path", routeName), 177 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 178 "vnetName": autorest.Encode("path", vnetName), 179 } 180 181 const APIVersion = "2020-09-01" 182 queryParameters := map[string]interface{}{ 183 "api-version": APIVersion, 184 } 185 186 preparer := autorest.CreatePreparer( 187 autorest.AsContentType("application/json; charset=utf-8"), 188 autorest.AsPut(), 189 autorest.WithBaseURL(client.BaseURI), 190 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), 191 autorest.WithJSON(route), 192 autorest.WithQueryParameters(queryParameters)) 193 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 194} 195 196// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the 197// http.Response Body if it receives an error. 198func (client AppServicePlansClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { 199 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 200} 201 202// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always 203// closes the http.Response Body. 204func (client AppServicePlansClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { 205 err = autorest.Respond( 206 resp, 207 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), 208 autorest.ByUnmarshallingJSON(&result), 209 autorest.ByClosing()) 210 result.Response = autorest.Response{Response: resp} 211 return 212} 213 214// Delete description for Delete an App Service plan. 215// Parameters: 216// resourceGroupName - name of the resource group to which the resource belongs. 217// name - name of the App Service plan. 218func (client AppServicePlansClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { 219 if tracing.IsEnabled() { 220 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Delete") 221 defer func() { 222 sc := -1 223 if result.Response != nil { 224 sc = result.Response.StatusCode 225 } 226 tracing.EndSpan(ctx, sc, err) 227 }() 228 } 229 if err := validation.Validate([]validation.Validation{ 230 {TargetValue: resourceGroupName, 231 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 232 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 233 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 234 return result, validation.NewError("web.AppServicePlansClient", "Delete", err.Error()) 235 } 236 237 req, err := client.DeletePreparer(ctx, resourceGroupName, name) 238 if err != nil { 239 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", nil, "Failure preparing request") 240 return 241 } 242 243 resp, err := client.DeleteSender(req) 244 if err != nil { 245 result.Response = resp 246 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure sending request") 247 return 248 } 249 250 result, err = client.DeleteResponder(resp) 251 if err != nil { 252 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure responding to request") 253 return 254 } 255 256 return 257} 258 259// DeletePreparer prepares the Delete request. 260func (client AppServicePlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 261 pathParameters := map[string]interface{}{ 262 "name": autorest.Encode("path", name), 263 "resourceGroupName": autorest.Encode("path", resourceGroupName), 264 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 265 } 266 267 const APIVersion = "2020-09-01" 268 queryParameters := map[string]interface{}{ 269 "api-version": APIVersion, 270 } 271 272 preparer := autorest.CreatePreparer( 273 autorest.AsDelete(), 274 autorest.WithBaseURL(client.BaseURI), 275 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), 276 autorest.WithQueryParameters(queryParameters)) 277 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 278} 279 280// DeleteSender sends the Delete request. The method will close the 281// http.Response Body if it receives an error. 282func (client AppServicePlansClient) DeleteSender(req *http.Request) (*http.Response, error) { 283 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 284} 285 286// DeleteResponder handles the response to the Delete request. The method always 287// closes the http.Response Body. 288func (client AppServicePlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 289 err = autorest.Respond( 290 resp, 291 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 292 autorest.ByClosing()) 293 result.Response = resp 294 return 295} 296 297// DeleteHybridConnection description for Delete a Hybrid Connection in use in an App Service plan. 298// Parameters: 299// resourceGroupName - name of the resource group to which the resource belongs. 300// name - name of the App Service plan. 301// namespaceName - name of the Service Bus namespace. 302// relayName - name of the Service Bus relay. 303func (client AppServicePlansClient) DeleteHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { 304 if tracing.IsEnabled() { 305 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.DeleteHybridConnection") 306 defer func() { 307 sc := -1 308 if result.Response != nil { 309 sc = result.Response.StatusCode 310 } 311 tracing.EndSpan(ctx, sc, err) 312 }() 313 } 314 if err := validation.Validate([]validation.Validation{ 315 {TargetValue: resourceGroupName, 316 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 317 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 318 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 319 return result, validation.NewError("web.AppServicePlansClient", "DeleteHybridConnection", err.Error()) 320 } 321 322 req, err := client.DeleteHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) 323 if err != nil { 324 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", nil, "Failure preparing request") 325 return 326 } 327 328 resp, err := client.DeleteHybridConnectionSender(req) 329 if err != nil { 330 result.Response = resp 331 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure sending request") 332 return 333 } 334 335 result, err = client.DeleteHybridConnectionResponder(resp) 336 if err != nil { 337 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure responding to request") 338 return 339 } 340 341 return 342} 343 344// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. 345func (client AppServicePlansClient) DeleteHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { 346 pathParameters := map[string]interface{}{ 347 "name": autorest.Encode("path", name), 348 "namespaceName": autorest.Encode("path", namespaceName), 349 "relayName": autorest.Encode("path", relayName), 350 "resourceGroupName": autorest.Encode("path", resourceGroupName), 351 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 352 } 353 354 const APIVersion = "2020-09-01" 355 queryParameters := map[string]interface{}{ 356 "api-version": APIVersion, 357 } 358 359 preparer := autorest.CreatePreparer( 360 autorest.AsDelete(), 361 autorest.WithBaseURL(client.BaseURI), 362 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), 363 autorest.WithQueryParameters(queryParameters)) 364 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 365} 366 367// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the 368// http.Response Body if it receives an error. 369func (client AppServicePlansClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { 370 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 371} 372 373// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always 374// closes the http.Response Body. 375func (client AppServicePlansClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { 376 err = autorest.Respond( 377 resp, 378 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 379 autorest.ByClosing()) 380 result.Response = resp 381 return 382} 383 384// DeleteVnetRoute description for Delete a Virtual Network route in an App Service plan. 385// Parameters: 386// resourceGroupName - name of the resource group to which the resource belongs. 387// name - name of the App Service plan. 388// vnetName - name of the Virtual Network. 389// routeName - name of the Virtual Network route. 390func (client AppServicePlansClient) DeleteVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (result autorest.Response, err error) { 391 if tracing.IsEnabled() { 392 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.DeleteVnetRoute") 393 defer func() { 394 sc := -1 395 if result.Response != nil { 396 sc = result.Response.StatusCode 397 } 398 tracing.EndSpan(ctx, sc, err) 399 }() 400 } 401 if err := validation.Validate([]validation.Validation{ 402 {TargetValue: resourceGroupName, 403 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 404 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 405 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 406 return result, validation.NewError("web.AppServicePlansClient", "DeleteVnetRoute", err.Error()) 407 } 408 409 req, err := client.DeleteVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName) 410 if err != nil { 411 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", nil, "Failure preparing request") 412 return 413 } 414 415 resp, err := client.DeleteVnetRouteSender(req) 416 if err != nil { 417 result.Response = resp 418 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure sending request") 419 return 420 } 421 422 result, err = client.DeleteVnetRouteResponder(resp) 423 if err != nil { 424 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure responding to request") 425 return 426 } 427 428 return 429} 430 431// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. 432func (client AppServicePlansClient) DeleteVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { 433 pathParameters := map[string]interface{}{ 434 "name": autorest.Encode("path", name), 435 "resourceGroupName": autorest.Encode("path", resourceGroupName), 436 "routeName": autorest.Encode("path", routeName), 437 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 438 "vnetName": autorest.Encode("path", vnetName), 439 } 440 441 const APIVersion = "2020-09-01" 442 queryParameters := map[string]interface{}{ 443 "api-version": APIVersion, 444 } 445 446 preparer := autorest.CreatePreparer( 447 autorest.AsDelete(), 448 autorest.WithBaseURL(client.BaseURI), 449 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), 450 autorest.WithQueryParameters(queryParameters)) 451 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 452} 453 454// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the 455// http.Response Body if it receives an error. 456func (client AppServicePlansClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { 457 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 458} 459 460// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always 461// closes the http.Response Body. 462func (client AppServicePlansClient) DeleteVnetRouteResponder(resp *http.Response) (result autorest.Response, err error) { 463 err = autorest.Respond( 464 resp, 465 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 466 autorest.ByClosing()) 467 result.Response = resp 468 return 469} 470 471// Get description for Get an App Service plan. 472// Parameters: 473// resourceGroupName - name of the resource group to which the resource belongs. 474// name - name of the App Service plan. 475func (client AppServicePlansClient) Get(ctx context.Context, resourceGroupName string, name string) (result AppServicePlan, err error) { 476 if tracing.IsEnabled() { 477 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Get") 478 defer func() { 479 sc := -1 480 if result.Response.Response != nil { 481 sc = result.Response.Response.StatusCode 482 } 483 tracing.EndSpan(ctx, sc, err) 484 }() 485 } 486 if err := validation.Validate([]validation.Validation{ 487 {TargetValue: resourceGroupName, 488 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 489 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 490 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 491 return result, validation.NewError("web.AppServicePlansClient", "Get", err.Error()) 492 } 493 494 req, err := client.GetPreparer(ctx, resourceGroupName, name) 495 if err != nil { 496 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", nil, "Failure preparing request") 497 return 498 } 499 500 resp, err := client.GetSender(req) 501 if err != nil { 502 result.Response = autorest.Response{Response: resp} 503 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure sending request") 504 return 505 } 506 507 result, err = client.GetResponder(resp) 508 if err != nil { 509 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure responding to request") 510 return 511 } 512 513 return 514} 515 516// GetPreparer prepares the Get request. 517func (client AppServicePlansClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 518 pathParameters := map[string]interface{}{ 519 "name": autorest.Encode("path", name), 520 "resourceGroupName": autorest.Encode("path", resourceGroupName), 521 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 522 } 523 524 const APIVersion = "2020-09-01" 525 queryParameters := map[string]interface{}{ 526 "api-version": APIVersion, 527 } 528 529 preparer := autorest.CreatePreparer( 530 autorest.AsGet(), 531 autorest.WithBaseURL(client.BaseURI), 532 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), 533 autorest.WithQueryParameters(queryParameters)) 534 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 535} 536 537// GetSender sends the Get request. The method will close the 538// http.Response Body if it receives an error. 539func (client AppServicePlansClient) GetSender(req *http.Request) (*http.Response, error) { 540 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 541} 542 543// GetResponder handles the response to the Get request. The method always 544// closes the http.Response Body. 545func (client AppServicePlansClient) GetResponder(resp *http.Response) (result AppServicePlan, err error) { 546 err = autorest.Respond( 547 resp, 548 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 549 autorest.ByUnmarshallingJSON(&result), 550 autorest.ByClosing()) 551 result.Response = autorest.Response{Response: resp} 552 return 553} 554 555// GetHybridConnection description for Retrieve a Hybrid Connection in use in an App Service plan. 556// Parameters: 557// resourceGroupName - name of the resource group to which the resource belongs. 558// name - name of the App Service plan. 559// namespaceName - name of the Service Bus namespace. 560// relayName - name of the Service Bus relay. 561func (client AppServicePlansClient) GetHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { 562 if tracing.IsEnabled() { 563 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetHybridConnection") 564 defer func() { 565 sc := -1 566 if result.Response.Response != nil { 567 sc = result.Response.Response.StatusCode 568 } 569 tracing.EndSpan(ctx, sc, err) 570 }() 571 } 572 if err := validation.Validate([]validation.Validation{ 573 {TargetValue: resourceGroupName, 574 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 575 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 576 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 577 return result, validation.NewError("web.AppServicePlansClient", "GetHybridConnection", err.Error()) 578 } 579 580 req, err := client.GetHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) 581 if err != nil { 582 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", nil, "Failure preparing request") 583 return 584 } 585 586 resp, err := client.GetHybridConnectionSender(req) 587 if err != nil { 588 result.Response = autorest.Response{Response: resp} 589 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure sending request") 590 return 591 } 592 593 result, err = client.GetHybridConnectionResponder(resp) 594 if err != nil { 595 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure responding to request") 596 return 597 } 598 599 return 600} 601 602// GetHybridConnectionPreparer prepares the GetHybridConnection request. 603func (client AppServicePlansClient) GetHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { 604 pathParameters := map[string]interface{}{ 605 "name": autorest.Encode("path", name), 606 "namespaceName": autorest.Encode("path", namespaceName), 607 "relayName": autorest.Encode("path", relayName), 608 "resourceGroupName": autorest.Encode("path", resourceGroupName), 609 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 610 } 611 612 const APIVersion = "2020-09-01" 613 queryParameters := map[string]interface{}{ 614 "api-version": APIVersion, 615 } 616 617 preparer := autorest.CreatePreparer( 618 autorest.AsGet(), 619 autorest.WithBaseURL(client.BaseURI), 620 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), 621 autorest.WithQueryParameters(queryParameters)) 622 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 623} 624 625// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the 626// http.Response Body if it receives an error. 627func (client AppServicePlansClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { 628 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 629} 630 631// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always 632// closes the http.Response Body. 633func (client AppServicePlansClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { 634 err = autorest.Respond( 635 resp, 636 azure.WithErrorUnlessStatusCode(http.StatusOK), 637 autorest.ByUnmarshallingJSON(&result), 638 autorest.ByClosing()) 639 result.Response = autorest.Response{Response: resp} 640 return 641} 642 643// GetHybridConnectionPlanLimit description for Get the maximum number of Hybrid Connections allowed in an App Service 644// plan. 645// Parameters: 646// resourceGroupName - name of the resource group to which the resource belongs. 647// name - name of the App Service plan. 648func (client AppServicePlansClient) GetHybridConnectionPlanLimit(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionLimits, err error) { 649 if tracing.IsEnabled() { 650 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetHybridConnectionPlanLimit") 651 defer func() { 652 sc := -1 653 if result.Response.Response != nil { 654 sc = result.Response.Response.StatusCode 655 } 656 tracing.EndSpan(ctx, sc, err) 657 }() 658 } 659 if err := validation.Validate([]validation.Validation{ 660 {TargetValue: resourceGroupName, 661 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 662 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 663 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 664 return result, validation.NewError("web.AppServicePlansClient", "GetHybridConnectionPlanLimit", err.Error()) 665 } 666 667 req, err := client.GetHybridConnectionPlanLimitPreparer(ctx, resourceGroupName, name) 668 if err != nil { 669 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", nil, "Failure preparing request") 670 return 671 } 672 673 resp, err := client.GetHybridConnectionPlanLimitSender(req) 674 if err != nil { 675 result.Response = autorest.Response{Response: resp} 676 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure sending request") 677 return 678 } 679 680 result, err = client.GetHybridConnectionPlanLimitResponder(resp) 681 if err != nil { 682 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure responding to request") 683 return 684 } 685 686 return 687} 688 689// GetHybridConnectionPlanLimitPreparer prepares the GetHybridConnectionPlanLimit request. 690func (client AppServicePlansClient) GetHybridConnectionPlanLimitPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 691 pathParameters := map[string]interface{}{ 692 "name": autorest.Encode("path", name), 693 "resourceGroupName": autorest.Encode("path", resourceGroupName), 694 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 695 } 696 697 const APIVersion = "2020-09-01" 698 queryParameters := map[string]interface{}{ 699 "api-version": APIVersion, 700 } 701 702 preparer := autorest.CreatePreparer( 703 autorest.AsGet(), 704 autorest.WithBaseURL(client.BaseURI), 705 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit", pathParameters), 706 autorest.WithQueryParameters(queryParameters)) 707 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 708} 709 710// GetHybridConnectionPlanLimitSender sends the GetHybridConnectionPlanLimit request. The method will close the 711// http.Response Body if it receives an error. 712func (client AppServicePlansClient) GetHybridConnectionPlanLimitSender(req *http.Request) (*http.Response, error) { 713 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 714} 715 716// GetHybridConnectionPlanLimitResponder handles the response to the GetHybridConnectionPlanLimit request. The method always 717// closes the http.Response Body. 718func (client AppServicePlansClient) GetHybridConnectionPlanLimitResponder(resp *http.Response) (result HybridConnectionLimits, err error) { 719 err = autorest.Respond( 720 resp, 721 azure.WithErrorUnlessStatusCode(http.StatusOK), 722 autorest.ByUnmarshallingJSON(&result), 723 autorest.ByClosing()) 724 result.Response = autorest.Response{Response: resp} 725 return 726} 727 728// GetRouteForVnet description for Get a Virtual Network route in an App Service plan. 729// Parameters: 730// resourceGroupName - name of the resource group to which the resource belongs. 731// name - name of the App Service plan. 732// vnetName - name of the Virtual Network. 733// routeName - name of the Virtual Network route. 734func (client AppServicePlansClient) GetRouteForVnet(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { 735 if tracing.IsEnabled() { 736 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetRouteForVnet") 737 defer func() { 738 sc := -1 739 if result.Response.Response != nil { 740 sc = result.Response.Response.StatusCode 741 } 742 tracing.EndSpan(ctx, sc, err) 743 }() 744 } 745 if err := validation.Validate([]validation.Validation{ 746 {TargetValue: resourceGroupName, 747 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 748 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 749 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 750 return result, validation.NewError("web.AppServicePlansClient", "GetRouteForVnet", err.Error()) 751 } 752 753 req, err := client.GetRouteForVnetPreparer(ctx, resourceGroupName, name, vnetName, routeName) 754 if err != nil { 755 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", nil, "Failure preparing request") 756 return 757 } 758 759 resp, err := client.GetRouteForVnetSender(req) 760 if err != nil { 761 result.Response = autorest.Response{Response: resp} 762 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure sending request") 763 return 764 } 765 766 result, err = client.GetRouteForVnetResponder(resp) 767 if err != nil { 768 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure responding to request") 769 return 770 } 771 772 return 773} 774 775// GetRouteForVnetPreparer prepares the GetRouteForVnet request. 776func (client AppServicePlansClient) GetRouteForVnetPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { 777 pathParameters := map[string]interface{}{ 778 "name": autorest.Encode("path", name), 779 "resourceGroupName": autorest.Encode("path", resourceGroupName), 780 "routeName": autorest.Encode("path", routeName), 781 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 782 "vnetName": autorest.Encode("path", vnetName), 783 } 784 785 const APIVersion = "2020-09-01" 786 queryParameters := map[string]interface{}{ 787 "api-version": APIVersion, 788 } 789 790 preparer := autorest.CreatePreparer( 791 autorest.AsGet(), 792 autorest.WithBaseURL(client.BaseURI), 793 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), 794 autorest.WithQueryParameters(queryParameters)) 795 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 796} 797 798// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the 799// http.Response Body if it receives an error. 800func (client AppServicePlansClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { 801 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 802} 803 804// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always 805// closes the http.Response Body. 806func (client AppServicePlansClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { 807 err = autorest.Respond( 808 resp, 809 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 810 autorest.ByUnmarshallingJSON(&result.Value), 811 autorest.ByClosing()) 812 result.Response = autorest.Response{Response: resp} 813 return 814} 815 816// GetServerFarmSkus description for Gets all selectable SKUs for a given App Service Plan 817// Parameters: 818// resourceGroupName - name of the resource group to which the resource belongs. 819// name - name of App Service Plan 820func (client AppServicePlansClient) GetServerFarmSkus(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) { 821 if tracing.IsEnabled() { 822 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetServerFarmSkus") 823 defer func() { 824 sc := -1 825 if result.Response.Response != nil { 826 sc = result.Response.Response.StatusCode 827 } 828 tracing.EndSpan(ctx, sc, err) 829 }() 830 } 831 if err := validation.Validate([]validation.Validation{ 832 {TargetValue: resourceGroupName, 833 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 834 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 835 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 836 return result, validation.NewError("web.AppServicePlansClient", "GetServerFarmSkus", err.Error()) 837 } 838 839 req, err := client.GetServerFarmSkusPreparer(ctx, resourceGroupName, name) 840 if err != nil { 841 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", nil, "Failure preparing request") 842 return 843 } 844 845 resp, err := client.GetServerFarmSkusSender(req) 846 if err != nil { 847 result.Response = autorest.Response{Response: resp} 848 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", resp, "Failure sending request") 849 return 850 } 851 852 result, err = client.GetServerFarmSkusResponder(resp) 853 if err != nil { 854 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", resp, "Failure responding to request") 855 return 856 } 857 858 return 859} 860 861// GetServerFarmSkusPreparer prepares the GetServerFarmSkus request. 862func (client AppServicePlansClient) GetServerFarmSkusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 863 pathParameters := map[string]interface{}{ 864 "name": autorest.Encode("path", name), 865 "resourceGroupName": autorest.Encode("path", resourceGroupName), 866 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 867 } 868 869 const APIVersion = "2020-09-01" 870 queryParameters := map[string]interface{}{ 871 "api-version": APIVersion, 872 } 873 874 preparer := autorest.CreatePreparer( 875 autorest.AsGet(), 876 autorest.WithBaseURL(client.BaseURI), 877 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus", pathParameters), 878 autorest.WithQueryParameters(queryParameters)) 879 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 880} 881 882// GetServerFarmSkusSender sends the GetServerFarmSkus request. The method will close the 883// http.Response Body if it receives an error. 884func (client AppServicePlansClient) GetServerFarmSkusSender(req *http.Request) (*http.Response, error) { 885 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 886} 887 888// GetServerFarmSkusResponder handles the response to the GetServerFarmSkus request. The method always 889// closes the http.Response Body. 890func (client AppServicePlansClient) GetServerFarmSkusResponder(resp *http.Response) (result SetObject, err error) { 891 err = autorest.Respond( 892 resp, 893 azure.WithErrorUnlessStatusCode(http.StatusOK), 894 autorest.ByUnmarshallingJSON(&result.Value), 895 autorest.ByClosing()) 896 result.Response = autorest.Response{Response: resp} 897 return 898} 899 900// GetVnetFromServerFarm description for Get a Virtual Network associated with an App Service plan. 901// Parameters: 902// resourceGroupName - name of the resource group to which the resource belongs. 903// name - name of the App Service plan. 904// vnetName - name of the Virtual Network. 905func (client AppServicePlansClient) GetVnetFromServerFarm(ctx context.Context, resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { 906 if tracing.IsEnabled() { 907 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetVnetFromServerFarm") 908 defer func() { 909 sc := -1 910 if result.Response.Response != nil { 911 sc = result.Response.Response.StatusCode 912 } 913 tracing.EndSpan(ctx, sc, err) 914 }() 915 } 916 if err := validation.Validate([]validation.Validation{ 917 {TargetValue: resourceGroupName, 918 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 919 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 920 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 921 return result, validation.NewError("web.AppServicePlansClient", "GetVnetFromServerFarm", err.Error()) 922 } 923 924 req, err := client.GetVnetFromServerFarmPreparer(ctx, resourceGroupName, name, vnetName) 925 if err != nil { 926 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", nil, "Failure preparing request") 927 return 928 } 929 930 resp, err := client.GetVnetFromServerFarmSender(req) 931 if err != nil { 932 result.Response = autorest.Response{Response: resp} 933 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure sending request") 934 return 935 } 936 937 result, err = client.GetVnetFromServerFarmResponder(resp) 938 if err != nil { 939 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure responding to request") 940 return 941 } 942 943 return 944} 945 946// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. 947func (client AppServicePlansClient) GetVnetFromServerFarmPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { 948 pathParameters := map[string]interface{}{ 949 "name": autorest.Encode("path", name), 950 "resourceGroupName": autorest.Encode("path", resourceGroupName), 951 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 952 "vnetName": autorest.Encode("path", vnetName), 953 } 954 955 const APIVersion = "2020-09-01" 956 queryParameters := map[string]interface{}{ 957 "api-version": APIVersion, 958 } 959 960 preparer := autorest.CreatePreparer( 961 autorest.AsGet(), 962 autorest.WithBaseURL(client.BaseURI), 963 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), 964 autorest.WithQueryParameters(queryParameters)) 965 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 966} 967 968// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the 969// http.Response Body if it receives an error. 970func (client AppServicePlansClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { 971 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 972} 973 974// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always 975// closes the http.Response Body. 976func (client AppServicePlansClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfo, err error) { 977 err = autorest.Respond( 978 resp, 979 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 980 autorest.ByUnmarshallingJSON(&result), 981 autorest.ByClosing()) 982 result.Response = autorest.Response{Response: resp} 983 return 984} 985 986// GetVnetGateway description for Get a Virtual Network gateway. 987// Parameters: 988// resourceGroupName - name of the resource group to which the resource belongs. 989// name - name of the App Service plan. 990// vnetName - name of the Virtual Network. 991// gatewayName - name of the gateway. Only the 'primary' gateway is supported. 992func (client AppServicePlansClient) GetVnetGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { 993 if tracing.IsEnabled() { 994 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetVnetGateway") 995 defer func() { 996 sc := -1 997 if result.Response.Response != nil { 998 sc = result.Response.Response.StatusCode 999 } 1000 tracing.EndSpan(ctx, sc, err) 1001 }() 1002 } 1003 if err := validation.Validate([]validation.Validation{ 1004 {TargetValue: resourceGroupName, 1005 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1006 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1007 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1008 return result, validation.NewError("web.AppServicePlansClient", "GetVnetGateway", err.Error()) 1009 } 1010 1011 req, err := client.GetVnetGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName) 1012 if err != nil { 1013 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", nil, "Failure preparing request") 1014 return 1015 } 1016 1017 resp, err := client.GetVnetGatewaySender(req) 1018 if err != nil { 1019 result.Response = autorest.Response{Response: resp} 1020 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure sending request") 1021 return 1022 } 1023 1024 result, err = client.GetVnetGatewayResponder(resp) 1025 if err != nil { 1026 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure responding to request") 1027 return 1028 } 1029 1030 return 1031} 1032 1033// GetVnetGatewayPreparer prepares the GetVnetGateway request. 1034func (client AppServicePlansClient) GetVnetGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { 1035 pathParameters := map[string]interface{}{ 1036 "gatewayName": autorest.Encode("path", gatewayName), 1037 "name": autorest.Encode("path", name), 1038 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1039 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1040 "vnetName": autorest.Encode("path", vnetName), 1041 } 1042 1043 const APIVersion = "2020-09-01" 1044 queryParameters := map[string]interface{}{ 1045 "api-version": APIVersion, 1046 } 1047 1048 preparer := autorest.CreatePreparer( 1049 autorest.AsGet(), 1050 autorest.WithBaseURL(client.BaseURI), 1051 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), 1052 autorest.WithQueryParameters(queryParameters)) 1053 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1054} 1055 1056// GetVnetGatewaySender sends the GetVnetGateway request. The method will close the 1057// http.Response Body if it receives an error. 1058func (client AppServicePlansClient) GetVnetGatewaySender(req *http.Request) (*http.Response, error) { 1059 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1060} 1061 1062// GetVnetGatewayResponder handles the response to the GetVnetGateway request. The method always 1063// closes the http.Response Body. 1064func (client AppServicePlansClient) GetVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { 1065 err = autorest.Respond( 1066 resp, 1067 azure.WithErrorUnlessStatusCode(http.StatusOK), 1068 autorest.ByUnmarshallingJSON(&result), 1069 autorest.ByClosing()) 1070 result.Response = autorest.Response{Response: resp} 1071 return 1072} 1073 1074// List description for Get all App Service plans for a subscription. 1075// Parameters: 1076// detailed - specify <code>true</code> to return all App Service plan properties. The default is 1077// <code>false</code>, which returns a subset of the properties. 1078// Retrieval of all properties may increase the API latency. 1079func (client AppServicePlansClient) List(ctx context.Context, detailed *bool) (result AppServicePlanCollectionPage, err error) { 1080 if tracing.IsEnabled() { 1081 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.List") 1082 defer func() { 1083 sc := -1 1084 if result.aspc.Response.Response != nil { 1085 sc = result.aspc.Response.Response.StatusCode 1086 } 1087 tracing.EndSpan(ctx, sc, err) 1088 }() 1089 } 1090 result.fn = client.listNextResults 1091 req, err := client.ListPreparer(ctx, detailed) 1092 if err != nil { 1093 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing request") 1094 return 1095 } 1096 1097 resp, err := client.ListSender(req) 1098 if err != nil { 1099 result.aspc.Response = autorest.Response{Response: resp} 1100 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending request") 1101 return 1102 } 1103 1104 result.aspc, err = client.ListResponder(resp) 1105 if err != nil { 1106 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to request") 1107 return 1108 } 1109 if result.aspc.hasNextLink() && result.aspc.IsEmpty() { 1110 err = result.NextWithContext(ctx) 1111 return 1112 } 1113 1114 return 1115} 1116 1117// ListPreparer prepares the List request. 1118func (client AppServicePlansClient) ListPreparer(ctx context.Context, detailed *bool) (*http.Request, error) { 1119 pathParameters := map[string]interface{}{ 1120 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1121 } 1122 1123 const APIVersion = "2020-09-01" 1124 queryParameters := map[string]interface{}{ 1125 "api-version": APIVersion, 1126 } 1127 if detailed != nil { 1128 queryParameters["detailed"] = autorest.Encode("query", *detailed) 1129 } 1130 1131 preparer := autorest.CreatePreparer( 1132 autorest.AsGet(), 1133 autorest.WithBaseURL(client.BaseURI), 1134 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), 1135 autorest.WithQueryParameters(queryParameters)) 1136 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1137} 1138 1139// ListSender sends the List request. The method will close the 1140// http.Response Body if it receives an error. 1141func (client AppServicePlansClient) ListSender(req *http.Request) (*http.Response, error) { 1142 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1143} 1144 1145// ListResponder handles the response to the List request. The method always 1146// closes the http.Response Body. 1147func (client AppServicePlansClient) ListResponder(resp *http.Response) (result AppServicePlanCollection, err error) { 1148 err = autorest.Respond( 1149 resp, 1150 azure.WithErrorUnlessStatusCode(http.StatusOK), 1151 autorest.ByUnmarshallingJSON(&result), 1152 autorest.ByClosing()) 1153 result.Response = autorest.Response{Response: resp} 1154 return 1155} 1156 1157// listNextResults retrieves the next set of results, if any. 1158func (client AppServicePlansClient) listNextResults(ctx context.Context, lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { 1159 req, err := lastResults.appServicePlanCollectionPreparer(ctx) 1160 if err != nil { 1161 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", nil, "Failure preparing next results request") 1162 } 1163 if req == nil { 1164 return 1165 } 1166 resp, err := client.ListSender(req) 1167 if err != nil { 1168 result.Response = autorest.Response{Response: resp} 1169 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", resp, "Failure sending next results request") 1170 } 1171 result, err = client.ListResponder(resp) 1172 if err != nil { 1173 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", resp, "Failure responding to next results request") 1174 } 1175 return 1176} 1177 1178// ListComplete enumerates all values, automatically crossing page boundaries as required. 1179func (client AppServicePlansClient) ListComplete(ctx context.Context, detailed *bool) (result AppServicePlanCollectionIterator, err error) { 1180 if tracing.IsEnabled() { 1181 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.List") 1182 defer func() { 1183 sc := -1 1184 if result.Response().Response.Response != nil { 1185 sc = result.page.Response().Response.Response.StatusCode 1186 } 1187 tracing.EndSpan(ctx, sc, err) 1188 }() 1189 } 1190 result.page, err = client.List(ctx, detailed) 1191 return 1192} 1193 1194// ListByResourceGroup description for Get all App Service plans in a resource group. 1195// Parameters: 1196// resourceGroupName - name of the resource group to which the resource belongs. 1197func (client AppServicePlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AppServicePlanCollectionPage, err error) { 1198 if tracing.IsEnabled() { 1199 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListByResourceGroup") 1200 defer func() { 1201 sc := -1 1202 if result.aspc.Response.Response != nil { 1203 sc = result.aspc.Response.Response.StatusCode 1204 } 1205 tracing.EndSpan(ctx, sc, err) 1206 }() 1207 } 1208 if err := validation.Validate([]validation.Validation{ 1209 {TargetValue: resourceGroupName, 1210 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1211 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1212 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1213 return result, validation.NewError("web.AppServicePlansClient", "ListByResourceGroup", err.Error()) 1214 } 1215 1216 result.fn = client.listByResourceGroupNextResults 1217 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) 1218 if err != nil { 1219 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing request") 1220 return 1221 } 1222 1223 resp, err := client.ListByResourceGroupSender(req) 1224 if err != nil { 1225 result.aspc.Response = autorest.Response{Response: resp} 1226 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending request") 1227 return 1228 } 1229 1230 result.aspc, err = client.ListByResourceGroupResponder(resp) 1231 if err != nil { 1232 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to request") 1233 return 1234 } 1235 if result.aspc.hasNextLink() && result.aspc.IsEmpty() { 1236 err = result.NextWithContext(ctx) 1237 return 1238 } 1239 1240 return 1241} 1242 1243// ListByResourceGroupPreparer prepares the ListByResourceGroup request. 1244func (client AppServicePlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 1245 pathParameters := map[string]interface{}{ 1246 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1247 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1248 } 1249 1250 const APIVersion = "2020-09-01" 1251 queryParameters := map[string]interface{}{ 1252 "api-version": APIVersion, 1253 } 1254 1255 preparer := autorest.CreatePreparer( 1256 autorest.AsGet(), 1257 autorest.WithBaseURL(client.BaseURI), 1258 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms", pathParameters), 1259 autorest.WithQueryParameters(queryParameters)) 1260 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1261} 1262 1263// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the 1264// http.Response Body if it receives an error. 1265func (client AppServicePlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { 1266 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1267} 1268 1269// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always 1270// closes the http.Response Body. 1271func (client AppServicePlansClient) ListByResourceGroupResponder(resp *http.Response) (result AppServicePlanCollection, err error) { 1272 err = autorest.Respond( 1273 resp, 1274 azure.WithErrorUnlessStatusCode(http.StatusOK), 1275 autorest.ByUnmarshallingJSON(&result), 1276 autorest.ByClosing()) 1277 result.Response = autorest.Response{Response: resp} 1278 return 1279} 1280 1281// listByResourceGroupNextResults retrieves the next set of results, if any. 1282func (client AppServicePlansClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { 1283 req, err := lastResults.appServicePlanCollectionPreparer(ctx) 1284 if err != nil { 1285 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") 1286 } 1287 if req == nil { 1288 return 1289 } 1290 resp, err := client.ListByResourceGroupSender(req) 1291 if err != nil { 1292 result.Response = autorest.Response{Response: resp} 1293 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") 1294 } 1295 result, err = client.ListByResourceGroupResponder(resp) 1296 if err != nil { 1297 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") 1298 } 1299 return 1300} 1301 1302// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 1303func (client AppServicePlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AppServicePlanCollectionIterator, err error) { 1304 if tracing.IsEnabled() { 1305 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListByResourceGroup") 1306 defer func() { 1307 sc := -1 1308 if result.Response().Response.Response != nil { 1309 sc = result.page.Response().Response.Response.StatusCode 1310 } 1311 tracing.EndSpan(ctx, sc, err) 1312 }() 1313 } 1314 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) 1315 return 1316} 1317 1318// ListCapabilities description for List all capabilities of an App Service plan. 1319// Parameters: 1320// resourceGroupName - name of the resource group to which the resource belongs. 1321// name - name of the App Service plan. 1322func (client AppServicePlansClient) ListCapabilities(ctx context.Context, resourceGroupName string, name string) (result ListCapability, err error) { 1323 if tracing.IsEnabled() { 1324 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListCapabilities") 1325 defer func() { 1326 sc := -1 1327 if result.Response.Response != nil { 1328 sc = result.Response.Response.StatusCode 1329 } 1330 tracing.EndSpan(ctx, sc, err) 1331 }() 1332 } 1333 if err := validation.Validate([]validation.Validation{ 1334 {TargetValue: resourceGroupName, 1335 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1336 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1337 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1338 return result, validation.NewError("web.AppServicePlansClient", "ListCapabilities", err.Error()) 1339 } 1340 1341 req, err := client.ListCapabilitiesPreparer(ctx, resourceGroupName, name) 1342 if err != nil { 1343 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", nil, "Failure preparing request") 1344 return 1345 } 1346 1347 resp, err := client.ListCapabilitiesSender(req) 1348 if err != nil { 1349 result.Response = autorest.Response{Response: resp} 1350 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure sending request") 1351 return 1352 } 1353 1354 result, err = client.ListCapabilitiesResponder(resp) 1355 if err != nil { 1356 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure responding to request") 1357 return 1358 } 1359 1360 return 1361} 1362 1363// ListCapabilitiesPreparer prepares the ListCapabilities request. 1364func (client AppServicePlansClient) ListCapabilitiesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 1365 pathParameters := map[string]interface{}{ 1366 "name": autorest.Encode("path", name), 1367 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1368 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1369 } 1370 1371 const APIVersion = "2020-09-01" 1372 queryParameters := map[string]interface{}{ 1373 "api-version": APIVersion, 1374 } 1375 1376 preparer := autorest.CreatePreparer( 1377 autorest.AsGet(), 1378 autorest.WithBaseURL(client.BaseURI), 1379 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities", pathParameters), 1380 autorest.WithQueryParameters(queryParameters)) 1381 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1382} 1383 1384// ListCapabilitiesSender sends the ListCapabilities request. The method will close the 1385// http.Response Body if it receives an error. 1386func (client AppServicePlansClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { 1387 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1388} 1389 1390// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always 1391// closes the http.Response Body. 1392func (client AppServicePlansClient) ListCapabilitiesResponder(resp *http.Response) (result ListCapability, err error) { 1393 err = autorest.Respond( 1394 resp, 1395 azure.WithErrorUnlessStatusCode(http.StatusOK), 1396 autorest.ByUnmarshallingJSON(&result.Value), 1397 autorest.ByClosing()) 1398 result.Response = autorest.Response{Response: resp} 1399 return 1400} 1401 1402// ListHybridConnectionKeys description for Get the send key name and value of a Hybrid Connection. 1403// Parameters: 1404// resourceGroupName - name of the resource group to which the resource belongs. 1405// name - name of the App Service plan. 1406// namespaceName - the name of the Service Bus namespace. 1407// relayName - the name of the Service Bus relay. 1408func (client AppServicePlansClient) ListHybridConnectionKeys(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { 1409 if tracing.IsEnabled() { 1410 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnectionKeys") 1411 defer func() { 1412 sc := -1 1413 if result.Response.Response != nil { 1414 sc = result.Response.Response.StatusCode 1415 } 1416 tracing.EndSpan(ctx, sc, err) 1417 }() 1418 } 1419 if err := validation.Validate([]validation.Validation{ 1420 {TargetValue: resourceGroupName, 1421 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1422 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1423 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1424 return result, validation.NewError("web.AppServicePlansClient", "ListHybridConnectionKeys", err.Error()) 1425 } 1426 1427 req, err := client.ListHybridConnectionKeysPreparer(ctx, resourceGroupName, name, namespaceName, relayName) 1428 if err != nil { 1429 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", nil, "Failure preparing request") 1430 return 1431 } 1432 1433 resp, err := client.ListHybridConnectionKeysSender(req) 1434 if err != nil { 1435 result.Response = autorest.Response{Response: resp} 1436 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure sending request") 1437 return 1438 } 1439 1440 result, err = client.ListHybridConnectionKeysResponder(resp) 1441 if err != nil { 1442 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure responding to request") 1443 return 1444 } 1445 1446 return 1447} 1448 1449// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. 1450func (client AppServicePlansClient) ListHybridConnectionKeysPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { 1451 pathParameters := map[string]interface{}{ 1452 "name": autorest.Encode("path", name), 1453 "namespaceName": autorest.Encode("path", namespaceName), 1454 "relayName": autorest.Encode("path", relayName), 1455 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1456 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1457 } 1458 1459 const APIVersion = "2020-09-01" 1460 queryParameters := map[string]interface{}{ 1461 "api-version": APIVersion, 1462 } 1463 1464 preparer := autorest.CreatePreparer( 1465 autorest.AsPost(), 1466 autorest.WithBaseURL(client.BaseURI), 1467 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), 1468 autorest.WithQueryParameters(queryParameters)) 1469 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1470} 1471 1472// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the 1473// http.Response Body if it receives an error. 1474func (client AppServicePlansClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { 1475 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1476} 1477 1478// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always 1479// closes the http.Response Body. 1480func (client AppServicePlansClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { 1481 err = autorest.Respond( 1482 resp, 1483 azure.WithErrorUnlessStatusCode(http.StatusOK), 1484 autorest.ByUnmarshallingJSON(&result), 1485 autorest.ByClosing()) 1486 result.Response = autorest.Response{Response: resp} 1487 return 1488} 1489 1490// ListHybridConnections description for Retrieve all Hybrid Connections in use in an App Service plan. 1491// Parameters: 1492// resourceGroupName - name of the resource group to which the resource belongs. 1493// name - name of the App Service plan. 1494func (client AppServicePlansClient) ListHybridConnections(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionCollectionPage, err error) { 1495 if tracing.IsEnabled() { 1496 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnections") 1497 defer func() { 1498 sc := -1 1499 if result.hcc.Response.Response != nil { 1500 sc = result.hcc.Response.Response.StatusCode 1501 } 1502 tracing.EndSpan(ctx, sc, err) 1503 }() 1504 } 1505 if err := validation.Validate([]validation.Validation{ 1506 {TargetValue: resourceGroupName, 1507 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1508 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1509 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1510 return result, validation.NewError("web.AppServicePlansClient", "ListHybridConnections", err.Error()) 1511 } 1512 1513 result.fn = client.listHybridConnectionsNextResults 1514 req, err := client.ListHybridConnectionsPreparer(ctx, resourceGroupName, name) 1515 if err != nil { 1516 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing request") 1517 return 1518 } 1519 1520 resp, err := client.ListHybridConnectionsSender(req) 1521 if err != nil { 1522 result.hcc.Response = autorest.Response{Response: resp} 1523 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending request") 1524 return 1525 } 1526 1527 result.hcc, err = client.ListHybridConnectionsResponder(resp) 1528 if err != nil { 1529 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to request") 1530 return 1531 } 1532 if result.hcc.hasNextLink() && result.hcc.IsEmpty() { 1533 err = result.NextWithContext(ctx) 1534 return 1535 } 1536 1537 return 1538} 1539 1540// ListHybridConnectionsPreparer prepares the ListHybridConnections request. 1541func (client AppServicePlansClient) ListHybridConnectionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 1542 pathParameters := map[string]interface{}{ 1543 "name": autorest.Encode("path", name), 1544 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1545 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1546 } 1547 1548 const APIVersion = "2020-09-01" 1549 queryParameters := map[string]interface{}{ 1550 "api-version": APIVersion, 1551 } 1552 1553 preparer := autorest.CreatePreparer( 1554 autorest.AsGet(), 1555 autorest.WithBaseURL(client.BaseURI), 1556 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays", pathParameters), 1557 autorest.WithQueryParameters(queryParameters)) 1558 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1559} 1560 1561// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the 1562// http.Response Body if it receives an error. 1563func (client AppServicePlansClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { 1564 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1565} 1566 1567// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always 1568// closes the http.Response Body. 1569func (client AppServicePlansClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnectionCollection, err error) { 1570 err = autorest.Respond( 1571 resp, 1572 azure.WithErrorUnlessStatusCode(http.StatusOK), 1573 autorest.ByUnmarshallingJSON(&result), 1574 autorest.ByClosing()) 1575 result.Response = autorest.Response{Response: resp} 1576 return 1577} 1578 1579// listHybridConnectionsNextResults retrieves the next set of results, if any. 1580func (client AppServicePlansClient) listHybridConnectionsNextResults(ctx context.Context, lastResults HybridConnectionCollection) (result HybridConnectionCollection, err error) { 1581 req, err := lastResults.hybridConnectionCollectionPreparer(ctx) 1582 if err != nil { 1583 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", nil, "Failure preparing next results request") 1584 } 1585 if req == nil { 1586 return 1587 } 1588 resp, err := client.ListHybridConnectionsSender(req) 1589 if err != nil { 1590 result.Response = autorest.Response{Response: resp} 1591 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", resp, "Failure sending next results request") 1592 } 1593 result, err = client.ListHybridConnectionsResponder(resp) 1594 if err != nil { 1595 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", resp, "Failure responding to next results request") 1596 } 1597 return 1598} 1599 1600// ListHybridConnectionsComplete enumerates all values, automatically crossing page boundaries as required. 1601func (client AppServicePlansClient) ListHybridConnectionsComplete(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionCollectionIterator, err error) { 1602 if tracing.IsEnabled() { 1603 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnections") 1604 defer func() { 1605 sc := -1 1606 if result.Response().Response.Response != nil { 1607 sc = result.page.Response().Response.Response.StatusCode 1608 } 1609 tracing.EndSpan(ctx, sc, err) 1610 }() 1611 } 1612 result.page, err = client.ListHybridConnections(ctx, resourceGroupName, name) 1613 return 1614} 1615 1616// ListRoutesForVnet description for Get all routes that are associated with a Virtual Network in an App Service plan. 1617// Parameters: 1618// resourceGroupName - name of the resource group to which the resource belongs. 1619// name - name of the App Service plan. 1620// vnetName - name of the Virtual Network. 1621func (client AppServicePlansClient) ListRoutesForVnet(ctx context.Context, resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { 1622 if tracing.IsEnabled() { 1623 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListRoutesForVnet") 1624 defer func() { 1625 sc := -1 1626 if result.Response.Response != nil { 1627 sc = result.Response.Response.StatusCode 1628 } 1629 tracing.EndSpan(ctx, sc, err) 1630 }() 1631 } 1632 if err := validation.Validate([]validation.Validation{ 1633 {TargetValue: resourceGroupName, 1634 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1635 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1636 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1637 return result, validation.NewError("web.AppServicePlansClient", "ListRoutesForVnet", err.Error()) 1638 } 1639 1640 req, err := client.ListRoutesForVnetPreparer(ctx, resourceGroupName, name, vnetName) 1641 if err != nil { 1642 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", nil, "Failure preparing request") 1643 return 1644 } 1645 1646 resp, err := client.ListRoutesForVnetSender(req) 1647 if err != nil { 1648 result.Response = autorest.Response{Response: resp} 1649 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure sending request") 1650 return 1651 } 1652 1653 result, err = client.ListRoutesForVnetResponder(resp) 1654 if err != nil { 1655 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure responding to request") 1656 return 1657 } 1658 1659 return 1660} 1661 1662// ListRoutesForVnetPreparer prepares the ListRoutesForVnet request. 1663func (client AppServicePlansClient) ListRoutesForVnetPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { 1664 pathParameters := map[string]interface{}{ 1665 "name": autorest.Encode("path", name), 1666 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1667 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1668 "vnetName": autorest.Encode("path", vnetName), 1669 } 1670 1671 const APIVersion = "2020-09-01" 1672 queryParameters := map[string]interface{}{ 1673 "api-version": APIVersion, 1674 } 1675 1676 preparer := autorest.CreatePreparer( 1677 autorest.AsGet(), 1678 autorest.WithBaseURL(client.BaseURI), 1679 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), 1680 autorest.WithQueryParameters(queryParameters)) 1681 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1682} 1683 1684// ListRoutesForVnetSender sends the ListRoutesForVnet request. The method will close the 1685// http.Response Body if it receives an error. 1686func (client AppServicePlansClient) ListRoutesForVnetSender(req *http.Request) (*http.Response, error) { 1687 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1688} 1689 1690// ListRoutesForVnetResponder handles the response to the ListRoutesForVnet request. The method always 1691// closes the http.Response Body. 1692func (client AppServicePlansClient) ListRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { 1693 err = autorest.Respond( 1694 resp, 1695 azure.WithErrorUnlessStatusCode(http.StatusOK), 1696 autorest.ByUnmarshallingJSON(&result.Value), 1697 autorest.ByClosing()) 1698 result.Response = autorest.Response{Response: resp} 1699 return 1700} 1701 1702// ListUsages description for Gets server farm usage information 1703// Parameters: 1704// resourceGroupName - name of the resource group to which the resource belongs. 1705// name - name of App Service Plan 1706// filter - return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: 1707// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). 1708func (client AppServicePlansClient) ListUsages(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionPage, err error) { 1709 if tracing.IsEnabled() { 1710 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListUsages") 1711 defer func() { 1712 sc := -1 1713 if result.cuqc.Response.Response != nil { 1714 sc = result.cuqc.Response.Response.StatusCode 1715 } 1716 tracing.EndSpan(ctx, sc, err) 1717 }() 1718 } 1719 if err := validation.Validate([]validation.Validation{ 1720 {TargetValue: resourceGroupName, 1721 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1722 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1723 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1724 return result, validation.NewError("web.AppServicePlansClient", "ListUsages", err.Error()) 1725 } 1726 1727 result.fn = client.listUsagesNextResults 1728 req, err := client.ListUsagesPreparer(ctx, resourceGroupName, name, filter) 1729 if err != nil { 1730 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", nil, "Failure preparing request") 1731 return 1732 } 1733 1734 resp, err := client.ListUsagesSender(req) 1735 if err != nil { 1736 result.cuqc.Response = autorest.Response{Response: resp} 1737 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", resp, "Failure sending request") 1738 return 1739 } 1740 1741 result.cuqc, err = client.ListUsagesResponder(resp) 1742 if err != nil { 1743 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", resp, "Failure responding to request") 1744 return 1745 } 1746 if result.cuqc.hasNextLink() && result.cuqc.IsEmpty() { 1747 err = result.NextWithContext(ctx) 1748 return 1749 } 1750 1751 return 1752} 1753 1754// ListUsagesPreparer prepares the ListUsages request. 1755func (client AppServicePlansClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, name string, filter string) (*http.Request, error) { 1756 pathParameters := map[string]interface{}{ 1757 "name": autorest.Encode("path", name), 1758 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1759 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1760 } 1761 1762 const APIVersion = "2020-09-01" 1763 queryParameters := map[string]interface{}{ 1764 "api-version": APIVersion, 1765 } 1766 if len(filter) > 0 { 1767 queryParameters["$filter"] = filter 1768 } 1769 1770 preparer := autorest.CreatePreparer( 1771 autorest.AsGet(), 1772 autorest.WithBaseURL(client.BaseURI), 1773 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages", pathParameters), 1774 autorest.WithQueryParameters(queryParameters)) 1775 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1776} 1777 1778// ListUsagesSender sends the ListUsages request. The method will close the 1779// http.Response Body if it receives an error. 1780func (client AppServicePlansClient) ListUsagesSender(req *http.Request) (*http.Response, error) { 1781 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1782} 1783 1784// ListUsagesResponder handles the response to the ListUsages request. The method always 1785// closes the http.Response Body. 1786func (client AppServicePlansClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { 1787 err = autorest.Respond( 1788 resp, 1789 azure.WithErrorUnlessStatusCode(http.StatusOK), 1790 autorest.ByUnmarshallingJSON(&result), 1791 autorest.ByClosing()) 1792 result.Response = autorest.Response{Response: resp} 1793 return 1794} 1795 1796// listUsagesNextResults retrieves the next set of results, if any. 1797func (client AppServicePlansClient) listUsagesNextResults(ctx context.Context, lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { 1798 req, err := lastResults.csmUsageQuotaCollectionPreparer(ctx) 1799 if err != nil { 1800 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", nil, "Failure preparing next results request") 1801 } 1802 if req == nil { 1803 return 1804 } 1805 resp, err := client.ListUsagesSender(req) 1806 if err != nil { 1807 result.Response = autorest.Response{Response: resp} 1808 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", resp, "Failure sending next results request") 1809 } 1810 result, err = client.ListUsagesResponder(resp) 1811 if err != nil { 1812 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", resp, "Failure responding to next results request") 1813 } 1814 return 1815} 1816 1817// ListUsagesComplete enumerates all values, automatically crossing page boundaries as required. 1818func (client AppServicePlansClient) ListUsagesComplete(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionIterator, err error) { 1819 if tracing.IsEnabled() { 1820 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListUsages") 1821 defer func() { 1822 sc := -1 1823 if result.Response().Response.Response != nil { 1824 sc = result.page.Response().Response.Response.StatusCode 1825 } 1826 tracing.EndSpan(ctx, sc, err) 1827 }() 1828 } 1829 result.page, err = client.ListUsages(ctx, resourceGroupName, name, filter) 1830 return 1831} 1832 1833// ListVnets description for Get all Virtual Networks associated with an App Service plan. 1834// Parameters: 1835// resourceGroupName - name of the resource group to which the resource belongs. 1836// name - name of the App Service plan. 1837func (client AppServicePlansClient) ListVnets(ctx context.Context, resourceGroupName string, name string) (result ListVnetInfo, err error) { 1838 if tracing.IsEnabled() { 1839 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListVnets") 1840 defer func() { 1841 sc := -1 1842 if result.Response.Response != nil { 1843 sc = result.Response.Response.StatusCode 1844 } 1845 tracing.EndSpan(ctx, sc, err) 1846 }() 1847 } 1848 if err := validation.Validate([]validation.Validation{ 1849 {TargetValue: resourceGroupName, 1850 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1851 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1852 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1853 return result, validation.NewError("web.AppServicePlansClient", "ListVnets", err.Error()) 1854 } 1855 1856 req, err := client.ListVnetsPreparer(ctx, resourceGroupName, name) 1857 if err != nil { 1858 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", nil, "Failure preparing request") 1859 return 1860 } 1861 1862 resp, err := client.ListVnetsSender(req) 1863 if err != nil { 1864 result.Response = autorest.Response{Response: resp} 1865 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure sending request") 1866 return 1867 } 1868 1869 result, err = client.ListVnetsResponder(resp) 1870 if err != nil { 1871 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure responding to request") 1872 return 1873 } 1874 1875 return 1876} 1877 1878// ListVnetsPreparer prepares the ListVnets request. 1879func (client AppServicePlansClient) ListVnetsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { 1880 pathParameters := map[string]interface{}{ 1881 "name": autorest.Encode("path", name), 1882 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1883 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1884 } 1885 1886 const APIVersion = "2020-09-01" 1887 queryParameters := map[string]interface{}{ 1888 "api-version": APIVersion, 1889 } 1890 1891 preparer := autorest.CreatePreparer( 1892 autorest.AsGet(), 1893 autorest.WithBaseURL(client.BaseURI), 1894 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), 1895 autorest.WithQueryParameters(queryParameters)) 1896 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1897} 1898 1899// ListVnetsSender sends the ListVnets request. The method will close the 1900// http.Response Body if it receives an error. 1901func (client AppServicePlansClient) ListVnetsSender(req *http.Request) (*http.Response, error) { 1902 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1903} 1904 1905// ListVnetsResponder handles the response to the ListVnets request. The method always 1906// closes the http.Response Body. 1907func (client AppServicePlansClient) ListVnetsResponder(resp *http.Response) (result ListVnetInfo, err error) { 1908 err = autorest.Respond( 1909 resp, 1910 azure.WithErrorUnlessStatusCode(http.StatusOK), 1911 autorest.ByUnmarshallingJSON(&result.Value), 1912 autorest.ByClosing()) 1913 result.Response = autorest.Response{Response: resp} 1914 return 1915} 1916 1917// ListWebApps description for Get all apps associated with an App Service plan. 1918// Parameters: 1919// resourceGroupName - name of the resource group to which the resource belongs. 1920// name - name of the App Service plan. 1921// skipToken - skip to a web app in the list of webapps associated with app service plan. If specified, the 1922// resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list 1923// contains web apps from the start of the list 1924// filter - supported filter: $filter=state eq running. Returns only web apps that are currently running 1925// top - list page size. If specified, results are paged. 1926func (client AppServicePlansClient) ListWebApps(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollectionPage, err error) { 1927 if tracing.IsEnabled() { 1928 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebApps") 1929 defer func() { 1930 sc := -1 1931 if result.ac.Response.Response != nil { 1932 sc = result.ac.Response.Response.StatusCode 1933 } 1934 tracing.EndSpan(ctx, sc, err) 1935 }() 1936 } 1937 if err := validation.Validate([]validation.Validation{ 1938 {TargetValue: resourceGroupName, 1939 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 1940 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 1941 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 1942 return result, validation.NewError("web.AppServicePlansClient", "ListWebApps", err.Error()) 1943 } 1944 1945 result.fn = client.listWebAppsNextResults 1946 req, err := client.ListWebAppsPreparer(ctx, resourceGroupName, name, skipToken, filter, top) 1947 if err != nil { 1948 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing request") 1949 return 1950 } 1951 1952 resp, err := client.ListWebAppsSender(req) 1953 if err != nil { 1954 result.ac.Response = autorest.Response{Response: resp} 1955 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending request") 1956 return 1957 } 1958 1959 result.ac, err = client.ListWebAppsResponder(resp) 1960 if err != nil { 1961 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to request") 1962 return 1963 } 1964 if result.ac.hasNextLink() && result.ac.IsEmpty() { 1965 err = result.NextWithContext(ctx) 1966 return 1967 } 1968 1969 return 1970} 1971 1972// ListWebAppsPreparer prepares the ListWebApps request. 1973func (client AppServicePlansClient) ListWebAppsPreparer(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { 1974 pathParameters := map[string]interface{}{ 1975 "name": autorest.Encode("path", name), 1976 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1977 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1978 } 1979 1980 const APIVersion = "2020-09-01" 1981 queryParameters := map[string]interface{}{ 1982 "api-version": APIVersion, 1983 } 1984 if len(skipToken) > 0 { 1985 queryParameters["$skipToken"] = autorest.Encode("query", skipToken) 1986 } 1987 if len(filter) > 0 { 1988 queryParameters["$filter"] = filter 1989 } 1990 if len(top) > 0 { 1991 queryParameters["$top"] = autorest.Encode("query", top) 1992 } 1993 1994 preparer := autorest.CreatePreparer( 1995 autorest.AsGet(), 1996 autorest.WithBaseURL(client.BaseURI), 1997 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites", pathParameters), 1998 autorest.WithQueryParameters(queryParameters)) 1999 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2000} 2001 2002// ListWebAppsSender sends the ListWebApps request. The method will close the 2003// http.Response Body if it receives an error. 2004func (client AppServicePlansClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { 2005 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2006} 2007 2008// ListWebAppsResponder handles the response to the ListWebApps request. The method always 2009// closes the http.Response Body. 2010func (client AppServicePlansClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { 2011 err = autorest.Respond( 2012 resp, 2013 azure.WithErrorUnlessStatusCode(http.StatusOK), 2014 autorest.ByUnmarshallingJSON(&result), 2015 autorest.ByClosing()) 2016 result.Response = autorest.Response{Response: resp} 2017 return 2018} 2019 2020// listWebAppsNextResults retrieves the next set of results, if any. 2021func (client AppServicePlansClient) listWebAppsNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { 2022 req, err := lastResults.appCollectionPreparer(ctx) 2023 if err != nil { 2024 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", nil, "Failure preparing next results request") 2025 } 2026 if req == nil { 2027 return 2028 } 2029 resp, err := client.ListWebAppsSender(req) 2030 if err != nil { 2031 result.Response = autorest.Response{Response: resp} 2032 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", resp, "Failure sending next results request") 2033 } 2034 result, err = client.ListWebAppsResponder(resp) 2035 if err != nil { 2036 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", resp, "Failure responding to next results request") 2037 } 2038 return 2039} 2040 2041// ListWebAppsComplete enumerates all values, automatically crossing page boundaries as required. 2042func (client AppServicePlansClient) ListWebAppsComplete(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollectionIterator, err error) { 2043 if tracing.IsEnabled() { 2044 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebApps") 2045 defer func() { 2046 sc := -1 2047 if result.Response().Response.Response != nil { 2048 sc = result.page.Response().Response.Response.StatusCode 2049 } 2050 tracing.EndSpan(ctx, sc, err) 2051 }() 2052 } 2053 result.page, err = client.ListWebApps(ctx, resourceGroupName, name, skipToken, filter, top) 2054 return 2055} 2056 2057// ListWebAppsByHybridConnection description for Get all apps that use a Hybrid Connection in an App Service Plan. 2058// Parameters: 2059// resourceGroupName - name of the resource group to which the resource belongs. 2060// name - name of the App Service plan. 2061// namespaceName - name of the Hybrid Connection namespace. 2062// relayName - name of the Hybrid Connection relay. 2063func (client AppServicePlansClient) ListWebAppsByHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollectionPage, err error) { 2064 if tracing.IsEnabled() { 2065 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebAppsByHybridConnection") 2066 defer func() { 2067 sc := -1 2068 if result.rc.Response.Response != nil { 2069 sc = result.rc.Response.Response.StatusCode 2070 } 2071 tracing.EndSpan(ctx, sc, err) 2072 }() 2073 } 2074 if err := validation.Validate([]validation.Validation{ 2075 {TargetValue: resourceGroupName, 2076 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2077 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2078 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 2079 return result, validation.NewError("web.AppServicePlansClient", "ListWebAppsByHybridConnection", err.Error()) 2080 } 2081 2082 result.fn = client.listWebAppsByHybridConnectionNextResults 2083 req, err := client.ListWebAppsByHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) 2084 if err != nil { 2085 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing request") 2086 return 2087 } 2088 2089 resp, err := client.ListWebAppsByHybridConnectionSender(req) 2090 if err != nil { 2091 result.rc.Response = autorest.Response{Response: resp} 2092 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending request") 2093 return 2094 } 2095 2096 result.rc, err = client.ListWebAppsByHybridConnectionResponder(resp) 2097 if err != nil { 2098 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to request") 2099 return 2100 } 2101 if result.rc.hasNextLink() && result.rc.IsEmpty() { 2102 err = result.NextWithContext(ctx) 2103 return 2104 } 2105 2106 return 2107} 2108 2109// ListWebAppsByHybridConnectionPreparer prepares the ListWebAppsByHybridConnection request. 2110func (client AppServicePlansClient) ListWebAppsByHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { 2111 pathParameters := map[string]interface{}{ 2112 "name": autorest.Encode("path", name), 2113 "namespaceName": autorest.Encode("path", namespaceName), 2114 "relayName": autorest.Encode("path", relayName), 2115 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2116 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2117 } 2118 2119 const APIVersion = "2020-09-01" 2120 queryParameters := map[string]interface{}{ 2121 "api-version": APIVersion, 2122 } 2123 2124 preparer := autorest.CreatePreparer( 2125 autorest.AsGet(), 2126 autorest.WithBaseURL(client.BaseURI), 2127 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites", pathParameters), 2128 autorest.WithQueryParameters(queryParameters)) 2129 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2130} 2131 2132// ListWebAppsByHybridConnectionSender sends the ListWebAppsByHybridConnection request. The method will close the 2133// http.Response Body if it receives an error. 2134func (client AppServicePlansClient) ListWebAppsByHybridConnectionSender(req *http.Request) (*http.Response, error) { 2135 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2136} 2137 2138// ListWebAppsByHybridConnectionResponder handles the response to the ListWebAppsByHybridConnection request. The method always 2139// closes the http.Response Body. 2140func (client AppServicePlansClient) ListWebAppsByHybridConnectionResponder(resp *http.Response) (result ResourceCollection, err error) { 2141 err = autorest.Respond( 2142 resp, 2143 azure.WithErrorUnlessStatusCode(http.StatusOK), 2144 autorest.ByUnmarshallingJSON(&result), 2145 autorest.ByClosing()) 2146 result.Response = autorest.Response{Response: resp} 2147 return 2148} 2149 2150// listWebAppsByHybridConnectionNextResults retrieves the next set of results, if any. 2151func (client AppServicePlansClient) listWebAppsByHybridConnectionNextResults(ctx context.Context, lastResults ResourceCollection) (result ResourceCollection, err error) { 2152 req, err := lastResults.resourceCollectionPreparer(ctx) 2153 if err != nil { 2154 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", nil, "Failure preparing next results request") 2155 } 2156 if req == nil { 2157 return 2158 } 2159 resp, err := client.ListWebAppsByHybridConnectionSender(req) 2160 if err != nil { 2161 result.Response = autorest.Response{Response: resp} 2162 return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", resp, "Failure sending next results request") 2163 } 2164 result, err = client.ListWebAppsByHybridConnectionResponder(resp) 2165 if err != nil { 2166 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", resp, "Failure responding to next results request") 2167 } 2168 return 2169} 2170 2171// ListWebAppsByHybridConnectionComplete enumerates all values, automatically crossing page boundaries as required. 2172func (client AppServicePlansClient) ListWebAppsByHybridConnectionComplete(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollectionIterator, err error) { 2173 if tracing.IsEnabled() { 2174 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebAppsByHybridConnection") 2175 defer func() { 2176 sc := -1 2177 if result.Response().Response.Response != nil { 2178 sc = result.page.Response().Response.Response.StatusCode 2179 } 2180 tracing.EndSpan(ctx, sc, err) 2181 }() 2182 } 2183 result.page, err = client.ListWebAppsByHybridConnection(ctx, resourceGroupName, name, namespaceName, relayName) 2184 return 2185} 2186 2187// RebootWorker description for Reboot a worker machine in an App Service plan. 2188// Parameters: 2189// resourceGroupName - name of the resource group to which the resource belongs. 2190// name - name of the App Service plan. 2191// workerName - name of worker machine, which typically starts with RD. 2192func (client AppServicePlansClient) RebootWorker(ctx context.Context, resourceGroupName string, name string, workerName string) (result autorest.Response, err error) { 2193 if tracing.IsEnabled() { 2194 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.RebootWorker") 2195 defer func() { 2196 sc := -1 2197 if result.Response != nil { 2198 sc = result.Response.StatusCode 2199 } 2200 tracing.EndSpan(ctx, sc, err) 2201 }() 2202 } 2203 if err := validation.Validate([]validation.Validation{ 2204 {TargetValue: resourceGroupName, 2205 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2206 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2207 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 2208 return result, validation.NewError("web.AppServicePlansClient", "RebootWorker", err.Error()) 2209 } 2210 2211 req, err := client.RebootWorkerPreparer(ctx, resourceGroupName, name, workerName) 2212 if err != nil { 2213 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", nil, "Failure preparing request") 2214 return 2215 } 2216 2217 resp, err := client.RebootWorkerSender(req) 2218 if err != nil { 2219 result.Response = resp 2220 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure sending request") 2221 return 2222 } 2223 2224 result, err = client.RebootWorkerResponder(resp) 2225 if err != nil { 2226 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure responding to request") 2227 return 2228 } 2229 2230 return 2231} 2232 2233// RebootWorkerPreparer prepares the RebootWorker request. 2234func (client AppServicePlansClient) RebootWorkerPreparer(ctx context.Context, resourceGroupName string, name string, workerName string) (*http.Request, error) { 2235 pathParameters := map[string]interface{}{ 2236 "name": autorest.Encode("path", name), 2237 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2238 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2239 "workerName": autorest.Encode("path", workerName), 2240 } 2241 2242 const APIVersion = "2020-09-01" 2243 queryParameters := map[string]interface{}{ 2244 "api-version": APIVersion, 2245 } 2246 2247 preparer := autorest.CreatePreparer( 2248 autorest.AsPost(), 2249 autorest.WithBaseURL(client.BaseURI), 2250 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), 2251 autorest.WithQueryParameters(queryParameters)) 2252 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2253} 2254 2255// RebootWorkerSender sends the RebootWorker request. The method will close the 2256// http.Response Body if it receives an error. 2257func (client AppServicePlansClient) RebootWorkerSender(req *http.Request) (*http.Response, error) { 2258 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2259} 2260 2261// RebootWorkerResponder handles the response to the RebootWorker request. The method always 2262// closes the http.Response Body. 2263func (client AppServicePlansClient) RebootWorkerResponder(resp *http.Response) (result autorest.Response, err error) { 2264 err = autorest.Respond( 2265 resp, 2266 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 2267 autorest.ByClosing()) 2268 result.Response = resp 2269 return 2270} 2271 2272// RestartWebApps description for Restart all apps in an App Service plan. 2273// Parameters: 2274// resourceGroupName - name of the resource group to which the resource belongs. 2275// name - name of the App Service plan. 2276// softRestart - specify <code>true</code> to perform a soft restart, applies the configuration settings and 2277// restarts the apps if necessary. The default is <code>false</code>, which always restarts and reprovisions 2278// the apps 2279func (client AppServicePlansClient) RestartWebApps(ctx context.Context, resourceGroupName string, name string, softRestart *bool) (result autorest.Response, err error) { 2280 if tracing.IsEnabled() { 2281 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.RestartWebApps") 2282 defer func() { 2283 sc := -1 2284 if result.Response != nil { 2285 sc = result.Response.StatusCode 2286 } 2287 tracing.EndSpan(ctx, sc, err) 2288 }() 2289 } 2290 if err := validation.Validate([]validation.Validation{ 2291 {TargetValue: resourceGroupName, 2292 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2293 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2294 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 2295 return result, validation.NewError("web.AppServicePlansClient", "RestartWebApps", err.Error()) 2296 } 2297 2298 req, err := client.RestartWebAppsPreparer(ctx, resourceGroupName, name, softRestart) 2299 if err != nil { 2300 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", nil, "Failure preparing request") 2301 return 2302 } 2303 2304 resp, err := client.RestartWebAppsSender(req) 2305 if err != nil { 2306 result.Response = resp 2307 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure sending request") 2308 return 2309 } 2310 2311 result, err = client.RestartWebAppsResponder(resp) 2312 if err != nil { 2313 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure responding to request") 2314 return 2315 } 2316 2317 return 2318} 2319 2320// RestartWebAppsPreparer prepares the RestartWebApps request. 2321func (client AppServicePlansClient) RestartWebAppsPreparer(ctx context.Context, resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { 2322 pathParameters := map[string]interface{}{ 2323 "name": autorest.Encode("path", name), 2324 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2325 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2326 } 2327 2328 const APIVersion = "2020-09-01" 2329 queryParameters := map[string]interface{}{ 2330 "api-version": APIVersion, 2331 } 2332 if softRestart != nil { 2333 queryParameters["softRestart"] = autorest.Encode("query", *softRestart) 2334 } 2335 2336 preparer := autorest.CreatePreparer( 2337 autorest.AsPost(), 2338 autorest.WithBaseURL(client.BaseURI), 2339 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), 2340 autorest.WithQueryParameters(queryParameters)) 2341 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2342} 2343 2344// RestartWebAppsSender sends the RestartWebApps request. The method will close the 2345// http.Response Body if it receives an error. 2346func (client AppServicePlansClient) RestartWebAppsSender(req *http.Request) (*http.Response, error) { 2347 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2348} 2349 2350// RestartWebAppsResponder handles the response to the RestartWebApps request. The method always 2351// closes the http.Response Body. 2352func (client AppServicePlansClient) RestartWebAppsResponder(resp *http.Response) (result autorest.Response, err error) { 2353 err = autorest.Respond( 2354 resp, 2355 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 2356 autorest.ByClosing()) 2357 result.Response = resp 2358 return 2359} 2360 2361// Update description for Creates or updates an App Service Plan. 2362// Parameters: 2363// resourceGroupName - name of the resource group to which the resource belongs. 2364// name - name of the App Service plan. 2365// appServicePlan - details of the App Service plan. 2366func (client AppServicePlansClient) Update(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlanPatchResource) (result AppServicePlan, err error) { 2367 if tracing.IsEnabled() { 2368 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Update") 2369 defer func() { 2370 sc := -1 2371 if result.Response.Response != nil { 2372 sc = result.Response.Response.StatusCode 2373 } 2374 tracing.EndSpan(ctx, sc, err) 2375 }() 2376 } 2377 if err := validation.Validate([]validation.Validation{ 2378 {TargetValue: resourceGroupName, 2379 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2380 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2381 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 2382 return result, validation.NewError("web.AppServicePlansClient", "Update", err.Error()) 2383 } 2384 2385 req, err := client.UpdatePreparer(ctx, resourceGroupName, name, appServicePlan) 2386 if err != nil { 2387 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", nil, "Failure preparing request") 2388 return 2389 } 2390 2391 resp, err := client.UpdateSender(req) 2392 if err != nil { 2393 result.Response = autorest.Response{Response: resp} 2394 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", resp, "Failure sending request") 2395 return 2396 } 2397 2398 result, err = client.UpdateResponder(resp) 2399 if err != nil { 2400 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", resp, "Failure responding to request") 2401 return 2402 } 2403 2404 return 2405} 2406 2407// UpdatePreparer prepares the Update request. 2408func (client AppServicePlansClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlanPatchResource) (*http.Request, error) { 2409 pathParameters := map[string]interface{}{ 2410 "name": autorest.Encode("path", name), 2411 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2412 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2413 } 2414 2415 const APIVersion = "2020-09-01" 2416 queryParameters := map[string]interface{}{ 2417 "api-version": APIVersion, 2418 } 2419 2420 preparer := autorest.CreatePreparer( 2421 autorest.AsContentType("application/json; charset=utf-8"), 2422 autorest.AsPatch(), 2423 autorest.WithBaseURL(client.BaseURI), 2424 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), 2425 autorest.WithJSON(appServicePlan), 2426 autorest.WithQueryParameters(queryParameters)) 2427 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2428} 2429 2430// UpdateSender sends the Update request. The method will close the 2431// http.Response Body if it receives an error. 2432func (client AppServicePlansClient) UpdateSender(req *http.Request) (*http.Response, error) { 2433 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2434} 2435 2436// UpdateResponder handles the response to the Update request. The method always 2437// closes the http.Response Body. 2438func (client AppServicePlansClient) UpdateResponder(resp *http.Response) (result AppServicePlan, err error) { 2439 err = autorest.Respond( 2440 resp, 2441 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 2442 autorest.ByUnmarshallingJSON(&result), 2443 autorest.ByClosing()) 2444 result.Response = autorest.Response{Response: resp} 2445 return 2446} 2447 2448// UpdateVnetGateway description for Update a Virtual Network gateway. 2449// Parameters: 2450// resourceGroupName - name of the resource group to which the resource belongs. 2451// name - name of the App Service plan. 2452// vnetName - name of the Virtual Network. 2453// gatewayName - name of the gateway. Only the 'primary' gateway is supported. 2454// connectionEnvelope - definition of the gateway. 2455func (client AppServicePlansClient) UpdateVnetGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { 2456 if tracing.IsEnabled() { 2457 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.UpdateVnetGateway") 2458 defer func() { 2459 sc := -1 2460 if result.Response.Response != nil { 2461 sc = result.Response.Response.StatusCode 2462 } 2463 tracing.EndSpan(ctx, sc, err) 2464 }() 2465 } 2466 if err := validation.Validate([]validation.Validation{ 2467 {TargetValue: resourceGroupName, 2468 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2469 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2470 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, 2471 {TargetValue: connectionEnvelope, 2472 Constraints: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties", Name: validation.Null, Rule: false, 2473 Chain: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties.VpnPackageURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { 2474 return result, validation.NewError("web.AppServicePlansClient", "UpdateVnetGateway", err.Error()) 2475 } 2476 2477 req, err := client.UpdateVnetGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) 2478 if err != nil { 2479 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", nil, "Failure preparing request") 2480 return 2481 } 2482 2483 resp, err := client.UpdateVnetGatewaySender(req) 2484 if err != nil { 2485 result.Response = autorest.Response{Response: resp} 2486 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure sending request") 2487 return 2488 } 2489 2490 result, err = client.UpdateVnetGatewayResponder(resp) 2491 if err != nil { 2492 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure responding to request") 2493 return 2494 } 2495 2496 return 2497} 2498 2499// UpdateVnetGatewayPreparer prepares the UpdateVnetGateway request. 2500func (client AppServicePlansClient) UpdateVnetGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { 2501 pathParameters := map[string]interface{}{ 2502 "gatewayName": autorest.Encode("path", gatewayName), 2503 "name": autorest.Encode("path", name), 2504 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2505 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2506 "vnetName": autorest.Encode("path", vnetName), 2507 } 2508 2509 const APIVersion = "2020-09-01" 2510 queryParameters := map[string]interface{}{ 2511 "api-version": APIVersion, 2512 } 2513 2514 preparer := autorest.CreatePreparer( 2515 autorest.AsContentType("application/json; charset=utf-8"), 2516 autorest.AsPut(), 2517 autorest.WithBaseURL(client.BaseURI), 2518 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), 2519 autorest.WithJSON(connectionEnvelope), 2520 autorest.WithQueryParameters(queryParameters)) 2521 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2522} 2523 2524// UpdateVnetGatewaySender sends the UpdateVnetGateway request. The method will close the 2525// http.Response Body if it receives an error. 2526func (client AppServicePlansClient) UpdateVnetGatewaySender(req *http.Request) (*http.Response, error) { 2527 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2528} 2529 2530// UpdateVnetGatewayResponder handles the response to the UpdateVnetGateway request. The method always 2531// closes the http.Response Body. 2532func (client AppServicePlansClient) UpdateVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { 2533 err = autorest.Respond( 2534 resp, 2535 azure.WithErrorUnlessStatusCode(http.StatusOK), 2536 autorest.ByUnmarshallingJSON(&result), 2537 autorest.ByClosing()) 2538 result.Response = autorest.Response{Response: resp} 2539 return 2540} 2541 2542// UpdateVnetRoute description for Create or update a Virtual Network route in an App Service plan. 2543// Parameters: 2544// resourceGroupName - name of the resource group to which the resource belongs. 2545// name - name of the App Service plan. 2546// vnetName - name of the Virtual Network. 2547// routeName - name of the Virtual Network route. 2548// route - definition of the Virtual Network route. 2549func (client AppServicePlansClient) UpdateVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { 2550 if tracing.IsEnabled() { 2551 ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.UpdateVnetRoute") 2552 defer func() { 2553 sc := -1 2554 if result.Response.Response != nil { 2555 sc = result.Response.Response.StatusCode 2556 } 2557 tracing.EndSpan(ctx, sc, err) 2558 }() 2559 } 2560 if err := validation.Validate([]validation.Validation{ 2561 {TargetValue: resourceGroupName, 2562 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 2563 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 2564 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { 2565 return result, validation.NewError("web.AppServicePlansClient", "UpdateVnetRoute", err.Error()) 2566 } 2567 2568 req, err := client.UpdateVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName, route) 2569 if err != nil { 2570 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", nil, "Failure preparing request") 2571 return 2572 } 2573 2574 resp, err := client.UpdateVnetRouteSender(req) 2575 if err != nil { 2576 result.Response = autorest.Response{Response: resp} 2577 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure sending request") 2578 return 2579 } 2580 2581 result, err = client.UpdateVnetRouteResponder(resp) 2582 if err != nil { 2583 err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure responding to request") 2584 return 2585 } 2586 2587 return 2588} 2589 2590// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. 2591func (client AppServicePlansClient) UpdateVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { 2592 pathParameters := map[string]interface{}{ 2593 "name": autorest.Encode("path", name), 2594 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2595 "routeName": autorest.Encode("path", routeName), 2596 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2597 "vnetName": autorest.Encode("path", vnetName), 2598 } 2599 2600 const APIVersion = "2020-09-01" 2601 queryParameters := map[string]interface{}{ 2602 "api-version": APIVersion, 2603 } 2604 2605 preparer := autorest.CreatePreparer( 2606 autorest.AsContentType("application/json; charset=utf-8"), 2607 autorest.AsPatch(), 2608 autorest.WithBaseURL(client.BaseURI), 2609 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), 2610 autorest.WithJSON(route), 2611 autorest.WithQueryParameters(queryParameters)) 2612 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2613} 2614 2615// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the 2616// http.Response Body if it receives an error. 2617func (client AppServicePlansClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { 2618 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2619} 2620 2621// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always 2622// closes the http.Response Body. 2623func (client AppServicePlansClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { 2624 err = autorest.Respond( 2625 resp, 2626 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), 2627 autorest.ByUnmarshallingJSON(&result), 2628 autorest.ByClosing()) 2629 result.Response = autorest.Response{Response: resp} 2630 return 2631} 2632