...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/datalake/analytics/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  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/azure"
    14  	"github.com/Azure/go-autorest/autorest/date"
    15  	"github.com/Azure/go-autorest/autorest/to"
    16  	"github.com/Azure/go-autorest/tracing"
    17  	"net/http"
    18  )
    19  
    20  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/datalake/analytics/mgmt/2015-10-01-preview/account"
    22  
    23  // AddDataLakeStoreParameters additional Data Lake Store parameters.
    24  type AddDataLakeStoreParameters struct {
    25  	// Properties - the properties for the Data Lake Store account being added.
    26  	Properties *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"`
    27  }
    28  
    29  // AddStorageAccountParameters additional Azure Storage account parameters.
    30  type AddStorageAccountParameters struct {
    31  	// Properties - the properties for the Azure Storage account being added.
    32  	Properties *StorageAccountProperties `json:"properties,omitempty"`
    33  }
    34  
    35  // AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation,
    36  // indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct
    37  // from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous
    38  // operation succeeded, the response body includes the HTTP status code for the successful request. If the
    39  // asynchronous operation failed, the response body includes the HTTP status code for the failed request
    40  // and error information regarding the failure.
    41  type AzureAsyncOperationResult struct {
    42  	// Status - READ-ONLY; the status of the AzureAsyncOperation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed'
    43  	Status OperationStatus `json:"status,omitempty"`
    44  	// Error - READ-ONLY
    45  	Error *Error `json:"error,omitempty"`
    46  }
    47  
    48  // MarshalJSON is the custom marshaler for AzureAsyncOperationResult.
    49  func (aaor AzureAsyncOperationResult) MarshalJSON() ([]byte, error) {
    50  	objectMap := make(map[string]interface{})
    51  	return json.Marshal(objectMap)
    52  }
    53  
    54  // BlobContainer azure Storage blob container information.
    55  type BlobContainer struct {
    56  	autorest.Response `json:"-"`
    57  	// Name - READ-ONLY; the name of the blob container.
    58  	Name *string `json:"name,omitempty"`
    59  	// ID - READ-ONLY; the unique identifier of the blob container.
    60  	ID *string `json:"id,omitempty"`
    61  	// Type - READ-ONLY; the type of the blob container.
    62  	Type *string `json:"type,omitempty"`
    63  	// Properties - READ-ONLY; the properties of the blob container.
    64  	Properties *BlobContainerProperties `json:"properties,omitempty"`
    65  }
    66  
    67  // MarshalJSON is the custom marshaler for BlobContainer.
    68  func (bc BlobContainer) MarshalJSON() ([]byte, error) {
    69  	objectMap := make(map[string]interface{})
    70  	return json.Marshal(objectMap)
    71  }
    72  
    73  // BlobContainerProperties azure Storage blob container properties information.
    74  type BlobContainerProperties struct {
    75  	// LastModifiedTime - READ-ONLY; the last modified time of the blob container.
    76  	LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
    77  }
    78  
    79  // MarshalJSON is the custom marshaler for BlobContainerProperties.
    80  func (bcp BlobContainerProperties) MarshalJSON() ([]byte, error) {
    81  	objectMap := make(map[string]interface{})
    82  	return json.Marshal(objectMap)
    83  }
    84  
    85  // CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
    86  type CreateFuture struct {
    87  	azure.FutureAPI
    88  	// Result returns the result of the asynchronous operation.
    89  	// If the operation has not completed it will return an error.
    90  	Result func(Client) (DataLakeAnalyticsAccount, error)
    91  }
    92  
    93  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
    94  func (future *CreateFuture) UnmarshalJSON(body []byte) error {
    95  	var azFuture azure.Future
    96  	if err := json.Unmarshal(body, &azFuture); err != nil {
    97  		return err
    98  	}
    99  	future.FutureAPI = &azFuture
   100  	future.Result = future.result
   101  	return nil
   102  }
   103  
   104  // result is the default implementation for CreateFuture.Result.
   105  func (future *CreateFuture) result(client Client) (dlaa DataLakeAnalyticsAccount, err error) {
   106  	var done bool
   107  	done, err = future.DoneWithContext(context.Background(), client)
   108  	if err != nil {
   109  		err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", future.Response(), "Polling failure")
   110  		return
   111  	}
   112  	if !done {
   113  		dlaa.Response.Response = future.Response()
   114  		err = azure.NewAsyncOpIncompleteError("account.CreateFuture")
   115  		return
   116  	}
   117  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   118  	if dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {
   119  		dlaa, err = client.CreateResponder(dlaa.Response.Response)
   120  		if err != nil {
   121  			err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", dlaa.Response.Response, "Failure responding to request")
   122  		}
   123  	}
   124  	return
   125  }
   126  
   127  // DataLakeAnalyticsAccount a Data Lake Analytics account object, containing all information associated
   128  // with the named Data Lake Analytics account.
   129  type DataLakeAnalyticsAccount struct {
   130  	autorest.Response `json:"-"`
   131  	// Location - the account regional location.
   132  	Location *string `json:"location,omitempty"`
   133  	// Name - the account name.
   134  	Name *string `json:"name,omitempty"`
   135  	// Type - READ-ONLY; the namespace and type of the account.
   136  	Type *string `json:"type,omitempty"`
   137  	// ID - READ-ONLY; the account subscription ID.
   138  	ID *string `json:"id,omitempty"`
   139  	// Tags - the value of custom properties.
   140  	Tags map[string]*string `json:"tags"`
   141  	// Properties - the properties defined by Data Lake Analytics all properties are specific to each resource provider.
   142  	Properties *DataLakeAnalyticsAccountProperties `json:"properties,omitempty"`
   143  }
   144  
   145  // MarshalJSON is the custom marshaler for DataLakeAnalyticsAccount.
   146  func (dlaa DataLakeAnalyticsAccount) MarshalJSON() ([]byte, error) {
   147  	objectMap := make(map[string]interface{})
   148  	if dlaa.Location != nil {
   149  		objectMap["location"] = dlaa.Location
   150  	}
   151  	if dlaa.Name != nil {
   152  		objectMap["name"] = dlaa.Name
   153  	}
   154  	if dlaa.Tags != nil {
   155  		objectMap["tags"] = dlaa.Tags
   156  	}
   157  	if dlaa.Properties != nil {
   158  		objectMap["properties"] = dlaa.Properties
   159  	}
   160  	return json.Marshal(objectMap)
   161  }
   162  
   163  // DataLakeAnalyticsAccountListDataLakeStoreResult data Lake Account list information.
   164  type DataLakeAnalyticsAccountListDataLakeStoreResult struct {
   165  	autorest.Response `json:"-"`
   166  	// Value - READ-ONLY; the results of the list operation
   167  	Value *[]DataLakeStoreAccountInfo `json:"value,omitempty"`
   168  	// Count - READ-ONLY; total number of results.
   169  	Count *int32 `json:"count,omitempty"`
   170  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   171  	NextLink *string `json:"nextLink,omitempty"`
   172  }
   173  
   174  // MarshalJSON is the custom marshaler for DataLakeAnalyticsAccountListDataLakeStoreResult.
   175  func (dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult) MarshalJSON() ([]byte, error) {
   176  	objectMap := make(map[string]interface{})
   177  	return json.Marshal(objectMap)
   178  }
   179  
   180  // DataLakeAnalyticsAccountListDataLakeStoreResultIterator provides access to a complete listing of
   181  // DataLakeStoreAccountInfo values.
   182  type DataLakeAnalyticsAccountListDataLakeStoreResultIterator struct {
   183  	i    int
   184  	page DataLakeAnalyticsAccountListDataLakeStoreResultPage
   185  }
   186  
   187  // NextWithContext advances to the next value.  If there was an error making
   188  // the request the iterator does not advance and the error is returned.
   189  func (iter *DataLakeAnalyticsAccountListDataLakeStoreResultIterator) NextWithContext(ctx context.Context) (err error) {
   190  	if tracing.IsEnabled() {
   191  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListDataLakeStoreResultIterator.NextWithContext")
   192  		defer func() {
   193  			sc := -1
   194  			if iter.Response().Response.Response != nil {
   195  				sc = iter.Response().Response.Response.StatusCode
   196  			}
   197  			tracing.EndSpan(ctx, sc, err)
   198  		}()
   199  	}
   200  	iter.i++
   201  	if iter.i < len(iter.page.Values()) {
   202  		return nil
   203  	}
   204  	err = iter.page.NextWithContext(ctx)
   205  	if err != nil {
   206  		iter.i--
   207  		return err
   208  	}
   209  	iter.i = 0
   210  	return nil
   211  }
   212  
   213  // Next advances to the next value.  If there was an error making
   214  // the request the iterator does not advance and the error is returned.
   215  // Deprecated: Use NextWithContext() instead.
   216  func (iter *DataLakeAnalyticsAccountListDataLakeStoreResultIterator) Next() error {
   217  	return iter.NextWithContext(context.Background())
   218  }
   219  
   220  // NotDone returns true if the enumeration should be started or is not yet complete.
   221  func (iter DataLakeAnalyticsAccountListDataLakeStoreResultIterator) NotDone() bool {
   222  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   223  }
   224  
   225  // Response returns the raw server response from the last page request.
   226  func (iter DataLakeAnalyticsAccountListDataLakeStoreResultIterator) Response() DataLakeAnalyticsAccountListDataLakeStoreResult {
   227  	return iter.page.Response()
   228  }
   229  
   230  // Value returns the current value or a zero-initialized value if the
   231  // iterator has advanced beyond the end of the collection.
   232  func (iter DataLakeAnalyticsAccountListDataLakeStoreResultIterator) Value() DataLakeStoreAccountInfo {
   233  	if !iter.page.NotDone() {
   234  		return DataLakeStoreAccountInfo{}
   235  	}
   236  	return iter.page.Values()[iter.i]
   237  }
   238  
   239  // Creates a new instance of the DataLakeAnalyticsAccountListDataLakeStoreResultIterator type.
   240  func NewDataLakeAnalyticsAccountListDataLakeStoreResultIterator(page DataLakeAnalyticsAccountListDataLakeStoreResultPage) DataLakeAnalyticsAccountListDataLakeStoreResultIterator {
   241  	return DataLakeAnalyticsAccountListDataLakeStoreResultIterator{page: page}
   242  }
   243  
   244  // IsEmpty returns true if the ListResult contains no values.
   245  func (dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult) IsEmpty() bool {
   246  	return dlaaldlsr.Value == nil || len(*dlaaldlsr.Value) == 0
   247  }
   248  
   249  // hasNextLink returns true if the NextLink is not empty.
   250  func (dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult) hasNextLink() bool {
   251  	return dlaaldlsr.NextLink != nil && len(*dlaaldlsr.NextLink) != 0
   252  }
   253  
   254  // dataLakeAnalyticsAccountListDataLakeStoreResultPreparer prepares a request to retrieve the next set of results.
   255  // It returns nil if no more results exist.
   256  func (dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult) dataLakeAnalyticsAccountListDataLakeStoreResultPreparer(ctx context.Context) (*http.Request, error) {
   257  	if !dlaaldlsr.hasNextLink() {
   258  		return nil, nil
   259  	}
   260  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   261  		autorest.AsJSON(),
   262  		autorest.AsGet(),
   263  		autorest.WithBaseURL(to.String(dlaaldlsr.NextLink)))
   264  }
   265  
   266  // DataLakeAnalyticsAccountListDataLakeStoreResultPage contains a page of DataLakeStoreAccountInfo values.
   267  type DataLakeAnalyticsAccountListDataLakeStoreResultPage struct {
   268  	fn        func(context.Context, DataLakeAnalyticsAccountListDataLakeStoreResult) (DataLakeAnalyticsAccountListDataLakeStoreResult, error)
   269  	dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult
   270  }
   271  
   272  // NextWithContext advances to the next page of values.  If there was an error making
   273  // the request the page does not advance and the error is returned.
   274  func (page *DataLakeAnalyticsAccountListDataLakeStoreResultPage) NextWithContext(ctx context.Context) (err error) {
   275  	if tracing.IsEnabled() {
   276  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListDataLakeStoreResultPage.NextWithContext")
   277  		defer func() {
   278  			sc := -1
   279  			if page.Response().Response.Response != nil {
   280  				sc = page.Response().Response.Response.StatusCode
   281  			}
   282  			tracing.EndSpan(ctx, sc, err)
   283  		}()
   284  	}
   285  	for {
   286  		next, err := page.fn(ctx, page.dlaaldlsr)
   287  		if err != nil {
   288  			return err
   289  		}
   290  		page.dlaaldlsr = next
   291  		if !next.hasNextLink() || !next.IsEmpty() {
   292  			break
   293  		}
   294  	}
   295  	return nil
   296  }
   297  
   298  // Next advances to the next page of values.  If there was an error making
   299  // the request the page does not advance and the error is returned.
   300  // Deprecated: Use NextWithContext() instead.
   301  func (page *DataLakeAnalyticsAccountListDataLakeStoreResultPage) Next() error {
   302  	return page.NextWithContext(context.Background())
   303  }
   304  
   305  // NotDone returns true if the page enumeration should be started or is not yet complete.
   306  func (page DataLakeAnalyticsAccountListDataLakeStoreResultPage) NotDone() bool {
   307  	return !page.dlaaldlsr.IsEmpty()
   308  }
   309  
   310  // Response returns the raw server response from the last page request.
   311  func (page DataLakeAnalyticsAccountListDataLakeStoreResultPage) Response() DataLakeAnalyticsAccountListDataLakeStoreResult {
   312  	return page.dlaaldlsr
   313  }
   314  
   315  // Values returns the slice of values for the current page or nil if there are no values.
   316  func (page DataLakeAnalyticsAccountListDataLakeStoreResultPage) Values() []DataLakeStoreAccountInfo {
   317  	if page.dlaaldlsr.IsEmpty() {
   318  		return nil
   319  	}
   320  	return *page.dlaaldlsr.Value
   321  }
   322  
   323  // Creates a new instance of the DataLakeAnalyticsAccountListDataLakeStoreResultPage type.
   324  func NewDataLakeAnalyticsAccountListDataLakeStoreResultPage(cur DataLakeAnalyticsAccountListDataLakeStoreResult, getNextPage func(context.Context, DataLakeAnalyticsAccountListDataLakeStoreResult) (DataLakeAnalyticsAccountListDataLakeStoreResult, error)) DataLakeAnalyticsAccountListDataLakeStoreResultPage {
   325  	return DataLakeAnalyticsAccountListDataLakeStoreResultPage{
   326  		fn:        getNextPage,
   327  		dlaaldlsr: cur,
   328  	}
   329  }
   330  
   331  // DataLakeAnalyticsAccountListResult dataLakeAnalytics Account list information.
   332  type DataLakeAnalyticsAccountListResult struct {
   333  	autorest.Response `json:"-"`
   334  	// Value - READ-ONLY; the results of the list operation
   335  	Value *[]DataLakeAnalyticsAccount `json:"value,omitempty"`
   336  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   337  	NextLink *string `json:"nextLink,omitempty"`
   338  }
   339  
   340  // MarshalJSON is the custom marshaler for DataLakeAnalyticsAccountListResult.
   341  func (dlaalr DataLakeAnalyticsAccountListResult) MarshalJSON() ([]byte, error) {
   342  	objectMap := make(map[string]interface{})
   343  	return json.Marshal(objectMap)
   344  }
   345  
   346  // DataLakeAnalyticsAccountListResultIterator provides access to a complete listing of
   347  // DataLakeAnalyticsAccount values.
   348  type DataLakeAnalyticsAccountListResultIterator struct {
   349  	i    int
   350  	page DataLakeAnalyticsAccountListResultPage
   351  }
   352  
   353  // NextWithContext advances to the next value.  If there was an error making
   354  // the request the iterator does not advance and the error is returned.
   355  func (iter *DataLakeAnalyticsAccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
   356  	if tracing.IsEnabled() {
   357  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListResultIterator.NextWithContext")
   358  		defer func() {
   359  			sc := -1
   360  			if iter.Response().Response.Response != nil {
   361  				sc = iter.Response().Response.Response.StatusCode
   362  			}
   363  			tracing.EndSpan(ctx, sc, err)
   364  		}()
   365  	}
   366  	iter.i++
   367  	if iter.i < len(iter.page.Values()) {
   368  		return nil
   369  	}
   370  	err = iter.page.NextWithContext(ctx)
   371  	if err != nil {
   372  		iter.i--
   373  		return err
   374  	}
   375  	iter.i = 0
   376  	return nil
   377  }
   378  
   379  // Next advances to the next value.  If there was an error making
   380  // the request the iterator does not advance and the error is returned.
   381  // Deprecated: Use NextWithContext() instead.
   382  func (iter *DataLakeAnalyticsAccountListResultIterator) Next() error {
   383  	return iter.NextWithContext(context.Background())
   384  }
   385  
   386  // NotDone returns true if the enumeration should be started or is not yet complete.
   387  func (iter DataLakeAnalyticsAccountListResultIterator) NotDone() bool {
   388  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   389  }
   390  
   391  // Response returns the raw server response from the last page request.
   392  func (iter DataLakeAnalyticsAccountListResultIterator) Response() DataLakeAnalyticsAccountListResult {
   393  	return iter.page.Response()
   394  }
   395  
   396  // Value returns the current value or a zero-initialized value if the
   397  // iterator has advanced beyond the end of the collection.
   398  func (iter DataLakeAnalyticsAccountListResultIterator) Value() DataLakeAnalyticsAccount {
   399  	if !iter.page.NotDone() {
   400  		return DataLakeAnalyticsAccount{}
   401  	}
   402  	return iter.page.Values()[iter.i]
   403  }
   404  
   405  // Creates a new instance of the DataLakeAnalyticsAccountListResultIterator type.
   406  func NewDataLakeAnalyticsAccountListResultIterator(page DataLakeAnalyticsAccountListResultPage) DataLakeAnalyticsAccountListResultIterator {
   407  	return DataLakeAnalyticsAccountListResultIterator{page: page}
   408  }
   409  
   410  // IsEmpty returns true if the ListResult contains no values.
   411  func (dlaalr DataLakeAnalyticsAccountListResult) IsEmpty() bool {
   412  	return dlaalr.Value == nil || len(*dlaalr.Value) == 0
   413  }
   414  
   415  // hasNextLink returns true if the NextLink is not empty.
   416  func (dlaalr DataLakeAnalyticsAccountListResult) hasNextLink() bool {
   417  	return dlaalr.NextLink != nil && len(*dlaalr.NextLink) != 0
   418  }
   419  
   420  // dataLakeAnalyticsAccountListResultPreparer prepares a request to retrieve the next set of results.
   421  // It returns nil if no more results exist.
   422  func (dlaalr DataLakeAnalyticsAccountListResult) dataLakeAnalyticsAccountListResultPreparer(ctx context.Context) (*http.Request, error) {
   423  	if !dlaalr.hasNextLink() {
   424  		return nil, nil
   425  	}
   426  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   427  		autorest.AsJSON(),
   428  		autorest.AsGet(),
   429  		autorest.WithBaseURL(to.String(dlaalr.NextLink)))
   430  }
   431  
   432  // DataLakeAnalyticsAccountListResultPage contains a page of DataLakeAnalyticsAccount values.
   433  type DataLakeAnalyticsAccountListResultPage struct {
   434  	fn     func(context.Context, DataLakeAnalyticsAccountListResult) (DataLakeAnalyticsAccountListResult, error)
   435  	dlaalr DataLakeAnalyticsAccountListResult
   436  }
   437  
   438  // NextWithContext advances to the next page of values.  If there was an error making
   439  // the request the page does not advance and the error is returned.
   440  func (page *DataLakeAnalyticsAccountListResultPage) NextWithContext(ctx context.Context) (err error) {
   441  	if tracing.IsEnabled() {
   442  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListResultPage.NextWithContext")
   443  		defer func() {
   444  			sc := -1
   445  			if page.Response().Response.Response != nil {
   446  				sc = page.Response().Response.Response.StatusCode
   447  			}
   448  			tracing.EndSpan(ctx, sc, err)
   449  		}()
   450  	}
   451  	for {
   452  		next, err := page.fn(ctx, page.dlaalr)
   453  		if err != nil {
   454  			return err
   455  		}
   456  		page.dlaalr = next
   457  		if !next.hasNextLink() || !next.IsEmpty() {
   458  			break
   459  		}
   460  	}
   461  	return nil
   462  }
   463  
   464  // Next advances to the next page of values.  If there was an error making
   465  // the request the page does not advance and the error is returned.
   466  // Deprecated: Use NextWithContext() instead.
   467  func (page *DataLakeAnalyticsAccountListResultPage) Next() error {
   468  	return page.NextWithContext(context.Background())
   469  }
   470  
   471  // NotDone returns true if the page enumeration should be started or is not yet complete.
   472  func (page DataLakeAnalyticsAccountListResultPage) NotDone() bool {
   473  	return !page.dlaalr.IsEmpty()
   474  }
   475  
   476  // Response returns the raw server response from the last page request.
   477  func (page DataLakeAnalyticsAccountListResultPage) Response() DataLakeAnalyticsAccountListResult {
   478  	return page.dlaalr
   479  }
   480  
   481  // Values returns the slice of values for the current page or nil if there are no values.
   482  func (page DataLakeAnalyticsAccountListResultPage) Values() []DataLakeAnalyticsAccount {
   483  	if page.dlaalr.IsEmpty() {
   484  		return nil
   485  	}
   486  	return *page.dlaalr.Value
   487  }
   488  
   489  // Creates a new instance of the DataLakeAnalyticsAccountListResultPage type.
   490  func NewDataLakeAnalyticsAccountListResultPage(cur DataLakeAnalyticsAccountListResult, getNextPage func(context.Context, DataLakeAnalyticsAccountListResult) (DataLakeAnalyticsAccountListResult, error)) DataLakeAnalyticsAccountListResultPage {
   491  	return DataLakeAnalyticsAccountListResultPage{
   492  		fn:     getNextPage,
   493  		dlaalr: cur,
   494  	}
   495  }
   496  
   497  // DataLakeAnalyticsAccountListStorageAccountsResult azure Storage Account list information.
   498  type DataLakeAnalyticsAccountListStorageAccountsResult struct {
   499  	autorest.Response `json:"-"`
   500  	// Value - READ-ONLY; the results of the list operation
   501  	Value *[]StorageAccountInfo `json:"value,omitempty"`
   502  	// Count - READ-ONLY; total number of results.
   503  	Count *int32 `json:"count,omitempty"`
   504  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   505  	NextLink *string `json:"nextLink,omitempty"`
   506  }
   507  
   508  // MarshalJSON is the custom marshaler for DataLakeAnalyticsAccountListStorageAccountsResult.
   509  func (dlaalsar DataLakeAnalyticsAccountListStorageAccountsResult) MarshalJSON() ([]byte, error) {
   510  	objectMap := make(map[string]interface{})
   511  	return json.Marshal(objectMap)
   512  }
   513  
   514  // DataLakeAnalyticsAccountListStorageAccountsResultIterator provides access to a complete listing of
   515  // StorageAccountInfo values.
   516  type DataLakeAnalyticsAccountListStorageAccountsResultIterator struct {
   517  	i    int
   518  	page DataLakeAnalyticsAccountListStorageAccountsResultPage
   519  }
   520  
   521  // NextWithContext advances to the next value.  If there was an error making
   522  // the request the iterator does not advance and the error is returned.
   523  func (iter *DataLakeAnalyticsAccountListStorageAccountsResultIterator) NextWithContext(ctx context.Context) (err error) {
   524  	if tracing.IsEnabled() {
   525  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListStorageAccountsResultIterator.NextWithContext")
   526  		defer func() {
   527  			sc := -1
   528  			if iter.Response().Response.Response != nil {
   529  				sc = iter.Response().Response.Response.StatusCode
   530  			}
   531  			tracing.EndSpan(ctx, sc, err)
   532  		}()
   533  	}
   534  	iter.i++
   535  	if iter.i < len(iter.page.Values()) {
   536  		return nil
   537  	}
   538  	err = iter.page.NextWithContext(ctx)
   539  	if err != nil {
   540  		iter.i--
   541  		return err
   542  	}
   543  	iter.i = 0
   544  	return nil
   545  }
   546  
   547  // Next advances to the next value.  If there was an error making
   548  // the request the iterator does not advance and the error is returned.
   549  // Deprecated: Use NextWithContext() instead.
   550  func (iter *DataLakeAnalyticsAccountListStorageAccountsResultIterator) Next() error {
   551  	return iter.NextWithContext(context.Background())
   552  }
   553  
   554  // NotDone returns true if the enumeration should be started or is not yet complete.
   555  func (iter DataLakeAnalyticsAccountListStorageAccountsResultIterator) NotDone() bool {
   556  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   557  }
   558  
   559  // Response returns the raw server response from the last page request.
   560  func (iter DataLakeAnalyticsAccountListStorageAccountsResultIterator) Response() DataLakeAnalyticsAccountListStorageAccountsResult {
   561  	return iter.page.Response()
   562  }
   563  
   564  // Value returns the current value or a zero-initialized value if the
   565  // iterator has advanced beyond the end of the collection.
   566  func (iter DataLakeAnalyticsAccountListStorageAccountsResultIterator) Value() StorageAccountInfo {
   567  	if !iter.page.NotDone() {
   568  		return StorageAccountInfo{}
   569  	}
   570  	return iter.page.Values()[iter.i]
   571  }
   572  
   573  // Creates a new instance of the DataLakeAnalyticsAccountListStorageAccountsResultIterator type.
   574  func NewDataLakeAnalyticsAccountListStorageAccountsResultIterator(page DataLakeAnalyticsAccountListStorageAccountsResultPage) DataLakeAnalyticsAccountListStorageAccountsResultIterator {
   575  	return DataLakeAnalyticsAccountListStorageAccountsResultIterator{page: page}
   576  }
   577  
   578  // IsEmpty returns true if the ListResult contains no values.
   579  func (dlaalsar DataLakeAnalyticsAccountListStorageAccountsResult) IsEmpty() bool {
   580  	return dlaalsar.Value == nil || len(*dlaalsar.Value) == 0
   581  }
   582  
   583  // hasNextLink returns true if the NextLink is not empty.
   584  func (dlaalsar DataLakeAnalyticsAccountListStorageAccountsResult) hasNextLink() bool {
   585  	return dlaalsar.NextLink != nil && len(*dlaalsar.NextLink) != 0
   586  }
   587  
   588  // dataLakeAnalyticsAccountListStorageAccountsResultPreparer prepares a request to retrieve the next set of results.
   589  // It returns nil if no more results exist.
   590  func (dlaalsar DataLakeAnalyticsAccountListStorageAccountsResult) dataLakeAnalyticsAccountListStorageAccountsResultPreparer(ctx context.Context) (*http.Request, error) {
   591  	if !dlaalsar.hasNextLink() {
   592  		return nil, nil
   593  	}
   594  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   595  		autorest.AsJSON(),
   596  		autorest.AsGet(),
   597  		autorest.WithBaseURL(to.String(dlaalsar.NextLink)))
   598  }
   599  
   600  // DataLakeAnalyticsAccountListStorageAccountsResultPage contains a page of StorageAccountInfo values.
   601  type DataLakeAnalyticsAccountListStorageAccountsResultPage struct {
   602  	fn       func(context.Context, DataLakeAnalyticsAccountListStorageAccountsResult) (DataLakeAnalyticsAccountListStorageAccountsResult, error)
   603  	dlaalsar DataLakeAnalyticsAccountListStorageAccountsResult
   604  }
   605  
   606  // NextWithContext advances to the next page of values.  If there was an error making
   607  // the request the page does not advance and the error is returned.
   608  func (page *DataLakeAnalyticsAccountListStorageAccountsResultPage) NextWithContext(ctx context.Context) (err error) {
   609  	if tracing.IsEnabled() {
   610  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeAnalyticsAccountListStorageAccountsResultPage.NextWithContext")
   611  		defer func() {
   612  			sc := -1
   613  			if page.Response().Response.Response != nil {
   614  				sc = page.Response().Response.Response.StatusCode
   615  			}
   616  			tracing.EndSpan(ctx, sc, err)
   617  		}()
   618  	}
   619  	for {
   620  		next, err := page.fn(ctx, page.dlaalsar)
   621  		if err != nil {
   622  			return err
   623  		}
   624  		page.dlaalsar = next
   625  		if !next.hasNextLink() || !next.IsEmpty() {
   626  			break
   627  		}
   628  	}
   629  	return nil
   630  }
   631  
   632  // Next advances to the next page of values.  If there was an error making
   633  // the request the page does not advance and the error is returned.
   634  // Deprecated: Use NextWithContext() instead.
   635  func (page *DataLakeAnalyticsAccountListStorageAccountsResultPage) Next() error {
   636  	return page.NextWithContext(context.Background())
   637  }
   638  
   639  // NotDone returns true if the page enumeration should be started or is not yet complete.
   640  func (page DataLakeAnalyticsAccountListStorageAccountsResultPage) NotDone() bool {
   641  	return !page.dlaalsar.IsEmpty()
   642  }
   643  
   644  // Response returns the raw server response from the last page request.
   645  func (page DataLakeAnalyticsAccountListStorageAccountsResultPage) Response() DataLakeAnalyticsAccountListStorageAccountsResult {
   646  	return page.dlaalsar
   647  }
   648  
   649  // Values returns the slice of values for the current page or nil if there are no values.
   650  func (page DataLakeAnalyticsAccountListStorageAccountsResultPage) Values() []StorageAccountInfo {
   651  	if page.dlaalsar.IsEmpty() {
   652  		return nil
   653  	}
   654  	return *page.dlaalsar.Value
   655  }
   656  
   657  // Creates a new instance of the DataLakeAnalyticsAccountListStorageAccountsResultPage type.
   658  func NewDataLakeAnalyticsAccountListStorageAccountsResultPage(cur DataLakeAnalyticsAccountListStorageAccountsResult, getNextPage func(context.Context, DataLakeAnalyticsAccountListStorageAccountsResult) (DataLakeAnalyticsAccountListStorageAccountsResult, error)) DataLakeAnalyticsAccountListStorageAccountsResultPage {
   659  	return DataLakeAnalyticsAccountListStorageAccountsResultPage{
   660  		fn:       getNextPage,
   661  		dlaalsar: cur,
   662  	}
   663  }
   664  
   665  // DataLakeAnalyticsAccountProperties the account specific properties that are associated with an
   666  // underlying Data Lake Analytics account.
   667  type DataLakeAnalyticsAccountProperties struct {
   668  	// ProvisioningState - READ-ONLY; the provisioning status of the Data Lake Analytics account. Possible values include: 'Failed', 'Creating', 'Running', 'Succeeded', 'Patching', 'Suspending', 'Resuming', 'Deleting', 'Deleted'
   669  	ProvisioningState DataLakeAnalyticsAccountStatus `json:"provisioningState,omitempty"`
   670  	// State - READ-ONLY; the state of the Data Lake Analytics account. Possible values include: 'Active', 'Suspended'
   671  	State DataLakeAnalyticsAccountState `json:"state,omitempty"`
   672  	// DefaultDataLakeStoreAccount - the default data lake storage account associated with this Data Lake Analytics account.
   673  	DefaultDataLakeStoreAccount *string `json:"defaultDataLakeStoreAccount,omitempty"`
   674  	// MaxDegreeOfParallelism - the maximum supported degree of parallelism for this account.
   675  	MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"`
   676  	// MaxJobCount - the maximum supported jobs running under the account at the same time.
   677  	MaxJobCount *int32 `json:"maxJobCount,omitempty"`
   678  	// DataLakeStoreAccounts - the list of Data Lake storage accounts associated with this account.
   679  	DataLakeStoreAccounts *[]DataLakeStoreAccountInfo `json:"dataLakeStoreAccounts,omitempty"`
   680  	// StorageAccounts - the list of Azure Blob storage accounts associated with this account.
   681  	StorageAccounts *[]StorageAccountInfo `json:"storageAccounts,omitempty"`
   682  	// CreationTime - READ-ONLY; the account creation time.
   683  	CreationTime *date.Time `json:"creationTime,omitempty"`
   684  	// LastModifiedTime - READ-ONLY; the account last modified time.
   685  	LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
   686  	// Endpoint - READ-ONLY; the full CName endpoint for this account.
   687  	Endpoint *string `json:"endpoint,omitempty"`
   688  }
   689  
   690  // MarshalJSON is the custom marshaler for DataLakeAnalyticsAccountProperties.
   691  func (dlaap DataLakeAnalyticsAccountProperties) MarshalJSON() ([]byte, error) {
   692  	objectMap := make(map[string]interface{})
   693  	if dlaap.DefaultDataLakeStoreAccount != nil {
   694  		objectMap["defaultDataLakeStoreAccount"] = dlaap.DefaultDataLakeStoreAccount
   695  	}
   696  	if dlaap.MaxDegreeOfParallelism != nil {
   697  		objectMap["maxDegreeOfParallelism"] = dlaap.MaxDegreeOfParallelism
   698  	}
   699  	if dlaap.MaxJobCount != nil {
   700  		objectMap["maxJobCount"] = dlaap.MaxJobCount
   701  	}
   702  	if dlaap.DataLakeStoreAccounts != nil {
   703  		objectMap["dataLakeStoreAccounts"] = dlaap.DataLakeStoreAccounts
   704  	}
   705  	if dlaap.StorageAccounts != nil {
   706  		objectMap["storageAccounts"] = dlaap.StorageAccounts
   707  	}
   708  	return json.Marshal(objectMap)
   709  }
   710  
   711  // DataLakeStoreAccountInfo data Lake Store account information.
   712  type DataLakeStoreAccountInfo struct {
   713  	autorest.Response `json:"-"`
   714  	// Name - the account name of the Data Lake Store account.
   715  	Name *string `json:"name,omitempty"`
   716  	// Properties - the properties associated with this Data Lake Store account.
   717  	Properties *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"`
   718  }
   719  
   720  // DataLakeStoreAccountInfoProperties data Lake Store account properties information.
   721  type DataLakeStoreAccountInfoProperties struct {
   722  	// Suffix - the optional suffix for the Data Lake Store account.
   723  	Suffix *string `json:"suffix,omitempty"`
   724  }
   725  
   726  // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
   727  type DeleteFuture struct {
   728  	azure.FutureAPI
   729  	// Result returns the result of the asynchronous operation.
   730  	// If the operation has not completed it will return an error.
   731  	Result func(Client) (autorest.Response, error)
   732  }
   733  
   734  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   735  func (future *DeleteFuture) UnmarshalJSON(body []byte) error {
   736  	var azFuture azure.Future
   737  	if err := json.Unmarshal(body, &azFuture); err != nil {
   738  		return err
   739  	}
   740  	future.FutureAPI = &azFuture
   741  	future.Result = future.result
   742  	return nil
   743  }
   744  
   745  // result is the default implementation for DeleteFuture.Result.
   746  func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) {
   747  	var done bool
   748  	done, err = future.DoneWithContext(context.Background(), client)
   749  	if err != nil {
   750  		err = autorest.NewErrorWithError(err, "account.DeleteFuture", "Result", future.Response(), "Polling failure")
   751  		return
   752  	}
   753  	if !done {
   754  		ar.Response = future.Response()
   755  		err = azure.NewAsyncOpIncompleteError("account.DeleteFuture")
   756  		return
   757  	}
   758  	ar.Response = future.Response()
   759  	return
   760  }
   761  
   762  // Error generic resource error information.
   763  type Error struct {
   764  	// Code - READ-ONLY; the HTTP status code or error code associated with this error
   765  	Code *string `json:"code,omitempty"`
   766  	// Message - READ-ONLY; the error message to display.
   767  	Message *string `json:"message,omitempty"`
   768  	// Target - READ-ONLY; the target of the error.
   769  	Target *string `json:"target,omitempty"`
   770  	// Details - READ-ONLY; the list of error details
   771  	Details *[]ErrorDetails `json:"details,omitempty"`
   772  	// InnerError - READ-ONLY; the inner exceptions or errors, if any
   773  	InnerError *InnerError `json:"innerError,omitempty"`
   774  }
   775  
   776  // MarshalJSON is the custom marshaler for Error.
   777  func (e Error) MarshalJSON() ([]byte, error) {
   778  	objectMap := make(map[string]interface{})
   779  	return json.Marshal(objectMap)
   780  }
   781  
   782  // ErrorDetails generic resource error details information.
   783  type ErrorDetails struct {
   784  	// Code - READ-ONLY; the HTTP status code or error code associated with this error
   785  	Code *string `json:"code,omitempty"`
   786  	// Message - READ-ONLY; the error message localized based on Accept-Language
   787  	Message *string `json:"message,omitempty"`
   788  	// Target - READ-ONLY; the target of the particular error (for example, the name of the property in error).
   789  	Target *string `json:"target,omitempty"`
   790  }
   791  
   792  // MarshalJSON is the custom marshaler for ErrorDetails.
   793  func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
   794  	objectMap := make(map[string]interface{})
   795  	return json.Marshal(objectMap)
   796  }
   797  
   798  // InnerError generic resource inner error information.
   799  type InnerError struct {
   800  	// Trace - READ-ONLY; the stack trace for the error
   801  	Trace *string `json:"trace,omitempty"`
   802  	// Context - READ-ONLY; the context for the error message
   803  	Context *string `json:"context,omitempty"`
   804  }
   805  
   806  // MarshalJSON is the custom marshaler for InnerError.
   807  func (ie InnerError) MarshalJSON() ([]byte, error) {
   808  	objectMap := make(map[string]interface{})
   809  	return json.Marshal(objectMap)
   810  }
   811  
   812  // ListBlobContainersResult the list of blob containers associated with the storage account attached to the
   813  // Data Lake Analytics account.
   814  type ListBlobContainersResult struct {
   815  	autorest.Response `json:"-"`
   816  	// Value - READ-ONLY; the results of the list operation
   817  	Value *[]BlobContainer `json:"value,omitempty"`
   818  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   819  	NextLink *string `json:"nextLink,omitempty"`
   820  }
   821  
   822  // MarshalJSON is the custom marshaler for ListBlobContainersResult.
   823  func (lbcr ListBlobContainersResult) MarshalJSON() ([]byte, error) {
   824  	objectMap := make(map[string]interface{})
   825  	return json.Marshal(objectMap)
   826  }
   827  
   828  // ListBlobContainersResultIterator provides access to a complete listing of BlobContainer values.
   829  type ListBlobContainersResultIterator struct {
   830  	i    int
   831  	page ListBlobContainersResultPage
   832  }
   833  
   834  // NextWithContext advances to the next value.  If there was an error making
   835  // the request the iterator does not advance and the error is returned.
   836  func (iter *ListBlobContainersResultIterator) NextWithContext(ctx context.Context) (err error) {
   837  	if tracing.IsEnabled() {
   838  		ctx = tracing.StartSpan(ctx, fqdn+"/ListBlobContainersResultIterator.NextWithContext")
   839  		defer func() {
   840  			sc := -1
   841  			if iter.Response().Response.Response != nil {
   842  				sc = iter.Response().Response.Response.StatusCode
   843  			}
   844  			tracing.EndSpan(ctx, sc, err)
   845  		}()
   846  	}
   847  	iter.i++
   848  	if iter.i < len(iter.page.Values()) {
   849  		return nil
   850  	}
   851  	err = iter.page.NextWithContext(ctx)
   852  	if err != nil {
   853  		iter.i--
   854  		return err
   855  	}
   856  	iter.i = 0
   857  	return nil
   858  }
   859  
   860  // Next advances to the next value.  If there was an error making
   861  // the request the iterator does not advance and the error is returned.
   862  // Deprecated: Use NextWithContext() instead.
   863  func (iter *ListBlobContainersResultIterator) Next() error {
   864  	return iter.NextWithContext(context.Background())
   865  }
   866  
   867  // NotDone returns true if the enumeration should be started or is not yet complete.
   868  func (iter ListBlobContainersResultIterator) NotDone() bool {
   869  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   870  }
   871  
   872  // Response returns the raw server response from the last page request.
   873  func (iter ListBlobContainersResultIterator) Response() ListBlobContainersResult {
   874  	return iter.page.Response()
   875  }
   876  
   877  // Value returns the current value or a zero-initialized value if the
   878  // iterator has advanced beyond the end of the collection.
   879  func (iter ListBlobContainersResultIterator) Value() BlobContainer {
   880  	if !iter.page.NotDone() {
   881  		return BlobContainer{}
   882  	}
   883  	return iter.page.Values()[iter.i]
   884  }
   885  
   886  // Creates a new instance of the ListBlobContainersResultIterator type.
   887  func NewListBlobContainersResultIterator(page ListBlobContainersResultPage) ListBlobContainersResultIterator {
   888  	return ListBlobContainersResultIterator{page: page}
   889  }
   890  
   891  // IsEmpty returns true if the ListResult contains no values.
   892  func (lbcr ListBlobContainersResult) IsEmpty() bool {
   893  	return lbcr.Value == nil || len(*lbcr.Value) == 0
   894  }
   895  
   896  // hasNextLink returns true if the NextLink is not empty.
   897  func (lbcr ListBlobContainersResult) hasNextLink() bool {
   898  	return lbcr.NextLink != nil && len(*lbcr.NextLink) != 0
   899  }
   900  
   901  // listBlobContainersResultPreparer prepares a request to retrieve the next set of results.
   902  // It returns nil if no more results exist.
   903  func (lbcr ListBlobContainersResult) listBlobContainersResultPreparer(ctx context.Context) (*http.Request, error) {
   904  	if !lbcr.hasNextLink() {
   905  		return nil, nil
   906  	}
   907  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   908  		autorest.AsJSON(),
   909  		autorest.AsGet(),
   910  		autorest.WithBaseURL(to.String(lbcr.NextLink)))
   911  }
   912  
   913  // ListBlobContainersResultPage contains a page of BlobContainer values.
   914  type ListBlobContainersResultPage struct {
   915  	fn   func(context.Context, ListBlobContainersResult) (ListBlobContainersResult, error)
   916  	lbcr ListBlobContainersResult
   917  }
   918  
   919  // NextWithContext advances to the next page of values.  If there was an error making
   920  // the request the page does not advance and the error is returned.
   921  func (page *ListBlobContainersResultPage) NextWithContext(ctx context.Context) (err error) {
   922  	if tracing.IsEnabled() {
   923  		ctx = tracing.StartSpan(ctx, fqdn+"/ListBlobContainersResultPage.NextWithContext")
   924  		defer func() {
   925  			sc := -1
   926  			if page.Response().Response.Response != nil {
   927  				sc = page.Response().Response.Response.StatusCode
   928  			}
   929  			tracing.EndSpan(ctx, sc, err)
   930  		}()
   931  	}
   932  	for {
   933  		next, err := page.fn(ctx, page.lbcr)
   934  		if err != nil {
   935  			return err
   936  		}
   937  		page.lbcr = next
   938  		if !next.hasNextLink() || !next.IsEmpty() {
   939  			break
   940  		}
   941  	}
   942  	return nil
   943  }
   944  
   945  // Next advances to the next page of values.  If there was an error making
   946  // the request the page does not advance and the error is returned.
   947  // Deprecated: Use NextWithContext() instead.
   948  func (page *ListBlobContainersResultPage) Next() error {
   949  	return page.NextWithContext(context.Background())
   950  }
   951  
   952  // NotDone returns true if the page enumeration should be started or is not yet complete.
   953  func (page ListBlobContainersResultPage) NotDone() bool {
   954  	return !page.lbcr.IsEmpty()
   955  }
   956  
   957  // Response returns the raw server response from the last page request.
   958  func (page ListBlobContainersResultPage) Response() ListBlobContainersResult {
   959  	return page.lbcr
   960  }
   961  
   962  // Values returns the slice of values for the current page or nil if there are no values.
   963  func (page ListBlobContainersResultPage) Values() []BlobContainer {
   964  	if page.lbcr.IsEmpty() {
   965  		return nil
   966  	}
   967  	return *page.lbcr.Value
   968  }
   969  
   970  // Creates a new instance of the ListBlobContainersResultPage type.
   971  func NewListBlobContainersResultPage(cur ListBlobContainersResult, getNextPage func(context.Context, ListBlobContainersResult) (ListBlobContainersResult, error)) ListBlobContainersResultPage {
   972  	return ListBlobContainersResultPage{
   973  		fn:   getNextPage,
   974  		lbcr: cur,
   975  	}
   976  }
   977  
   978  // ListSasTokensResult the SAS response that contains the storage account, container and associated SAS
   979  // token for connection use.
   980  type ListSasTokensResult struct {
   981  	autorest.Response `json:"-"`
   982  	// Value - READ-ONLY
   983  	Value *[]SasTokenInfo `json:"value,omitempty"`
   984  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   985  	NextLink *string `json:"nextLink,omitempty"`
   986  }
   987  
   988  // MarshalJSON is the custom marshaler for ListSasTokensResult.
   989  func (lstr ListSasTokensResult) MarshalJSON() ([]byte, error) {
   990  	objectMap := make(map[string]interface{})
   991  	return json.Marshal(objectMap)
   992  }
   993  
   994  // ListSasTokensResultIterator provides access to a complete listing of SasTokenInfo values.
   995  type ListSasTokensResultIterator struct {
   996  	i    int
   997  	page ListSasTokensResultPage
   998  }
   999  
  1000  // NextWithContext advances to the next value.  If there was an error making
  1001  // the request the iterator does not advance and the error is returned.
  1002  func (iter *ListSasTokensResultIterator) NextWithContext(ctx context.Context) (err error) {
  1003  	if tracing.IsEnabled() {
  1004  		ctx = tracing.StartSpan(ctx, fqdn+"/ListSasTokensResultIterator.NextWithContext")
  1005  		defer func() {
  1006  			sc := -1
  1007  			if iter.Response().Response.Response != nil {
  1008  				sc = iter.Response().Response.Response.StatusCode
  1009  			}
  1010  			tracing.EndSpan(ctx, sc, err)
  1011  		}()
  1012  	}
  1013  	iter.i++
  1014  	if iter.i < len(iter.page.Values()) {
  1015  		return nil
  1016  	}
  1017  	err = iter.page.NextWithContext(ctx)
  1018  	if err != nil {
  1019  		iter.i--
  1020  		return err
  1021  	}
  1022  	iter.i = 0
  1023  	return nil
  1024  }
  1025  
  1026  // Next advances to the next value.  If there was an error making
  1027  // the request the iterator does not advance and the error is returned.
  1028  // Deprecated: Use NextWithContext() instead.
  1029  func (iter *ListSasTokensResultIterator) Next() error {
  1030  	return iter.NextWithContext(context.Background())
  1031  }
  1032  
  1033  // NotDone returns true if the enumeration should be started or is not yet complete.
  1034  func (iter ListSasTokensResultIterator) NotDone() bool {
  1035  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1036  }
  1037  
  1038  // Response returns the raw server response from the last page request.
  1039  func (iter ListSasTokensResultIterator) Response() ListSasTokensResult {
  1040  	return iter.page.Response()
  1041  }
  1042  
  1043  // Value returns the current value or a zero-initialized value if the
  1044  // iterator has advanced beyond the end of the collection.
  1045  func (iter ListSasTokensResultIterator) Value() SasTokenInfo {
  1046  	if !iter.page.NotDone() {
  1047  		return SasTokenInfo{}
  1048  	}
  1049  	return iter.page.Values()[iter.i]
  1050  }
  1051  
  1052  // Creates a new instance of the ListSasTokensResultIterator type.
  1053  func NewListSasTokensResultIterator(page ListSasTokensResultPage) ListSasTokensResultIterator {
  1054  	return ListSasTokensResultIterator{page: page}
  1055  }
  1056  
  1057  // IsEmpty returns true if the ListResult contains no values.
  1058  func (lstr ListSasTokensResult) IsEmpty() bool {
  1059  	return lstr.Value == nil || len(*lstr.Value) == 0
  1060  }
  1061  
  1062  // hasNextLink returns true if the NextLink is not empty.
  1063  func (lstr ListSasTokensResult) hasNextLink() bool {
  1064  	return lstr.NextLink != nil && len(*lstr.NextLink) != 0
  1065  }
  1066  
  1067  // listSasTokensResultPreparer prepares a request to retrieve the next set of results.
  1068  // It returns nil if no more results exist.
  1069  func (lstr ListSasTokensResult) listSasTokensResultPreparer(ctx context.Context) (*http.Request, error) {
  1070  	if !lstr.hasNextLink() {
  1071  		return nil, nil
  1072  	}
  1073  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1074  		autorest.AsJSON(),
  1075  		autorest.AsGet(),
  1076  		autorest.WithBaseURL(to.String(lstr.NextLink)))
  1077  }
  1078  
  1079  // ListSasTokensResultPage contains a page of SasTokenInfo values.
  1080  type ListSasTokensResultPage struct {
  1081  	fn   func(context.Context, ListSasTokensResult) (ListSasTokensResult, error)
  1082  	lstr ListSasTokensResult
  1083  }
  1084  
  1085  // NextWithContext advances to the next page of values.  If there was an error making
  1086  // the request the page does not advance and the error is returned.
  1087  func (page *ListSasTokensResultPage) NextWithContext(ctx context.Context) (err error) {
  1088  	if tracing.IsEnabled() {
  1089  		ctx = tracing.StartSpan(ctx, fqdn+"/ListSasTokensResultPage.NextWithContext")
  1090  		defer func() {
  1091  			sc := -1
  1092  			if page.Response().Response.Response != nil {
  1093  				sc = page.Response().Response.Response.StatusCode
  1094  			}
  1095  			tracing.EndSpan(ctx, sc, err)
  1096  		}()
  1097  	}
  1098  	for {
  1099  		next, err := page.fn(ctx, page.lstr)
  1100  		if err != nil {
  1101  			return err
  1102  		}
  1103  		page.lstr = next
  1104  		if !next.hasNextLink() || !next.IsEmpty() {
  1105  			break
  1106  		}
  1107  	}
  1108  	return nil
  1109  }
  1110  
  1111  // Next advances to the next page of values.  If there was an error making
  1112  // the request the page does not advance and the error is returned.
  1113  // Deprecated: Use NextWithContext() instead.
  1114  func (page *ListSasTokensResultPage) Next() error {
  1115  	return page.NextWithContext(context.Background())
  1116  }
  1117  
  1118  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1119  func (page ListSasTokensResultPage) NotDone() bool {
  1120  	return !page.lstr.IsEmpty()
  1121  }
  1122  
  1123  // Response returns the raw server response from the last page request.
  1124  func (page ListSasTokensResultPage) Response() ListSasTokensResult {
  1125  	return page.lstr
  1126  }
  1127  
  1128  // Values returns the slice of values for the current page or nil if there are no values.
  1129  func (page ListSasTokensResultPage) Values() []SasTokenInfo {
  1130  	if page.lstr.IsEmpty() {
  1131  		return nil
  1132  	}
  1133  	return *page.lstr.Value
  1134  }
  1135  
  1136  // Creates a new instance of the ListSasTokensResultPage type.
  1137  func NewListSasTokensResultPage(cur ListSasTokensResult, getNextPage func(context.Context, ListSasTokensResult) (ListSasTokensResult, error)) ListSasTokensResultPage {
  1138  	return ListSasTokensResultPage{
  1139  		fn:   getNextPage,
  1140  		lstr: cur,
  1141  	}
  1142  }
  1143  
  1144  // SasTokenInfo SAS token information.
  1145  type SasTokenInfo struct {
  1146  	// AccessToken - READ-ONLY; the access token for the associated Azure Storage Container.
  1147  	AccessToken *string `json:"accessToken,omitempty"`
  1148  }
  1149  
  1150  // MarshalJSON is the custom marshaler for SasTokenInfo.
  1151  func (sti SasTokenInfo) MarshalJSON() ([]byte, error) {
  1152  	objectMap := make(map[string]interface{})
  1153  	return json.Marshal(objectMap)
  1154  }
  1155  
  1156  // StorageAccountInfo azure Storage account information.
  1157  type StorageAccountInfo struct {
  1158  	autorest.Response `json:"-"`
  1159  	// Name - the account name associated with the Azure storage account.
  1160  	Name *string `json:"name,omitempty"`
  1161  	// Properties - the properties associated with this storage account.
  1162  	Properties *StorageAccountProperties `json:"properties,omitempty"`
  1163  }
  1164  
  1165  // StorageAccountProperties azure Storage account properties information.
  1166  type StorageAccountProperties struct {
  1167  	// AccessKey - the access key associated with this Azure Storage account that will be used to connect to it.
  1168  	AccessKey *string `json:"accessKey,omitempty"`
  1169  	// Suffix - the optional suffix for the Data Lake account.
  1170  	Suffix *string `json:"suffix,omitempty"`
  1171  }
  1172  
  1173  // UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  1174  type UpdateFuture struct {
  1175  	azure.FutureAPI
  1176  	// Result returns the result of the asynchronous operation.
  1177  	// If the operation has not completed it will return an error.
  1178  	Result func(Client) (DataLakeAnalyticsAccount, error)
  1179  }
  1180  
  1181  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1182  func (future *UpdateFuture) UnmarshalJSON(body []byte) error {
  1183  	var azFuture azure.Future
  1184  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1185  		return err
  1186  	}
  1187  	future.FutureAPI = &azFuture
  1188  	future.Result = future.result
  1189  	return nil
  1190  }
  1191  
  1192  // result is the default implementation for UpdateFuture.Result.
  1193  func (future *UpdateFuture) result(client Client) (dlaa DataLakeAnalyticsAccount, err error) {
  1194  	var done bool
  1195  	done, err = future.DoneWithContext(context.Background(), client)
  1196  	if err != nil {
  1197  		err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", future.Response(), "Polling failure")
  1198  		return
  1199  	}
  1200  	if !done {
  1201  		dlaa.Response.Response = future.Response()
  1202  		err = azure.NewAsyncOpIncompleteError("account.UpdateFuture")
  1203  		return
  1204  	}
  1205  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1206  	if dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {
  1207  		dlaa, err = client.UpdateResponder(dlaa.Response.Response)
  1208  		if err != nil {
  1209  			err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", dlaa.Response.Response, "Failure responding to request")
  1210  		}
  1211  	}
  1212  	return
  1213  }
  1214  

View as plain text