1package kusto 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// DatabasePrincipalAssignmentsClient is the the Azure Kusto management API provides a RESTful set of web services that 30// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and 31// delete clusters and databases. 32type DatabasePrincipalAssignmentsClient struct { 33 BaseClient 34} 35 36// NewDatabasePrincipalAssignmentsClient creates an instance of the DatabasePrincipalAssignmentsClient client. 37func NewDatabasePrincipalAssignmentsClient(subscriptionID string) DatabasePrincipalAssignmentsClient { 38 return NewDatabasePrincipalAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) 39} 40 41// NewDatabasePrincipalAssignmentsClientWithBaseURI creates an instance of the DatabasePrincipalAssignmentsClient 42// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI 43// (sovereign clouds, Azure stack). 44func NewDatabasePrincipalAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) DatabasePrincipalAssignmentsClient { 45 return DatabasePrincipalAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} 46} 47 48// CheckNameAvailability checks that the database principal assignment is valid and is not already in use. 49// Parameters: 50// resourceGroupName - the name of the resource group containing the Kusto cluster. 51// clusterName - the name of the Kusto cluster. 52// databaseName - the name of the database in the Kusto cluster. 53// principalAssignmentName - the name of the resource. 54func (client DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest) (result CheckNameResult, err error) { 55 if tracing.IsEnabled() { 56 ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.CheckNameAvailability") 57 defer func() { 58 sc := -1 59 if result.Response.Response != nil { 60 sc = result.Response.Response.StatusCode 61 } 62 tracing.EndSpan(ctx, sc, err) 63 }() 64 } 65 if err := validation.Validate([]validation.Validation{ 66 {TargetValue: principalAssignmentName, 67 Constraints: []validation.Constraint{{Target: "principalAssignmentName.Name", Name: validation.Null, Rule: true, Chain: nil}, 68 {Target: "principalAssignmentName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 69 return result, validation.NewError("kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", err.Error()) 70 } 71 72 req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) 73 if err != nil { 74 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") 75 return 76 } 77 78 resp, err := client.CheckNameAvailabilitySender(req) 79 if err != nil { 80 result.Response = autorest.Response{Response: resp} 81 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure sending request") 82 return 83 } 84 85 result, err = client.CheckNameAvailabilityResponder(resp) 86 if err != nil { 87 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure responding to request") 88 return 89 } 90 91 return 92} 93 94// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. 95func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest) (*http.Request, error) { 96 pathParameters := map[string]interface{}{ 97 "clusterName": autorest.Encode("path", clusterName), 98 "databaseName": autorest.Encode("path", databaseName), 99 "resourceGroupName": autorest.Encode("path", resourceGroupName), 100 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 101 } 102 103 const APIVersion = "2019-11-09" 104 queryParameters := map[string]interface{}{ 105 "api-version": APIVersion, 106 } 107 108 preparer := autorest.CreatePreparer( 109 autorest.AsContentType("application/json; charset=utf-8"), 110 autorest.AsPost(), 111 autorest.WithBaseURL(client.BaseURI), 112 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability", pathParameters), 113 autorest.WithJSON(principalAssignmentName), 114 autorest.WithQueryParameters(queryParameters)) 115 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 116} 117 118// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the 119// http.Response Body if it receives an error. 120func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { 121 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 122} 123 124// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always 125// closes the http.Response Body. 126func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { 127 err = autorest.Respond( 128 resp, 129 azure.WithErrorUnlessStatusCode(http.StatusOK), 130 autorest.ByUnmarshallingJSON(&result), 131 autorest.ByClosing()) 132 result.Response = autorest.Response{Response: resp} 133 return 134} 135 136// CreateOrUpdate creates a Kusto cluster database principalAssignment. 137// Parameters: 138// resourceGroupName - the name of the resource group containing the Kusto cluster. 139// clusterName - the name of the Kusto cluster. 140// databaseName - the name of the database in the Kusto cluster. 141// principalAssignmentName - the name of the Kusto principalAssignment. 142// parameters - the Kusto principalAssignments parameters supplied for the operation. 143func (client DatabasePrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment) (result DatabasePrincipalAssignmentsCreateOrUpdateFuture, err error) { 144 if tracing.IsEnabled() { 145 ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.CreateOrUpdate") 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: parameters, 156 Constraints: []validation.Constraint{{Target: "parameters.DatabasePrincipalProperties", Name: validation.Null, Rule: false, 157 Chain: []validation.Constraint{{Target: "parameters.DatabasePrincipalProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { 158 return result, validation.NewError("kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", err.Error()) 159 } 160 161 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, parameters) 162 if err != nil { 163 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") 164 return 165 } 166 167 result, err = client.CreateOrUpdateSender(req) 168 if err != nil { 169 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure sending request") 170 return 171 } 172 173 return 174} 175 176// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 177func (client DatabasePrincipalAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment) (*http.Request, error) { 178 pathParameters := map[string]interface{}{ 179 "clusterName": autorest.Encode("path", clusterName), 180 "databaseName": autorest.Encode("path", databaseName), 181 "principalAssignmentName": autorest.Encode("path", principalAssignmentName), 182 "resourceGroupName": autorest.Encode("path", resourceGroupName), 183 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 184 } 185 186 const APIVersion = "2019-11-09" 187 queryParameters := map[string]interface{}{ 188 "api-version": APIVersion, 189 } 190 191 preparer := autorest.CreatePreparer( 192 autorest.AsContentType("application/json; charset=utf-8"), 193 autorest.AsPut(), 194 autorest.WithBaseURL(client.BaseURI), 195 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), 196 autorest.WithJSON(parameters), 197 autorest.WithQueryParameters(queryParameters)) 198 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 199} 200 201// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 202// http.Response Body if it receives an error. 203func (client DatabasePrincipalAssignmentsClient) CreateOrUpdateSender(req *http.Request) (future DatabasePrincipalAssignmentsCreateOrUpdateFuture, err error) { 204 var resp *http.Response 205 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 206 if err != nil { 207 return 208 } 209 var azf azure.Future 210 azf, err = azure.NewFutureFromResponse(resp) 211 future.FutureAPI = &azf 212 future.Result = func(client DatabasePrincipalAssignmentsClient) (dpa DatabasePrincipalAssignment, err error) { 213 var done bool 214 done, err = future.DoneWithContext(context.Background(), client) 215 if err != nil { 216 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 217 return 218 } 219 if !done { 220 err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture") 221 return 222 } 223 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 224 if dpa.Response.Response, err = future.GetResult(sender); err == nil && dpa.Response.Response.StatusCode != http.StatusNoContent { 225 dpa, err = client.CreateOrUpdateResponder(dpa.Response.Response) 226 if err != nil { 227 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", dpa.Response.Response, "Failure responding to request") 228 } 229 } 230 return 231 } 232 return 233} 234 235// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 236// closes the http.Response Body. 237func (client DatabasePrincipalAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabasePrincipalAssignment, err error) { 238 err = autorest.Respond( 239 resp, 240 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 241 autorest.ByUnmarshallingJSON(&result), 242 autorest.ByClosing()) 243 result.Response = autorest.Response{Response: resp} 244 return 245} 246 247// Delete deletes a Kusto principalAssignment. 248// Parameters: 249// resourceGroupName - the name of the resource group containing the Kusto cluster. 250// clusterName - the name of the Kusto cluster. 251// databaseName - the name of the database in the Kusto cluster. 252// principalAssignmentName - the name of the Kusto principalAssignment. 253func (client DatabasePrincipalAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (result DatabasePrincipalAssignmentsDeleteFuture, err error) { 254 if tracing.IsEnabled() { 255 ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.Delete") 256 defer func() { 257 sc := -1 258 if result.Response() != nil { 259 sc = result.Response().StatusCode 260 } 261 tracing.EndSpan(ctx, sc, err) 262 }() 263 } 264 req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) 265 if err != nil { 266 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") 267 return 268 } 269 270 result, err = client.DeleteSender(req) 271 if err != nil { 272 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Delete", nil, "Failure sending request") 273 return 274 } 275 276 return 277} 278 279// DeletePreparer prepares the Delete request. 280func (client DatabasePrincipalAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (*http.Request, error) { 281 pathParameters := map[string]interface{}{ 282 "clusterName": autorest.Encode("path", clusterName), 283 "databaseName": autorest.Encode("path", databaseName), 284 "principalAssignmentName": autorest.Encode("path", principalAssignmentName), 285 "resourceGroupName": autorest.Encode("path", resourceGroupName), 286 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 287 } 288 289 const APIVersion = "2019-11-09" 290 queryParameters := map[string]interface{}{ 291 "api-version": APIVersion, 292 } 293 294 preparer := autorest.CreatePreparer( 295 autorest.AsDelete(), 296 autorest.WithBaseURL(client.BaseURI), 297 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), 298 autorest.WithQueryParameters(queryParameters)) 299 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 300} 301 302// DeleteSender sends the Delete request. The method will close the 303// http.Response Body if it receives an error. 304func (client DatabasePrincipalAssignmentsClient) DeleteSender(req *http.Request) (future DatabasePrincipalAssignmentsDeleteFuture, err error) { 305 var resp *http.Response 306 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 307 if err != nil { 308 return 309 } 310 var azf azure.Future 311 azf, err = azure.NewFutureFromResponse(resp) 312 future.FutureAPI = &azf 313 future.Result = func(client DatabasePrincipalAssignmentsClient) (ar autorest.Response, err error) { 314 var done bool 315 done, err = future.DoneWithContext(context.Background(), client) 316 if err != nil { 317 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") 318 return 319 } 320 if !done { 321 err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsDeleteFuture") 322 return 323 } 324 ar.Response = future.Response() 325 return 326 } 327 return 328} 329 330// DeleteResponder handles the response to the Delete request. The method always 331// closes the http.Response Body. 332func (client DatabasePrincipalAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 333 err = autorest.Respond( 334 resp, 335 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 336 autorest.ByClosing()) 337 result.Response = resp 338 return 339} 340 341// Get gets a Kusto cluster database principalAssignment. 342// Parameters: 343// resourceGroupName - the name of the resource group containing the Kusto cluster. 344// clusterName - the name of the Kusto cluster. 345// databaseName - the name of the database in the Kusto cluster. 346// principalAssignmentName - the name of the Kusto principalAssignment. 347func (client DatabasePrincipalAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (result DatabasePrincipalAssignment, err error) { 348 if tracing.IsEnabled() { 349 ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.Get") 350 defer func() { 351 sc := -1 352 if result.Response.Response != nil { 353 sc = result.Response.Response.StatusCode 354 } 355 tracing.EndSpan(ctx, sc, err) 356 }() 357 } 358 req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) 359 if err != nil { 360 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", nil, "Failure preparing request") 361 return 362 } 363 364 resp, err := client.GetSender(req) 365 if err != nil { 366 result.Response = autorest.Response{Response: resp} 367 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", resp, "Failure sending request") 368 return 369 } 370 371 result, err = client.GetResponder(resp) 372 if err != nil { 373 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", resp, "Failure responding to request") 374 return 375 } 376 377 return 378} 379 380// GetPreparer prepares the Get request. 381func (client DatabasePrincipalAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (*http.Request, error) { 382 pathParameters := map[string]interface{}{ 383 "clusterName": autorest.Encode("path", clusterName), 384 "databaseName": autorest.Encode("path", databaseName), 385 "principalAssignmentName": autorest.Encode("path", principalAssignmentName), 386 "resourceGroupName": autorest.Encode("path", resourceGroupName), 387 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 388 } 389 390 const APIVersion = "2019-11-09" 391 queryParameters := map[string]interface{}{ 392 "api-version": APIVersion, 393 } 394 395 preparer := autorest.CreatePreparer( 396 autorest.AsGet(), 397 autorest.WithBaseURL(client.BaseURI), 398 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), 399 autorest.WithQueryParameters(queryParameters)) 400 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 401} 402 403// GetSender sends the Get request. The method will close the 404// http.Response Body if it receives an error. 405func (client DatabasePrincipalAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { 406 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 407} 408 409// GetResponder handles the response to the Get request. The method always 410// closes the http.Response Body. 411func (client DatabasePrincipalAssignmentsClient) GetResponder(resp *http.Response) (result DatabasePrincipalAssignment, err error) { 412 err = autorest.Respond( 413 resp, 414 azure.WithErrorUnlessStatusCode(http.StatusOK), 415 autorest.ByUnmarshallingJSON(&result), 416 autorest.ByClosing()) 417 result.Response = autorest.Response{Response: resp} 418 return 419} 420 421// List lists all Kusto cluster database principalAssignments. 422// Parameters: 423// resourceGroupName - the name of the resource group containing the Kusto cluster. 424// clusterName - the name of the Kusto cluster. 425// databaseName - the name of the database in the Kusto cluster. 426func (client DatabasePrincipalAssignmentsClient) List(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasePrincipalAssignmentListResult, err error) { 427 if tracing.IsEnabled() { 428 ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.List") 429 defer func() { 430 sc := -1 431 if result.Response.Response != nil { 432 sc = result.Response.Response.StatusCode 433 } 434 tracing.EndSpan(ctx, sc, err) 435 }() 436 } 437 req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, databaseName) 438 if err != nil { 439 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", nil, "Failure preparing request") 440 return 441 } 442 443 resp, err := client.ListSender(req) 444 if err != nil { 445 result.Response = autorest.Response{Response: resp} 446 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", resp, "Failure sending request") 447 return 448 } 449 450 result, err = client.ListResponder(resp) 451 if err != nil { 452 err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", resp, "Failure responding to request") 453 return 454 } 455 456 return 457} 458 459// ListPreparer prepares the List request. 460func (client DatabasePrincipalAssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { 461 pathParameters := map[string]interface{}{ 462 "clusterName": autorest.Encode("path", clusterName), 463 "databaseName": autorest.Encode("path", databaseName), 464 "resourceGroupName": autorest.Encode("path", resourceGroupName), 465 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 466 } 467 468 const APIVersion = "2019-11-09" 469 queryParameters := map[string]interface{}{ 470 "api-version": APIVersion, 471 } 472 473 preparer := autorest.CreatePreparer( 474 autorest.AsGet(), 475 autorest.WithBaseURL(client.BaseURI), 476 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments", pathParameters), 477 autorest.WithQueryParameters(queryParameters)) 478 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 479} 480 481// ListSender sends the List request. The method will close the 482// http.Response Body if it receives an error. 483func (client DatabasePrincipalAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { 484 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 485} 486 487// ListResponder handles the response to the List request. The method always 488// closes the http.Response Body. 489func (client DatabasePrincipalAssignmentsClient) ListResponder(resp *http.Response) (result DatabasePrincipalAssignmentListResult, err error) { 490 err = autorest.Respond( 491 resp, 492 azure.WithErrorUnlessStatusCode(http.StatusOK), 493 autorest.ByUnmarshallingJSON(&result), 494 autorest.ByClosing()) 495 result.Response = autorest.Response{Response: resp} 496 return 497} 498