1package apimanagement 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// ProductPolicyClient is the apiManagement Client 19type ProductPolicyClient struct { 20 BaseClient 21} 22 23// NewProductPolicyClient creates an instance of the ProductPolicyClient client. 24func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { 25 return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewProductPolicyClientWithBaseURI creates an instance of the ProductPolicyClient 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 NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { 31 return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// CreateOrUpdate creates or updates policy configuration for the Product. 35// Parameters: 36// resourceGroupName - the name of the resource group. 37// serviceName - the name of the API Management service. 38// productID - product identifier. Must be unique in the current API Management service instance. 39// parameters - the policy contents to apply. 40// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. 41func (client ProductPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { 42 if tracing.IsEnabled() { 43 ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.CreateOrUpdate") 44 defer func() { 45 sc := -1 46 if result.Response.Response != nil { 47 sc = result.Response.Response.StatusCode 48 } 49 tracing.EndSpan(ctx, sc, err) 50 }() 51 } 52 if err := validation.Validate([]validation.Validation{ 53 {TargetValue: serviceName, 54 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 55 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 56 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 57 {TargetValue: productID, 58 Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 59 {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, 60 {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 61 {TargetValue: parameters, 62 Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, 63 Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.PolicyContent", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { 64 return result, validation.NewError("apimanagement.ProductPolicyClient", "CreateOrUpdate", err.Error()) 65 } 66 67 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) 68 if err != nil { 69 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") 70 return 71 } 72 73 resp, err := client.CreateOrUpdateSender(req) 74 if err != nil { 75 result.Response = autorest.Response{Response: resp} 76 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") 77 return 78 } 79 80 result, err = client.CreateOrUpdateResponder(resp) 81 if err != nil { 82 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") 83 return 84 } 85 86 return 87} 88 89// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 90func (client ProductPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { 91 pathParameters := map[string]interface{}{ 92 "policyId": autorest.Encode("path", "policy"), 93 "productId": autorest.Encode("path", productID), 94 "resourceGroupName": autorest.Encode("path", resourceGroupName), 95 "serviceName": autorest.Encode("path", serviceName), 96 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 97 } 98 99 const APIVersion = "2018-06-01-preview" 100 queryParameters := map[string]interface{}{ 101 "api-version": APIVersion, 102 } 103 104 preparer := autorest.CreatePreparer( 105 autorest.AsContentType("application/json; charset=utf-8"), 106 autorest.AsPut(), 107 autorest.WithBaseURL(client.BaseURI), 108 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), 109 autorest.WithJSON(parameters), 110 autorest.WithQueryParameters(queryParameters)) 111 if len(ifMatch) > 0 { 112 preparer = autorest.DecoratePreparer(preparer, 113 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 114 } 115 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 116} 117 118// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 119// http.Response Body if it receives an error. 120func (client ProductPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 121 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 122} 123 124// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 125// closes the http.Response Body. 126func (client ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, err error) { 127 err = autorest.Respond( 128 resp, 129 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 130 autorest.ByUnmarshallingJSON(&result), 131 autorest.ByClosing()) 132 result.Response = autorest.Response{Response: resp} 133 return 134} 135 136// Delete deletes the policy configuration at the Product. 137// Parameters: 138// resourceGroupName - the name of the resource group. 139// serviceName - the name of the API Management service. 140// productID - product identifier. Must be unique in the current API Management service instance. 141// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET 142// request or it should be * for unconditional update. 143func (client ProductPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { 144 if tracing.IsEnabled() { 145 ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.Delete") 146 defer func() { 147 sc := -1 148 if result.Response != nil { 149 sc = result.Response.StatusCode 150 } 151 tracing.EndSpan(ctx, sc, err) 152 }() 153 } 154 if err := validation.Validate([]validation.Validation{ 155 {TargetValue: serviceName, 156 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 157 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 158 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 159 {TargetValue: productID, 160 Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 161 {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, 162 {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 163 return result, validation.NewError("apimanagement.ProductPolicyClient", "Delete", err.Error()) 164 } 165 166 req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch) 167 if err != nil { 168 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") 169 return 170 } 171 172 resp, err := client.DeleteSender(req) 173 if err != nil { 174 result.Response = resp 175 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") 176 return 177 } 178 179 result, err = client.DeleteResponder(resp) 180 if err != nil { 181 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") 182 return 183 } 184 185 return 186} 187 188// DeletePreparer prepares the Delete request. 189func (client ProductPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { 190 pathParameters := map[string]interface{}{ 191 "policyId": autorest.Encode("path", "policy"), 192 "productId": autorest.Encode("path", productID), 193 "resourceGroupName": autorest.Encode("path", resourceGroupName), 194 "serviceName": autorest.Encode("path", serviceName), 195 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 196 } 197 198 const APIVersion = "2018-06-01-preview" 199 queryParameters := map[string]interface{}{ 200 "api-version": APIVersion, 201 } 202 203 preparer := autorest.CreatePreparer( 204 autorest.AsDelete(), 205 autorest.WithBaseURL(client.BaseURI), 206 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), 207 autorest.WithQueryParameters(queryParameters), 208 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 209 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 210} 211 212// DeleteSender sends the Delete request. The method will close the 213// http.Response Body if it receives an error. 214func (client ProductPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { 215 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 216} 217 218// DeleteResponder handles the response to the Delete request. The method always 219// closes the http.Response Body. 220func (client ProductPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 221 err = autorest.Respond( 222 resp, 223 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 224 autorest.ByClosing()) 225 result.Response = resp 226 return 227} 228 229// Get get the policy configuration at the Product level. 230// Parameters: 231// resourceGroupName - the name of the resource group. 232// serviceName - the name of the API Management service. 233// productID - product identifier. Must be unique in the current API Management service instance. 234func (client ProductPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyContract, err error) { 235 if tracing.IsEnabled() { 236 ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.Get") 237 defer func() { 238 sc := -1 239 if result.Response.Response != nil { 240 sc = result.Response.Response.StatusCode 241 } 242 tracing.EndSpan(ctx, sc, err) 243 }() 244 } 245 if err := validation.Validate([]validation.Validation{ 246 {TargetValue: serviceName, 247 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 248 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 249 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 250 {TargetValue: productID, 251 Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 252 {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, 253 {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 254 return result, validation.NewError("apimanagement.ProductPolicyClient", "Get", err.Error()) 255 } 256 257 req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID) 258 if err != nil { 259 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") 260 return 261 } 262 263 resp, err := client.GetSender(req) 264 if err != nil { 265 result.Response = autorest.Response{Response: resp} 266 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") 267 return 268 } 269 270 result, err = client.GetResponder(resp) 271 if err != nil { 272 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") 273 return 274 } 275 276 return 277} 278 279// GetPreparer prepares the Get request. 280func (client ProductPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { 281 pathParameters := map[string]interface{}{ 282 "policyId": autorest.Encode("path", "policy"), 283 "productId": autorest.Encode("path", productID), 284 "resourceGroupName": autorest.Encode("path", resourceGroupName), 285 "serviceName": autorest.Encode("path", serviceName), 286 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 287 } 288 289 const APIVersion = "2018-06-01-preview" 290 queryParameters := map[string]interface{}{ 291 "api-version": APIVersion, 292 } 293 294 preparer := autorest.CreatePreparer( 295 autorest.AsGet(), 296 autorest.WithBaseURL(client.BaseURI), 297 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), 298 autorest.WithQueryParameters(queryParameters)) 299 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 300} 301 302// GetSender sends the Get request. The method will close the 303// http.Response Body if it receives an error. 304func (client ProductPolicyClient) GetSender(req *http.Request) (*http.Response, error) { 305 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 306} 307 308// GetResponder handles the response to the Get request. The method always 309// closes the http.Response Body. 310func (client ProductPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { 311 err = autorest.Respond( 312 resp, 313 azure.WithErrorUnlessStatusCode(http.StatusOK), 314 autorest.ByUnmarshallingJSON(&result), 315 autorest.ByClosing()) 316 result.Response = autorest.Response{Response: resp} 317 return 318} 319 320// GetEntityTag get the ETag of the policy configuration at the Product level. 321// Parameters: 322// resourceGroupName - the name of the resource group. 323// serviceName - the name of the API Management service. 324// productID - product identifier. Must be unique in the current API Management service instance. 325func (client ProductPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { 326 if tracing.IsEnabled() { 327 ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.GetEntityTag") 328 defer func() { 329 sc := -1 330 if result.Response != nil { 331 sc = result.Response.StatusCode 332 } 333 tracing.EndSpan(ctx, sc, err) 334 }() 335 } 336 if err := validation.Validate([]validation.Validation{ 337 {TargetValue: serviceName, 338 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 339 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 340 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 341 {TargetValue: productID, 342 Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 343 {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, 344 {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 345 return result, validation.NewError("apimanagement.ProductPolicyClient", "GetEntityTag", err.Error()) 346 } 347 348 req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) 349 if err != nil { 350 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") 351 return 352 } 353 354 resp, err := client.GetEntityTagSender(req) 355 if err != nil { 356 result.Response = resp 357 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure sending request") 358 return 359 } 360 361 result, err = client.GetEntityTagResponder(resp) 362 if err != nil { 363 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure responding to request") 364 return 365 } 366 367 return 368} 369 370// GetEntityTagPreparer prepares the GetEntityTag request. 371func (client ProductPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { 372 pathParameters := map[string]interface{}{ 373 "policyId": autorest.Encode("path", "policy"), 374 "productId": autorest.Encode("path", productID), 375 "resourceGroupName": autorest.Encode("path", resourceGroupName), 376 "serviceName": autorest.Encode("path", serviceName), 377 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 378 } 379 380 const APIVersion = "2018-06-01-preview" 381 queryParameters := map[string]interface{}{ 382 "api-version": APIVersion, 383 } 384 385 preparer := autorest.CreatePreparer( 386 autorest.AsHead(), 387 autorest.WithBaseURL(client.BaseURI), 388 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), 389 autorest.WithQueryParameters(queryParameters)) 390 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 391} 392 393// GetEntityTagSender sends the GetEntityTag request. The method will close the 394// http.Response Body if it receives an error. 395func (client ProductPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { 396 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 397} 398 399// GetEntityTagResponder handles the response to the GetEntityTag request. The method always 400// closes the http.Response Body. 401func (client ProductPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { 402 err = autorest.Respond( 403 resp, 404 azure.WithErrorUnlessStatusCode(http.StatusOK), 405 autorest.ByClosing()) 406 result.Response = resp 407 return 408} 409 410// ListByProduct get the policy configuration at the Product level. 411// Parameters: 412// resourceGroupName - the name of the resource group. 413// serviceName - the name of the API Management service. 414// productID - product identifier. Must be unique in the current API Management service instance. 415func (client ProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyCollection, err error) { 416 if tracing.IsEnabled() { 417 ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.ListByProduct") 418 defer func() { 419 sc := -1 420 if result.Response.Response != nil { 421 sc = result.Response.Response.StatusCode 422 } 423 tracing.EndSpan(ctx, sc, err) 424 }() 425 } 426 if err := validation.Validate([]validation.Validation{ 427 {TargetValue: serviceName, 428 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 429 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 430 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 431 {TargetValue: productID, 432 Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 433 {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, 434 {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 435 return result, validation.NewError("apimanagement.ProductPolicyClient", "ListByProduct", err.Error()) 436 } 437 438 req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID) 439 if err != nil { 440 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") 441 return 442 } 443 444 resp, err := client.ListByProductSender(req) 445 if err != nil { 446 result.Response = autorest.Response{Response: resp} 447 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure sending request") 448 return 449 } 450 451 result, err = client.ListByProductResponder(resp) 452 if err != nil { 453 err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure responding to request") 454 return 455 } 456 457 return 458} 459 460// ListByProductPreparer prepares the ListByProduct request. 461func (client ProductPolicyClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { 462 pathParameters := map[string]interface{}{ 463 "productId": autorest.Encode("path", productID), 464 "resourceGroupName": autorest.Encode("path", resourceGroupName), 465 "serviceName": autorest.Encode("path", serviceName), 466 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 467 } 468 469 const APIVersion = "2018-06-01-preview" 470 queryParameters := map[string]interface{}{ 471 "api-version": APIVersion, 472 } 473 474 preparer := autorest.CreatePreparer( 475 autorest.AsGet(), 476 autorest.WithBaseURL(client.BaseURI), 477 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies", pathParameters), 478 autorest.WithQueryParameters(queryParameters)) 479 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 480} 481 482// ListByProductSender sends the ListByProduct request. The method will close the 483// http.Response Body if it receives an error. 484func (client ProductPolicyClient) ListByProductSender(req *http.Request) (*http.Response, error) { 485 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 486} 487 488// ListByProductResponder handles the response to the ListByProduct request. The method always 489// closes the http.Response Body. 490func (client ProductPolicyClient) ListByProductResponder(resp *http.Response) (result PolicyCollection, err error) { 491 err = autorest.Respond( 492 resp, 493 azure.WithErrorUnlessStatusCode(http.StatusOK), 494 autorest.ByUnmarshallingJSON(&result), 495 autorest.ByClosing()) 496 result.Response = autorest.Response{Response: resp} 497 return 498} 499