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