...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/mgmt/2015-10-01-preview/account/account.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/mgmt/2015-10-01-preview/account

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

View as plain text