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