1package account 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/tracing" 25 "net/http" 26) 27 28// Client is the dataLake Store Client 29type Client struct { 30 BaseClient 31} 32 33// NewClient creates an instance of the Client client. 34func NewClient(subscriptionID string) Client { 35 return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) 36} 37 38// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting 39// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 40func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { 41 return Client{NewWithBaseURI(baseURI, subscriptionID)} 42} 43 44// Create creates the specified Data Lake Store account. 45// Parameters: 46// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 47// name - the name of the Data Lake Store account to create. 48// parameters - parameters supplied to create the Data Lake Store account. 49func (client Client) Create(ctx context.Context, resourceGroupName string, name string, parameters DataLakeStoreAccount) (result CreateFuture, err error) { 50 if tracing.IsEnabled() { 51 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create") 52 defer func() { 53 sc := -1 54 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 55 sc = result.FutureAPI.Response().StatusCode 56 } 57 tracing.EndSpan(ctx, sc, err) 58 }() 59 } 60 req, err := client.CreatePreparer(ctx, resourceGroupName, name, parameters) 61 if err != nil { 62 err = autorest.NewErrorWithError(err, "account.Client", "Create", nil, "Failure preparing request") 63 return 64 } 65 66 result, err = client.CreateSender(req) 67 if err != nil { 68 err = autorest.NewErrorWithError(err, "account.Client", "Create", nil, "Failure sending request") 69 return 70 } 71 72 return 73} 74 75// CreatePreparer prepares the Create request. 76func (client Client) CreatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DataLakeStoreAccount) (*http.Request, error) { 77 pathParameters := map[string]interface{}{ 78 "name": autorest.Encode("path", name), 79 "resourceGroupName": autorest.Encode("path", resourceGroupName), 80 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 81 } 82 83 const APIVersion = "2015-10-01-preview" 84 queryParameters := map[string]interface{}{ 85 "api-version": APIVersion, 86 } 87 88 parameters.Type = nil 89 parameters.ID = nil 90 preparer := autorest.CreatePreparer( 91 autorest.AsContentType("application/json; charset=utf-8"), 92 autorest.AsPut(), 93 autorest.WithBaseURL(client.BaseURI), 94 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), 95 autorest.WithJSON(parameters), 96 autorest.WithQueryParameters(queryParameters)) 97 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 98} 99 100// CreateSender sends the Create request. The method will close the 101// http.Response Body if it receives an error. 102func (client Client) CreateSender(req *http.Request) (future CreateFuture, err error) { 103 var resp *http.Response 104 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 105 if err != nil { 106 return 107 } 108 var azf azure.Future 109 azf, err = azure.NewFutureFromResponse(resp) 110 future.FutureAPI = &azf 111 future.Result = func(client Client) (dlsa DataLakeStoreAccount, err error) { 112 var done bool 113 done, err = future.DoneWithContext(context.Background(), client) 114 if err != nil { 115 err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", future.Response(), "Polling failure") 116 return 117 } 118 if !done { 119 err = azure.NewAsyncOpIncompleteError("account.CreateFuture") 120 return 121 } 122 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 123 dlsa.Response.Response, err = future.GetResult(sender) 124 if dlsa.Response.Response == nil && err == nil { 125 err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", nil, "received nil response and error") 126 } 127 if err == nil && dlsa.Response.Response.StatusCode != http.StatusNoContent { 128 dlsa, err = client.CreateResponder(dlsa.Response.Response) 129 if err != nil { 130 err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", dlsa.Response.Response, "Failure responding to request") 131 } 132 } 133 return 134 } 135 return 136} 137 138// CreateResponder handles the response to the Create request. The method always 139// closes the http.Response Body. 140func (client Client) CreateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { 141 err = autorest.Respond( 142 resp, 143 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 144 autorest.ByUnmarshallingJSON(&result), 145 autorest.ByClosing()) 146 result.Response = autorest.Response{Response: resp} 147 return 148} 149 150// CreateOrUpdateFirewallRule creates or updates the specified firewall rule. 151// Parameters: 152// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 153// accountName - the name of the Data Lake Store account to which to add the firewall rule. 154// name - the name of the firewall rule to create or update. 155// parameters - parameters supplied to create the create firewall rule. 156func (client Client) CreateOrUpdateFirewallRule(ctx context.Context, resourceGroupName string, accountName string, name string, parameters FirewallRule) (result FirewallRule, err error) { 157 if tracing.IsEnabled() { 158 ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdateFirewallRule") 159 defer func() { 160 sc := -1 161 if result.Response.Response != nil { 162 sc = result.Response.Response.StatusCode 163 } 164 tracing.EndSpan(ctx, sc, err) 165 }() 166 } 167 req, err := client.CreateOrUpdateFirewallRulePreparer(ctx, resourceGroupName, accountName, name, parameters) 168 if err != nil { 169 err = autorest.NewErrorWithError(err, "account.Client", "CreateOrUpdateFirewallRule", nil, "Failure preparing request") 170 return 171 } 172 173 resp, err := client.CreateOrUpdateFirewallRuleSender(req) 174 if err != nil { 175 result.Response = autorest.Response{Response: resp} 176 err = autorest.NewErrorWithError(err, "account.Client", "CreateOrUpdateFirewallRule", resp, "Failure sending request") 177 return 178 } 179 180 result, err = client.CreateOrUpdateFirewallRuleResponder(resp) 181 if err != nil { 182 err = autorest.NewErrorWithError(err, "account.Client", "CreateOrUpdateFirewallRule", resp, "Failure responding to request") 183 return 184 } 185 186 return 187} 188 189// CreateOrUpdateFirewallRulePreparer prepares the CreateOrUpdateFirewallRule request. 190func (client Client) CreateOrUpdateFirewallRulePreparer(ctx context.Context, resourceGroupName string, accountName string, name string, parameters FirewallRule) (*http.Request, error) { 191 pathParameters := map[string]interface{}{ 192 "accountName": autorest.Encode("path", accountName), 193 "name": autorest.Encode("path", name), 194 "resourceGroupName": autorest.Encode("path", resourceGroupName), 195 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 196 } 197 198 const APIVersion = "2015-10-01-preview" 199 queryParameters := map[string]interface{}{ 200 "api-version": APIVersion, 201 } 202 203 parameters.Type = nil 204 preparer := autorest.CreatePreparer( 205 autorest.AsContentType("application/json; charset=utf-8"), 206 autorest.AsPut(), 207 autorest.WithBaseURL(client.BaseURI), 208 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{name}", pathParameters), 209 autorest.WithJSON(parameters), 210 autorest.WithQueryParameters(queryParameters)) 211 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 212} 213 214// CreateOrUpdateFirewallRuleSender sends the CreateOrUpdateFirewallRule request. The method will close the 215// http.Response Body if it receives an error. 216func (client Client) CreateOrUpdateFirewallRuleSender(req *http.Request) (*http.Response, error) { 217 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 218} 219 220// CreateOrUpdateFirewallRuleResponder handles the response to the CreateOrUpdateFirewallRule request. The method always 221// closes the http.Response Body. 222func (client Client) CreateOrUpdateFirewallRuleResponder(resp *http.Response) (result FirewallRule, err error) { 223 err = autorest.Respond( 224 resp, 225 azure.WithErrorUnlessStatusCode(http.StatusOK), 226 autorest.ByUnmarshallingJSON(&result), 227 autorest.ByClosing()) 228 result.Response = autorest.Response{Response: resp} 229 return 230} 231 232// Delete deletes the specified Data Lake Store account. 233// Parameters: 234// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 235// accountName - the name of the Data Lake Store account to delete. 236func (client Client) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DeleteFuture, err error) { 237 if tracing.IsEnabled() { 238 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") 239 defer func() { 240 sc := -1 241 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 242 sc = result.FutureAPI.Response().StatusCode 243 } 244 tracing.EndSpan(ctx, sc, err) 245 }() 246 } 247 req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) 248 if err != nil { 249 err = autorest.NewErrorWithError(err, "account.Client", "Delete", nil, "Failure preparing request") 250 return 251 } 252 253 result, err = client.DeleteSender(req) 254 if err != nil { 255 err = autorest.NewErrorWithError(err, "account.Client", "Delete", nil, "Failure sending request") 256 return 257 } 258 259 return 260} 261 262// DeletePreparer prepares the Delete request. 263func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { 264 pathParameters := map[string]interface{}{ 265 "accountName": autorest.Encode("path", accountName), 266 "resourceGroupName": autorest.Encode("path", resourceGroupName), 267 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 268 } 269 270 const APIVersion = "2015-10-01-preview" 271 queryParameters := map[string]interface{}{ 272 "api-version": APIVersion, 273 } 274 275 preparer := autorest.CreatePreparer( 276 autorest.AsDelete(), 277 autorest.WithBaseURL(client.BaseURI), 278 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", pathParameters), 279 autorest.WithQueryParameters(queryParameters)) 280 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 281} 282 283// DeleteSender sends the Delete request. The method will close the 284// http.Response Body if it receives an error. 285func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { 286 var resp *http.Response 287 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 288 if err != nil { 289 return 290 } 291 var azf azure.Future 292 azf, err = azure.NewFutureFromResponse(resp) 293 future.FutureAPI = &azf 294 future.Result = func(client Client) (ar autorest.Response, err error) { 295 var done bool 296 done, err = future.DoneWithContext(context.Background(), client) 297 if err != nil { 298 err = autorest.NewErrorWithError(err, "account.DeleteFuture", "Result", future.Response(), "Polling failure") 299 return 300 } 301 if !done { 302 err = azure.NewAsyncOpIncompleteError("account.DeleteFuture") 303 return 304 } 305 ar.Response = future.Response() 306 return 307 } 308 return 309} 310 311// DeleteResponder handles the response to the Delete request. The method always 312// closes the http.Response Body. 313func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 314 err = autorest.Respond( 315 resp, 316 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), 317 autorest.ByClosing()) 318 result.Response = resp 319 return 320} 321 322// DeleteFirewallRule deletes the specified firewall rule from the specified Data Lake Store account 323// Parameters: 324// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 325// accountName - the name of the Data Lake Store account from which to delete the firewall rule. 326// firewallRuleName - the name of the firewall rule to delete. 327func (client Client) DeleteFirewallRule(ctx context.Context, resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { 328 if tracing.IsEnabled() { 329 ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteFirewallRule") 330 defer func() { 331 sc := -1 332 if result.Response != nil { 333 sc = result.Response.StatusCode 334 } 335 tracing.EndSpan(ctx, sc, err) 336 }() 337 } 338 req, err := client.DeleteFirewallRulePreparer(ctx, resourceGroupName, accountName, firewallRuleName) 339 if err != nil { 340 err = autorest.NewErrorWithError(err, "account.Client", "DeleteFirewallRule", nil, "Failure preparing request") 341 return 342 } 343 344 resp, err := client.DeleteFirewallRuleSender(req) 345 if err != nil { 346 result.Response = resp 347 err = autorest.NewErrorWithError(err, "account.Client", "DeleteFirewallRule", resp, "Failure sending request") 348 return 349 } 350 351 result, err = client.DeleteFirewallRuleResponder(resp) 352 if err != nil { 353 err = autorest.NewErrorWithError(err, "account.Client", "DeleteFirewallRule", resp, "Failure responding to request") 354 return 355 } 356 357 return 358} 359 360// DeleteFirewallRulePreparer prepares the DeleteFirewallRule request. 361func (client Client) DeleteFirewallRulePreparer(ctx context.Context, resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { 362 pathParameters := map[string]interface{}{ 363 "accountName": autorest.Encode("path", accountName), 364 "firewallRuleName": autorest.Encode("path", firewallRuleName), 365 "resourceGroupName": autorest.Encode("path", resourceGroupName), 366 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 367 } 368 369 const APIVersion = "2015-10-01-preview" 370 queryParameters := map[string]interface{}{ 371 "api-version": APIVersion, 372 } 373 374 preparer := autorest.CreatePreparer( 375 autorest.AsDelete(), 376 autorest.WithBaseURL(client.BaseURI), 377 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), 378 autorest.WithQueryParameters(queryParameters)) 379 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 380} 381 382// DeleteFirewallRuleSender sends the DeleteFirewallRule request. The method will close the 383// http.Response Body if it receives an error. 384func (client Client) DeleteFirewallRuleSender(req *http.Request) (*http.Response, error) { 385 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 386} 387 388// DeleteFirewallRuleResponder handles the response to the DeleteFirewallRule request. The method always 389// closes the http.Response Body. 390func (client Client) DeleteFirewallRuleResponder(resp *http.Response) (result autorest.Response, err error) { 391 err = autorest.Respond( 392 resp, 393 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 394 autorest.ByClosing()) 395 result.Response = resp 396 return 397} 398 399// EnableKeyVault attempts to enable a user managed key vault for encryption of the specified Data Lake Store account. 400// Parameters: 401// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 402// accountName - the name of the Data Lake Store account to attempt to enable the Key Vault for. 403func (client Client) EnableKeyVault(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { 404 if tracing.IsEnabled() { 405 ctx = tracing.StartSpan(ctx, fqdn+"/Client.EnableKeyVault") 406 defer func() { 407 sc := -1 408 if result.Response != nil { 409 sc = result.Response.StatusCode 410 } 411 tracing.EndSpan(ctx, sc, err) 412 }() 413 } 414 req, err := client.EnableKeyVaultPreparer(ctx, resourceGroupName, accountName) 415 if err != nil { 416 err = autorest.NewErrorWithError(err, "account.Client", "EnableKeyVault", nil, "Failure preparing request") 417 return 418 } 419 420 resp, err := client.EnableKeyVaultSender(req) 421 if err != nil { 422 result.Response = resp 423 err = autorest.NewErrorWithError(err, "account.Client", "EnableKeyVault", resp, "Failure sending request") 424 return 425 } 426 427 result, err = client.EnableKeyVaultResponder(resp) 428 if err != nil { 429 err = autorest.NewErrorWithError(err, "account.Client", "EnableKeyVault", resp, "Failure responding to request") 430 return 431 } 432 433 return 434} 435 436// EnableKeyVaultPreparer prepares the EnableKeyVault request. 437func (client Client) EnableKeyVaultPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { 438 pathParameters := map[string]interface{}{ 439 "accountName": autorest.Encode("path", accountName), 440 "resourceGroupName": autorest.Encode("path", resourceGroupName), 441 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 442 } 443 444 const APIVersion = "2015-10-01-preview" 445 queryParameters := map[string]interface{}{ 446 "api-version": APIVersion, 447 } 448 449 preparer := autorest.CreatePreparer( 450 autorest.AsPost(), 451 autorest.WithBaseURL(client.BaseURI), 452 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault", pathParameters), 453 autorest.WithQueryParameters(queryParameters)) 454 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 455} 456 457// EnableKeyVaultSender sends the EnableKeyVault request. The method will close the 458// http.Response Body if it receives an error. 459func (client Client) EnableKeyVaultSender(req *http.Request) (*http.Response, error) { 460 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 461} 462 463// EnableKeyVaultResponder handles the response to the EnableKeyVault request. The method always 464// closes the http.Response Body. 465func (client Client) EnableKeyVaultResponder(resp *http.Response) (result autorest.Response, err error) { 466 err = autorest.Respond( 467 resp, 468 azure.WithErrorUnlessStatusCode(http.StatusOK), 469 autorest.ByClosing()) 470 result.Response = resp 471 return 472} 473 474// Get gets the specified Data Lake Store account. 475// Parameters: 476// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 477// accountName - the name of the Data Lake Store account to retrieve. 478func (client Client) Get(ctx context.Context, resourceGroupName string, accountName string) (result DataLakeStoreAccount, err error) { 479 if tracing.IsEnabled() { 480 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") 481 defer func() { 482 sc := -1 483 if result.Response.Response != nil { 484 sc = result.Response.Response.StatusCode 485 } 486 tracing.EndSpan(ctx, sc, err) 487 }() 488 } 489 req, err := client.GetPreparer(ctx, resourceGroupName, accountName) 490 if err != nil { 491 err = autorest.NewErrorWithError(err, "account.Client", "Get", nil, "Failure preparing request") 492 return 493 } 494 495 resp, err := client.GetSender(req) 496 if err != nil { 497 result.Response = autorest.Response{Response: resp} 498 err = autorest.NewErrorWithError(err, "account.Client", "Get", resp, "Failure sending request") 499 return 500 } 501 502 result, err = client.GetResponder(resp) 503 if err != nil { 504 err = autorest.NewErrorWithError(err, "account.Client", "Get", resp, "Failure responding to request") 505 return 506 } 507 508 return 509} 510 511// GetPreparer prepares the Get request. 512func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { 513 pathParameters := map[string]interface{}{ 514 "accountName": autorest.Encode("path", accountName), 515 "resourceGroupName": autorest.Encode("path", resourceGroupName), 516 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 517 } 518 519 const APIVersion = "2015-10-01-preview" 520 queryParameters := map[string]interface{}{ 521 "api-version": APIVersion, 522 } 523 524 preparer := autorest.CreatePreparer( 525 autorest.AsGet(), 526 autorest.WithBaseURL(client.BaseURI), 527 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", pathParameters), 528 autorest.WithQueryParameters(queryParameters)) 529 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 530} 531 532// GetSender sends the Get request. The method will close the 533// http.Response Body if it receives an error. 534func (client Client) GetSender(req *http.Request) (*http.Response, error) { 535 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 536} 537 538// GetResponder handles the response to the Get request. The method always 539// closes the http.Response Body. 540func (client Client) GetResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { 541 err = autorest.Respond( 542 resp, 543 azure.WithErrorUnlessStatusCode(http.StatusOK), 544 autorest.ByUnmarshallingJSON(&result), 545 autorest.ByClosing()) 546 result.Response = autorest.Response{Response: resp} 547 return 548} 549 550// GetFirewallRule gets the specified Data Lake Store firewall rule. 551// Parameters: 552// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 553// accountName - the name of the Data Lake Store account from which to get the firewall rule. 554// firewallRuleName - the name of the firewall rule to retrieve. 555func (client Client) GetFirewallRule(ctx context.Context, resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { 556 if tracing.IsEnabled() { 557 ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetFirewallRule") 558 defer func() { 559 sc := -1 560 if result.Response.Response != nil { 561 sc = result.Response.Response.StatusCode 562 } 563 tracing.EndSpan(ctx, sc, err) 564 }() 565 } 566 req, err := client.GetFirewallRulePreparer(ctx, resourceGroupName, accountName, firewallRuleName) 567 if err != nil { 568 err = autorest.NewErrorWithError(err, "account.Client", "GetFirewallRule", nil, "Failure preparing request") 569 return 570 } 571 572 resp, err := client.GetFirewallRuleSender(req) 573 if err != nil { 574 result.Response = autorest.Response{Response: resp} 575 err = autorest.NewErrorWithError(err, "account.Client", "GetFirewallRule", resp, "Failure sending request") 576 return 577 } 578 579 result, err = client.GetFirewallRuleResponder(resp) 580 if err != nil { 581 err = autorest.NewErrorWithError(err, "account.Client", "GetFirewallRule", resp, "Failure responding to request") 582 return 583 } 584 585 return 586} 587 588// GetFirewallRulePreparer prepares the GetFirewallRule request. 589func (client Client) GetFirewallRulePreparer(ctx context.Context, resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { 590 pathParameters := map[string]interface{}{ 591 "accountName": autorest.Encode("path", accountName), 592 "firewallRuleName": autorest.Encode("path", firewallRuleName), 593 "resourceGroupName": autorest.Encode("path", resourceGroupName), 594 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 595 } 596 597 const APIVersion = "2015-10-01-preview" 598 queryParameters := map[string]interface{}{ 599 "api-version": APIVersion, 600 } 601 602 preparer := autorest.CreatePreparer( 603 autorest.AsGet(), 604 autorest.WithBaseURL(client.BaseURI), 605 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), 606 autorest.WithQueryParameters(queryParameters)) 607 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 608} 609 610// GetFirewallRuleSender sends the GetFirewallRule request. The method will close the 611// http.Response Body if it receives an error. 612func (client Client) GetFirewallRuleSender(req *http.Request) (*http.Response, error) { 613 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 614} 615 616// GetFirewallRuleResponder handles the response to the GetFirewallRule request. The method always 617// closes the http.Response Body. 618func (client Client) GetFirewallRuleResponder(resp *http.Response) (result FirewallRule, err error) { 619 err = autorest.Respond( 620 resp, 621 azure.WithErrorUnlessStatusCode(http.StatusOK), 622 autorest.ByUnmarshallingJSON(&result), 623 autorest.ByClosing()) 624 result.Response = autorest.Response{Response: resp} 625 return 626} 627 628// List lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of 629// results, if any. 630// Parameters: 631// filter - oData filter. Optional. 632// top - the number of items to return. Optional. 633// skip - the number of items to skip over before returning elements. Optional. 634// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g. 635// Categories/$expand=Products would expand Product data in line with each Category entry. Optional. 636// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g. 637// Categories?$select=CategoryName,Description. Optional. 638// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or 639// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. 640// Optional. 641// count - the Boolean value of true or false to request a count of the matching resources included with the 642// resources in the response, e.g. Categories?$count=true. Optional. 643// search - a free form search. A free-text search expression to match for whether a particular entry should be 644// included in the feed, e.g. Categories?$search=blue OR green. Optional. 645// formatParameter - the desired return format. Return the response in particular format without access to 646// request headers for standard content-type negotiation (e.g Orders?$format=json). Optional. 647func (client Client) List(ctx context.Context, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result DataLakeStoreAccountListResultPage, err error) { 648 if tracing.IsEnabled() { 649 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") 650 defer func() { 651 sc := -1 652 if result.dlsalr.Response.Response != nil { 653 sc = result.dlsalr.Response.Response.StatusCode 654 } 655 tracing.EndSpan(ctx, sc, err) 656 }() 657 } 658 result.fn = client.listNextResults 659 req, err := client.ListPreparer(ctx, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 660 if err != nil { 661 err = autorest.NewErrorWithError(err, "account.Client", "List", nil, "Failure preparing request") 662 return 663 } 664 665 resp, err := client.ListSender(req) 666 if err != nil { 667 result.dlsalr.Response = autorest.Response{Response: resp} 668 err = autorest.NewErrorWithError(err, "account.Client", "List", resp, "Failure sending request") 669 return 670 } 671 672 result.dlsalr, err = client.ListResponder(resp) 673 if err != nil { 674 err = autorest.NewErrorWithError(err, "account.Client", "List", resp, "Failure responding to request") 675 return 676 } 677 if result.dlsalr.hasNextLink() && result.dlsalr.IsEmpty() { 678 err = result.NextWithContext(ctx) 679 return 680 } 681 682 return 683} 684 685// ListPreparer prepares the List request. 686func (client Client) ListPreparer(ctx context.Context, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (*http.Request, error) { 687 pathParameters := map[string]interface{}{ 688 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 689 } 690 691 const APIVersion = "2015-10-01-preview" 692 queryParameters := map[string]interface{}{ 693 "api-version": APIVersion, 694 } 695 if len(filter) > 0 { 696 queryParameters["$filter"] = autorest.Encode("query", filter) 697 } 698 if top != nil { 699 queryParameters["$top"] = autorest.Encode("query", *top) 700 } 701 if skip != nil { 702 queryParameters["$skip"] = autorest.Encode("query", *skip) 703 } 704 if len(expand) > 0 { 705 queryParameters["$expand"] = autorest.Encode("query", expand) 706 } 707 if len(selectParameter) > 0 { 708 queryParameters["$select"] = autorest.Encode("query", selectParameter) 709 } 710 if len(orderby) > 0 { 711 queryParameters["$orderby"] = autorest.Encode("query", orderby) 712 } 713 if count != nil { 714 queryParameters["$count"] = autorest.Encode("query", *count) 715 } 716 if len(search) > 0 { 717 queryParameters["$search"] = autorest.Encode("query", search) 718 } 719 if len(formatParameter) > 0 { 720 queryParameters["$format"] = autorest.Encode("query", formatParameter) 721 } 722 723 preparer := autorest.CreatePreparer( 724 autorest.AsGet(), 725 autorest.WithBaseURL(client.BaseURI), 726 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts", pathParameters), 727 autorest.WithQueryParameters(queryParameters)) 728 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 729} 730 731// ListSender sends the List request. The method will close the 732// http.Response Body if it receives an error. 733func (client Client) ListSender(req *http.Request) (*http.Response, error) { 734 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 735} 736 737// ListResponder handles the response to the List request. The method always 738// closes the http.Response Body. 739func (client Client) ListResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { 740 err = autorest.Respond( 741 resp, 742 azure.WithErrorUnlessStatusCode(http.StatusOK), 743 autorest.ByUnmarshallingJSON(&result), 744 autorest.ByClosing()) 745 result.Response = autorest.Response{Response: resp} 746 return 747} 748 749// listNextResults retrieves the next set of results, if any. 750func (client Client) listNextResults(ctx context.Context, lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { 751 req, err := lastResults.dataLakeStoreAccountListResultPreparer(ctx) 752 if err != nil { 753 return result, autorest.NewErrorWithError(err, "account.Client", "listNextResults", nil, "Failure preparing next results request") 754 } 755 if req == nil { 756 return 757 } 758 resp, err := client.ListSender(req) 759 if err != nil { 760 result.Response = autorest.Response{Response: resp} 761 return result, autorest.NewErrorWithError(err, "account.Client", "listNextResults", resp, "Failure sending next results request") 762 } 763 result, err = client.ListResponder(resp) 764 if err != nil { 765 err = autorest.NewErrorWithError(err, "account.Client", "listNextResults", resp, "Failure responding to next results request") 766 } 767 return 768} 769 770// ListComplete enumerates all values, automatically crossing page boundaries as required. 771func (client Client) ListComplete(ctx context.Context, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result DataLakeStoreAccountListResultIterator, err error) { 772 if tracing.IsEnabled() { 773 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") 774 defer func() { 775 sc := -1 776 if result.Response().Response.Response != nil { 777 sc = result.page.Response().Response.Response.StatusCode 778 } 779 tracing.EndSpan(ctx, sc, err) 780 }() 781 } 782 result.page, err = client.List(ctx, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 783 return 784} 785 786// ListByResourceGroup lists the Data Lake Store accounts within a specific resource group. The response includes a 787// link to the next page of results, if any. 788// Parameters: 789// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account(s). 790// filter - oData filter. Optional. 791// top - the number of items to return. Optional. 792// skip - the number of items to skip over before returning elements. Optional. 793// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g. 794// Categories/$expand=Products would expand Product data in line with each Category entry. Optional. 795// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g. 796// Categories?$select=CategoryName,Description. Optional. 797// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or 798// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. 799// Optional. 800// count - a Boolean value of true or false to request a count of the matching resources included with the 801// resources in the response, e.g. Categories?$count=true. Optional. 802// search - a free form search. A free-text search expression to match for whether a particular entry should be 803// included in the feed, e.g. Categories?$search=blue OR green. Optional. 804// formatParameter - the desired return format. Return the response in particular format without access to 805// request headers for standard content-type negotiation (e.g Orders?$format=json). Optional. 806func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result DataLakeStoreAccountListResultPage, err error) { 807 if tracing.IsEnabled() { 808 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") 809 defer func() { 810 sc := -1 811 if result.dlsalr.Response.Response != nil { 812 sc = result.dlsalr.Response.Response.StatusCode 813 } 814 tracing.EndSpan(ctx, sc, err) 815 }() 816 } 817 result.fn = client.listByResourceGroupNextResults 818 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 819 if err != nil { 820 err = autorest.NewErrorWithError(err, "account.Client", "ListByResourceGroup", nil, "Failure preparing request") 821 return 822 } 823 824 resp, err := client.ListByResourceGroupSender(req) 825 if err != nil { 826 result.dlsalr.Response = autorest.Response{Response: resp} 827 err = autorest.NewErrorWithError(err, "account.Client", "ListByResourceGroup", resp, "Failure sending request") 828 return 829 } 830 831 result.dlsalr, err = client.ListByResourceGroupResponder(resp) 832 if err != nil { 833 err = autorest.NewErrorWithError(err, "account.Client", "ListByResourceGroup", resp, "Failure responding to request") 834 return 835 } 836 if result.dlsalr.hasNextLink() && result.dlsalr.IsEmpty() { 837 err = result.NextWithContext(ctx) 838 return 839 } 840 841 return 842} 843 844// ListByResourceGroupPreparer prepares the ListByResourceGroup request. 845func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (*http.Request, error) { 846 pathParameters := map[string]interface{}{ 847 "resourceGroupName": autorest.Encode("path", resourceGroupName), 848 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 849 } 850 851 const APIVersion = "2015-10-01-preview" 852 queryParameters := map[string]interface{}{ 853 "api-version": APIVersion, 854 } 855 if len(filter) > 0 { 856 queryParameters["$filter"] = autorest.Encode("query", filter) 857 } 858 if top != nil { 859 queryParameters["$top"] = autorest.Encode("query", *top) 860 } 861 if skip != nil { 862 queryParameters["$skip"] = autorest.Encode("query", *skip) 863 } 864 if len(expand) > 0 { 865 queryParameters["$expand"] = autorest.Encode("query", expand) 866 } 867 if len(selectParameter) > 0 { 868 queryParameters["$select"] = autorest.Encode("query", selectParameter) 869 } 870 if len(orderby) > 0 { 871 queryParameters["$orderby"] = autorest.Encode("query", orderby) 872 } 873 if count != nil { 874 queryParameters["$count"] = autorest.Encode("query", *count) 875 } 876 if len(search) > 0 { 877 queryParameters["$search"] = autorest.Encode("query", search) 878 } 879 if len(formatParameter) > 0 { 880 queryParameters["$format"] = autorest.Encode("query", formatParameter) 881 } 882 883 preparer := autorest.CreatePreparer( 884 autorest.AsGet(), 885 autorest.WithBaseURL(client.BaseURI), 886 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts", pathParameters), 887 autorest.WithQueryParameters(queryParameters)) 888 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 889} 890 891// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the 892// http.Response Body if it receives an error. 893func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { 894 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 895} 896 897// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always 898// closes the http.Response Body. 899func (client Client) ListByResourceGroupResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { 900 err = autorest.Respond( 901 resp, 902 azure.WithErrorUnlessStatusCode(http.StatusOK), 903 autorest.ByUnmarshallingJSON(&result), 904 autorest.ByClosing()) 905 result.Response = autorest.Response{Response: resp} 906 return 907} 908 909// listByResourceGroupNextResults retrieves the next set of results, if any. 910func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { 911 req, err := lastResults.dataLakeStoreAccountListResultPreparer(ctx) 912 if err != nil { 913 return result, autorest.NewErrorWithError(err, "account.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") 914 } 915 if req == nil { 916 return 917 } 918 resp, err := client.ListByResourceGroupSender(req) 919 if err != nil { 920 result.Response = autorest.Response{Response: resp} 921 return result, autorest.NewErrorWithError(err, "account.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") 922 } 923 result, err = client.ListByResourceGroupResponder(resp) 924 if err != nil { 925 err = autorest.NewErrorWithError(err, "account.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") 926 } 927 return 928} 929 930// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 931func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result DataLakeStoreAccountListResultIterator, err error) { 932 if tracing.IsEnabled() { 933 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") 934 defer func() { 935 sc := -1 936 if result.Response().Response.Response != nil { 937 sc = result.page.Response().Response.Response.StatusCode 938 } 939 tracing.EndSpan(ctx, sc, err) 940 }() 941 } 942 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 943 return 944} 945 946// ListFirewallRules lists the Data Lake Store firewall rules within the specified Data Lake Store account. 947// Parameters: 948// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 949// accountName - the name of the Data Lake Store account from which to get the firewall rules. 950func (client Client) ListFirewallRules(ctx context.Context, resourceGroupName string, accountName string) (result DataLakeStoreFirewallRuleListResultPage, err error) { 951 if tracing.IsEnabled() { 952 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListFirewallRules") 953 defer func() { 954 sc := -1 955 if result.dlsfrlr.Response.Response != nil { 956 sc = result.dlsfrlr.Response.Response.StatusCode 957 } 958 tracing.EndSpan(ctx, sc, err) 959 }() 960 } 961 result.fn = client.listFirewallRulesNextResults 962 req, err := client.ListFirewallRulesPreparer(ctx, resourceGroupName, accountName) 963 if err != nil { 964 err = autorest.NewErrorWithError(err, "account.Client", "ListFirewallRules", nil, "Failure preparing request") 965 return 966 } 967 968 resp, err := client.ListFirewallRulesSender(req) 969 if err != nil { 970 result.dlsfrlr.Response = autorest.Response{Response: resp} 971 err = autorest.NewErrorWithError(err, "account.Client", "ListFirewallRules", resp, "Failure sending request") 972 return 973 } 974 975 result.dlsfrlr, err = client.ListFirewallRulesResponder(resp) 976 if err != nil { 977 err = autorest.NewErrorWithError(err, "account.Client", "ListFirewallRules", resp, "Failure responding to request") 978 return 979 } 980 if result.dlsfrlr.hasNextLink() && result.dlsfrlr.IsEmpty() { 981 err = result.NextWithContext(ctx) 982 return 983 } 984 985 return 986} 987 988// ListFirewallRulesPreparer prepares the ListFirewallRules request. 989func (client Client) ListFirewallRulesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { 990 pathParameters := map[string]interface{}{ 991 "accountName": autorest.Encode("path", accountName), 992 "resourceGroupName": autorest.Encode("path", resourceGroupName), 993 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 994 } 995 996 const APIVersion = "2015-10-01-preview" 997 queryParameters := map[string]interface{}{ 998 "api-version": APIVersion, 999 } 1000 1001 preparer := autorest.CreatePreparer( 1002 autorest.AsGet(), 1003 autorest.WithBaseURL(client.BaseURI), 1004 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules", pathParameters), 1005 autorest.WithQueryParameters(queryParameters)) 1006 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1007} 1008 1009// ListFirewallRulesSender sends the ListFirewallRules request. The method will close the 1010// http.Response Body if it receives an error. 1011func (client Client) ListFirewallRulesSender(req *http.Request) (*http.Response, error) { 1012 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1013} 1014 1015// ListFirewallRulesResponder handles the response to the ListFirewallRules request. The method always 1016// closes the http.Response Body. 1017func (client Client) ListFirewallRulesResponder(resp *http.Response) (result DataLakeStoreFirewallRuleListResult, err error) { 1018 err = autorest.Respond( 1019 resp, 1020 azure.WithErrorUnlessStatusCode(http.StatusOK), 1021 autorest.ByUnmarshallingJSON(&result), 1022 autorest.ByClosing()) 1023 result.Response = autorest.Response{Response: resp} 1024 return 1025} 1026 1027// listFirewallRulesNextResults retrieves the next set of results, if any. 1028func (client Client) listFirewallRulesNextResults(ctx context.Context, lastResults DataLakeStoreFirewallRuleListResult) (result DataLakeStoreFirewallRuleListResult, err error) { 1029 req, err := lastResults.dataLakeStoreFirewallRuleListResultPreparer(ctx) 1030 if err != nil { 1031 return result, autorest.NewErrorWithError(err, "account.Client", "listFirewallRulesNextResults", nil, "Failure preparing next results request") 1032 } 1033 if req == nil { 1034 return 1035 } 1036 resp, err := client.ListFirewallRulesSender(req) 1037 if err != nil { 1038 result.Response = autorest.Response{Response: resp} 1039 return result, autorest.NewErrorWithError(err, "account.Client", "listFirewallRulesNextResults", resp, "Failure sending next results request") 1040 } 1041 result, err = client.ListFirewallRulesResponder(resp) 1042 if err != nil { 1043 err = autorest.NewErrorWithError(err, "account.Client", "listFirewallRulesNextResults", resp, "Failure responding to next results request") 1044 } 1045 return 1046} 1047 1048// ListFirewallRulesComplete enumerates all values, automatically crossing page boundaries as required. 1049func (client Client) ListFirewallRulesComplete(ctx context.Context, resourceGroupName string, accountName string) (result DataLakeStoreFirewallRuleListResultIterator, err error) { 1050 if tracing.IsEnabled() { 1051 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListFirewallRules") 1052 defer func() { 1053 sc := -1 1054 if result.Response().Response.Response != nil { 1055 sc = result.page.Response().Response.Response.StatusCode 1056 } 1057 tracing.EndSpan(ctx, sc, err) 1058 }() 1059 } 1060 result.page, err = client.ListFirewallRules(ctx, resourceGroupName, accountName) 1061 return 1062} 1063 1064// Update updates the specified Data Lake Store account information. 1065// Parameters: 1066// resourceGroupName - the name of the Azure resource group that contains the Data Lake Store account. 1067// name - the name of the Data Lake Store account to update. 1068// parameters - parameters supplied to update the Data Lake Store account. 1069func (client Client) Update(ctx context.Context, resourceGroupName string, name string, parameters DataLakeStoreAccount) (result UpdateFuture, err error) { 1070 if tracing.IsEnabled() { 1071 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") 1072 defer func() { 1073 sc := -1 1074 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1075 sc = result.FutureAPI.Response().StatusCode 1076 } 1077 tracing.EndSpan(ctx, sc, err) 1078 }() 1079 } 1080 req, err := client.UpdatePreparer(ctx, resourceGroupName, name, parameters) 1081 if err != nil { 1082 err = autorest.NewErrorWithError(err, "account.Client", "Update", nil, "Failure preparing request") 1083 return 1084 } 1085 1086 result, err = client.UpdateSender(req) 1087 if err != nil { 1088 err = autorest.NewErrorWithError(err, "account.Client", "Update", nil, "Failure sending request") 1089 return 1090 } 1091 1092 return 1093} 1094 1095// UpdatePreparer prepares the Update request. 1096func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DataLakeStoreAccount) (*http.Request, error) { 1097 pathParameters := map[string]interface{}{ 1098 "name": autorest.Encode("path", name), 1099 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1100 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1101 } 1102 1103 const APIVersion = "2015-10-01-preview" 1104 queryParameters := map[string]interface{}{ 1105 "api-version": APIVersion, 1106 } 1107 1108 parameters.Type = nil 1109 parameters.ID = nil 1110 preparer := autorest.CreatePreparer( 1111 autorest.AsContentType("application/json; charset=utf-8"), 1112 autorest.AsPatch(), 1113 autorest.WithBaseURL(client.BaseURI), 1114 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), 1115 autorest.WithJSON(parameters), 1116 autorest.WithQueryParameters(queryParameters)) 1117 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1118} 1119 1120// UpdateSender sends the Update request. The method will close the 1121// http.Response Body if it receives an error. 1122func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { 1123 var resp *http.Response 1124 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1125 if err != nil { 1126 return 1127 } 1128 var azf azure.Future 1129 azf, err = azure.NewFutureFromResponse(resp) 1130 future.FutureAPI = &azf 1131 future.Result = func(client Client) (dlsa DataLakeStoreAccount, err error) { 1132 var done bool 1133 done, err = future.DoneWithContext(context.Background(), client) 1134 if err != nil { 1135 err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", future.Response(), "Polling failure") 1136 return 1137 } 1138 if !done { 1139 err = azure.NewAsyncOpIncompleteError("account.UpdateFuture") 1140 return 1141 } 1142 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1143 dlsa.Response.Response, err = future.GetResult(sender) 1144 if dlsa.Response.Response == nil && err == nil { 1145 err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", nil, "received nil response and error") 1146 } 1147 if err == nil && dlsa.Response.Response.StatusCode != http.StatusNoContent { 1148 dlsa, err = client.UpdateResponder(dlsa.Response.Response) 1149 if err != nil { 1150 err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", dlsa.Response.Response, "Failure responding to request") 1151 } 1152 } 1153 return 1154 } 1155 return 1156} 1157 1158// UpdateResponder handles the response to the Update request. The method always 1159// closes the http.Response Body. 1160func (client Client) UpdateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { 1161 err = autorest.Respond( 1162 resp, 1163 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 1164 autorest.ByUnmarshallingJSON(&result), 1165 autorest.ByClosing()) 1166 result.Response = autorest.Response{Response: resp} 1167 return 1168} 1169