1package web
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// RecommendationsClient is the webSite Management Client
30type RecommendationsClient struct {
31	BaseClient
32}
33
34// NewRecommendationsClient creates an instance of the RecommendationsClient client.
35func NewRecommendationsClient(subscriptionID string) RecommendationsClient {
36	return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
37}
38
39// NewRecommendationsClientWithBaseURI creates an instance of the RecommendationsClient client.
40func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient {
41	return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)}
42}
43
44// DisableAllForHostingEnvironment disable all recommendations for an app.
45// Parameters:
46// resourceGroupName - name of the resource group to which the resource belongs.
47// environmentName - name of the app.
48func (client RecommendationsClient) DisableAllForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (result autorest.Response, err error) {
49	if tracing.IsEnabled() {
50		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableAllForHostingEnvironment")
51		defer func() {
52			sc := -1
53			if result.Response != nil {
54				sc = result.Response.StatusCode
55			}
56			tracing.EndSpan(ctx, sc, err)
57		}()
58	}
59	if err := validation.Validate([]validation.Validation{
60		{TargetValue: resourceGroupName,
61			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
62				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
63				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
64		return result, validation.NewError("web.RecommendationsClient", "DisableAllForHostingEnvironment", err.Error())
65	}
66
67	req, err := client.DisableAllForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, hostingEnvironmentName)
68	if err != nil {
69		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", nil, "Failure preparing request")
70		return
71	}
72
73	resp, err := client.DisableAllForHostingEnvironmentSender(req)
74	if err != nil {
75		result.Response = resp
76		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", resp, "Failure sending request")
77		return
78	}
79
80	result, err = client.DisableAllForHostingEnvironmentResponder(resp)
81	if err != nil {
82		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", resp, "Failure responding to request")
83	}
84
85	return
86}
87
88// DisableAllForHostingEnvironmentPreparer prepares the DisableAllForHostingEnvironment request.
89func (client RecommendationsClient) DisableAllForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (*http.Request, error) {
90	pathParameters := map[string]interface{}{
91		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
92		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
93		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
94	}
95
96	const APIVersion = "2018-02-01"
97	queryParameters := map[string]interface{}{
98		"api-version":     APIVersion,
99		"environmentName": autorest.Encode("query", environmentName),
100	}
101
102	preparer := autorest.CreatePreparer(
103		autorest.AsPost(),
104		autorest.WithBaseURL(client.BaseURI),
105		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable", pathParameters),
106		autorest.WithQueryParameters(queryParameters))
107	return preparer.Prepare((&http.Request{}).WithContext(ctx))
108}
109
110// DisableAllForHostingEnvironmentSender sends the DisableAllForHostingEnvironment request. The method will close the
111// http.Response Body if it receives an error.
112func (client RecommendationsClient) DisableAllForHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
113	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
114	return autorest.SendWithSender(client, req, sd...)
115}
116
117// DisableAllForHostingEnvironmentResponder handles the response to the DisableAllForHostingEnvironment request. The method always
118// closes the http.Response Body.
119func (client RecommendationsClient) DisableAllForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) {
120	err = autorest.Respond(
121		resp,
122		client.ByInspecting(),
123		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
124		autorest.ByClosing())
125	result.Response = resp
126	return
127}
128
129// DisableAllForWebApp disable all recommendations for an app.
130// Parameters:
131// resourceGroupName - name of the resource group to which the resource belongs.
132// siteName - name of the app.
133func (client RecommendationsClient) DisableAllForWebApp(ctx context.Context, resourceGroupName string, siteName string) (result autorest.Response, err error) {
134	if tracing.IsEnabled() {
135		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableAllForWebApp")
136		defer func() {
137			sc := -1
138			if result.Response != nil {
139				sc = result.Response.StatusCode
140			}
141			tracing.EndSpan(ctx, sc, err)
142		}()
143	}
144	if err := validation.Validate([]validation.Validation{
145		{TargetValue: resourceGroupName,
146			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
147				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
148				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
149		return result, validation.NewError("web.RecommendationsClient", "DisableAllForWebApp", err.Error())
150	}
151
152	req, err := client.DisableAllForWebAppPreparer(ctx, resourceGroupName, siteName)
153	if err != nil {
154		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", nil, "Failure preparing request")
155		return
156	}
157
158	resp, err := client.DisableAllForWebAppSender(req)
159	if err != nil {
160		result.Response = resp
161		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure sending request")
162		return
163	}
164
165	result, err = client.DisableAllForWebAppResponder(resp)
166	if err != nil {
167		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure responding to request")
168	}
169
170	return
171}
172
173// DisableAllForWebAppPreparer prepares the DisableAllForWebApp request.
174func (client RecommendationsClient) DisableAllForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) {
175	pathParameters := map[string]interface{}{
176		"resourceGroupName": autorest.Encode("path", resourceGroupName),
177		"siteName":          autorest.Encode("path", siteName),
178		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
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.AsPost(),
188		autorest.WithBaseURL(client.BaseURI),
189		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable", pathParameters),
190		autorest.WithQueryParameters(queryParameters))
191	return preparer.Prepare((&http.Request{}).WithContext(ctx))
192}
193
194// DisableAllForWebAppSender sends the DisableAllForWebApp request. The method will close the
195// http.Response Body if it receives an error.
196func (client RecommendationsClient) DisableAllForWebAppSender(req *http.Request) (*http.Response, error) {
197	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
198	return autorest.SendWithSender(client, req, sd...)
199}
200
201// DisableAllForWebAppResponder handles the response to the DisableAllForWebApp request. The method always
202// closes the http.Response Body.
203func (client RecommendationsClient) DisableAllForWebAppResponder(resp *http.Response) (result autorest.Response, err error) {
204	err = autorest.Respond(
205		resp,
206		client.ByInspecting(),
207		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
208		autorest.ByClosing())
209	result.Response = resp
210	return
211}
212
213// DisableRecommendationForHostingEnvironment disables the specific rule for a web site permanently.
214// Parameters:
215// resourceGroupName - name of the resource group to which the resource belongs.
216// environmentName - site name
217// name - rule name
218func (client RecommendationsClient) DisableRecommendationForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, name string, hostingEnvironmentName string) (result autorest.Response, err error) {
219	if tracing.IsEnabled() {
220		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForHostingEnvironment")
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.RecommendationsClient", "DisableRecommendationForHostingEnvironment", err.Error())
235	}
236
237	req, err := client.DisableRecommendationForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, name, hostingEnvironmentName)
238	if err != nil {
239		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", nil, "Failure preparing request")
240		return
241	}
242
243	resp, err := client.DisableRecommendationForHostingEnvironmentSender(req)
244	if err != nil {
245		result.Response = resp
246		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", resp, "Failure sending request")
247		return
248	}
249
250	result, err = client.DisableRecommendationForHostingEnvironmentResponder(resp)
251	if err != nil {
252		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", resp, "Failure responding to request")
253	}
254
255	return
256}
257
258// DisableRecommendationForHostingEnvironmentPreparer prepares the DisableRecommendationForHostingEnvironment request.
259func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, name string, hostingEnvironmentName string) (*http.Request, error) {
260	pathParameters := map[string]interface{}{
261		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
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		"environmentName": autorest.Encode("query", environmentName),
271	}
272
273	preparer := autorest.CreatePreparer(
274		autorest.AsPost(),
275		autorest.WithBaseURL(client.BaseURI),
276		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable", pathParameters),
277		autorest.WithQueryParameters(queryParameters))
278	return preparer.Prepare((&http.Request{}).WithContext(ctx))
279}
280
281// DisableRecommendationForHostingEnvironmentSender sends the DisableRecommendationForHostingEnvironment request. The method will close the
282// http.Response Body if it receives an error.
283func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
284	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
285	return autorest.SendWithSender(client, req, sd...)
286}
287
288// DisableRecommendationForHostingEnvironmentResponder handles the response to the DisableRecommendationForHostingEnvironment request. The method always
289// closes the http.Response Body.
290func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) {
291	err = autorest.Respond(
292		resp,
293		client.ByInspecting(),
294		azure.WithErrorUnlessStatusCode(http.StatusOK),
295		autorest.ByClosing())
296	result.Response = resp
297	return
298}
299
300// DisableRecommendationForSite disables the specific rule for a web site permanently.
301// Parameters:
302// resourceGroupName - name of the resource group to which the resource belongs.
303// siteName - site name
304// name - rule name
305func (client RecommendationsClient) DisableRecommendationForSite(ctx context.Context, resourceGroupName string, siteName string, name string) (result autorest.Response, err error) {
306	if tracing.IsEnabled() {
307		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForSite")
308		defer func() {
309			sc := -1
310			if result.Response != nil {
311				sc = result.Response.StatusCode
312			}
313			tracing.EndSpan(ctx, sc, err)
314		}()
315	}
316	if err := validation.Validate([]validation.Validation{
317		{TargetValue: resourceGroupName,
318			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
319				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
320				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
321		return result, validation.NewError("web.RecommendationsClient", "DisableRecommendationForSite", err.Error())
322	}
323
324	req, err := client.DisableRecommendationForSitePreparer(ctx, resourceGroupName, siteName, name)
325	if err != nil {
326		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", nil, "Failure preparing request")
327		return
328	}
329
330	resp, err := client.DisableRecommendationForSiteSender(req)
331	if err != nil {
332		result.Response = resp
333		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", resp, "Failure sending request")
334		return
335	}
336
337	result, err = client.DisableRecommendationForSiteResponder(resp)
338	if err != nil {
339		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", resp, "Failure responding to request")
340	}
341
342	return
343}
344
345// DisableRecommendationForSitePreparer prepares the DisableRecommendationForSite request.
346func (client RecommendationsClient) DisableRecommendationForSitePreparer(ctx context.Context, resourceGroupName string, siteName string, name string) (*http.Request, error) {
347	pathParameters := map[string]interface{}{
348		"name":              autorest.Encode("path", name),
349		"resourceGroupName": autorest.Encode("path", resourceGroupName),
350		"siteName":          autorest.Encode("path", siteName),
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.AsPost(),
361		autorest.WithBaseURL(client.BaseURI),
362		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable", pathParameters),
363		autorest.WithQueryParameters(queryParameters))
364	return preparer.Prepare((&http.Request{}).WithContext(ctx))
365}
366
367// DisableRecommendationForSiteSender sends the DisableRecommendationForSite request. The method will close the
368// http.Response Body if it receives an error.
369func (client RecommendationsClient) DisableRecommendationForSiteSender(req *http.Request) (*http.Response, error) {
370	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
371	return autorest.SendWithSender(client, req, sd...)
372}
373
374// DisableRecommendationForSiteResponder handles the response to the DisableRecommendationForSite request. The method always
375// closes the http.Response Body.
376func (client RecommendationsClient) DisableRecommendationForSiteResponder(resp *http.Response) (result autorest.Response, err error) {
377	err = autorest.Respond(
378		resp,
379		client.ByInspecting(),
380		azure.WithErrorUnlessStatusCode(http.StatusOK),
381		autorest.ByClosing())
382	result.Response = resp
383	return
384}
385
386// DisableRecommendationForSubscription disables the specified rule so it will not apply to a subscription in the
387// future.
388// Parameters:
389// name - rule name
390func (client RecommendationsClient) DisableRecommendationForSubscription(ctx context.Context, name string) (result autorest.Response, err error) {
391	if tracing.IsEnabled() {
392		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForSubscription")
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	req, err := client.DisableRecommendationForSubscriptionPreparer(ctx, name)
402	if err != nil {
403		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", nil, "Failure preparing request")
404		return
405	}
406
407	resp, err := client.DisableRecommendationForSubscriptionSender(req)
408	if err != nil {
409		result.Response = resp
410		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", resp, "Failure sending request")
411		return
412	}
413
414	result, err = client.DisableRecommendationForSubscriptionResponder(resp)
415	if err != nil {
416		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", resp, "Failure responding to request")
417	}
418
419	return
420}
421
422// DisableRecommendationForSubscriptionPreparer prepares the DisableRecommendationForSubscription request.
423func (client RecommendationsClient) DisableRecommendationForSubscriptionPreparer(ctx context.Context, name string) (*http.Request, error) {
424	pathParameters := map[string]interface{}{
425		"name":           autorest.Encode("path", name),
426		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
427	}
428
429	const APIVersion = "2018-02-01"
430	queryParameters := map[string]interface{}{
431		"api-version": APIVersion,
432	}
433
434	preparer := autorest.CreatePreparer(
435		autorest.AsPost(),
436		autorest.WithBaseURL(client.BaseURI),
437		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable", pathParameters),
438		autorest.WithQueryParameters(queryParameters))
439	return preparer.Prepare((&http.Request{}).WithContext(ctx))
440}
441
442// DisableRecommendationForSubscriptionSender sends the DisableRecommendationForSubscription request. The method will close the
443// http.Response Body if it receives an error.
444func (client RecommendationsClient) DisableRecommendationForSubscriptionSender(req *http.Request) (*http.Response, error) {
445	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
446	return autorest.SendWithSender(client, req, sd...)
447}
448
449// DisableRecommendationForSubscriptionResponder handles the response to the DisableRecommendationForSubscription request. The method always
450// closes the http.Response Body.
451func (client RecommendationsClient) DisableRecommendationForSubscriptionResponder(resp *http.Response) (result autorest.Response, err error) {
452	err = autorest.Respond(
453		resp,
454		client.ByInspecting(),
455		azure.WithErrorUnlessStatusCode(http.StatusOK),
456		autorest.ByClosing())
457	result.Response = resp
458	return
459}
460
461// GetRuleDetailsByHostingEnvironment get a recommendation rule for an app.
462// Parameters:
463// resourceGroupName - name of the resource group to which the resource belongs.
464// hostingEnvironmentName - name of the hosting environment.
465// name - name of the recommendation.
466// updateSeen - specify <code>true</code> to update the last-seen timestamp of the recommendation object.
467// recommendationID - the GUID of the recommendation object if you query an expired one. You don't need to
468// specify it to query an active entry.
469func (client RecommendationsClient) GetRuleDetailsByHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, name string, updateSeen *bool, recommendationID string) (result RecommendationRule, err error) {
470	if tracing.IsEnabled() {
471		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.GetRuleDetailsByHostingEnvironment")
472		defer func() {
473			sc := -1
474			if result.Response.Response != nil {
475				sc = result.Response.Response.StatusCode
476			}
477			tracing.EndSpan(ctx, sc, err)
478		}()
479	}
480	if err := validation.Validate([]validation.Validation{
481		{TargetValue: resourceGroupName,
482			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
483				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
484				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
485		return result, validation.NewError("web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", err.Error())
486	}
487
488	req, err := client.GetRuleDetailsByHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, name, updateSeen, recommendationID)
489	if err != nil {
490		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", nil, "Failure preparing request")
491		return
492	}
493
494	resp, err := client.GetRuleDetailsByHostingEnvironmentSender(req)
495	if err != nil {
496		result.Response = autorest.Response{Response: resp}
497		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", resp, "Failure sending request")
498		return
499	}
500
501	result, err = client.GetRuleDetailsByHostingEnvironmentResponder(resp)
502	if err != nil {
503		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", resp, "Failure responding to request")
504	}
505
506	return
507}
508
509// GetRuleDetailsByHostingEnvironmentPreparer prepares the GetRuleDetailsByHostingEnvironment request.
510func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, name string, updateSeen *bool, recommendationID string) (*http.Request, error) {
511	pathParameters := map[string]interface{}{
512		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
513		"name":                   autorest.Encode("path", name),
514		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
515		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
516	}
517
518	const APIVersion = "2018-02-01"
519	queryParameters := map[string]interface{}{
520		"api-version": APIVersion,
521	}
522	if updateSeen != nil {
523		queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen)
524	}
525	if len(recommendationID) > 0 {
526		queryParameters["recommendationId"] = autorest.Encode("query", recommendationID)
527	}
528
529	preparer := autorest.CreatePreparer(
530		autorest.AsGet(),
531		autorest.WithBaseURL(client.BaseURI),
532		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}", pathParameters),
533		autorest.WithQueryParameters(queryParameters))
534	return preparer.Prepare((&http.Request{}).WithContext(ctx))
535}
536
537// GetRuleDetailsByHostingEnvironmentSender sends the GetRuleDetailsByHostingEnvironment request. The method will close the
538// http.Response Body if it receives an error.
539func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
540	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
541	return autorest.SendWithSender(client, req, sd...)
542}
543
544// GetRuleDetailsByHostingEnvironmentResponder handles the response to the GetRuleDetailsByHostingEnvironment request. The method always
545// closes the http.Response Body.
546func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentResponder(resp *http.Response) (result RecommendationRule, err error) {
547	err = autorest.Respond(
548		resp,
549		client.ByInspecting(),
550		azure.WithErrorUnlessStatusCode(http.StatusOK),
551		autorest.ByUnmarshallingJSON(&result),
552		autorest.ByClosing())
553	result.Response = autorest.Response{Response: resp}
554	return
555}
556
557// GetRuleDetailsByWebApp get a recommendation rule for an app.
558// Parameters:
559// resourceGroupName - name of the resource group to which the resource belongs.
560// siteName - name of the app.
561// name - name of the recommendation.
562// updateSeen - specify <code>true</code> to update the last-seen timestamp of the recommendation object.
563// recommendationID - the GUID of the recommendation object if you query an expired one. You don't need to
564// specify it to query an active entry.
565func (client RecommendationsClient) GetRuleDetailsByWebApp(ctx context.Context, resourceGroupName string, siteName string, name string, updateSeen *bool, recommendationID string) (result RecommendationRule, err error) {
566	if tracing.IsEnabled() {
567		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.GetRuleDetailsByWebApp")
568		defer func() {
569			sc := -1
570			if result.Response.Response != nil {
571				sc = result.Response.Response.StatusCode
572			}
573			tracing.EndSpan(ctx, sc, err)
574		}()
575	}
576	if err := validation.Validate([]validation.Validation{
577		{TargetValue: resourceGroupName,
578			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
579				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
580				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
581		return result, validation.NewError("web.RecommendationsClient", "GetRuleDetailsByWebApp", err.Error())
582	}
583
584	req, err := client.GetRuleDetailsByWebAppPreparer(ctx, resourceGroupName, siteName, name, updateSeen, recommendationID)
585	if err != nil {
586		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", nil, "Failure preparing request")
587		return
588	}
589
590	resp, err := client.GetRuleDetailsByWebAppSender(req)
591	if err != nil {
592		result.Response = autorest.Response{Response: resp}
593		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure sending request")
594		return
595	}
596
597	result, err = client.GetRuleDetailsByWebAppResponder(resp)
598	if err != nil {
599		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure responding to request")
600	}
601
602	return
603}
604
605// GetRuleDetailsByWebAppPreparer prepares the GetRuleDetailsByWebApp request.
606func (client RecommendationsClient) GetRuleDetailsByWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, name string, updateSeen *bool, recommendationID string) (*http.Request, error) {
607	pathParameters := map[string]interface{}{
608		"name":              autorest.Encode("path", name),
609		"resourceGroupName": autorest.Encode("path", resourceGroupName),
610		"siteName":          autorest.Encode("path", siteName),
611		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
612	}
613
614	const APIVersion = "2018-02-01"
615	queryParameters := map[string]interface{}{
616		"api-version": APIVersion,
617	}
618	if updateSeen != nil {
619		queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen)
620	}
621	if len(recommendationID) > 0 {
622		queryParameters["recommendationId"] = autorest.Encode("query", recommendationID)
623	}
624
625	preparer := autorest.CreatePreparer(
626		autorest.AsGet(),
627		autorest.WithBaseURL(client.BaseURI),
628		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters),
629		autorest.WithQueryParameters(queryParameters))
630	return preparer.Prepare((&http.Request{}).WithContext(ctx))
631}
632
633// GetRuleDetailsByWebAppSender sends the GetRuleDetailsByWebApp request. The method will close the
634// http.Response Body if it receives an error.
635func (client RecommendationsClient) GetRuleDetailsByWebAppSender(req *http.Request) (*http.Response, error) {
636	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
637	return autorest.SendWithSender(client, req, sd...)
638}
639
640// GetRuleDetailsByWebAppResponder handles the response to the GetRuleDetailsByWebApp request. The method always
641// closes the http.Response Body.
642func (client RecommendationsClient) GetRuleDetailsByWebAppResponder(resp *http.Response) (result RecommendationRule, err error) {
643	err = autorest.Respond(
644		resp,
645		client.ByInspecting(),
646		azure.WithErrorUnlessStatusCode(http.StatusOK),
647		autorest.ByUnmarshallingJSON(&result),
648		autorest.ByClosing())
649	result.Response = autorest.Response{Response: resp}
650	return
651}
652
653// List list all recommendations for a subscription.
654// Parameters:
655// featured - specify <code>true</code> to return only the most critical recommendations. The default is
656// <code>false</code>, which returns all recommendations.
657// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq
658// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq
659// duration'[PT1H|PT1M|P1D]
660func (client RecommendationsClient) List(ctx context.Context, featured *bool, filter string) (result RecommendationCollectionPage, err error) {
661	if tracing.IsEnabled() {
662		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.List")
663		defer func() {
664			sc := -1
665			if result.rc.Response.Response != nil {
666				sc = result.rc.Response.Response.StatusCode
667			}
668			tracing.EndSpan(ctx, sc, err)
669		}()
670	}
671	result.fn = client.listNextResults
672	req, err := client.ListPreparer(ctx, featured, filter)
673	if err != nil {
674		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", nil, "Failure preparing request")
675		return
676	}
677
678	resp, err := client.ListSender(req)
679	if err != nil {
680		result.rc.Response = autorest.Response{Response: resp}
681		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure sending request")
682		return
683	}
684
685	result.rc, err = client.ListResponder(resp)
686	if err != nil {
687		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure responding to request")
688	}
689
690	return
691}
692
693// ListPreparer prepares the List request.
694func (client RecommendationsClient) ListPreparer(ctx context.Context, featured *bool, filter string) (*http.Request, error) {
695	pathParameters := map[string]interface{}{
696		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
697	}
698
699	const APIVersion = "2018-02-01"
700	queryParameters := map[string]interface{}{
701		"api-version": APIVersion,
702	}
703	if featured != nil {
704		queryParameters["featured"] = autorest.Encode("query", *featured)
705	}
706	if len(filter) > 0 {
707		queryParameters["$filter"] = filter
708	}
709
710	preparer := autorest.CreatePreparer(
711		autorest.AsGet(),
712		autorest.WithBaseURL(client.BaseURI),
713		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations", pathParameters),
714		autorest.WithQueryParameters(queryParameters))
715	return preparer.Prepare((&http.Request{}).WithContext(ctx))
716}
717
718// ListSender sends the List request. The method will close the
719// http.Response Body if it receives an error.
720func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) {
721	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
722	return autorest.SendWithSender(client, req, sd...)
723}
724
725// ListResponder handles the response to the List request. The method always
726// closes the http.Response Body.
727func (client RecommendationsClient) ListResponder(resp *http.Response) (result RecommendationCollection, err error) {
728	err = autorest.Respond(
729		resp,
730		client.ByInspecting(),
731		azure.WithErrorUnlessStatusCode(http.StatusOK),
732		autorest.ByUnmarshallingJSON(&result),
733		autorest.ByClosing())
734	result.Response = autorest.Response{Response: resp}
735	return
736}
737
738// listNextResults retrieves the next set of results, if any.
739func (client RecommendationsClient) listNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) {
740	req, err := lastResults.recommendationCollectionPreparer(ctx)
741	if err != nil {
742		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", nil, "Failure preparing next results request")
743	}
744	if req == nil {
745		return
746	}
747	resp, err := client.ListSender(req)
748	if err != nil {
749		result.Response = autorest.Response{Response: resp}
750		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", resp, "Failure sending next results request")
751	}
752	result, err = client.ListResponder(resp)
753	if err != nil {
754		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", resp, "Failure responding to next results request")
755	}
756	return
757}
758
759// ListComplete enumerates all values, automatically crossing page boundaries as required.
760func (client RecommendationsClient) ListComplete(ctx context.Context, featured *bool, filter string) (result RecommendationCollectionIterator, err error) {
761	if tracing.IsEnabled() {
762		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.List")
763		defer func() {
764			sc := -1
765			if result.Response().Response.Response != nil {
766				sc = result.page.Response().Response.Response.StatusCode
767			}
768			tracing.EndSpan(ctx, sc, err)
769		}()
770	}
771	result.page, err = client.List(ctx, featured, filter)
772	return
773}
774
775// ListHistoryForHostingEnvironment get past recommendations for an app, optionally specified by the time range.
776// Parameters:
777// resourceGroupName - name of the resource group to which the resource belongs.
778// hostingEnvironmentName - name of the hosting environment.
779// expiredOnly - specify <code>false</code> to return all recommendations. The default is <code>true</code>,
780// which returns only expired recommendations.
781// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq
782// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq
783// duration'[PT1H|PT1M|P1D]
784func (client RecommendationsClient) ListHistoryForHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (result RecommendationCollectionPage, err error) {
785	if tracing.IsEnabled() {
786		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForHostingEnvironment")
787		defer func() {
788			sc := -1
789			if result.rc.Response.Response != nil {
790				sc = result.rc.Response.Response.StatusCode
791			}
792			tracing.EndSpan(ctx, sc, err)
793		}()
794	}
795	if err := validation.Validate([]validation.Validation{
796		{TargetValue: resourceGroupName,
797			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
798				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
799				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
800		return result, validation.NewError("web.RecommendationsClient", "ListHistoryForHostingEnvironment", err.Error())
801	}
802
803	result.fn = client.listHistoryForHostingEnvironmentNextResults
804	req, err := client.ListHistoryForHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, expiredOnly, filter)
805	if err != nil {
806		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", nil, "Failure preparing request")
807		return
808	}
809
810	resp, err := client.ListHistoryForHostingEnvironmentSender(req)
811	if err != nil {
812		result.rc.Response = autorest.Response{Response: resp}
813		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", resp, "Failure sending request")
814		return
815	}
816
817	result.rc, err = client.ListHistoryForHostingEnvironmentResponder(resp)
818	if err != nil {
819		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", resp, "Failure responding to request")
820	}
821
822	return
823}
824
825// ListHistoryForHostingEnvironmentPreparer prepares the ListHistoryForHostingEnvironment request.
826func (client RecommendationsClient) ListHistoryForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (*http.Request, error) {
827	pathParameters := map[string]interface{}{
828		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
829		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
830		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
831	}
832
833	const APIVersion = "2018-02-01"
834	queryParameters := map[string]interface{}{
835		"api-version": APIVersion,
836	}
837	if expiredOnly != nil {
838		queryParameters["expiredOnly"] = autorest.Encode("query", *expiredOnly)
839	}
840	if len(filter) > 0 {
841		queryParameters["$filter"] = filter
842	}
843
844	preparer := autorest.CreatePreparer(
845		autorest.AsGet(),
846		autorest.WithBaseURL(client.BaseURI),
847		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory", pathParameters),
848		autorest.WithQueryParameters(queryParameters))
849	return preparer.Prepare((&http.Request{}).WithContext(ctx))
850}
851
852// ListHistoryForHostingEnvironmentSender sends the ListHistoryForHostingEnvironment request. The method will close the
853// http.Response Body if it receives an error.
854func (client RecommendationsClient) ListHistoryForHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
855	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
856	return autorest.SendWithSender(client, req, sd...)
857}
858
859// ListHistoryForHostingEnvironmentResponder handles the response to the ListHistoryForHostingEnvironment request. The method always
860// closes the http.Response Body.
861func (client RecommendationsClient) ListHistoryForHostingEnvironmentResponder(resp *http.Response) (result RecommendationCollection, err error) {
862	err = autorest.Respond(
863		resp,
864		client.ByInspecting(),
865		azure.WithErrorUnlessStatusCode(http.StatusOK),
866		autorest.ByUnmarshallingJSON(&result),
867		autorest.ByClosing())
868	result.Response = autorest.Response{Response: resp}
869	return
870}
871
872// listHistoryForHostingEnvironmentNextResults retrieves the next set of results, if any.
873func (client RecommendationsClient) listHistoryForHostingEnvironmentNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) {
874	req, err := lastResults.recommendationCollectionPreparer(ctx)
875	if err != nil {
876		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", nil, "Failure preparing next results request")
877	}
878	if req == nil {
879		return
880	}
881	resp, err := client.ListHistoryForHostingEnvironmentSender(req)
882	if err != nil {
883		result.Response = autorest.Response{Response: resp}
884		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", resp, "Failure sending next results request")
885	}
886	result, err = client.ListHistoryForHostingEnvironmentResponder(resp)
887	if err != nil {
888		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", resp, "Failure responding to next results request")
889	}
890	return
891}
892
893// ListHistoryForHostingEnvironmentComplete enumerates all values, automatically crossing page boundaries as required.
894func (client RecommendationsClient) ListHistoryForHostingEnvironmentComplete(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (result RecommendationCollectionIterator, err error) {
895	if tracing.IsEnabled() {
896		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForHostingEnvironment")
897		defer func() {
898			sc := -1
899			if result.Response().Response.Response != nil {
900				sc = result.page.Response().Response.Response.StatusCode
901			}
902			tracing.EndSpan(ctx, sc, err)
903		}()
904	}
905	result.page, err = client.ListHistoryForHostingEnvironment(ctx, resourceGroupName, hostingEnvironmentName, expiredOnly, filter)
906	return
907}
908
909// ListHistoryForWebApp get past recommendations for an app, optionally specified by the time range.
910// Parameters:
911// resourceGroupName - name of the resource group to which the resource belongs.
912// siteName - name of the app.
913// expiredOnly - specify <code>false</code> to return all recommendations. The default is <code>true</code>,
914// which returns only expired recommendations.
915// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq
916// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq
917// duration'[PT1H|PT1M|P1D]
918func (client RecommendationsClient) ListHistoryForWebApp(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (result RecommendationCollectionPage, err error) {
919	if tracing.IsEnabled() {
920		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForWebApp")
921		defer func() {
922			sc := -1
923			if result.rc.Response.Response != nil {
924				sc = result.rc.Response.Response.StatusCode
925			}
926			tracing.EndSpan(ctx, sc, err)
927		}()
928	}
929	if err := validation.Validate([]validation.Validation{
930		{TargetValue: resourceGroupName,
931			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
932				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
933				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
934		return result, validation.NewError("web.RecommendationsClient", "ListHistoryForWebApp", err.Error())
935	}
936
937	result.fn = client.listHistoryForWebAppNextResults
938	req, err := client.ListHistoryForWebAppPreparer(ctx, resourceGroupName, siteName, expiredOnly, filter)
939	if err != nil {
940		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", nil, "Failure preparing request")
941		return
942	}
943
944	resp, err := client.ListHistoryForWebAppSender(req)
945	if err != nil {
946		result.rc.Response = autorest.Response{Response: resp}
947		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure sending request")
948		return
949	}
950
951	result.rc, err = client.ListHistoryForWebAppResponder(resp)
952	if err != nil {
953		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure responding to request")
954	}
955
956	return
957}
958
959// ListHistoryForWebAppPreparer prepares the ListHistoryForWebApp request.
960func (client RecommendationsClient) ListHistoryForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (*http.Request, error) {
961	pathParameters := map[string]interface{}{
962		"resourceGroupName": autorest.Encode("path", resourceGroupName),
963		"siteName":          autorest.Encode("path", siteName),
964		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
965	}
966
967	const APIVersion = "2018-02-01"
968	queryParameters := map[string]interface{}{
969		"api-version": APIVersion,
970	}
971	if expiredOnly != nil {
972		queryParameters["expiredOnly"] = autorest.Encode("query", *expiredOnly)
973	}
974	if len(filter) > 0 {
975		queryParameters["$filter"] = filter
976	}
977
978	preparer := autorest.CreatePreparer(
979		autorest.AsGet(),
980		autorest.WithBaseURL(client.BaseURI),
981		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory", pathParameters),
982		autorest.WithQueryParameters(queryParameters))
983	return preparer.Prepare((&http.Request{}).WithContext(ctx))
984}
985
986// ListHistoryForWebAppSender sends the ListHistoryForWebApp request. The method will close the
987// http.Response Body if it receives an error.
988func (client RecommendationsClient) ListHistoryForWebAppSender(req *http.Request) (*http.Response, error) {
989	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
990	return autorest.SendWithSender(client, req, sd...)
991}
992
993// ListHistoryForWebAppResponder handles the response to the ListHistoryForWebApp request. The method always
994// closes the http.Response Body.
995func (client RecommendationsClient) ListHistoryForWebAppResponder(resp *http.Response) (result RecommendationCollection, err error) {
996	err = autorest.Respond(
997		resp,
998		client.ByInspecting(),
999		azure.WithErrorUnlessStatusCode(http.StatusOK),
1000		autorest.ByUnmarshallingJSON(&result),
1001		autorest.ByClosing())
1002	result.Response = autorest.Response{Response: resp}
1003	return
1004}
1005
1006// listHistoryForWebAppNextResults retrieves the next set of results, if any.
1007func (client RecommendationsClient) listHistoryForWebAppNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) {
1008	req, err := lastResults.recommendationCollectionPreparer(ctx)
1009	if err != nil {
1010		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", nil, "Failure preparing next results request")
1011	}
1012	if req == nil {
1013		return
1014	}
1015	resp, err := client.ListHistoryForWebAppSender(req)
1016	if err != nil {
1017		result.Response = autorest.Response{Response: resp}
1018		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", resp, "Failure sending next results request")
1019	}
1020	result, err = client.ListHistoryForWebAppResponder(resp)
1021	if err != nil {
1022		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", resp, "Failure responding to next results request")
1023	}
1024	return
1025}
1026
1027// ListHistoryForWebAppComplete enumerates all values, automatically crossing page boundaries as required.
1028func (client RecommendationsClient) ListHistoryForWebAppComplete(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (result RecommendationCollectionIterator, err error) {
1029	if tracing.IsEnabled() {
1030		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForWebApp")
1031		defer func() {
1032			sc := -1
1033			if result.Response().Response.Response != nil {
1034				sc = result.page.Response().Response.Response.StatusCode
1035			}
1036			tracing.EndSpan(ctx, sc, err)
1037		}()
1038	}
1039	result.page, err = client.ListHistoryForWebApp(ctx, resourceGroupName, siteName, expiredOnly, filter)
1040	return
1041}
1042
1043// ListRecommendedRulesForHostingEnvironment get all recommendations for an app.
1044// Parameters:
1045// resourceGroupName - name of the resource group to which the resource belongs.
1046// hostingEnvironmentName - name of the app.
1047// featured - specify <code>true</code> to return only the most critical recommendations. The default is
1048// <code>false</code>, which returns all recommendations.
1049// filter - return only channels specified in the filter. Filter is specified by using OData syntax. Example:
1050// $filter=channel eq 'Api' or channel eq 'Notification'
1051func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (result RecommendationCollectionPage, err error) {
1052	if tracing.IsEnabled() {
1053		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForHostingEnvironment")
1054		defer func() {
1055			sc := -1
1056			if result.rc.Response.Response != nil {
1057				sc = result.rc.Response.Response.StatusCode
1058			}
1059			tracing.EndSpan(ctx, sc, err)
1060		}()
1061	}
1062	if err := validation.Validate([]validation.Validation{
1063		{TargetValue: resourceGroupName,
1064			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1065				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1066				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
1067		return result, validation.NewError("web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", err.Error())
1068	}
1069
1070	result.fn = client.listRecommendedRulesForHostingEnvironmentNextResults
1071	req, err := client.ListRecommendedRulesForHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, featured, filter)
1072	if err != nil {
1073		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", nil, "Failure preparing request")
1074		return
1075	}
1076
1077	resp, err := client.ListRecommendedRulesForHostingEnvironmentSender(req)
1078	if err != nil {
1079		result.rc.Response = autorest.Response{Response: resp}
1080		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", resp, "Failure sending request")
1081		return
1082	}
1083
1084	result.rc, err = client.ListRecommendedRulesForHostingEnvironmentResponder(resp)
1085	if err != nil {
1086		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", resp, "Failure responding to request")
1087	}
1088
1089	return
1090}
1091
1092// ListRecommendedRulesForHostingEnvironmentPreparer prepares the ListRecommendedRulesForHostingEnvironment request.
1093func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (*http.Request, error) {
1094	pathParameters := map[string]interface{}{
1095		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
1096		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1097		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1098	}
1099
1100	const APIVersion = "2018-02-01"
1101	queryParameters := map[string]interface{}{
1102		"api-version": APIVersion,
1103	}
1104	if featured != nil {
1105		queryParameters["featured"] = autorest.Encode("query", *featured)
1106	}
1107	if len(filter) > 0 {
1108		queryParameters["$filter"] = filter
1109	}
1110
1111	preparer := autorest.CreatePreparer(
1112		autorest.AsGet(),
1113		autorest.WithBaseURL(client.BaseURI),
1114		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations", pathParameters),
1115		autorest.WithQueryParameters(queryParameters))
1116	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1117}
1118
1119// ListRecommendedRulesForHostingEnvironmentSender sends the ListRecommendedRulesForHostingEnvironment request. The method will close the
1120// http.Response Body if it receives an error.
1121func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
1122	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
1123	return autorest.SendWithSender(client, req, sd...)
1124}
1125
1126// ListRecommendedRulesForHostingEnvironmentResponder handles the response to the ListRecommendedRulesForHostingEnvironment request. The method always
1127// closes the http.Response Body.
1128func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentResponder(resp *http.Response) (result RecommendationCollection, err error) {
1129	err = autorest.Respond(
1130		resp,
1131		client.ByInspecting(),
1132		azure.WithErrorUnlessStatusCode(http.StatusOK),
1133		autorest.ByUnmarshallingJSON(&result),
1134		autorest.ByClosing())
1135	result.Response = autorest.Response{Response: resp}
1136	return
1137}
1138
1139// listRecommendedRulesForHostingEnvironmentNextResults retrieves the next set of results, if any.
1140func (client RecommendationsClient) listRecommendedRulesForHostingEnvironmentNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) {
1141	req, err := lastResults.recommendationCollectionPreparer(ctx)
1142	if err != nil {
1143		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", nil, "Failure preparing next results request")
1144	}
1145	if req == nil {
1146		return
1147	}
1148	resp, err := client.ListRecommendedRulesForHostingEnvironmentSender(req)
1149	if err != nil {
1150		result.Response = autorest.Response{Response: resp}
1151		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", resp, "Failure sending next results request")
1152	}
1153	result, err = client.ListRecommendedRulesForHostingEnvironmentResponder(resp)
1154	if err != nil {
1155		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", resp, "Failure responding to next results request")
1156	}
1157	return
1158}
1159
1160// ListRecommendedRulesForHostingEnvironmentComplete enumerates all values, automatically crossing page boundaries as required.
1161func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentComplete(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (result RecommendationCollectionIterator, err error) {
1162	if tracing.IsEnabled() {
1163		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForHostingEnvironment")
1164		defer func() {
1165			sc := -1
1166			if result.Response().Response.Response != nil {
1167				sc = result.page.Response().Response.Response.StatusCode
1168			}
1169			tracing.EndSpan(ctx, sc, err)
1170		}()
1171	}
1172	result.page, err = client.ListRecommendedRulesForHostingEnvironment(ctx, resourceGroupName, hostingEnvironmentName, featured, filter)
1173	return
1174}
1175
1176// ListRecommendedRulesForWebApp get all recommendations for an app.
1177// Parameters:
1178// resourceGroupName - name of the resource group to which the resource belongs.
1179// siteName - name of the app.
1180// featured - specify <code>true</code> to return only the most critical recommendations. The default is
1181// <code>false</code>, which returns all recommendations.
1182// filter - return only channels specified in the filter. Filter is specified by using OData syntax. Example:
1183// $filter=channel eq 'Api' or channel eq 'Notification'
1184func (client RecommendationsClient) ListRecommendedRulesForWebApp(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (result RecommendationCollectionPage, err error) {
1185	if tracing.IsEnabled() {
1186		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForWebApp")
1187		defer func() {
1188			sc := -1
1189			if result.rc.Response.Response != nil {
1190				sc = result.rc.Response.Response.StatusCode
1191			}
1192			tracing.EndSpan(ctx, sc, err)
1193		}()
1194	}
1195	if err := validation.Validate([]validation.Validation{
1196		{TargetValue: resourceGroupName,
1197			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1198				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1199				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
1200		return result, validation.NewError("web.RecommendationsClient", "ListRecommendedRulesForWebApp", err.Error())
1201	}
1202
1203	result.fn = client.listRecommendedRulesForWebAppNextResults
1204	req, err := client.ListRecommendedRulesForWebAppPreparer(ctx, resourceGroupName, siteName, featured, filter)
1205	if err != nil {
1206		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", nil, "Failure preparing request")
1207		return
1208	}
1209
1210	resp, err := client.ListRecommendedRulesForWebAppSender(req)
1211	if err != nil {
1212		result.rc.Response = autorest.Response{Response: resp}
1213		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure sending request")
1214		return
1215	}
1216
1217	result.rc, err = client.ListRecommendedRulesForWebAppResponder(resp)
1218	if err != nil {
1219		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure responding to request")
1220	}
1221
1222	return
1223}
1224
1225// ListRecommendedRulesForWebAppPreparer prepares the ListRecommendedRulesForWebApp request.
1226func (client RecommendationsClient) ListRecommendedRulesForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (*http.Request, error) {
1227	pathParameters := map[string]interface{}{
1228		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1229		"siteName":          autorest.Encode("path", siteName),
1230		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1231	}
1232
1233	const APIVersion = "2018-02-01"
1234	queryParameters := map[string]interface{}{
1235		"api-version": APIVersion,
1236	}
1237	if featured != nil {
1238		queryParameters["featured"] = autorest.Encode("query", *featured)
1239	}
1240	if len(filter) > 0 {
1241		queryParameters["$filter"] = filter
1242	}
1243
1244	preparer := autorest.CreatePreparer(
1245		autorest.AsGet(),
1246		autorest.WithBaseURL(client.BaseURI),
1247		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations", pathParameters),
1248		autorest.WithQueryParameters(queryParameters))
1249	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1250}
1251
1252// ListRecommendedRulesForWebAppSender sends the ListRecommendedRulesForWebApp request. The method will close the
1253// http.Response Body if it receives an error.
1254func (client RecommendationsClient) ListRecommendedRulesForWebAppSender(req *http.Request) (*http.Response, error) {
1255	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
1256	return autorest.SendWithSender(client, req, sd...)
1257}
1258
1259// ListRecommendedRulesForWebAppResponder handles the response to the ListRecommendedRulesForWebApp request. The method always
1260// closes the http.Response Body.
1261func (client RecommendationsClient) ListRecommendedRulesForWebAppResponder(resp *http.Response) (result RecommendationCollection, err error) {
1262	err = autorest.Respond(
1263		resp,
1264		client.ByInspecting(),
1265		azure.WithErrorUnlessStatusCode(http.StatusOK),
1266		autorest.ByUnmarshallingJSON(&result),
1267		autorest.ByClosing())
1268	result.Response = autorest.Response{Response: resp}
1269	return
1270}
1271
1272// listRecommendedRulesForWebAppNextResults retrieves the next set of results, if any.
1273func (client RecommendationsClient) listRecommendedRulesForWebAppNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) {
1274	req, err := lastResults.recommendationCollectionPreparer(ctx)
1275	if err != nil {
1276		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", nil, "Failure preparing next results request")
1277	}
1278	if req == nil {
1279		return
1280	}
1281	resp, err := client.ListRecommendedRulesForWebAppSender(req)
1282	if err != nil {
1283		result.Response = autorest.Response{Response: resp}
1284		return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", resp, "Failure sending next results request")
1285	}
1286	result, err = client.ListRecommendedRulesForWebAppResponder(resp)
1287	if err != nil {
1288		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", resp, "Failure responding to next results request")
1289	}
1290	return
1291}
1292
1293// ListRecommendedRulesForWebAppComplete enumerates all values, automatically crossing page boundaries as required.
1294func (client RecommendationsClient) ListRecommendedRulesForWebAppComplete(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (result RecommendationCollectionIterator, err error) {
1295	if tracing.IsEnabled() {
1296		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForWebApp")
1297		defer func() {
1298			sc := -1
1299			if result.Response().Response.Response != nil {
1300				sc = result.page.Response().Response.Response.StatusCode
1301			}
1302			tracing.EndSpan(ctx, sc, err)
1303		}()
1304	}
1305	result.page, err = client.ListRecommendedRulesForWebApp(ctx, resourceGroupName, siteName, featured, filter)
1306	return
1307}
1308
1309// ResetAllFilters reset all recommendation opt-out settings for a subscription.
1310func (client RecommendationsClient) ResetAllFilters(ctx context.Context) (result autorest.Response, err error) {
1311	if tracing.IsEnabled() {
1312		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFilters")
1313		defer func() {
1314			sc := -1
1315			if result.Response != nil {
1316				sc = result.Response.StatusCode
1317			}
1318			tracing.EndSpan(ctx, sc, err)
1319		}()
1320	}
1321	req, err := client.ResetAllFiltersPreparer(ctx)
1322	if err != nil {
1323		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", nil, "Failure preparing request")
1324		return
1325	}
1326
1327	resp, err := client.ResetAllFiltersSender(req)
1328	if err != nil {
1329		result.Response = resp
1330		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure sending request")
1331		return
1332	}
1333
1334	result, err = client.ResetAllFiltersResponder(resp)
1335	if err != nil {
1336		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure responding to request")
1337	}
1338
1339	return
1340}
1341
1342// ResetAllFiltersPreparer prepares the ResetAllFilters request.
1343func (client RecommendationsClient) ResetAllFiltersPreparer(ctx context.Context) (*http.Request, error) {
1344	pathParameters := map[string]interface{}{
1345		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
1346	}
1347
1348	const APIVersion = "2018-02-01"
1349	queryParameters := map[string]interface{}{
1350		"api-version": APIVersion,
1351	}
1352
1353	preparer := autorest.CreatePreparer(
1354		autorest.AsPost(),
1355		autorest.WithBaseURL(client.BaseURI),
1356		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset", pathParameters),
1357		autorest.WithQueryParameters(queryParameters))
1358	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1359}
1360
1361// ResetAllFiltersSender sends the ResetAllFilters request. The method will close the
1362// http.Response Body if it receives an error.
1363func (client RecommendationsClient) ResetAllFiltersSender(req *http.Request) (*http.Response, error) {
1364	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
1365	return autorest.SendWithSender(client, req, sd...)
1366}
1367
1368// ResetAllFiltersResponder handles the response to the ResetAllFilters request. The method always
1369// closes the http.Response Body.
1370func (client RecommendationsClient) ResetAllFiltersResponder(resp *http.Response) (result autorest.Response, err error) {
1371	err = autorest.Respond(
1372		resp,
1373		client.ByInspecting(),
1374		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
1375		autorest.ByClosing())
1376	result.Response = resp
1377	return
1378}
1379
1380// ResetAllFiltersForHostingEnvironment reset all recommendation opt-out settings for an app.
1381// Parameters:
1382// resourceGroupName - name of the resource group to which the resource belongs.
1383// environmentName - name of the app.
1384func (client RecommendationsClient) ResetAllFiltersForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (result autorest.Response, err error) {
1385	if tracing.IsEnabled() {
1386		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFiltersForHostingEnvironment")
1387		defer func() {
1388			sc := -1
1389			if result.Response != nil {
1390				sc = result.Response.StatusCode
1391			}
1392			tracing.EndSpan(ctx, sc, err)
1393		}()
1394	}
1395	if err := validation.Validate([]validation.Validation{
1396		{TargetValue: resourceGroupName,
1397			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1398				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1399				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
1400		return result, validation.NewError("web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", err.Error())
1401	}
1402
1403	req, err := client.ResetAllFiltersForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, hostingEnvironmentName)
1404	if err != nil {
1405		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", nil, "Failure preparing request")
1406		return
1407	}
1408
1409	resp, err := client.ResetAllFiltersForHostingEnvironmentSender(req)
1410	if err != nil {
1411		result.Response = resp
1412		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", resp, "Failure sending request")
1413		return
1414	}
1415
1416	result, err = client.ResetAllFiltersForHostingEnvironmentResponder(resp)
1417	if err != nil {
1418		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", resp, "Failure responding to request")
1419	}
1420
1421	return
1422}
1423
1424// ResetAllFiltersForHostingEnvironmentPreparer prepares the ResetAllFiltersForHostingEnvironment request.
1425func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (*http.Request, error) {
1426	pathParameters := map[string]interface{}{
1427		"hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName),
1428		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1429		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1430	}
1431
1432	const APIVersion = "2018-02-01"
1433	queryParameters := map[string]interface{}{
1434		"api-version":     APIVersion,
1435		"environmentName": autorest.Encode("query", environmentName),
1436	}
1437
1438	preparer := autorest.CreatePreparer(
1439		autorest.AsPost(),
1440		autorest.WithBaseURL(client.BaseURI),
1441		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset", pathParameters),
1442		autorest.WithQueryParameters(queryParameters))
1443	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1444}
1445
1446// ResetAllFiltersForHostingEnvironmentSender sends the ResetAllFiltersForHostingEnvironment request. The method will close the
1447// http.Response Body if it receives an error.
1448func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentSender(req *http.Request) (*http.Response, error) {
1449	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
1450	return autorest.SendWithSender(client, req, sd...)
1451}
1452
1453// ResetAllFiltersForHostingEnvironmentResponder handles the response to the ResetAllFiltersForHostingEnvironment request. The method always
1454// closes the http.Response Body.
1455func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) {
1456	err = autorest.Respond(
1457		resp,
1458		client.ByInspecting(),
1459		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
1460		autorest.ByClosing())
1461	result.Response = resp
1462	return
1463}
1464
1465// ResetAllFiltersForWebApp reset all recommendation opt-out settings for an app.
1466// Parameters:
1467// resourceGroupName - name of the resource group to which the resource belongs.
1468// siteName - name of the app.
1469func (client RecommendationsClient) ResetAllFiltersForWebApp(ctx context.Context, resourceGroupName string, siteName string) (result autorest.Response, err error) {
1470	if tracing.IsEnabled() {
1471		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFiltersForWebApp")
1472		defer func() {
1473			sc := -1
1474			if result.Response != nil {
1475				sc = result.Response.StatusCode
1476			}
1477			tracing.EndSpan(ctx, sc, err)
1478		}()
1479	}
1480	if err := validation.Validate([]validation.Validation{
1481		{TargetValue: resourceGroupName,
1482			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1483				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1484				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil {
1485		return result, validation.NewError("web.RecommendationsClient", "ResetAllFiltersForWebApp", err.Error())
1486	}
1487
1488	req, err := client.ResetAllFiltersForWebAppPreparer(ctx, resourceGroupName, siteName)
1489	if err != nil {
1490		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", nil, "Failure preparing request")
1491		return
1492	}
1493
1494	resp, err := client.ResetAllFiltersForWebAppSender(req)
1495	if err != nil {
1496		result.Response = resp
1497		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure sending request")
1498		return
1499	}
1500
1501	result, err = client.ResetAllFiltersForWebAppResponder(resp)
1502	if err != nil {
1503		err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure responding to request")
1504	}
1505
1506	return
1507}
1508
1509// ResetAllFiltersForWebAppPreparer prepares the ResetAllFiltersForWebApp request.
1510func (client RecommendationsClient) ResetAllFiltersForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) {
1511	pathParameters := map[string]interface{}{
1512		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1513		"siteName":          autorest.Encode("path", siteName),
1514		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1515	}
1516
1517	const APIVersion = "2018-02-01"
1518	queryParameters := map[string]interface{}{
1519		"api-version": APIVersion,
1520	}
1521
1522	preparer := autorest.CreatePreparer(
1523		autorest.AsPost(),
1524		autorest.WithBaseURL(client.BaseURI),
1525		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset", pathParameters),
1526		autorest.WithQueryParameters(queryParameters))
1527	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1528}
1529
1530// ResetAllFiltersForWebAppSender sends the ResetAllFiltersForWebApp request. The method will close the
1531// http.Response Body if it receives an error.
1532func (client RecommendationsClient) ResetAllFiltersForWebAppSender(req *http.Request) (*http.Response, error) {
1533	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
1534	return autorest.SendWithSender(client, req, sd...)
1535}
1536
1537// ResetAllFiltersForWebAppResponder handles the response to the ResetAllFiltersForWebApp request. The method always
1538// closes the http.Response Body.
1539func (client RecommendationsClient) ResetAllFiltersForWebAppResponder(resp *http.Response) (result autorest.Response, err error) {
1540	err = autorest.Respond(
1541		resp,
1542		client.ByInspecting(),
1543		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
1544		autorest.ByClosing())
1545	result.Response = resp
1546	return
1547}
1548