1package storage 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// QueueClient is the the Azure Storage Management API. 19type QueueClient struct { 20 BaseClient 21} 22 23// NewQueueClient creates an instance of the QueueClient client. 24func NewQueueClient(subscriptionID string) QueueClient { 25 return NewQueueClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewQueueClientWithBaseURI creates an instance of the QueueClient client using a custom endpoint. Use this when 29// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 30func NewQueueClientWithBaseURI(baseURI string, subscriptionID string) QueueClient { 31 return QueueClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// Create creates a new queue with the specified queue name, under the specified account. 35// Parameters: 36// resourceGroupName - the name of the resource group within the user's subscription. The name is case 37// insensitive. 38// accountName - the name of the storage account within the specified resource group. Storage account names 39// must be between 3 and 24 characters in length and use numbers and lower-case letters only. 40// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The 41// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an 42// alphanumeric character and it cannot have two consecutive dash(-) characters. 43// queue - queue properties and metadata to be created with 44func (client QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { 45 if tracing.IsEnabled() { 46 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Create") 47 defer func() { 48 sc := -1 49 if result.Response.Response != nil { 50 sc = result.Response.Response.StatusCode 51 } 52 tracing.EndSpan(ctx, sc, err) 53 }() 54 } 55 if err := validation.Validate([]validation.Validation{ 56 {TargetValue: resourceGroupName, 57 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 58 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 59 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 60 {TargetValue: accountName, 61 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, 62 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, 63 {TargetValue: client.SubscriptionID, 64 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 65 {TargetValue: queueName, 66 Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 67 {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { 68 return result, validation.NewError("storage.QueueClient", "Create", err.Error()) 69 } 70 71 req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, queueName, queue) 72 if err != nil { 73 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", nil, "Failure preparing request") 74 return 75 } 76 77 resp, err := client.CreateSender(req) 78 if err != nil { 79 result.Response = autorest.Response{Response: resp} 80 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure sending request") 81 return 82 } 83 84 result, err = client.CreateResponder(resp) 85 if err != nil { 86 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure responding to request") 87 return 88 } 89 90 return 91} 92 93// CreatePreparer prepares the Create request. 94func (client QueueClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { 95 pathParameters := map[string]interface{}{ 96 "accountName": autorest.Encode("path", accountName), 97 "queueName": autorest.Encode("path", queueName), 98 "resourceGroupName": autorest.Encode("path", resourceGroupName), 99 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 100 } 101 102 const APIVersion = "2020-08-01-preview" 103 queryParameters := map[string]interface{}{ 104 "api-version": APIVersion, 105 } 106 107 preparer := autorest.CreatePreparer( 108 autorest.AsContentType("application/json; charset=utf-8"), 109 autorest.AsPut(), 110 autorest.WithBaseURL(client.BaseURI), 111 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), 112 autorest.WithJSON(queue), 113 autorest.WithQueryParameters(queryParameters)) 114 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 115} 116 117// CreateSender sends the Create request. The method will close the 118// http.Response Body if it receives an error. 119func (client QueueClient) CreateSender(req *http.Request) (*http.Response, error) { 120 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 121} 122 123// CreateResponder handles the response to the Create request. The method always 124// closes the http.Response Body. 125func (client QueueClient) CreateResponder(resp *http.Response) (result Queue, err error) { 126 err = autorest.Respond( 127 resp, 128 azure.WithErrorUnlessStatusCode(http.StatusOK), 129 autorest.ByUnmarshallingJSON(&result), 130 autorest.ByClosing()) 131 result.Response = autorest.Response{Response: resp} 132 return 133} 134 135// Delete deletes the queue with the specified queue name, under the specified account if it exists. 136// Parameters: 137// resourceGroupName - the name of the resource group within the user's subscription. The name is case 138// insensitive. 139// accountName - the name of the storage account within the specified resource group. Storage account names 140// must be between 3 and 24 characters in length and use numbers and lower-case letters only. 141// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The 142// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an 143// alphanumeric character and it cannot have two consecutive dash(-) characters. 144func (client QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result autorest.Response, err error) { 145 if tracing.IsEnabled() { 146 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Delete") 147 defer func() { 148 sc := -1 149 if result.Response != nil { 150 sc = result.Response.StatusCode 151 } 152 tracing.EndSpan(ctx, sc, err) 153 }() 154 } 155 if err := validation.Validate([]validation.Validation{ 156 {TargetValue: resourceGroupName, 157 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 158 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 159 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 160 {TargetValue: accountName, 161 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, 162 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, 163 {TargetValue: client.SubscriptionID, 164 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 165 {TargetValue: queueName, 166 Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 167 {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { 168 return result, validation.NewError("storage.QueueClient", "Delete", err.Error()) 169 } 170 171 req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, queueName) 172 if err != nil { 173 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", nil, "Failure preparing request") 174 return 175 } 176 177 resp, err := client.DeleteSender(req) 178 if err != nil { 179 result.Response = resp 180 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure sending request") 181 return 182 } 183 184 result, err = client.DeleteResponder(resp) 185 if err != nil { 186 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure responding to request") 187 return 188 } 189 190 return 191} 192 193// DeletePreparer prepares the Delete request. 194func (client QueueClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { 195 pathParameters := map[string]interface{}{ 196 "accountName": autorest.Encode("path", accountName), 197 "queueName": autorest.Encode("path", queueName), 198 "resourceGroupName": autorest.Encode("path", resourceGroupName), 199 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 200 } 201 202 const APIVersion = "2020-08-01-preview" 203 queryParameters := map[string]interface{}{ 204 "api-version": APIVersion, 205 } 206 207 preparer := autorest.CreatePreparer( 208 autorest.AsDelete(), 209 autorest.WithBaseURL(client.BaseURI), 210 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), 211 autorest.WithQueryParameters(queryParameters)) 212 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 213} 214 215// DeleteSender sends the Delete request. The method will close the 216// http.Response Body if it receives an error. 217func (client QueueClient) DeleteSender(req *http.Request) (*http.Response, error) { 218 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 219} 220 221// DeleteResponder handles the response to the Delete request. The method always 222// closes the http.Response Body. 223func (client QueueClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 224 err = autorest.Respond( 225 resp, 226 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 227 autorest.ByClosing()) 228 result.Response = resp 229 return 230} 231 232// Get gets the queue with the specified queue name, under the specified account if it exists. 233// Parameters: 234// resourceGroupName - the name of the resource group within the user's subscription. The name is case 235// insensitive. 236// accountName - the name of the storage account within the specified resource group. Storage account names 237// must be between 3 and 24 characters in length and use numbers and lower-case letters only. 238// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The 239// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an 240// alphanumeric character and it cannot have two consecutive dash(-) characters. 241func (client QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result Queue, err error) { 242 if tracing.IsEnabled() { 243 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Get") 244 defer func() { 245 sc := -1 246 if result.Response.Response != nil { 247 sc = result.Response.Response.StatusCode 248 } 249 tracing.EndSpan(ctx, sc, err) 250 }() 251 } 252 if err := validation.Validate([]validation.Validation{ 253 {TargetValue: resourceGroupName, 254 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 255 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 256 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 257 {TargetValue: accountName, 258 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, 259 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, 260 {TargetValue: client.SubscriptionID, 261 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 262 {TargetValue: queueName, 263 Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 264 {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { 265 return result, validation.NewError("storage.QueueClient", "Get", err.Error()) 266 } 267 268 req, err := client.GetPreparer(ctx, resourceGroupName, accountName, queueName) 269 if err != nil { 270 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", nil, "Failure preparing request") 271 return 272 } 273 274 resp, err := client.GetSender(req) 275 if err != nil { 276 result.Response = autorest.Response{Response: resp} 277 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure sending request") 278 return 279 } 280 281 result, err = client.GetResponder(resp) 282 if err != nil { 283 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure responding to request") 284 return 285 } 286 287 return 288} 289 290// GetPreparer prepares the Get request. 291func (client QueueClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { 292 pathParameters := map[string]interface{}{ 293 "accountName": autorest.Encode("path", accountName), 294 "queueName": autorest.Encode("path", queueName), 295 "resourceGroupName": autorest.Encode("path", resourceGroupName), 296 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 297 } 298 299 const APIVersion = "2020-08-01-preview" 300 queryParameters := map[string]interface{}{ 301 "api-version": APIVersion, 302 } 303 304 preparer := autorest.CreatePreparer( 305 autorest.AsGet(), 306 autorest.WithBaseURL(client.BaseURI), 307 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), 308 autorest.WithQueryParameters(queryParameters)) 309 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 310} 311 312// GetSender sends the Get request. The method will close the 313// http.Response Body if it receives an error. 314func (client QueueClient) GetSender(req *http.Request) (*http.Response, error) { 315 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 316} 317 318// GetResponder handles the response to the Get request. The method always 319// closes the http.Response Body. 320func (client QueueClient) GetResponder(resp *http.Response) (result Queue, err error) { 321 err = autorest.Respond( 322 resp, 323 azure.WithErrorUnlessStatusCode(http.StatusOK), 324 autorest.ByUnmarshallingJSON(&result), 325 autorest.ByClosing()) 326 result.Response = autorest.Response{Response: resp} 327 return 328} 329 330// List gets a list of all the queues under the specified storage account 331// Parameters: 332// resourceGroupName - the name of the resource group within the user's subscription. The name is case 333// insensitive. 334// accountName - the name of the storage account within the specified resource group. Storage account names 335// must be between 3 and 24 characters in length and use numbers and lower-case letters only. 336// maxpagesize - optional, a maximum number of queues that should be included in a list queue response 337// filter - optional, When specified, only the queues with a name starting with the given filter will be 338// listed. 339func (client QueueClient) List(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourcePage, err error) { 340 if tracing.IsEnabled() { 341 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") 342 defer func() { 343 sc := -1 344 if result.lqr.Response.Response != nil { 345 sc = result.lqr.Response.Response.StatusCode 346 } 347 tracing.EndSpan(ctx, sc, err) 348 }() 349 } 350 if err := validation.Validate([]validation.Validation{ 351 {TargetValue: resourceGroupName, 352 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 353 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 354 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 355 {TargetValue: accountName, 356 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, 357 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, 358 {TargetValue: client.SubscriptionID, 359 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { 360 return result, validation.NewError("storage.QueueClient", "List", err.Error()) 361 } 362 363 result.fn = client.listNextResults 364 req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxpagesize, filter) 365 if err != nil { 366 err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", nil, "Failure preparing request") 367 return 368 } 369 370 resp, err := client.ListSender(req) 371 if err != nil { 372 result.lqr.Response = autorest.Response{Response: resp} 373 err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure sending request") 374 return 375 } 376 377 result.lqr, err = client.ListResponder(resp) 378 if err != nil { 379 err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure responding to request") 380 return 381 } 382 if result.lqr.hasNextLink() && result.lqr.IsEmpty() { 383 err = result.NextWithContext(ctx) 384 return 385 } 386 387 return 388} 389 390// ListPreparer prepares the List request. 391func (client QueueClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (*http.Request, error) { 392 pathParameters := map[string]interface{}{ 393 "accountName": autorest.Encode("path", accountName), 394 "resourceGroupName": autorest.Encode("path", resourceGroupName), 395 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 396 } 397 398 const APIVersion = "2020-08-01-preview" 399 queryParameters := map[string]interface{}{ 400 "api-version": APIVersion, 401 } 402 if len(maxpagesize) > 0 { 403 queryParameters["$maxpagesize"] = autorest.Encode("query", maxpagesize) 404 } 405 if len(filter) > 0 { 406 queryParameters["$filter"] = autorest.Encode("query", filter) 407 } 408 409 preparer := autorest.CreatePreparer( 410 autorest.AsGet(), 411 autorest.WithBaseURL(client.BaseURI), 412 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues", pathParameters), 413 autorest.WithQueryParameters(queryParameters)) 414 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 415} 416 417// ListSender sends the List request. The method will close the 418// http.Response Body if it receives an error. 419func (client QueueClient) ListSender(req *http.Request) (*http.Response, error) { 420 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 421} 422 423// ListResponder handles the response to the List request. The method always 424// closes the http.Response Body. 425func (client QueueClient) ListResponder(resp *http.Response) (result ListQueueResource, err error) { 426 err = autorest.Respond( 427 resp, 428 azure.WithErrorUnlessStatusCode(http.StatusOK), 429 autorest.ByUnmarshallingJSON(&result), 430 autorest.ByClosing()) 431 result.Response = autorest.Response{Response: resp} 432 return 433} 434 435// listNextResults retrieves the next set of results, if any. 436func (client QueueClient) listNextResults(ctx context.Context, lastResults ListQueueResource) (result ListQueueResource, err error) { 437 req, err := lastResults.listQueueResourcePreparer(ctx) 438 if err != nil { 439 return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", nil, "Failure preparing next results request") 440 } 441 if req == nil { 442 return 443 } 444 resp, err := client.ListSender(req) 445 if err != nil { 446 result.Response = autorest.Response{Response: resp} 447 return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure sending next results request") 448 } 449 result, err = client.ListResponder(resp) 450 if err != nil { 451 err = autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure responding to next results request") 452 } 453 return 454} 455 456// ListComplete enumerates all values, automatically crossing page boundaries as required. 457func (client QueueClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourceIterator, err error) { 458 if tracing.IsEnabled() { 459 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") 460 defer func() { 461 sc := -1 462 if result.Response().Response.Response != nil { 463 sc = result.page.Response().Response.Response.StatusCode 464 } 465 tracing.EndSpan(ctx, sc, err) 466 }() 467 } 468 result.page, err = client.List(ctx, resourceGroupName, accountName, maxpagesize, filter) 469 return 470} 471 472// Update creates a new queue with the specified queue name, under the specified account. 473// Parameters: 474// resourceGroupName - the name of the resource group within the user's subscription. The name is case 475// insensitive. 476// accountName - the name of the storage account within the specified resource group. Storage account names 477// must be between 3 and 24 characters in length and use numbers and lower-case letters only. 478// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The 479// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an 480// alphanumeric character and it cannot have two consecutive dash(-) characters. 481// queue - queue properties and metadata to be created with 482func (client QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { 483 if tracing.IsEnabled() { 484 ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Update") 485 defer func() { 486 sc := -1 487 if result.Response.Response != nil { 488 sc = result.Response.Response.StatusCode 489 } 490 tracing.EndSpan(ctx, sc, err) 491 }() 492 } 493 if err := validation.Validate([]validation.Validation{ 494 {TargetValue: resourceGroupName, 495 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 496 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 497 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 498 {TargetValue: accountName, 499 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, 500 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, 501 {TargetValue: client.SubscriptionID, 502 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 503 {TargetValue: queueName, 504 Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 505 {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { 506 return result, validation.NewError("storage.QueueClient", "Update", err.Error()) 507 } 508 509 req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, queueName, queue) 510 if err != nil { 511 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", nil, "Failure preparing request") 512 return 513 } 514 515 resp, err := client.UpdateSender(req) 516 if err != nil { 517 result.Response = autorest.Response{Response: resp} 518 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure sending request") 519 return 520 } 521 522 result, err = client.UpdateResponder(resp) 523 if err != nil { 524 err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure responding to request") 525 return 526 } 527 528 return 529} 530 531// UpdatePreparer prepares the Update request. 532func (client QueueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { 533 pathParameters := map[string]interface{}{ 534 "accountName": autorest.Encode("path", accountName), 535 "queueName": autorest.Encode("path", queueName), 536 "resourceGroupName": autorest.Encode("path", resourceGroupName), 537 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 538 } 539 540 const APIVersion = "2020-08-01-preview" 541 queryParameters := map[string]interface{}{ 542 "api-version": APIVersion, 543 } 544 545 preparer := autorest.CreatePreparer( 546 autorest.AsContentType("application/json; charset=utf-8"), 547 autorest.AsPatch(), 548 autorest.WithBaseURL(client.BaseURI), 549 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), 550 autorest.WithJSON(queue), 551 autorest.WithQueryParameters(queryParameters)) 552 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 553} 554 555// UpdateSender sends the Update request. The method will close the 556// http.Response Body if it receives an error. 557func (client QueueClient) UpdateSender(req *http.Request) (*http.Response, error) { 558 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 559} 560 561// UpdateResponder handles the response to the Update request. The method always 562// closes the http.Response Body. 563func (client QueueClient) UpdateResponder(resp *http.Response) (result Queue, err error) { 564 err = autorest.Respond( 565 resp, 566 azure.WithErrorUnlessStatusCode(http.StatusOK), 567 autorest.ByUnmarshallingJSON(&result), 568 autorest.ByClosing()) 569 result.Response = autorest.Response{Response: resp} 570 return 571} 572