...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/mgmt/2015-10-01-preview/account/models.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  	"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  	"github.com/gofrs/uuid"
    18  	"net/http"
    19  )
    20  
    21  // The package's fully qualified name.
    22  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/mgmt/2015-10-01-preview/account"
    23  
    24  // AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation,
    25  // indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct
    26  // from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous
    27  // operation succeeded, the response body includes the HTTP status code for the successful request. If the
    28  // asynchronous operation failed, the response body includes the HTTP status code for the failed request
    29  // and error information regarding the failure.
    30  type AzureAsyncOperationResult struct {
    31  	// Status - READ-ONLY; the status of the AzureAsyncOperation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed'
    32  	Status OperationStatus `json:"status,omitempty"`
    33  	// Error - READ-ONLY
    34  	Error *Error `json:"error,omitempty"`
    35  }
    36  
    37  // MarshalJSON is the custom marshaler for AzureAsyncOperationResult.
    38  func (aaor AzureAsyncOperationResult) MarshalJSON() ([]byte, error) {
    39  	objectMap := make(map[string]interface{})
    40  	return json.Marshal(objectMap)
    41  }
    42  
    43  // CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
    44  type CreateFuture struct {
    45  	azure.FutureAPI
    46  	// Result returns the result of the asynchronous operation.
    47  	// If the operation has not completed it will return an error.
    48  	Result func(Client) (DataLakeStoreAccount, error)
    49  }
    50  
    51  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
    52  func (future *CreateFuture) UnmarshalJSON(body []byte) error {
    53  	var azFuture azure.Future
    54  	if err := json.Unmarshal(body, &azFuture); err != nil {
    55  		return err
    56  	}
    57  	future.FutureAPI = &azFuture
    58  	future.Result = future.result
    59  	return nil
    60  }
    61  
    62  // result is the default implementation for CreateFuture.Result.
    63  func (future *CreateFuture) result(client Client) (dlsa DataLakeStoreAccount, err error) {
    64  	var done bool
    65  	done, err = future.DoneWithContext(context.Background(), client)
    66  	if err != nil {
    67  		err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", future.Response(), "Polling failure")
    68  		return
    69  	}
    70  	if !done {
    71  		dlsa.Response.Response = future.Response()
    72  		err = azure.NewAsyncOpIncompleteError("account.CreateFuture")
    73  		return
    74  	}
    75  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
    76  	if dlsa.Response.Response, err = future.GetResult(sender); err == nil && dlsa.Response.Response.StatusCode != http.StatusNoContent {
    77  		dlsa, err = client.CreateResponder(dlsa.Response.Response)
    78  		if err != nil {
    79  			err = autorest.NewErrorWithError(err, "account.CreateFuture", "Result", dlsa.Response.Response, "Failure responding to request")
    80  		}
    81  	}
    82  	return
    83  }
    84  
    85  // DataLakeStoreAccount data Lake Store account information
    86  type DataLakeStoreAccount struct {
    87  	autorest.Response `json:"-"`
    88  	// Location - the account regional location.
    89  	Location *string `json:"location,omitempty"`
    90  	// Name - the account name.
    91  	Name *string `json:"name,omitempty"`
    92  	// Type - READ-ONLY; the namespace and type of the account.
    93  	Type *string `json:"type,omitempty"`
    94  	// ID - READ-ONLY; the account subscription ID.
    95  	ID *string `json:"id,omitempty"`
    96  	// Identity - The Key vault encryption identity, if any.
    97  	Identity *EncryptionIdentity `json:"identity,omitempty"`
    98  	// Tags - the value of custom properties.
    99  	Tags map[string]*string `json:"tags"`
   100  	// Properties - the Data Lake Store account properties.
   101  	Properties *DataLakeStoreAccountProperties `json:"properties,omitempty"`
   102  }
   103  
   104  // MarshalJSON is the custom marshaler for DataLakeStoreAccount.
   105  func (dlsa DataLakeStoreAccount) MarshalJSON() ([]byte, error) {
   106  	objectMap := make(map[string]interface{})
   107  	if dlsa.Location != nil {
   108  		objectMap["location"] = dlsa.Location
   109  	}
   110  	if dlsa.Name != nil {
   111  		objectMap["name"] = dlsa.Name
   112  	}
   113  	if dlsa.Identity != nil {
   114  		objectMap["identity"] = dlsa.Identity
   115  	}
   116  	if dlsa.Tags != nil {
   117  		objectMap["tags"] = dlsa.Tags
   118  	}
   119  	if dlsa.Properties != nil {
   120  		objectMap["properties"] = dlsa.Properties
   121  	}
   122  	return json.Marshal(objectMap)
   123  }
   124  
   125  // DataLakeStoreAccountListResult data Lake Store account list information response.
   126  type DataLakeStoreAccountListResult struct {
   127  	autorest.Response `json:"-"`
   128  	// Value - READ-ONLY; the results of the list operation
   129  	Value *[]DataLakeStoreAccount `json:"value,omitempty"`
   130  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   131  	NextLink *string `json:"nextLink,omitempty"`
   132  	// Count - READ-ONLY; the total count of results that are available, but might not be returned in the current page.
   133  	Count *int64 `json:"count,omitempty"`
   134  }
   135  
   136  // MarshalJSON is the custom marshaler for DataLakeStoreAccountListResult.
   137  func (dlsalr DataLakeStoreAccountListResult) MarshalJSON() ([]byte, error) {
   138  	objectMap := make(map[string]interface{})
   139  	return json.Marshal(objectMap)
   140  }
   141  
   142  // DataLakeStoreAccountListResultIterator provides access to a complete listing of DataLakeStoreAccount
   143  // values.
   144  type DataLakeStoreAccountListResultIterator struct {
   145  	i    int
   146  	page DataLakeStoreAccountListResultPage
   147  }
   148  
   149  // NextWithContext advances to the next value.  If there was an error making
   150  // the request the iterator does not advance and the error is returned.
   151  func (iter *DataLakeStoreAccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
   152  	if tracing.IsEnabled() {
   153  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeStoreAccountListResultIterator.NextWithContext")
   154  		defer func() {
   155  			sc := -1
   156  			if iter.Response().Response.Response != nil {
   157  				sc = iter.Response().Response.Response.StatusCode
   158  			}
   159  			tracing.EndSpan(ctx, sc, err)
   160  		}()
   161  	}
   162  	iter.i++
   163  	if iter.i < len(iter.page.Values()) {
   164  		return nil
   165  	}
   166  	err = iter.page.NextWithContext(ctx)
   167  	if err != nil {
   168  		iter.i--
   169  		return err
   170  	}
   171  	iter.i = 0
   172  	return nil
   173  }
   174  
   175  // Next advances to the next value.  If there was an error making
   176  // the request the iterator does not advance and the error is returned.
   177  // Deprecated: Use NextWithContext() instead.
   178  func (iter *DataLakeStoreAccountListResultIterator) Next() error {
   179  	return iter.NextWithContext(context.Background())
   180  }
   181  
   182  // NotDone returns true if the enumeration should be started or is not yet complete.
   183  func (iter DataLakeStoreAccountListResultIterator) NotDone() bool {
   184  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   185  }
   186  
   187  // Response returns the raw server response from the last page request.
   188  func (iter DataLakeStoreAccountListResultIterator) Response() DataLakeStoreAccountListResult {
   189  	return iter.page.Response()
   190  }
   191  
   192  // Value returns the current value or a zero-initialized value if the
   193  // iterator has advanced beyond the end of the collection.
   194  func (iter DataLakeStoreAccountListResultIterator) Value() DataLakeStoreAccount {
   195  	if !iter.page.NotDone() {
   196  		return DataLakeStoreAccount{}
   197  	}
   198  	return iter.page.Values()[iter.i]
   199  }
   200  
   201  // Creates a new instance of the DataLakeStoreAccountListResultIterator type.
   202  func NewDataLakeStoreAccountListResultIterator(page DataLakeStoreAccountListResultPage) DataLakeStoreAccountListResultIterator {
   203  	return DataLakeStoreAccountListResultIterator{page: page}
   204  }
   205  
   206  // IsEmpty returns true if the ListResult contains no values.
   207  func (dlsalr DataLakeStoreAccountListResult) IsEmpty() bool {
   208  	return dlsalr.Value == nil || len(*dlsalr.Value) == 0
   209  }
   210  
   211  // hasNextLink returns true if the NextLink is not empty.
   212  func (dlsalr DataLakeStoreAccountListResult) hasNextLink() bool {
   213  	return dlsalr.NextLink != nil && len(*dlsalr.NextLink) != 0
   214  }
   215  
   216  // dataLakeStoreAccountListResultPreparer prepares a request to retrieve the next set of results.
   217  // It returns nil if no more results exist.
   218  func (dlsalr DataLakeStoreAccountListResult) dataLakeStoreAccountListResultPreparer(ctx context.Context) (*http.Request, error) {
   219  	if !dlsalr.hasNextLink() {
   220  		return nil, nil
   221  	}
   222  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   223  		autorest.AsJSON(),
   224  		autorest.AsGet(),
   225  		autorest.WithBaseURL(to.String(dlsalr.NextLink)))
   226  }
   227  
   228  // DataLakeStoreAccountListResultPage contains a page of DataLakeStoreAccount values.
   229  type DataLakeStoreAccountListResultPage struct {
   230  	fn     func(context.Context, DataLakeStoreAccountListResult) (DataLakeStoreAccountListResult, error)
   231  	dlsalr DataLakeStoreAccountListResult
   232  }
   233  
   234  // NextWithContext advances to the next page of values.  If there was an error making
   235  // the request the page does not advance and the error is returned.
   236  func (page *DataLakeStoreAccountListResultPage) NextWithContext(ctx context.Context) (err error) {
   237  	if tracing.IsEnabled() {
   238  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeStoreAccountListResultPage.NextWithContext")
   239  		defer func() {
   240  			sc := -1
   241  			if page.Response().Response.Response != nil {
   242  				sc = page.Response().Response.Response.StatusCode
   243  			}
   244  			tracing.EndSpan(ctx, sc, err)
   245  		}()
   246  	}
   247  	for {
   248  		next, err := page.fn(ctx, page.dlsalr)
   249  		if err != nil {
   250  			return err
   251  		}
   252  		page.dlsalr = next
   253  		if !next.hasNextLink() || !next.IsEmpty() {
   254  			break
   255  		}
   256  	}
   257  	return nil
   258  }
   259  
   260  // Next advances to the next page of values.  If there was an error making
   261  // the request the page does not advance and the error is returned.
   262  // Deprecated: Use NextWithContext() instead.
   263  func (page *DataLakeStoreAccountListResultPage) Next() error {
   264  	return page.NextWithContext(context.Background())
   265  }
   266  
   267  // NotDone returns true if the page enumeration should be started or is not yet complete.
   268  func (page DataLakeStoreAccountListResultPage) NotDone() bool {
   269  	return !page.dlsalr.IsEmpty()
   270  }
   271  
   272  // Response returns the raw server response from the last page request.
   273  func (page DataLakeStoreAccountListResultPage) Response() DataLakeStoreAccountListResult {
   274  	return page.dlsalr
   275  }
   276  
   277  // Values returns the slice of values for the current page or nil if there are no values.
   278  func (page DataLakeStoreAccountListResultPage) Values() []DataLakeStoreAccount {
   279  	if page.dlsalr.IsEmpty() {
   280  		return nil
   281  	}
   282  	return *page.dlsalr.Value
   283  }
   284  
   285  // Creates a new instance of the DataLakeStoreAccountListResultPage type.
   286  func NewDataLakeStoreAccountListResultPage(cur DataLakeStoreAccountListResult, getNextPage func(context.Context, DataLakeStoreAccountListResult) (DataLakeStoreAccountListResult, error)) DataLakeStoreAccountListResultPage {
   287  	return DataLakeStoreAccountListResultPage{
   288  		fn:     getNextPage,
   289  		dlsalr: cur,
   290  	}
   291  }
   292  
   293  // DataLakeStoreAccountProperties data Lake Store account properties information
   294  type DataLakeStoreAccountProperties struct {
   295  	// ProvisioningState - READ-ONLY; the status of the Data Lake Store account while being provisioned. Possible values include: 'Failed', 'Creating', 'Running', 'Succeeded', 'Patching', 'Suspending', 'Resuming', 'Deleting', 'Deleted'
   296  	ProvisioningState DataLakeStoreAccountStatus `json:"provisioningState,omitempty"`
   297  	// State - READ-ONLY; the status of the Data Lake Store account after provisioning has completed. Possible values include: 'Active', 'Suspended'
   298  	State DataLakeStoreAccountState `json:"state,omitempty"`
   299  	// CreationTime - READ-ONLY; the account creation time.
   300  	CreationTime *date.Time `json:"creationTime,omitempty"`
   301  	// EncryptionState - The current state of encryption for this Data Lake store account. Possible values include: 'Enabled', 'Disabled'
   302  	EncryptionState EncryptionState `json:"encryptionState,omitempty"`
   303  	// EncryptionProvisioningState - READ-ONLY; The current state of encryption provisioning for this Data Lake store account. Possible values include: 'EncryptionProvisioningStateCreating', 'EncryptionProvisioningStateSucceeded'
   304  	EncryptionProvisioningState EncryptionProvisioningState `json:"encryptionProvisioningState,omitempty"`
   305  	// EncryptionConfig - The Key vault encryption configuration.
   306  	EncryptionConfig *EncryptionConfig `json:"encryptionConfig,omitempty"`
   307  	// LastModifiedTime - READ-ONLY; the account last modified time.
   308  	LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
   309  	// Endpoint - the gateway host.
   310  	Endpoint *string `json:"endpoint,omitempty"`
   311  	// DefaultGroup - the default owner group for all new folders and files created in the Data Lake Store account.
   312  	DefaultGroup *string `json:"defaultGroup,omitempty"`
   313  }
   314  
   315  // MarshalJSON is the custom marshaler for DataLakeStoreAccountProperties.
   316  func (dlsap DataLakeStoreAccountProperties) MarshalJSON() ([]byte, error) {
   317  	objectMap := make(map[string]interface{})
   318  	if dlsap.EncryptionState != "" {
   319  		objectMap["encryptionState"] = dlsap.EncryptionState
   320  	}
   321  	if dlsap.EncryptionConfig != nil {
   322  		objectMap["encryptionConfig"] = dlsap.EncryptionConfig
   323  	}
   324  	if dlsap.Endpoint != nil {
   325  		objectMap["endpoint"] = dlsap.Endpoint
   326  	}
   327  	if dlsap.DefaultGroup != nil {
   328  		objectMap["defaultGroup"] = dlsap.DefaultGroup
   329  	}
   330  	return json.Marshal(objectMap)
   331  }
   332  
   333  // DataLakeStoreFirewallRuleListResult data Lake Store firewall rule list information.
   334  type DataLakeStoreFirewallRuleListResult struct {
   335  	autorest.Response `json:"-"`
   336  	// Value - READ-ONLY; the results of the list operation
   337  	Value *[]FirewallRule `json:"value,omitempty"`
   338  	// NextLink - READ-ONLY; the link (url) to the next page of results.
   339  	NextLink *string `json:"nextLink,omitempty"`
   340  	// Count - READ-ONLY; the total count of results that are available, but might not be returned in the current page.
   341  	Count *int64 `json:"count,omitempty"`
   342  }
   343  
   344  // MarshalJSON is the custom marshaler for DataLakeStoreFirewallRuleListResult.
   345  func (dlsfrlr DataLakeStoreFirewallRuleListResult) MarshalJSON() ([]byte, error) {
   346  	objectMap := make(map[string]interface{})
   347  	return json.Marshal(objectMap)
   348  }
   349  
   350  // DataLakeStoreFirewallRuleListResultIterator provides access to a complete listing of FirewallRule
   351  // values.
   352  type DataLakeStoreFirewallRuleListResultIterator struct {
   353  	i    int
   354  	page DataLakeStoreFirewallRuleListResultPage
   355  }
   356  
   357  // NextWithContext advances to the next value.  If there was an error making
   358  // the request the iterator does not advance and the error is returned.
   359  func (iter *DataLakeStoreFirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
   360  	if tracing.IsEnabled() {
   361  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeStoreFirewallRuleListResultIterator.NextWithContext")
   362  		defer func() {
   363  			sc := -1
   364  			if iter.Response().Response.Response != nil {
   365  				sc = iter.Response().Response.Response.StatusCode
   366  			}
   367  			tracing.EndSpan(ctx, sc, err)
   368  		}()
   369  	}
   370  	iter.i++
   371  	if iter.i < len(iter.page.Values()) {
   372  		return nil
   373  	}
   374  	err = iter.page.NextWithContext(ctx)
   375  	if err != nil {
   376  		iter.i--
   377  		return err
   378  	}
   379  	iter.i = 0
   380  	return nil
   381  }
   382  
   383  // Next advances to the next value.  If there was an error making
   384  // the request the iterator does not advance and the error is returned.
   385  // Deprecated: Use NextWithContext() instead.
   386  func (iter *DataLakeStoreFirewallRuleListResultIterator) Next() error {
   387  	return iter.NextWithContext(context.Background())
   388  }
   389  
   390  // NotDone returns true if the enumeration should be started or is not yet complete.
   391  func (iter DataLakeStoreFirewallRuleListResultIterator) NotDone() bool {
   392  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   393  }
   394  
   395  // Response returns the raw server response from the last page request.
   396  func (iter DataLakeStoreFirewallRuleListResultIterator) Response() DataLakeStoreFirewallRuleListResult {
   397  	return iter.page.Response()
   398  }
   399  
   400  // Value returns the current value or a zero-initialized value if the
   401  // iterator has advanced beyond the end of the collection.
   402  func (iter DataLakeStoreFirewallRuleListResultIterator) Value() FirewallRule {
   403  	if !iter.page.NotDone() {
   404  		return FirewallRule{}
   405  	}
   406  	return iter.page.Values()[iter.i]
   407  }
   408  
   409  // Creates a new instance of the DataLakeStoreFirewallRuleListResultIterator type.
   410  func NewDataLakeStoreFirewallRuleListResultIterator(page DataLakeStoreFirewallRuleListResultPage) DataLakeStoreFirewallRuleListResultIterator {
   411  	return DataLakeStoreFirewallRuleListResultIterator{page: page}
   412  }
   413  
   414  // IsEmpty returns true if the ListResult contains no values.
   415  func (dlsfrlr DataLakeStoreFirewallRuleListResult) IsEmpty() bool {
   416  	return dlsfrlr.Value == nil || len(*dlsfrlr.Value) == 0
   417  }
   418  
   419  // hasNextLink returns true if the NextLink is not empty.
   420  func (dlsfrlr DataLakeStoreFirewallRuleListResult) hasNextLink() bool {
   421  	return dlsfrlr.NextLink != nil && len(*dlsfrlr.NextLink) != 0
   422  }
   423  
   424  // dataLakeStoreFirewallRuleListResultPreparer prepares a request to retrieve the next set of results.
   425  // It returns nil if no more results exist.
   426  func (dlsfrlr DataLakeStoreFirewallRuleListResult) dataLakeStoreFirewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
   427  	if !dlsfrlr.hasNextLink() {
   428  		return nil, nil
   429  	}
   430  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   431  		autorest.AsJSON(),
   432  		autorest.AsGet(),
   433  		autorest.WithBaseURL(to.String(dlsfrlr.NextLink)))
   434  }
   435  
   436  // DataLakeStoreFirewallRuleListResultPage contains a page of FirewallRule values.
   437  type DataLakeStoreFirewallRuleListResultPage struct {
   438  	fn      func(context.Context, DataLakeStoreFirewallRuleListResult) (DataLakeStoreFirewallRuleListResult, error)
   439  	dlsfrlr DataLakeStoreFirewallRuleListResult
   440  }
   441  
   442  // NextWithContext advances to the next page of values.  If there was an error making
   443  // the request the page does not advance and the error is returned.
   444  func (page *DataLakeStoreFirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
   445  	if tracing.IsEnabled() {
   446  		ctx = tracing.StartSpan(ctx, fqdn+"/DataLakeStoreFirewallRuleListResultPage.NextWithContext")
   447  		defer func() {
   448  			sc := -1
   449  			if page.Response().Response.Response != nil {
   450  				sc = page.Response().Response.Response.StatusCode
   451  			}
   452  			tracing.EndSpan(ctx, sc, err)
   453  		}()
   454  	}
   455  	for {
   456  		next, err := page.fn(ctx, page.dlsfrlr)
   457  		if err != nil {
   458  			return err
   459  		}
   460  		page.dlsfrlr = next
   461  		if !next.hasNextLink() || !next.IsEmpty() {
   462  			break
   463  		}
   464  	}
   465  	return nil
   466  }
   467  
   468  // Next advances to the next page of values.  If there was an error making
   469  // the request the page does not advance and the error is returned.
   470  // Deprecated: Use NextWithContext() instead.
   471  func (page *DataLakeStoreFirewallRuleListResultPage) Next() error {
   472  	return page.NextWithContext(context.Background())
   473  }
   474  
   475  // NotDone returns true if the page enumeration should be started or is not yet complete.
   476  func (page DataLakeStoreFirewallRuleListResultPage) NotDone() bool {
   477  	return !page.dlsfrlr.IsEmpty()
   478  }
   479  
   480  // Response returns the raw server response from the last page request.
   481  func (page DataLakeStoreFirewallRuleListResultPage) Response() DataLakeStoreFirewallRuleListResult {
   482  	return page.dlsfrlr
   483  }
   484  
   485  // Values returns the slice of values for the current page or nil if there are no values.
   486  func (page DataLakeStoreFirewallRuleListResultPage) Values() []FirewallRule {
   487  	if page.dlsfrlr.IsEmpty() {
   488  		return nil
   489  	}
   490  	return *page.dlsfrlr.Value
   491  }
   492  
   493  // Creates a new instance of the DataLakeStoreFirewallRuleListResultPage type.
   494  func NewDataLakeStoreFirewallRuleListResultPage(cur DataLakeStoreFirewallRuleListResult, getNextPage func(context.Context, DataLakeStoreFirewallRuleListResult) (DataLakeStoreFirewallRuleListResult, error)) DataLakeStoreFirewallRuleListResultPage {
   495  	return DataLakeStoreFirewallRuleListResultPage{
   496  		fn:      getNextPage,
   497  		dlsfrlr: cur,
   498  	}
   499  }
   500  
   501  // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
   502  type DeleteFuture struct {
   503  	azure.FutureAPI
   504  	// Result returns the result of the asynchronous operation.
   505  	// If the operation has not completed it will return an error.
   506  	Result func(Client) (autorest.Response, error)
   507  }
   508  
   509  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   510  func (future *DeleteFuture) UnmarshalJSON(body []byte) error {
   511  	var azFuture azure.Future
   512  	if err := json.Unmarshal(body, &azFuture); err != nil {
   513  		return err
   514  	}
   515  	future.FutureAPI = &azFuture
   516  	future.Result = future.result
   517  	return nil
   518  }
   519  
   520  // result is the default implementation for DeleteFuture.Result.
   521  func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) {
   522  	var done bool
   523  	done, err = future.DoneWithContext(context.Background(), client)
   524  	if err != nil {
   525  		err = autorest.NewErrorWithError(err, "account.DeleteFuture", "Result", future.Response(), "Polling failure")
   526  		return
   527  	}
   528  	if !done {
   529  		ar.Response = future.Response()
   530  		err = azure.NewAsyncOpIncompleteError("account.DeleteFuture")
   531  		return
   532  	}
   533  	ar.Response = future.Response()
   534  	return
   535  }
   536  
   537  // EncryptionConfig ...
   538  type EncryptionConfig struct {
   539  	// Type - The type of encryption configuration being used. Currently the only supported types are 'UserManaged' and 'ServiceManaged'. Possible values include: 'UserManaged', 'ServiceManaged'
   540  	Type EncryptionConfigType `json:"type,omitempty"`
   541  	// KeyVaultMetaInfo - The Key vault information for connecting to user managed encryption keys.
   542  	KeyVaultMetaInfo *KeyVaultMetaInfo `json:"keyVaultMetaInfo,omitempty"`
   543  }
   544  
   545  // EncryptionIdentity ...
   546  type EncryptionIdentity struct {
   547  	// Type - The type of encryption being used. Currently the only supported type is 'SystemAssigned'. Possible values include: 'SystemAssigned'
   548  	Type EncryptionIdentityType `json:"type,omitempty"`
   549  	// PrincipalID - READ-ONLY; The principal identifier associated with the encryption.
   550  	PrincipalID *uuid.UUID `json:"principalId,omitempty"`
   551  	// TenantID - READ-ONLY; The tenant identifier associated with the encryption.
   552  	TenantID *uuid.UUID `json:"tenantId,omitempty"`
   553  }
   554  
   555  // MarshalJSON is the custom marshaler for EncryptionIdentity.
   556  func (ei EncryptionIdentity) MarshalJSON() ([]byte, error) {
   557  	objectMap := make(map[string]interface{})
   558  	if ei.Type != "" {
   559  		objectMap["type"] = ei.Type
   560  	}
   561  	return json.Marshal(objectMap)
   562  }
   563  
   564  // Error data Lake Store error information
   565  type Error struct {
   566  	// Code - READ-ONLY; the HTTP status code or error code associated with this error
   567  	Code *string `json:"code,omitempty"`
   568  	// Message - READ-ONLY; the error message to display.
   569  	Message *string `json:"message,omitempty"`
   570  	// Target - READ-ONLY; the target of the error.
   571  	Target *string `json:"target,omitempty"`
   572  	// Details - READ-ONLY; the list of error details
   573  	Details *[]ErrorDetails `json:"details,omitempty"`
   574  	// InnerError - READ-ONLY; the inner exceptions or errors, if any
   575  	InnerError *InnerError `json:"innerError,omitempty"`
   576  }
   577  
   578  // MarshalJSON is the custom marshaler for Error.
   579  func (e Error) MarshalJSON() ([]byte, error) {
   580  	objectMap := make(map[string]interface{})
   581  	return json.Marshal(objectMap)
   582  }
   583  
   584  // ErrorDetails data Lake Store error details information
   585  type ErrorDetails struct {
   586  	// Code - READ-ONLY; the HTTP status code or error code associated with this error
   587  	Code *string `json:"code,omitempty"`
   588  	// Message - READ-ONLY; the error message localized based on Accept-Language
   589  	Message *string `json:"message,omitempty"`
   590  	// Target - READ-ONLY; the target of the particular error (for example, the name of the property in error).
   591  	Target *string `json:"target,omitempty"`
   592  }
   593  
   594  // MarshalJSON is the custom marshaler for ErrorDetails.
   595  func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
   596  	objectMap := make(map[string]interface{})
   597  	return json.Marshal(objectMap)
   598  }
   599  
   600  // FirewallRule data Lake Store firewall rule information
   601  type FirewallRule struct {
   602  	autorest.Response `json:"-"`
   603  	// Name - the firewall rule's name.
   604  	Name *string `json:"name,omitempty"`
   605  	// Type - READ-ONLY; the namespace and type of the firewall Rule.
   606  	Type *string `json:"type,omitempty"`
   607  	// ID - the firewall rule's subscription ID.
   608  	ID *string `json:"id,omitempty"`
   609  	// Location - the firewall rule's regional location.
   610  	Location *string `json:"location,omitempty"`
   611  	// Properties - the properties of the firewall rule.
   612  	Properties *FirewallRuleProperties `json:"properties,omitempty"`
   613  }
   614  
   615  // MarshalJSON is the custom marshaler for FirewallRule.
   616  func (fr FirewallRule) MarshalJSON() ([]byte, error) {
   617  	objectMap := make(map[string]interface{})
   618  	if fr.Name != nil {
   619  		objectMap["name"] = fr.Name
   620  	}
   621  	if fr.ID != nil {
   622  		objectMap["id"] = fr.ID
   623  	}
   624  	if fr.Location != nil {
   625  		objectMap["location"] = fr.Location
   626  	}
   627  	if fr.Properties != nil {
   628  		objectMap["properties"] = fr.Properties
   629  	}
   630  	return json.Marshal(objectMap)
   631  }
   632  
   633  // FirewallRuleProperties data Lake Store firewall rule properties information
   634  type FirewallRuleProperties struct {
   635  	// StartIPAddress - the start IP address for the firewall rule.
   636  	StartIPAddress *string `json:"startIpAddress,omitempty"`
   637  	// EndIPAddress - the end IP address for the firewall rule.
   638  	EndIPAddress *string `json:"endIpAddress,omitempty"`
   639  }
   640  
   641  // InnerError data Lake Store inner error information
   642  type InnerError struct {
   643  	// Trace - READ-ONLY; the stack trace for the error
   644  	Trace *string `json:"trace,omitempty"`
   645  	// Context - READ-ONLY; the context for the error message
   646  	Context *string `json:"context,omitempty"`
   647  }
   648  
   649  // MarshalJSON is the custom marshaler for InnerError.
   650  func (ie InnerError) MarshalJSON() ([]byte, error) {
   651  	objectMap := make(map[string]interface{})
   652  	return json.Marshal(objectMap)
   653  }
   654  
   655  // KeyVaultMetaInfo ...
   656  type KeyVaultMetaInfo struct {
   657  	// KeyVaultResourceID - The resource identifier for the user managed Key Vault being used to encrypt.
   658  	KeyVaultResourceID *string `json:"keyVaultResourceId,omitempty"`
   659  	// EncryptionKeyName - The name of the user managed encryption key.
   660  	EncryptionKeyName *string `json:"encryptionKeyName,omitempty"`
   661  	// EncryptionKeyVersion - The version of the user managed encryption key.
   662  	EncryptionKeyVersion *string `json:"encryptionKeyVersion,omitempty"`
   663  }
   664  
   665  // UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
   666  type UpdateFuture struct {
   667  	azure.FutureAPI
   668  	// Result returns the result of the asynchronous operation.
   669  	// If the operation has not completed it will return an error.
   670  	Result func(Client) (DataLakeStoreAccount, error)
   671  }
   672  
   673  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   674  func (future *UpdateFuture) UnmarshalJSON(body []byte) error {
   675  	var azFuture azure.Future
   676  	if err := json.Unmarshal(body, &azFuture); err != nil {
   677  		return err
   678  	}
   679  	future.FutureAPI = &azFuture
   680  	future.Result = future.result
   681  	return nil
   682  }
   683  
   684  // result is the default implementation for UpdateFuture.Result.
   685  func (future *UpdateFuture) result(client Client) (dlsa DataLakeStoreAccount, err error) {
   686  	var done bool
   687  	done, err = future.DoneWithContext(context.Background(), client)
   688  	if err != nil {
   689  		err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", future.Response(), "Polling failure")
   690  		return
   691  	}
   692  	if !done {
   693  		dlsa.Response.Response = future.Response()
   694  		err = azure.NewAsyncOpIncompleteError("account.UpdateFuture")
   695  		return
   696  	}
   697  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   698  	if dlsa.Response.Response, err = future.GetResult(sender); err == nil && dlsa.Response.Response.StatusCode != http.StatusNoContent {
   699  		dlsa, err = client.UpdateResponder(dlsa.Response.Response)
   700  		if err != nil {
   701  			err = autorest.NewErrorWithError(err, "account.UpdateFuture", "Result", dlsa.Response.Response, "Failure responding to request")
   702  		}
   703  	}
   704  	return
   705  }
   706  

View as plain text