...

Source file src/github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2017-08-01/analysisservices/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2017-08-01/analysisservices

     1  package analysisservices
     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/to"
    15  	"github.com/Azure/go-autorest/tracing"
    16  	"net/http"
    17  )
    18  
    19  // The package's fully qualified name.
    20  const fqdn = "github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2017-08-01/analysisservices"
    21  
    22  // CheckServerNameAvailabilityParameters details of server name request body.
    23  type CheckServerNameAvailabilityParameters struct {
    24  	// Name - Name for checking availability.
    25  	Name *string `json:"name,omitempty"`
    26  	// Type - The resource type of azure analysis services.
    27  	Type *string `json:"type,omitempty"`
    28  }
    29  
    30  // CheckServerNameAvailabilityResult the checking result of server name availability.
    31  type CheckServerNameAvailabilityResult struct {
    32  	autorest.Response `json:"-"`
    33  	// NameAvailable - Indicator of available of the server name.
    34  	NameAvailable *bool `json:"nameAvailable,omitempty"`
    35  	// Reason - The reason of unavailability.
    36  	Reason *string `json:"reason,omitempty"`
    37  	// Message - The detailed message of the request unavailability.
    38  	Message *string `json:"message,omitempty"`
    39  }
    40  
    41  // ErrorResponse describes the format of Error response.
    42  type ErrorResponse struct {
    43  	// Code - Error code
    44  	Code *string `json:"code,omitempty"`
    45  	// Message - Error message indicating why the operation failed.
    46  	Message *string `json:"message,omitempty"`
    47  }
    48  
    49  // GatewayDetails the gateway details.
    50  type GatewayDetails struct {
    51  	// GatewayResourceID - Gateway resource to be associated with the server.
    52  	GatewayResourceID *string `json:"gatewayResourceId,omitempty"`
    53  	// GatewayObjectID - READ-ONLY; Gateway object id from in the DMTS cluster for the gateway resource.
    54  	GatewayObjectID *string `json:"gatewayObjectId,omitempty"`
    55  	// DmtsClusterURI - READ-ONLY; Uri of the DMTS cluster.
    56  	DmtsClusterURI *string `json:"dmtsClusterUri,omitempty"`
    57  }
    58  
    59  // MarshalJSON is the custom marshaler for GatewayDetails.
    60  func (gd GatewayDetails) MarshalJSON() ([]byte, error) {
    61  	objectMap := make(map[string]interface{})
    62  	if gd.GatewayResourceID != nil {
    63  		objectMap["gatewayResourceId"] = gd.GatewayResourceID
    64  	}
    65  	return json.Marshal(objectMap)
    66  }
    67  
    68  // GatewayError detail of gateway errors.
    69  type GatewayError struct {
    70  	// Code - Error code of list gateway.
    71  	Code *string `json:"code,omitempty"`
    72  	// Message - Error message of list gateway.
    73  	Message *string `json:"message,omitempty"`
    74  }
    75  
    76  // GatewayListStatusError status of gateway is error.
    77  type GatewayListStatusError struct {
    78  	// Error - Error of the list gateway status.
    79  	Error *GatewayError `json:"error,omitempty"`
    80  }
    81  
    82  // GatewayListStatusLive status of gateway is live.
    83  type GatewayListStatusLive struct {
    84  	autorest.Response `json:"-"`
    85  	// Status - Live message of list gateway. Possible values include: 'Live'
    86  	Status Status `json:"status,omitempty"`
    87  }
    88  
    89  // IPv4FirewallRule the detail of firewall rule.
    90  type IPv4FirewallRule struct {
    91  	// FirewallRuleName - The rule name.
    92  	FirewallRuleName *string `json:"firewallRuleName,omitempty"`
    93  	// RangeStart - The start range of IPv4.
    94  	RangeStart *string `json:"rangeStart,omitempty"`
    95  	// RangeEnd - The end range of IPv4.
    96  	RangeEnd *string `json:"rangeEnd,omitempty"`
    97  }
    98  
    99  // IPv4FirewallSettings an array of firewall rules.
   100  type IPv4FirewallSettings struct {
   101  	// FirewallRules - An array of firewall rules.
   102  	FirewallRules *[]IPv4FirewallRule `json:"firewallRules,omitempty"`
   103  	// EnablePowerBIService - The indicator of enabling PBI service.
   104  	EnablePowerBIService *bool `json:"enablePowerBIService,omitempty"`
   105  }
   106  
   107  // Operation a Consumption REST API operation.
   108  type Operation struct {
   109  	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
   110  	Name *string `json:"name,omitempty"`
   111  	// Display - The object that represents the operation.
   112  	Display *OperationDisplay `json:"display,omitempty"`
   113  }
   114  
   115  // MarshalJSON is the custom marshaler for Operation.
   116  func (o Operation) MarshalJSON() ([]byte, error) {
   117  	objectMap := make(map[string]interface{})
   118  	if o.Display != nil {
   119  		objectMap["display"] = o.Display
   120  	}
   121  	return json.Marshal(objectMap)
   122  }
   123  
   124  // OperationDisplay the object that represents the operation.
   125  type OperationDisplay struct {
   126  	// Provider - READ-ONLY; Service provider: Microsoft.Consumption.
   127  	Provider *string `json:"provider,omitempty"`
   128  	// Resource - READ-ONLY; Resource on which the operation is performed: UsageDetail, etc.
   129  	Resource *string `json:"resource,omitempty"`
   130  	// Operation - READ-ONLY; Operation type: Read, write, delete, etc.
   131  	Operation *string `json:"operation,omitempty"`
   132  }
   133  
   134  // MarshalJSON is the custom marshaler for OperationDisplay.
   135  func (o OperationDisplay) MarshalJSON() ([]byte, error) {
   136  	objectMap := make(map[string]interface{})
   137  	return json.Marshal(objectMap)
   138  }
   139  
   140  // OperationListResult result of listing consumption operations. It contains a list of operations and a URL
   141  // link to get the next set of results.
   142  type OperationListResult struct {
   143  	autorest.Response `json:"-"`
   144  	// Value - READ-ONLY; List of analysis services operations supported by the Microsoft.AnalysisServices resource provider.
   145  	Value *[]Operation `json:"value,omitempty"`
   146  	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
   147  	NextLink *string `json:"nextLink,omitempty"`
   148  }
   149  
   150  // MarshalJSON is the custom marshaler for OperationListResult.
   151  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
   152  	objectMap := make(map[string]interface{})
   153  	return json.Marshal(objectMap)
   154  }
   155  
   156  // OperationListResultIterator provides access to a complete listing of Operation values.
   157  type OperationListResultIterator struct {
   158  	i    int
   159  	page OperationListResultPage
   160  }
   161  
   162  // NextWithContext advances to the next value.  If there was an error making
   163  // the request the iterator does not advance and the error is returned.
   164  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   165  	if tracing.IsEnabled() {
   166  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
   167  		defer func() {
   168  			sc := -1
   169  			if iter.Response().Response.Response != nil {
   170  				sc = iter.Response().Response.Response.StatusCode
   171  			}
   172  			tracing.EndSpan(ctx, sc, err)
   173  		}()
   174  	}
   175  	iter.i++
   176  	if iter.i < len(iter.page.Values()) {
   177  		return nil
   178  	}
   179  	err = iter.page.NextWithContext(ctx)
   180  	if err != nil {
   181  		iter.i--
   182  		return err
   183  	}
   184  	iter.i = 0
   185  	return nil
   186  }
   187  
   188  // Next advances to the next value.  If there was an error making
   189  // the request the iterator does not advance and the error is returned.
   190  // Deprecated: Use NextWithContext() instead.
   191  func (iter *OperationListResultIterator) Next() error {
   192  	return iter.NextWithContext(context.Background())
   193  }
   194  
   195  // NotDone returns true if the enumeration should be started or is not yet complete.
   196  func (iter OperationListResultIterator) NotDone() bool {
   197  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   198  }
   199  
   200  // Response returns the raw server response from the last page request.
   201  func (iter OperationListResultIterator) Response() OperationListResult {
   202  	return iter.page.Response()
   203  }
   204  
   205  // Value returns the current value or a zero-initialized value if the
   206  // iterator has advanced beyond the end of the collection.
   207  func (iter OperationListResultIterator) Value() Operation {
   208  	if !iter.page.NotDone() {
   209  		return Operation{}
   210  	}
   211  	return iter.page.Values()[iter.i]
   212  }
   213  
   214  // Creates a new instance of the OperationListResultIterator type.
   215  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
   216  	return OperationListResultIterator{page: page}
   217  }
   218  
   219  // IsEmpty returns true if the ListResult contains no values.
   220  func (olr OperationListResult) IsEmpty() bool {
   221  	return olr.Value == nil || len(*olr.Value) == 0
   222  }
   223  
   224  // hasNextLink returns true if the NextLink is not empty.
   225  func (olr OperationListResult) hasNextLink() bool {
   226  	return olr.NextLink != nil && len(*olr.NextLink) != 0
   227  }
   228  
   229  // operationListResultPreparer prepares a request to retrieve the next set of results.
   230  // It returns nil if no more results exist.
   231  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
   232  	if !olr.hasNextLink() {
   233  		return nil, nil
   234  	}
   235  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   236  		autorest.AsJSON(),
   237  		autorest.AsGet(),
   238  		autorest.WithBaseURL(to.String(olr.NextLink)))
   239  }
   240  
   241  // OperationListResultPage contains a page of Operation values.
   242  type OperationListResultPage struct {
   243  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
   244  	olr OperationListResult
   245  }
   246  
   247  // NextWithContext advances to the next page of values.  If there was an error making
   248  // the request the page does not advance and the error is returned.
   249  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
   250  	if tracing.IsEnabled() {
   251  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
   252  		defer func() {
   253  			sc := -1
   254  			if page.Response().Response.Response != nil {
   255  				sc = page.Response().Response.Response.StatusCode
   256  			}
   257  			tracing.EndSpan(ctx, sc, err)
   258  		}()
   259  	}
   260  	for {
   261  		next, err := page.fn(ctx, page.olr)
   262  		if err != nil {
   263  			return err
   264  		}
   265  		page.olr = next
   266  		if !next.hasNextLink() || !next.IsEmpty() {
   267  			break
   268  		}
   269  	}
   270  	return nil
   271  }
   272  
   273  // Next advances to the next page of values.  If there was an error making
   274  // the request the page does not advance and the error is returned.
   275  // Deprecated: Use NextWithContext() instead.
   276  func (page *OperationListResultPage) Next() error {
   277  	return page.NextWithContext(context.Background())
   278  }
   279  
   280  // NotDone returns true if the page enumeration should be started or is not yet complete.
   281  func (page OperationListResultPage) NotDone() bool {
   282  	return !page.olr.IsEmpty()
   283  }
   284  
   285  // Response returns the raw server response from the last page request.
   286  func (page OperationListResultPage) Response() OperationListResult {
   287  	return page.olr
   288  }
   289  
   290  // Values returns the slice of values for the current page or nil if there are no values.
   291  func (page OperationListResultPage) Values() []Operation {
   292  	if page.olr.IsEmpty() {
   293  		return nil
   294  	}
   295  	return *page.olr.Value
   296  }
   297  
   298  // Creates a new instance of the OperationListResultPage type.
   299  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
   300  	return OperationListResultPage{
   301  		fn:  getNextPage,
   302  		olr: cur,
   303  	}
   304  }
   305  
   306  // OperationStatus the status of operation.
   307  type OperationStatus struct {
   308  	autorest.Response `json:"-"`
   309  	// ID - The operation Id.
   310  	ID *string `json:"id,omitempty"`
   311  	// Name - The operation name.
   312  	Name *string `json:"name,omitempty"`
   313  	// StartTime - The start time of the operation.
   314  	StartTime *string `json:"startTime,omitempty"`
   315  	// EndTime - The end time of the operation.
   316  	EndTime *string `json:"endTime,omitempty"`
   317  	// Status - The status of the operation.
   318  	Status *string `json:"status,omitempty"`
   319  	// Error - The error detail of the operation if any.
   320  	Error *ErrorResponse `json:"error,omitempty"`
   321  }
   322  
   323  // Resource represents an instance of an Analysis Services resource.
   324  type Resource struct {
   325  	// ID - READ-ONLY; An identifier that represents the Analysis Services resource.
   326  	ID *string `json:"id,omitempty"`
   327  	// Name - READ-ONLY; The name of the Analysis Services resource.
   328  	Name *string `json:"name,omitempty"`
   329  	// Type - READ-ONLY; The type of the Analysis Services resource.
   330  	Type *string `json:"type,omitempty"`
   331  	// Location - Location of the Analysis Services resource.
   332  	Location *string `json:"location,omitempty"`
   333  	// Sku - The SKU of the Analysis Services resource.
   334  	Sku *ResourceSku `json:"sku,omitempty"`
   335  	// Tags - Key-value pairs of additional resource provisioning properties.
   336  	Tags map[string]*string `json:"tags"`
   337  }
   338  
   339  // MarshalJSON is the custom marshaler for Resource.
   340  func (r Resource) MarshalJSON() ([]byte, error) {
   341  	objectMap := make(map[string]interface{})
   342  	if r.Location != nil {
   343  		objectMap["location"] = r.Location
   344  	}
   345  	if r.Sku != nil {
   346  		objectMap["sku"] = r.Sku
   347  	}
   348  	if r.Tags != nil {
   349  		objectMap["tags"] = r.Tags
   350  	}
   351  	return json.Marshal(objectMap)
   352  }
   353  
   354  // ResourceSku represents the SKU name and Azure pricing tier for Analysis Services resource.
   355  type ResourceSku struct {
   356  	// Name - Name of the SKU level.
   357  	Name *string `json:"name,omitempty"`
   358  	// Tier - The name of the Azure pricing tier to which the SKU applies. Possible values include: 'Development', 'Basic', 'Standard'
   359  	Tier SkuTier `json:"tier,omitempty"`
   360  	// Capacity - The number of instances in the read only query pool.
   361  	Capacity *int32 `json:"capacity,omitempty"`
   362  }
   363  
   364  // Server represents an instance of an Analysis Services resource.
   365  type Server struct {
   366  	autorest.Response `json:"-"`
   367  	// ServerProperties - Properties of the provision operation request.
   368  	*ServerProperties `json:"properties,omitempty"`
   369  	// ID - READ-ONLY; An identifier that represents the Analysis Services resource.
   370  	ID *string `json:"id,omitempty"`
   371  	// Name - READ-ONLY; The name of the Analysis Services resource.
   372  	Name *string `json:"name,omitempty"`
   373  	// Type - READ-ONLY; The type of the Analysis Services resource.
   374  	Type *string `json:"type,omitempty"`
   375  	// Location - Location of the Analysis Services resource.
   376  	Location *string `json:"location,omitempty"`
   377  	// Sku - The SKU of the Analysis Services resource.
   378  	Sku *ResourceSku `json:"sku,omitempty"`
   379  	// Tags - Key-value pairs of additional resource provisioning properties.
   380  	Tags map[string]*string `json:"tags"`
   381  }
   382  
   383  // MarshalJSON is the custom marshaler for Server.
   384  func (s Server) MarshalJSON() ([]byte, error) {
   385  	objectMap := make(map[string]interface{})
   386  	if s.ServerProperties != nil {
   387  		objectMap["properties"] = s.ServerProperties
   388  	}
   389  	if s.Location != nil {
   390  		objectMap["location"] = s.Location
   391  	}
   392  	if s.Sku != nil {
   393  		objectMap["sku"] = s.Sku
   394  	}
   395  	if s.Tags != nil {
   396  		objectMap["tags"] = s.Tags
   397  	}
   398  	return json.Marshal(objectMap)
   399  }
   400  
   401  // UnmarshalJSON is the custom unmarshaler for Server struct.
   402  func (s *Server) UnmarshalJSON(body []byte) error {
   403  	var m map[string]*json.RawMessage
   404  	err := json.Unmarshal(body, &m)
   405  	if err != nil {
   406  		return err
   407  	}
   408  	for k, v := range m {
   409  		switch k {
   410  		case "properties":
   411  			if v != nil {
   412  				var serverProperties ServerProperties
   413  				err = json.Unmarshal(*v, &serverProperties)
   414  				if err != nil {
   415  					return err
   416  				}
   417  				s.ServerProperties = &serverProperties
   418  			}
   419  		case "id":
   420  			if v != nil {
   421  				var ID string
   422  				err = json.Unmarshal(*v, &ID)
   423  				if err != nil {
   424  					return err
   425  				}
   426  				s.ID = &ID
   427  			}
   428  		case "name":
   429  			if v != nil {
   430  				var name string
   431  				err = json.Unmarshal(*v, &name)
   432  				if err != nil {
   433  					return err
   434  				}
   435  				s.Name = &name
   436  			}
   437  		case "type":
   438  			if v != nil {
   439  				var typeVar string
   440  				err = json.Unmarshal(*v, &typeVar)
   441  				if err != nil {
   442  					return err
   443  				}
   444  				s.Type = &typeVar
   445  			}
   446  		case "location":
   447  			if v != nil {
   448  				var location string
   449  				err = json.Unmarshal(*v, &location)
   450  				if err != nil {
   451  					return err
   452  				}
   453  				s.Location = &location
   454  			}
   455  		case "sku":
   456  			if v != nil {
   457  				var sku ResourceSku
   458  				err = json.Unmarshal(*v, &sku)
   459  				if err != nil {
   460  					return err
   461  				}
   462  				s.Sku = &sku
   463  			}
   464  		case "tags":
   465  			if v != nil {
   466  				var tags map[string]*string
   467  				err = json.Unmarshal(*v, &tags)
   468  				if err != nil {
   469  					return err
   470  				}
   471  				s.Tags = tags
   472  			}
   473  		}
   474  	}
   475  
   476  	return nil
   477  }
   478  
   479  // ServerAdministrators an array of administrator user identities.
   480  type ServerAdministrators struct {
   481  	// Members - An array of administrator user identities.
   482  	Members *[]string `json:"members,omitempty"`
   483  }
   484  
   485  // ServerMutableProperties an object that represents a set of mutable Analysis Services resource
   486  // properties.
   487  type ServerMutableProperties struct {
   488  	// AsAdministrators - A collection of AS server administrators
   489  	AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
   490  	// BackupBlobContainerURI - The SAS container URI to the backup container.
   491  	BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
   492  	// GatewayDetails - The gateway details configured for the AS server.
   493  	GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"`
   494  	// IPV4FirewallSettings - The firewall settings for the AS server.
   495  	IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"`
   496  	// QuerypoolConnectionMode - How the read-write server's participation in the query pool is controlled.<br/>It can have the following values: <ul><li>readOnly - indicates that the read-write server is intended not to participate in query operations</li><li>all - indicates that the read-write server can participate in query operations</li></ul>Specifying readOnly when capacity is 1 results in error. Possible values include: 'All', 'ReadOnly'
   497  	QuerypoolConnectionMode ConnectionMode `json:"querypoolConnectionMode,omitempty"`
   498  }
   499  
   500  // ServerProperties properties of Analysis Services resource.
   501  type ServerProperties struct {
   502  	// State - READ-ONLY; The current state of Analysis Services resource. The state is to indicate more states outside of resource provisioning. Possible values include: 'StateDeleting', 'StateSucceeded', 'StateFailed', 'StatePaused', 'StateSuspended', 'StateProvisioning', 'StateUpdating', 'StateSuspending', 'StatePausing', 'StateResuming', 'StatePreparing', 'StateScaling'
   503  	State State `json:"state,omitempty"`
   504  	// ProvisioningState - READ-ONLY; The current deployment state of Analysis Services resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling'
   505  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   506  	// ServerFullName - READ-ONLY; The full name of the Analysis Services resource.
   507  	ServerFullName *string `json:"serverFullName,omitempty"`
   508  	// AsAdministrators - A collection of AS server administrators
   509  	AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
   510  	// BackupBlobContainerURI - The SAS container URI to the backup container.
   511  	BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
   512  	// GatewayDetails - The gateway details configured for the AS server.
   513  	GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"`
   514  	// IPV4FirewallSettings - The firewall settings for the AS server.
   515  	IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"`
   516  	// QuerypoolConnectionMode - How the read-write server's participation in the query pool is controlled.<br/>It can have the following values: <ul><li>readOnly - indicates that the read-write server is intended not to participate in query operations</li><li>all - indicates that the read-write server can participate in query operations</li></ul>Specifying readOnly when capacity is 1 results in error. Possible values include: 'All', 'ReadOnly'
   517  	QuerypoolConnectionMode ConnectionMode `json:"querypoolConnectionMode,omitempty"`
   518  }
   519  
   520  // MarshalJSON is the custom marshaler for ServerProperties.
   521  func (sp ServerProperties) MarshalJSON() ([]byte, error) {
   522  	objectMap := make(map[string]interface{})
   523  	if sp.AsAdministrators != nil {
   524  		objectMap["asAdministrators"] = sp.AsAdministrators
   525  	}
   526  	if sp.BackupBlobContainerURI != nil {
   527  		objectMap["backupBlobContainerUri"] = sp.BackupBlobContainerURI
   528  	}
   529  	if sp.GatewayDetails != nil {
   530  		objectMap["gatewayDetails"] = sp.GatewayDetails
   531  	}
   532  	if sp.IPV4FirewallSettings != nil {
   533  		objectMap["ipV4FirewallSettings"] = sp.IPV4FirewallSettings
   534  	}
   535  	if sp.QuerypoolConnectionMode != "" {
   536  		objectMap["querypoolConnectionMode"] = sp.QuerypoolConnectionMode
   537  	}
   538  	return json.Marshal(objectMap)
   539  }
   540  
   541  // Servers an array of Analysis Services resources.
   542  type Servers struct {
   543  	autorest.Response `json:"-"`
   544  	// Value - An array of Analysis Services resources.
   545  	Value *[]Server `json:"value,omitempty"`
   546  }
   547  
   548  // ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
   549  // operation.
   550  type ServersCreateFuture struct {
   551  	azure.FutureAPI
   552  	// Result returns the result of the asynchronous operation.
   553  	// If the operation has not completed it will return an error.
   554  	Result func(ServersClient) (Server, error)
   555  }
   556  
   557  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   558  func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
   559  	var azFuture azure.Future
   560  	if err := json.Unmarshal(body, &azFuture); err != nil {
   561  		return err
   562  	}
   563  	future.FutureAPI = &azFuture
   564  	future.Result = future.result
   565  	return nil
   566  }
   567  
   568  // result is the default implementation for ServersCreateFuture.Result.
   569  func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
   570  	var done bool
   571  	done, err = future.DoneWithContext(context.Background(), client)
   572  	if err != nil {
   573  		err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", future.Response(), "Polling failure")
   574  		return
   575  	}
   576  	if !done {
   577  		s.Response.Response = future.Response()
   578  		err = azure.NewAsyncOpIncompleteError("analysisservices.ServersCreateFuture")
   579  		return
   580  	}
   581  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   582  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
   583  		s, err = client.CreateResponder(s.Response.Response)
   584  		if err != nil {
   585  			err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
   586  		}
   587  	}
   588  	return
   589  }
   590  
   591  // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   592  // operation.
   593  type ServersDeleteFuture struct {
   594  	azure.FutureAPI
   595  	// Result returns the result of the asynchronous operation.
   596  	// If the operation has not completed it will return an error.
   597  	Result func(ServersClient) (autorest.Response, error)
   598  }
   599  
   600  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   601  func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
   602  	var azFuture azure.Future
   603  	if err := json.Unmarshal(body, &azFuture); err != nil {
   604  		return err
   605  	}
   606  	future.FutureAPI = &azFuture
   607  	future.Result = future.result
   608  	return nil
   609  }
   610  
   611  // result is the default implementation for ServersDeleteFuture.Result.
   612  func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
   613  	var done bool
   614  	done, err = future.DoneWithContext(context.Background(), client)
   615  	if err != nil {
   616  		err = autorest.NewErrorWithError(err, "analysisservices.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
   617  		return
   618  	}
   619  	if !done {
   620  		ar.Response = future.Response()
   621  		err = azure.NewAsyncOpIncompleteError("analysisservices.ServersDeleteFuture")
   622  		return
   623  	}
   624  	ar.Response = future.Response()
   625  	return
   626  }
   627  
   628  // ServersResumeFuture an abstraction for monitoring and retrieving the results of a long-running
   629  // operation.
   630  type ServersResumeFuture struct {
   631  	azure.FutureAPI
   632  	// Result returns the result of the asynchronous operation.
   633  	// If the operation has not completed it will return an error.
   634  	Result func(ServersClient) (autorest.Response, error)
   635  }
   636  
   637  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   638  func (future *ServersResumeFuture) UnmarshalJSON(body []byte) error {
   639  	var azFuture azure.Future
   640  	if err := json.Unmarshal(body, &azFuture); err != nil {
   641  		return err
   642  	}
   643  	future.FutureAPI = &azFuture
   644  	future.Result = future.result
   645  	return nil
   646  }
   647  
   648  // result is the default implementation for ServersResumeFuture.Result.
   649  func (future *ServersResumeFuture) result(client ServersClient) (ar autorest.Response, err error) {
   650  	var done bool
   651  	done, err = future.DoneWithContext(context.Background(), client)
   652  	if err != nil {
   653  		err = autorest.NewErrorWithError(err, "analysisservices.ServersResumeFuture", "Result", future.Response(), "Polling failure")
   654  		return
   655  	}
   656  	if !done {
   657  		ar.Response = future.Response()
   658  		err = azure.NewAsyncOpIncompleteError("analysisservices.ServersResumeFuture")
   659  		return
   660  	}
   661  	ar.Response = future.Response()
   662  	return
   663  }
   664  
   665  // ServersSuspendFuture an abstraction for monitoring and retrieving the results of a long-running
   666  // operation.
   667  type ServersSuspendFuture struct {
   668  	azure.FutureAPI
   669  	// Result returns the result of the asynchronous operation.
   670  	// If the operation has not completed it will return an error.
   671  	Result func(ServersClient) (autorest.Response, error)
   672  }
   673  
   674  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   675  func (future *ServersSuspendFuture) UnmarshalJSON(body []byte) error {
   676  	var azFuture azure.Future
   677  	if err := json.Unmarshal(body, &azFuture); err != nil {
   678  		return err
   679  	}
   680  	future.FutureAPI = &azFuture
   681  	future.Result = future.result
   682  	return nil
   683  }
   684  
   685  // result is the default implementation for ServersSuspendFuture.Result.
   686  func (future *ServersSuspendFuture) result(client ServersClient) (ar autorest.Response, err error) {
   687  	var done bool
   688  	done, err = future.DoneWithContext(context.Background(), client)
   689  	if err != nil {
   690  		err = autorest.NewErrorWithError(err, "analysisservices.ServersSuspendFuture", "Result", future.Response(), "Polling failure")
   691  		return
   692  	}
   693  	if !done {
   694  		ar.Response = future.Response()
   695  		err = azure.NewAsyncOpIncompleteError("analysisservices.ServersSuspendFuture")
   696  		return
   697  	}
   698  	ar.Response = future.Response()
   699  	return
   700  }
   701  
   702  // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   703  // operation.
   704  type ServersUpdateFuture struct {
   705  	azure.FutureAPI
   706  	// Result returns the result of the asynchronous operation.
   707  	// If the operation has not completed it will return an error.
   708  	Result func(ServersClient) (Server, error)
   709  }
   710  
   711  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   712  func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
   713  	var azFuture azure.Future
   714  	if err := json.Unmarshal(body, &azFuture); err != nil {
   715  		return err
   716  	}
   717  	future.FutureAPI = &azFuture
   718  	future.Result = future.result
   719  	return nil
   720  }
   721  
   722  // result is the default implementation for ServersUpdateFuture.Result.
   723  func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
   724  	var done bool
   725  	done, err = future.DoneWithContext(context.Background(), client)
   726  	if err != nil {
   727  		err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
   728  		return
   729  	}
   730  	if !done {
   731  		s.Response.Response = future.Response()
   732  		err = azure.NewAsyncOpIncompleteError("analysisservices.ServersUpdateFuture")
   733  		return
   734  	}
   735  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   736  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
   737  		s, err = client.UpdateResponder(s.Response.Response)
   738  		if err != nil {
   739  			err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
   740  		}
   741  	}
   742  	return
   743  }
   744  
   745  // ServerUpdateParameters provision request specification
   746  type ServerUpdateParameters struct {
   747  	// Sku - The SKU of the Analysis Services resource.
   748  	Sku *ResourceSku `json:"sku,omitempty"`
   749  	// Tags - Key-value pairs of additional provisioning properties.
   750  	Tags map[string]*string `json:"tags"`
   751  	// ServerMutableProperties - Properties of the provision operation request.
   752  	*ServerMutableProperties `json:"properties,omitempty"`
   753  }
   754  
   755  // MarshalJSON is the custom marshaler for ServerUpdateParameters.
   756  func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
   757  	objectMap := make(map[string]interface{})
   758  	if sup.Sku != nil {
   759  		objectMap["sku"] = sup.Sku
   760  	}
   761  	if sup.Tags != nil {
   762  		objectMap["tags"] = sup.Tags
   763  	}
   764  	if sup.ServerMutableProperties != nil {
   765  		objectMap["properties"] = sup.ServerMutableProperties
   766  	}
   767  	return json.Marshal(objectMap)
   768  }
   769  
   770  // UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct.
   771  func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error {
   772  	var m map[string]*json.RawMessage
   773  	err := json.Unmarshal(body, &m)
   774  	if err != nil {
   775  		return err
   776  	}
   777  	for k, v := range m {
   778  		switch k {
   779  		case "sku":
   780  			if v != nil {
   781  				var sku ResourceSku
   782  				err = json.Unmarshal(*v, &sku)
   783  				if err != nil {
   784  					return err
   785  				}
   786  				sup.Sku = &sku
   787  			}
   788  		case "tags":
   789  			if v != nil {
   790  				var tags map[string]*string
   791  				err = json.Unmarshal(*v, &tags)
   792  				if err != nil {
   793  					return err
   794  				}
   795  				sup.Tags = tags
   796  			}
   797  		case "properties":
   798  			if v != nil {
   799  				var serverMutableProperties ServerMutableProperties
   800  				err = json.Unmarshal(*v, &serverMutableProperties)
   801  				if err != nil {
   802  					return err
   803  				}
   804  				sup.ServerMutableProperties = &serverMutableProperties
   805  			}
   806  		}
   807  	}
   808  
   809  	return nil
   810  }
   811  
   812  // SkuDetailsForExistingResource an object that represents SKU details for existing resources.
   813  type SkuDetailsForExistingResource struct {
   814  	// Sku - The SKU in SKU details for existing resources.
   815  	Sku *ResourceSku `json:"sku,omitempty"`
   816  }
   817  
   818  // SkuEnumerationForExistingResourceResult an object that represents enumerating SKUs for existing
   819  // resources.
   820  type SkuEnumerationForExistingResourceResult struct {
   821  	autorest.Response `json:"-"`
   822  	// Value - The collection of available SKUs for existing resources.
   823  	Value *[]SkuDetailsForExistingResource `json:"value,omitempty"`
   824  }
   825  
   826  // SkuEnumerationForNewResourceResult an object that represents enumerating SKUs for new resources.
   827  type SkuEnumerationForNewResourceResult struct {
   828  	autorest.Response `json:"-"`
   829  	// Value - The collection of available SKUs for new resources.
   830  	Value *[]ResourceSku `json:"value,omitempty"`
   831  }
   832  

View as plain text