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