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