1package programmatic 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/satori/go.uuid" 26 "net/http" 27) 28 29// VersionsClient is the client for the Versions methods of the Programmatic service. 30type VersionsClient struct { 31 BaseClient 32} 33 34// NewVersionsClient creates an instance of the VersionsClient client. 35func NewVersionsClient(azureRegion AzureRegions) VersionsClient { 36 return VersionsClient{New(azureRegion)} 37} 38 39// Clone creates a new version using the current snapshot of the selected application version. 40// Parameters: 41// appID - the application ID. 42// versionID - the version ID. 43// versionCloneObject - a model containing the new version ID. 44func (client VersionsClient) Clone(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject *TaskUpdateObject) (result String, err error) { 45 req, err := client.ClonePreparer(ctx, appID, versionID, versionCloneObject) 46 if err != nil { 47 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Clone", nil, "Failure preparing request") 48 return 49 } 50 51 resp, err := client.CloneSender(req) 52 if err != nil { 53 result.Response = autorest.Response{Response: resp} 54 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Clone", resp, "Failure sending request") 55 return 56 } 57 58 result, err = client.CloneResponder(resp) 59 if err != nil { 60 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Clone", resp, "Failure responding to request") 61 } 62 63 return 64} 65 66// ClonePreparer prepares the Clone request. 67func (client VersionsClient) ClonePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject *TaskUpdateObject) (*http.Request, error) { 68 urlParameters := map[string]interface{}{ 69 "AzureRegion": client.AzureRegion, 70 } 71 72 pathParameters := map[string]interface{}{ 73 "appId": autorest.Encode("path", appID), 74 "versionId": autorest.Encode("path", versionID), 75 } 76 77 preparer := autorest.CreatePreparer( 78 autorest.AsContentType("application/json; charset=utf-8"), 79 autorest.AsPost(), 80 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 81 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/clone", pathParameters)) 82 if versionCloneObject != nil { 83 preparer = autorest.DecoratePreparer(preparer, 84 autorest.WithJSON(versionCloneObject)) 85 } 86 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 87} 88 89// CloneSender sends the Clone request. The method will close the 90// http.Response Body if it receives an error. 91func (client VersionsClient) CloneSender(req *http.Request) (*http.Response, error) { 92 return autorest.SendWithSender(client, req, 93 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 94} 95 96// CloneResponder handles the response to the Clone request. The method always 97// closes the http.Response Body. 98func (client VersionsClient) CloneResponder(resp *http.Response) (result String, err error) { 99 err = autorest.Respond( 100 resp, 101 client.ByInspecting(), 102 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 103 autorest.ByUnmarshallingJSON(&result.Value), 104 autorest.ByClosing()) 105 result.Response = autorest.Response{Response: resp} 106 return 107} 108 109// Delete deletes an application version. 110// Parameters: 111// appID - the application ID. 112// versionID - the version ID. 113func (client VersionsClient) Delete(ctx context.Context, appID uuid.UUID, versionID string) (result OperationStatus, err error) { 114 req, err := client.DeletePreparer(ctx, appID, versionID) 115 if err != nil { 116 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Delete", nil, "Failure preparing request") 117 return 118 } 119 120 resp, err := client.DeleteSender(req) 121 if err != nil { 122 result.Response = autorest.Response{Response: resp} 123 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Delete", resp, "Failure sending request") 124 return 125 } 126 127 result, err = client.DeleteResponder(resp) 128 if err != nil { 129 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Delete", resp, "Failure responding to request") 130 } 131 132 return 133} 134 135// DeletePreparer prepares the Delete request. 136func (client VersionsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { 137 urlParameters := map[string]interface{}{ 138 "AzureRegion": client.AzureRegion, 139 } 140 141 pathParameters := map[string]interface{}{ 142 "appId": autorest.Encode("path", appID), 143 "versionId": autorest.Encode("path", versionID), 144 } 145 146 preparer := autorest.CreatePreparer( 147 autorest.AsDelete(), 148 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 149 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters)) 150 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 151} 152 153// DeleteSender sends the Delete request. The method will close the 154// http.Response Body if it receives an error. 155func (client VersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { 156 return autorest.SendWithSender(client, req, 157 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 158} 159 160// DeleteResponder handles the response to the Delete request. The method always 161// closes the http.Response Body. 162func (client VersionsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) { 163 err = autorest.Respond( 164 resp, 165 client.ByInspecting(), 166 azure.WithErrorUnlessStatusCode(http.StatusOK), 167 autorest.ByUnmarshallingJSON(&result), 168 autorest.ByClosing()) 169 result.Response = autorest.Response{Response: resp} 170 return 171} 172 173// DeleteUnlabelledUtterance deleted an unlabelled utterance. 174// Parameters: 175// appID - the application ID. 176// versionID - the version ID. 177// utterance - the utterance text to delete. 178func (client VersionsClient) DeleteUnlabelledUtterance(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (result OperationStatus, err error) { 179 req, err := client.DeleteUnlabelledUtterancePreparer(ctx, appID, versionID, utterance) 180 if err != nil { 181 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "DeleteUnlabelledUtterance", nil, "Failure preparing request") 182 return 183 } 184 185 resp, err := client.DeleteUnlabelledUtteranceSender(req) 186 if err != nil { 187 result.Response = autorest.Response{Response: resp} 188 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure sending request") 189 return 190 } 191 192 result, err = client.DeleteUnlabelledUtteranceResponder(resp) 193 if err != nil { 194 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure responding to request") 195 } 196 197 return 198} 199 200// DeleteUnlabelledUtterancePreparer prepares the DeleteUnlabelledUtterance request. 201func (client VersionsClient) DeleteUnlabelledUtterancePreparer(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (*http.Request, error) { 202 urlParameters := map[string]interface{}{ 203 "AzureRegion": client.AzureRegion, 204 } 205 206 pathParameters := map[string]interface{}{ 207 "appId": autorest.Encode("path", appID), 208 "versionId": autorest.Encode("path", versionID), 209 } 210 211 preparer := autorest.CreatePreparer( 212 autorest.AsContentType("application/json; charset=utf-8"), 213 autorest.AsDelete(), 214 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 215 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/suggest", pathParameters), 216 autorest.WithJSON(utterance)) 217 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 218} 219 220// DeleteUnlabelledUtteranceSender sends the DeleteUnlabelledUtterance request. The method will close the 221// http.Response Body if it receives an error. 222func (client VersionsClient) DeleteUnlabelledUtteranceSender(req *http.Request) (*http.Response, error) { 223 return autorest.SendWithSender(client, req, 224 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 225} 226 227// DeleteUnlabelledUtteranceResponder handles the response to the DeleteUnlabelledUtterance request. The method always 228// closes the http.Response Body. 229func (client VersionsClient) DeleteUnlabelledUtteranceResponder(resp *http.Response) (result OperationStatus, err error) { 230 err = autorest.Respond( 231 resp, 232 client.ByInspecting(), 233 azure.WithErrorUnlessStatusCode(http.StatusOK), 234 autorest.ByUnmarshallingJSON(&result), 235 autorest.ByClosing()) 236 result.Response = autorest.Response{Response: resp} 237 return 238} 239 240// Export exports a LUIS application to JSON format. 241// Parameters: 242// appID - the application ID. 243// versionID - the version ID. 244func (client VersionsClient) Export(ctx context.Context, appID uuid.UUID, versionID string) (result LuisApp, err error) { 245 req, err := client.ExportPreparer(ctx, appID, versionID) 246 if err != nil { 247 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Export", nil, "Failure preparing request") 248 return 249 } 250 251 resp, err := client.ExportSender(req) 252 if err != nil { 253 result.Response = autorest.Response{Response: resp} 254 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Export", resp, "Failure sending request") 255 return 256 } 257 258 result, err = client.ExportResponder(resp) 259 if err != nil { 260 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Export", resp, "Failure responding to request") 261 } 262 263 return 264} 265 266// ExportPreparer prepares the Export request. 267func (client VersionsClient) ExportPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { 268 urlParameters := map[string]interface{}{ 269 "AzureRegion": client.AzureRegion, 270 } 271 272 pathParameters := map[string]interface{}{ 273 "appId": autorest.Encode("path", appID), 274 "versionId": autorest.Encode("path", versionID), 275 } 276 277 preparer := autorest.CreatePreparer( 278 autorest.AsGet(), 279 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 280 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/export", pathParameters)) 281 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 282} 283 284// ExportSender sends the Export request. The method will close the 285// http.Response Body if it receives an error. 286func (client VersionsClient) ExportSender(req *http.Request) (*http.Response, error) { 287 return autorest.SendWithSender(client, req, 288 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 289} 290 291// ExportResponder handles the response to the Export request. The method always 292// closes the http.Response Body. 293func (client VersionsClient) ExportResponder(resp *http.Response) (result LuisApp, err error) { 294 err = autorest.Respond( 295 resp, 296 client.ByInspecting(), 297 azure.WithErrorUnlessStatusCode(http.StatusOK), 298 autorest.ByUnmarshallingJSON(&result), 299 autorest.ByClosing()) 300 result.Response = autorest.Response{Response: resp} 301 return 302} 303 304// Get gets the version info. 305// Parameters: 306// appID - the application ID. 307// versionID - the version ID. 308func (client VersionsClient) Get(ctx context.Context, appID uuid.UUID, versionID string) (result VersionInfo, err error) { 309 req, err := client.GetPreparer(ctx, appID, versionID) 310 if err != nil { 311 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Get", nil, "Failure preparing request") 312 return 313 } 314 315 resp, err := client.GetSender(req) 316 if err != nil { 317 result.Response = autorest.Response{Response: resp} 318 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Get", resp, "Failure sending request") 319 return 320 } 321 322 result, err = client.GetResponder(resp) 323 if err != nil { 324 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Get", resp, "Failure responding to request") 325 } 326 327 return 328} 329 330// GetPreparer prepares the Get request. 331func (client VersionsClient) GetPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { 332 urlParameters := map[string]interface{}{ 333 "AzureRegion": client.AzureRegion, 334 } 335 336 pathParameters := map[string]interface{}{ 337 "appId": autorest.Encode("path", appID), 338 "versionId": autorest.Encode("path", versionID), 339 } 340 341 preparer := autorest.CreatePreparer( 342 autorest.AsGet(), 343 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 344 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters)) 345 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 346} 347 348// GetSender sends the Get request. The method will close the 349// http.Response Body if it receives an error. 350func (client VersionsClient) GetSender(req *http.Request) (*http.Response, error) { 351 return autorest.SendWithSender(client, req, 352 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 353} 354 355// GetResponder handles the response to the Get request. The method always 356// closes the http.Response Body. 357func (client VersionsClient) GetResponder(resp *http.Response) (result VersionInfo, err error) { 358 err = autorest.Respond( 359 resp, 360 client.ByInspecting(), 361 azure.WithErrorUnlessStatusCode(http.StatusOK), 362 autorest.ByUnmarshallingJSON(&result), 363 autorest.ByClosing()) 364 result.Response = autorest.Response{Response: resp} 365 return 366} 367 368// Import imports a new version into a LUIS application. 369// Parameters: 370// appID - the application ID. 371// luisApp - a LUIS application structure. 372// versionID - the new versionId to import. If not specified, the versionId will be read from the imported 373// object. 374func (client VersionsClient) Import(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (result String, err error) { 375 req, err := client.ImportPreparer(ctx, appID, luisApp, versionID) 376 if err != nil { 377 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Import", nil, "Failure preparing request") 378 return 379 } 380 381 resp, err := client.ImportSender(req) 382 if err != nil { 383 result.Response = autorest.Response{Response: resp} 384 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Import", resp, "Failure sending request") 385 return 386 } 387 388 result, err = client.ImportResponder(resp) 389 if err != nil { 390 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Import", resp, "Failure responding to request") 391 } 392 393 return 394} 395 396// ImportPreparer prepares the Import request. 397func (client VersionsClient) ImportPreparer(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (*http.Request, error) { 398 urlParameters := map[string]interface{}{ 399 "AzureRegion": client.AzureRegion, 400 } 401 402 pathParameters := map[string]interface{}{ 403 "appId": autorest.Encode("path", appID), 404 } 405 406 queryParameters := map[string]interface{}{} 407 if len(versionID) > 0 { 408 queryParameters["versionId"] = autorest.Encode("query", versionID) 409 } 410 411 preparer := autorest.CreatePreparer( 412 autorest.AsContentType("application/json; charset=utf-8"), 413 autorest.AsPost(), 414 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 415 autorest.WithPathParameters("/apps/{appId}/versions/import", pathParameters), 416 autorest.WithJSON(luisApp), 417 autorest.WithQueryParameters(queryParameters)) 418 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 419} 420 421// ImportSender sends the Import request. The method will close the 422// http.Response Body if it receives an error. 423func (client VersionsClient) ImportSender(req *http.Request) (*http.Response, error) { 424 return autorest.SendWithSender(client, req, 425 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 426} 427 428// ImportResponder handles the response to the Import request. The method always 429// closes the http.Response Body. 430func (client VersionsClient) ImportResponder(resp *http.Response) (result String, err error) { 431 err = autorest.Respond( 432 resp, 433 client.ByInspecting(), 434 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 435 autorest.ByUnmarshallingJSON(&result.Value), 436 autorest.ByClosing()) 437 result.Response = autorest.Response{Response: resp} 438 return 439} 440 441// List gets the application versions info. 442// Parameters: 443// appID - the application ID. 444// skip - the number of entries to skip. Default value is 0. 445// take - the number of entries to return. Maximum page size is 500. Default is 100. 446func (client VersionsClient) List(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (result ListVersionInfo, err error) { 447 if err := validation.Validate([]validation.Validation{ 448 {TargetValue: skip, 449 Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, 450 Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, 451 {TargetValue: take, 452 Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, 453 Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: 500, Chain: nil}, 454 {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, 455 }}}}}); err != nil { 456 return result, validation.NewError("programmatic.VersionsClient", "List", err.Error()) 457 } 458 459 req, err := client.ListPreparer(ctx, appID, skip, take) 460 if err != nil { 461 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "List", nil, "Failure preparing request") 462 return 463 } 464 465 resp, err := client.ListSender(req) 466 if err != nil { 467 result.Response = autorest.Response{Response: resp} 468 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "List", resp, "Failure sending request") 469 return 470 } 471 472 result, err = client.ListResponder(resp) 473 if err != nil { 474 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "List", resp, "Failure responding to request") 475 } 476 477 return 478} 479 480// ListPreparer prepares the List request. 481func (client VersionsClient) ListPreparer(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (*http.Request, error) { 482 urlParameters := map[string]interface{}{ 483 "AzureRegion": client.AzureRegion, 484 } 485 486 pathParameters := map[string]interface{}{ 487 "appId": autorest.Encode("path", appID), 488 } 489 490 queryParameters := map[string]interface{}{} 491 if skip != nil { 492 queryParameters["skip"] = autorest.Encode("query", *skip) 493 } else { 494 queryParameters["skip"] = autorest.Encode("query", 0) 495 } 496 if take != nil { 497 queryParameters["take"] = autorest.Encode("query", *take) 498 } else { 499 queryParameters["take"] = autorest.Encode("query", 100) 500 } 501 502 preparer := autorest.CreatePreparer( 503 autorest.AsGet(), 504 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 505 autorest.WithPathParameters("/apps/{appId}/versions", pathParameters), 506 autorest.WithQueryParameters(queryParameters)) 507 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 508} 509 510// ListSender sends the List request. The method will close the 511// http.Response Body if it receives an error. 512func (client VersionsClient) ListSender(req *http.Request) (*http.Response, error) { 513 return autorest.SendWithSender(client, req, 514 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 515} 516 517// ListResponder handles the response to the List request. The method always 518// closes the http.Response Body. 519func (client VersionsClient) ListResponder(resp *http.Response) (result ListVersionInfo, err error) { 520 err = autorest.Respond( 521 resp, 522 client.ByInspecting(), 523 azure.WithErrorUnlessStatusCode(http.StatusOK), 524 autorest.ByUnmarshallingJSON(&result.Value), 525 autorest.ByClosing()) 526 result.Response = autorest.Response{Response: resp} 527 return 528} 529 530// Update updates the name or description of the application version. 531// Parameters: 532// appID - the application ID. 533// versionID - the version ID. 534// versionUpdateObject - a model containing Name and Description of the application. 535func (client VersionsClient) Update(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (result OperationStatus, err error) { 536 req, err := client.UpdatePreparer(ctx, appID, versionID, versionUpdateObject) 537 if err != nil { 538 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Update", nil, "Failure preparing request") 539 return 540 } 541 542 resp, err := client.UpdateSender(req) 543 if err != nil { 544 result.Response = autorest.Response{Response: resp} 545 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Update", resp, "Failure sending request") 546 return 547 } 548 549 result, err = client.UpdateResponder(resp) 550 if err != nil { 551 err = autorest.NewErrorWithError(err, "programmatic.VersionsClient", "Update", resp, "Failure responding to request") 552 } 553 554 return 555} 556 557// UpdatePreparer prepares the Update request. 558func (client VersionsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (*http.Request, error) { 559 urlParameters := map[string]interface{}{ 560 "AzureRegion": client.AzureRegion, 561 } 562 563 pathParameters := map[string]interface{}{ 564 "appId": autorest.Encode("path", appID), 565 "versionId": autorest.Encode("path", versionID), 566 } 567 568 preparer := autorest.CreatePreparer( 569 autorest.AsContentType("application/json; charset=utf-8"), 570 autorest.AsPut(), 571 autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), 572 autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters), 573 autorest.WithJSON(versionUpdateObject)) 574 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 575} 576 577// UpdateSender sends the Update request. The method will close the 578// http.Response Body if it receives an error. 579func (client VersionsClient) UpdateSender(req *http.Request) (*http.Response, error) { 580 return autorest.SendWithSender(client, req, 581 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 582} 583 584// UpdateResponder handles the response to the Update request. The method always 585// closes the http.Response Body. 586func (client VersionsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) { 587 err = autorest.Respond( 588 resp, 589 client.ByInspecting(), 590 azure.WithErrorUnlessStatusCode(http.StatusOK), 591 autorest.ByUnmarshallingJSON(&result), 592 autorest.ByClosing()) 593 result.Response = autorest.Response{Response: resp} 594 return 595} 596