...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-09-01/managedapplications/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-09-01/managedapplications

     1  package managedapplications
     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/resources/mgmt/2017-09-01/managedapplications"
    21  
    22  // Application information about managed application.
    23  type Application struct {
    24  	autorest.Response `json:"-"`
    25  	// ApplicationProperties - The managed application properties.
    26  	*ApplicationProperties `json:"properties,omitempty"`
    27  	// Plan - The plan information.
    28  	Plan *Plan `json:"plan,omitempty"`
    29  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
    30  	Kind *string `json:"kind,omitempty"`
    31  	// ManagedBy - ID of the resource that manages this resource.
    32  	ManagedBy *string `json:"managedBy,omitempty"`
    33  	// Sku - The SKU of the resource.
    34  	Sku *Sku `json:"sku,omitempty"`
    35  	// Identity - The identity of the resource.
    36  	Identity *Identity `json:"identity,omitempty"`
    37  	// ID - READ-ONLY; Resource ID
    38  	ID *string `json:"id,omitempty"`
    39  	// Name - READ-ONLY; Resource name
    40  	Name *string `json:"name,omitempty"`
    41  	// Type - READ-ONLY; Resource type
    42  	Type *string `json:"type,omitempty"`
    43  	// Location - Resource location
    44  	Location *string `json:"location,omitempty"`
    45  	// Tags - Resource tags
    46  	Tags map[string]*string `json:"tags"`
    47  }
    48  
    49  // MarshalJSON is the custom marshaler for Application.
    50  func (a Application) MarshalJSON() ([]byte, error) {
    51  	objectMap := make(map[string]interface{})
    52  	if a.ApplicationProperties != nil {
    53  		objectMap["properties"] = a.ApplicationProperties
    54  	}
    55  	if a.Plan != nil {
    56  		objectMap["plan"] = a.Plan
    57  	}
    58  	if a.Kind != nil {
    59  		objectMap["kind"] = a.Kind
    60  	}
    61  	if a.ManagedBy != nil {
    62  		objectMap["managedBy"] = a.ManagedBy
    63  	}
    64  	if a.Sku != nil {
    65  		objectMap["sku"] = a.Sku
    66  	}
    67  	if a.Identity != nil {
    68  		objectMap["identity"] = a.Identity
    69  	}
    70  	if a.Location != nil {
    71  		objectMap["location"] = a.Location
    72  	}
    73  	if a.Tags != nil {
    74  		objectMap["tags"] = a.Tags
    75  	}
    76  	return json.Marshal(objectMap)
    77  }
    78  
    79  // UnmarshalJSON is the custom unmarshaler for Application struct.
    80  func (a *Application) UnmarshalJSON(body []byte) error {
    81  	var m map[string]*json.RawMessage
    82  	err := json.Unmarshal(body, &m)
    83  	if err != nil {
    84  		return err
    85  	}
    86  	for k, v := range m {
    87  		switch k {
    88  		case "properties":
    89  			if v != nil {
    90  				var applicationProperties ApplicationProperties
    91  				err = json.Unmarshal(*v, &applicationProperties)
    92  				if err != nil {
    93  					return err
    94  				}
    95  				a.ApplicationProperties = &applicationProperties
    96  			}
    97  		case "plan":
    98  			if v != nil {
    99  				var plan Plan
   100  				err = json.Unmarshal(*v, &plan)
   101  				if err != nil {
   102  					return err
   103  				}
   104  				a.Plan = &plan
   105  			}
   106  		case "kind":
   107  			if v != nil {
   108  				var kind string
   109  				err = json.Unmarshal(*v, &kind)
   110  				if err != nil {
   111  					return err
   112  				}
   113  				a.Kind = &kind
   114  			}
   115  		case "managedBy":
   116  			if v != nil {
   117  				var managedBy string
   118  				err = json.Unmarshal(*v, &managedBy)
   119  				if err != nil {
   120  					return err
   121  				}
   122  				a.ManagedBy = &managedBy
   123  			}
   124  		case "sku":
   125  			if v != nil {
   126  				var sku Sku
   127  				err = json.Unmarshal(*v, &sku)
   128  				if err != nil {
   129  					return err
   130  				}
   131  				a.Sku = &sku
   132  			}
   133  		case "identity":
   134  			if v != nil {
   135  				var identity Identity
   136  				err = json.Unmarshal(*v, &identity)
   137  				if err != nil {
   138  					return err
   139  				}
   140  				a.Identity = &identity
   141  			}
   142  		case "id":
   143  			if v != nil {
   144  				var ID string
   145  				err = json.Unmarshal(*v, &ID)
   146  				if err != nil {
   147  					return err
   148  				}
   149  				a.ID = &ID
   150  			}
   151  		case "name":
   152  			if v != nil {
   153  				var name string
   154  				err = json.Unmarshal(*v, &name)
   155  				if err != nil {
   156  					return err
   157  				}
   158  				a.Name = &name
   159  			}
   160  		case "type":
   161  			if v != nil {
   162  				var typeVar string
   163  				err = json.Unmarshal(*v, &typeVar)
   164  				if err != nil {
   165  					return err
   166  				}
   167  				a.Type = &typeVar
   168  			}
   169  		case "location":
   170  			if v != nil {
   171  				var location string
   172  				err = json.Unmarshal(*v, &location)
   173  				if err != nil {
   174  					return err
   175  				}
   176  				a.Location = &location
   177  			}
   178  		case "tags":
   179  			if v != nil {
   180  				var tags map[string]*string
   181  				err = json.Unmarshal(*v, &tags)
   182  				if err != nil {
   183  					return err
   184  				}
   185  				a.Tags = tags
   186  			}
   187  		}
   188  	}
   189  
   190  	return nil
   191  }
   192  
   193  // ApplicationArtifact managed application artifact.
   194  type ApplicationArtifact struct {
   195  	// Name - The managed application artifact name.
   196  	Name *string `json:"name,omitempty"`
   197  	// URI - The managed application artifact blob uri.
   198  	URI *string `json:"uri,omitempty"`
   199  	// Type - The managed application artifact type. Possible values include: 'Template', 'Custom'
   200  	Type ApplicationArtifactType `json:"type,omitempty"`
   201  }
   202  
   203  // ApplicationDefinition information about managed application definition.
   204  type ApplicationDefinition struct {
   205  	autorest.Response `json:"-"`
   206  	// ApplicationDefinitionProperties - The managed application definition properties.
   207  	*ApplicationDefinitionProperties `json:"properties,omitempty"`
   208  	// ManagedBy - ID of the resource that manages this resource.
   209  	ManagedBy *string `json:"managedBy,omitempty"`
   210  	// Sku - The SKU of the resource.
   211  	Sku *Sku `json:"sku,omitempty"`
   212  	// Identity - The identity of the resource.
   213  	Identity *Identity `json:"identity,omitempty"`
   214  	// ID - READ-ONLY; Resource ID
   215  	ID *string `json:"id,omitempty"`
   216  	// Name - READ-ONLY; Resource name
   217  	Name *string `json:"name,omitempty"`
   218  	// Type - READ-ONLY; Resource type
   219  	Type *string `json:"type,omitempty"`
   220  	// Location - Resource location
   221  	Location *string `json:"location,omitempty"`
   222  	// Tags - Resource tags
   223  	Tags map[string]*string `json:"tags"`
   224  }
   225  
   226  // MarshalJSON is the custom marshaler for ApplicationDefinition.
   227  func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
   228  	objectMap := make(map[string]interface{})
   229  	if ad.ApplicationDefinitionProperties != nil {
   230  		objectMap["properties"] = ad.ApplicationDefinitionProperties
   231  	}
   232  	if ad.ManagedBy != nil {
   233  		objectMap["managedBy"] = ad.ManagedBy
   234  	}
   235  	if ad.Sku != nil {
   236  		objectMap["sku"] = ad.Sku
   237  	}
   238  	if ad.Identity != nil {
   239  		objectMap["identity"] = ad.Identity
   240  	}
   241  	if ad.Location != nil {
   242  		objectMap["location"] = ad.Location
   243  	}
   244  	if ad.Tags != nil {
   245  		objectMap["tags"] = ad.Tags
   246  	}
   247  	return json.Marshal(objectMap)
   248  }
   249  
   250  // UnmarshalJSON is the custom unmarshaler for ApplicationDefinition struct.
   251  func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
   252  	var m map[string]*json.RawMessage
   253  	err := json.Unmarshal(body, &m)
   254  	if err != nil {
   255  		return err
   256  	}
   257  	for k, v := range m {
   258  		switch k {
   259  		case "properties":
   260  			if v != nil {
   261  				var applicationDefinitionProperties ApplicationDefinitionProperties
   262  				err = json.Unmarshal(*v, &applicationDefinitionProperties)
   263  				if err != nil {
   264  					return err
   265  				}
   266  				ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
   267  			}
   268  		case "managedBy":
   269  			if v != nil {
   270  				var managedBy string
   271  				err = json.Unmarshal(*v, &managedBy)
   272  				if err != nil {
   273  					return err
   274  				}
   275  				ad.ManagedBy = &managedBy
   276  			}
   277  		case "sku":
   278  			if v != nil {
   279  				var sku Sku
   280  				err = json.Unmarshal(*v, &sku)
   281  				if err != nil {
   282  					return err
   283  				}
   284  				ad.Sku = &sku
   285  			}
   286  		case "identity":
   287  			if v != nil {
   288  				var identity Identity
   289  				err = json.Unmarshal(*v, &identity)
   290  				if err != nil {
   291  					return err
   292  				}
   293  				ad.Identity = &identity
   294  			}
   295  		case "id":
   296  			if v != nil {
   297  				var ID string
   298  				err = json.Unmarshal(*v, &ID)
   299  				if err != nil {
   300  					return err
   301  				}
   302  				ad.ID = &ID
   303  			}
   304  		case "name":
   305  			if v != nil {
   306  				var name string
   307  				err = json.Unmarshal(*v, &name)
   308  				if err != nil {
   309  					return err
   310  				}
   311  				ad.Name = &name
   312  			}
   313  		case "type":
   314  			if v != nil {
   315  				var typeVar string
   316  				err = json.Unmarshal(*v, &typeVar)
   317  				if err != nil {
   318  					return err
   319  				}
   320  				ad.Type = &typeVar
   321  			}
   322  		case "location":
   323  			if v != nil {
   324  				var location string
   325  				err = json.Unmarshal(*v, &location)
   326  				if err != nil {
   327  					return err
   328  				}
   329  				ad.Location = &location
   330  			}
   331  		case "tags":
   332  			if v != nil {
   333  				var tags map[string]*string
   334  				err = json.Unmarshal(*v, &tags)
   335  				if err != nil {
   336  					return err
   337  				}
   338  				ad.Tags = tags
   339  			}
   340  		}
   341  	}
   342  
   343  	return nil
   344  }
   345  
   346  // ApplicationDefinitionListResult list of managed application definitions.
   347  type ApplicationDefinitionListResult struct {
   348  	autorest.Response `json:"-"`
   349  	// Value - The array of managed application definitions.
   350  	Value *[]ApplicationDefinition `json:"value,omitempty"`
   351  	// NextLink - The URL to use for getting the next set of results.
   352  	NextLink *string `json:"nextLink,omitempty"`
   353  }
   354  
   355  // ApplicationDefinitionListResultIterator provides access to a complete listing of ApplicationDefinition
   356  // values.
   357  type ApplicationDefinitionListResultIterator struct {
   358  	i    int
   359  	page ApplicationDefinitionListResultPage
   360  }
   361  
   362  // NextWithContext advances to the next value.  If there was an error making
   363  // the request the iterator does not advance and the error is returned.
   364  func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   365  	if tracing.IsEnabled() {
   366  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
   367  		defer func() {
   368  			sc := -1
   369  			if iter.Response().Response.Response != nil {
   370  				sc = iter.Response().Response.Response.StatusCode
   371  			}
   372  			tracing.EndSpan(ctx, sc, err)
   373  		}()
   374  	}
   375  	iter.i++
   376  	if iter.i < len(iter.page.Values()) {
   377  		return nil
   378  	}
   379  	err = iter.page.NextWithContext(ctx)
   380  	if err != nil {
   381  		iter.i--
   382  		return err
   383  	}
   384  	iter.i = 0
   385  	return nil
   386  }
   387  
   388  // Next advances to the next value.  If there was an error making
   389  // the request the iterator does not advance and the error is returned.
   390  // Deprecated: Use NextWithContext() instead.
   391  func (iter *ApplicationDefinitionListResultIterator) Next() error {
   392  	return iter.NextWithContext(context.Background())
   393  }
   394  
   395  // NotDone returns true if the enumeration should be started or is not yet complete.
   396  func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
   397  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   398  }
   399  
   400  // Response returns the raw server response from the last page request.
   401  func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
   402  	return iter.page.Response()
   403  }
   404  
   405  // Value returns the current value or a zero-initialized value if the
   406  // iterator has advanced beyond the end of the collection.
   407  func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
   408  	if !iter.page.NotDone() {
   409  		return ApplicationDefinition{}
   410  	}
   411  	return iter.page.Values()[iter.i]
   412  }
   413  
   414  // Creates a new instance of the ApplicationDefinitionListResultIterator type.
   415  func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
   416  	return ApplicationDefinitionListResultIterator{page: page}
   417  }
   418  
   419  // IsEmpty returns true if the ListResult contains no values.
   420  func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
   421  	return adlr.Value == nil || len(*adlr.Value) == 0
   422  }
   423  
   424  // hasNextLink returns true if the NextLink is not empty.
   425  func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
   426  	return adlr.NextLink != nil && len(*adlr.NextLink) != 0
   427  }
   428  
   429  // applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results.
   430  // It returns nil if no more results exist.
   431  func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
   432  	if !adlr.hasNextLink() {
   433  		return nil, nil
   434  	}
   435  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   436  		autorest.AsJSON(),
   437  		autorest.AsGet(),
   438  		autorest.WithBaseURL(to.String(adlr.NextLink)))
   439  }
   440  
   441  // ApplicationDefinitionListResultPage contains a page of ApplicationDefinition values.
   442  type ApplicationDefinitionListResultPage struct {
   443  	fn   func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
   444  	adlr ApplicationDefinitionListResult
   445  }
   446  
   447  // NextWithContext advances to the next page of values.  If there was an error making
   448  // the request the page does not advance and the error is returned.
   449  func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
   450  	if tracing.IsEnabled() {
   451  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
   452  		defer func() {
   453  			sc := -1
   454  			if page.Response().Response.Response != nil {
   455  				sc = page.Response().Response.Response.StatusCode
   456  			}
   457  			tracing.EndSpan(ctx, sc, err)
   458  		}()
   459  	}
   460  	for {
   461  		next, err := page.fn(ctx, page.adlr)
   462  		if err != nil {
   463  			return err
   464  		}
   465  		page.adlr = next
   466  		if !next.hasNextLink() || !next.IsEmpty() {
   467  			break
   468  		}
   469  	}
   470  	return nil
   471  }
   472  
   473  // Next advances to the next page of values.  If there was an error making
   474  // the request the page does not advance and the error is returned.
   475  // Deprecated: Use NextWithContext() instead.
   476  func (page *ApplicationDefinitionListResultPage) Next() error {
   477  	return page.NextWithContext(context.Background())
   478  }
   479  
   480  // NotDone returns true if the page enumeration should be started or is not yet complete.
   481  func (page ApplicationDefinitionListResultPage) NotDone() bool {
   482  	return !page.adlr.IsEmpty()
   483  }
   484  
   485  // Response returns the raw server response from the last page request.
   486  func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
   487  	return page.adlr
   488  }
   489  
   490  // Values returns the slice of values for the current page or nil if there are no values.
   491  func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
   492  	if page.adlr.IsEmpty() {
   493  		return nil
   494  	}
   495  	return *page.adlr.Value
   496  }
   497  
   498  // Creates a new instance of the ApplicationDefinitionListResultPage type.
   499  func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
   500  	return ApplicationDefinitionListResultPage{
   501  		fn:   getNextPage,
   502  		adlr: cur,
   503  	}
   504  }
   505  
   506  // ApplicationDefinitionProperties the managed application definition properties.
   507  type ApplicationDefinitionProperties struct {
   508  	// LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
   509  	LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
   510  	// DisplayName - The managed application definition display name.
   511  	DisplayName *string `json:"displayName,omitempty"`
   512  	// IsEnabled - A value indicating whether the package is enabled or not.
   513  	IsEnabled *string `json:"isEnabled,omitempty"`
   514  	// Authorizations - The managed application provider authorizations.
   515  	Authorizations *[]ApplicationProviderAuthorization `json:"authorizations,omitempty"`
   516  	// Artifacts - The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition.
   517  	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
   518  	// Description - The managed application definition description.
   519  	Description *string `json:"description,omitempty"`
   520  	// PackageFileURI - The managed application definition package file Uri. Use this element
   521  	PackageFileURI *string `json:"packageFileUri,omitempty"`
   522  	// MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string.
   523  	MainTemplate interface{} `json:"mainTemplate,omitempty"`
   524  	// CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.
   525  	CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
   526  }
   527  
   528  // ApplicationDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results
   529  // of a long-running operation.
   530  type ApplicationDefinitionsCreateOrUpdateByIDFuture struct {
   531  	azure.FutureAPI
   532  	// Result returns the result of the asynchronous operation.
   533  	// If the operation has not completed it will return an error.
   534  	Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
   535  }
   536  
   537  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   538  func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
   539  	var azFuture azure.Future
   540  	if err := json.Unmarshal(body, &azFuture); err != nil {
   541  		return err
   542  	}
   543  	future.FutureAPI = &azFuture
   544  	future.Result = future.result
   545  	return nil
   546  }
   547  
   548  // result is the default implementation for ApplicationDefinitionsCreateOrUpdateByIDFuture.Result.
   549  func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) {
   550  	var done bool
   551  	done, err = future.DoneWithContext(context.Background(), client)
   552  	if err != nil {
   553  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
   554  		return
   555  	}
   556  	if !done {
   557  		ad.Response.Response = future.Response()
   558  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture")
   559  		return
   560  	}
   561  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   562  	if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent {
   563  		ad, err = client.CreateOrUpdateByIDResponder(ad.Response.Response)
   564  		if err != nil {
   565  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", ad.Response.Response, "Failure responding to request")
   566  		}
   567  	}
   568  	return
   569  }
   570  
   571  // ApplicationDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   572  // long-running operation.
   573  type ApplicationDefinitionsCreateOrUpdateFuture struct {
   574  	azure.FutureAPI
   575  	// Result returns the result of the asynchronous operation.
   576  	// If the operation has not completed it will return an error.
   577  	Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
   578  }
   579  
   580  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   581  func (future *ApplicationDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   582  	var azFuture azure.Future
   583  	if err := json.Unmarshal(body, &azFuture); err != nil {
   584  		return err
   585  	}
   586  	future.FutureAPI = &azFuture
   587  	future.Result = future.result
   588  	return nil
   589  }
   590  
   591  // result is the default implementation for ApplicationDefinitionsCreateOrUpdateFuture.Result.
   592  func (future *ApplicationDefinitionsCreateOrUpdateFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) {
   593  	var done bool
   594  	done, err = future.DoneWithContext(context.Background(), client)
   595  	if err != nil {
   596  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   597  		return
   598  	}
   599  	if !done {
   600  		ad.Response.Response = future.Response()
   601  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateFuture")
   602  		return
   603  	}
   604  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   605  	if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent {
   606  		ad, err = client.CreateOrUpdateResponder(ad.Response.Response)
   607  		if err != nil {
   608  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", ad.Response.Response, "Failure responding to request")
   609  		}
   610  	}
   611  	return
   612  }
   613  
   614  // ApplicationDefinitionsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a
   615  // long-running operation.
   616  type ApplicationDefinitionsDeleteByIDFuture struct {
   617  	azure.FutureAPI
   618  	// Result returns the result of the asynchronous operation.
   619  	// If the operation has not completed it will return an error.
   620  	Result func(ApplicationDefinitionsClient) (autorest.Response, error)
   621  }
   622  
   623  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   624  func (future *ApplicationDefinitionsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
   625  	var azFuture azure.Future
   626  	if err := json.Unmarshal(body, &azFuture); err != nil {
   627  		return err
   628  	}
   629  	future.FutureAPI = &azFuture
   630  	future.Result = future.result
   631  	return nil
   632  }
   633  
   634  // result is the default implementation for ApplicationDefinitionsDeleteByIDFuture.Result.
   635  func (future *ApplicationDefinitionsDeleteByIDFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) {
   636  	var done bool
   637  	done, err = future.DoneWithContext(context.Background(), client)
   638  	if err != nil {
   639  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
   640  		return
   641  	}
   642  	if !done {
   643  		ar.Response = future.Response()
   644  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteByIDFuture")
   645  		return
   646  	}
   647  	ar.Response = future.Response()
   648  	return
   649  }
   650  
   651  // ApplicationDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of a
   652  // long-running operation.
   653  type ApplicationDefinitionsDeleteFuture struct {
   654  	azure.FutureAPI
   655  	// Result returns the result of the asynchronous operation.
   656  	// If the operation has not completed it will return an error.
   657  	Result func(ApplicationDefinitionsClient) (autorest.Response, error)
   658  }
   659  
   660  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   661  func (future *ApplicationDefinitionsDeleteFuture) UnmarshalJSON(body []byte) error {
   662  	var azFuture azure.Future
   663  	if err := json.Unmarshal(body, &azFuture); err != nil {
   664  		return err
   665  	}
   666  	future.FutureAPI = &azFuture
   667  	future.Result = future.result
   668  	return nil
   669  }
   670  
   671  // result is the default implementation for ApplicationDefinitionsDeleteFuture.Result.
   672  func (future *ApplicationDefinitionsDeleteFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) {
   673  	var done bool
   674  	done, err = future.DoneWithContext(context.Background(), client)
   675  	if err != nil {
   676  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure")
   677  		return
   678  	}
   679  	if !done {
   680  		ar.Response = future.Response()
   681  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteFuture")
   682  		return
   683  	}
   684  	ar.Response = future.Response()
   685  	return
   686  }
   687  
   688  // ApplicationListResult list of managed applications.
   689  type ApplicationListResult struct {
   690  	autorest.Response `json:"-"`
   691  	// Value - The array of managed applications.
   692  	Value *[]Application `json:"value,omitempty"`
   693  	// NextLink - The URL to use for getting the next set of results.
   694  	NextLink *string `json:"nextLink,omitempty"`
   695  }
   696  
   697  // ApplicationListResultIterator provides access to a complete listing of Application values.
   698  type ApplicationListResultIterator struct {
   699  	i    int
   700  	page ApplicationListResultPage
   701  }
   702  
   703  // NextWithContext advances to the next value.  If there was an error making
   704  // the request the iterator does not advance and the error is returned.
   705  func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   706  	if tracing.IsEnabled() {
   707  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
   708  		defer func() {
   709  			sc := -1
   710  			if iter.Response().Response.Response != nil {
   711  				sc = iter.Response().Response.Response.StatusCode
   712  			}
   713  			tracing.EndSpan(ctx, sc, err)
   714  		}()
   715  	}
   716  	iter.i++
   717  	if iter.i < len(iter.page.Values()) {
   718  		return nil
   719  	}
   720  	err = iter.page.NextWithContext(ctx)
   721  	if err != nil {
   722  		iter.i--
   723  		return err
   724  	}
   725  	iter.i = 0
   726  	return nil
   727  }
   728  
   729  // Next advances to the next value.  If there was an error making
   730  // the request the iterator does not advance and the error is returned.
   731  // Deprecated: Use NextWithContext() instead.
   732  func (iter *ApplicationListResultIterator) Next() error {
   733  	return iter.NextWithContext(context.Background())
   734  }
   735  
   736  // NotDone returns true if the enumeration should be started or is not yet complete.
   737  func (iter ApplicationListResultIterator) NotDone() bool {
   738  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   739  }
   740  
   741  // Response returns the raw server response from the last page request.
   742  func (iter ApplicationListResultIterator) Response() ApplicationListResult {
   743  	return iter.page.Response()
   744  }
   745  
   746  // Value returns the current value or a zero-initialized value if the
   747  // iterator has advanced beyond the end of the collection.
   748  func (iter ApplicationListResultIterator) Value() Application {
   749  	if !iter.page.NotDone() {
   750  		return Application{}
   751  	}
   752  	return iter.page.Values()[iter.i]
   753  }
   754  
   755  // Creates a new instance of the ApplicationListResultIterator type.
   756  func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
   757  	return ApplicationListResultIterator{page: page}
   758  }
   759  
   760  // IsEmpty returns true if the ListResult contains no values.
   761  func (alr ApplicationListResult) IsEmpty() bool {
   762  	return alr.Value == nil || len(*alr.Value) == 0
   763  }
   764  
   765  // hasNextLink returns true if the NextLink is not empty.
   766  func (alr ApplicationListResult) hasNextLink() bool {
   767  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   768  }
   769  
   770  // applicationListResultPreparer prepares a request to retrieve the next set of results.
   771  // It returns nil if no more results exist.
   772  func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
   773  	if !alr.hasNextLink() {
   774  		return nil, nil
   775  	}
   776  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   777  		autorest.AsJSON(),
   778  		autorest.AsGet(),
   779  		autorest.WithBaseURL(to.String(alr.NextLink)))
   780  }
   781  
   782  // ApplicationListResultPage contains a page of Application values.
   783  type ApplicationListResultPage struct {
   784  	fn  func(context.Context, ApplicationListResult) (ApplicationListResult, error)
   785  	alr ApplicationListResult
   786  }
   787  
   788  // NextWithContext advances to the next page of values.  If there was an error making
   789  // the request the page does not advance and the error is returned.
   790  func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
   791  	if tracing.IsEnabled() {
   792  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
   793  		defer func() {
   794  			sc := -1
   795  			if page.Response().Response.Response != nil {
   796  				sc = page.Response().Response.Response.StatusCode
   797  			}
   798  			tracing.EndSpan(ctx, sc, err)
   799  		}()
   800  	}
   801  	for {
   802  		next, err := page.fn(ctx, page.alr)
   803  		if err != nil {
   804  			return err
   805  		}
   806  		page.alr = next
   807  		if !next.hasNextLink() || !next.IsEmpty() {
   808  			break
   809  		}
   810  	}
   811  	return nil
   812  }
   813  
   814  // Next advances to the next page of values.  If there was an error making
   815  // the request the page does not advance and the error is returned.
   816  // Deprecated: Use NextWithContext() instead.
   817  func (page *ApplicationListResultPage) Next() error {
   818  	return page.NextWithContext(context.Background())
   819  }
   820  
   821  // NotDone returns true if the page enumeration should be started or is not yet complete.
   822  func (page ApplicationListResultPage) NotDone() bool {
   823  	return !page.alr.IsEmpty()
   824  }
   825  
   826  // Response returns the raw server response from the last page request.
   827  func (page ApplicationListResultPage) Response() ApplicationListResult {
   828  	return page.alr
   829  }
   830  
   831  // Values returns the slice of values for the current page or nil if there are no values.
   832  func (page ApplicationListResultPage) Values() []Application {
   833  	if page.alr.IsEmpty() {
   834  		return nil
   835  	}
   836  	return *page.alr.Value
   837  }
   838  
   839  // Creates a new instance of the ApplicationListResultPage type.
   840  func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
   841  	return ApplicationListResultPage{
   842  		fn:  getNextPage,
   843  		alr: cur,
   844  	}
   845  }
   846  
   847  // ApplicationPatchable information about managed application.
   848  type ApplicationPatchable struct {
   849  	// ApplicationPropertiesPatchable - The managed application properties.
   850  	*ApplicationPropertiesPatchable `json:"properties,omitempty"`
   851  	// Plan - The plan information.
   852  	Plan *PlanPatchable `json:"plan,omitempty"`
   853  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
   854  	Kind *string `json:"kind,omitempty"`
   855  	// ManagedBy - ID of the resource that manages this resource.
   856  	ManagedBy *string `json:"managedBy,omitempty"`
   857  	// Sku - The SKU of the resource.
   858  	Sku *Sku `json:"sku,omitempty"`
   859  	// Identity - The identity of the resource.
   860  	Identity *Identity `json:"identity,omitempty"`
   861  	// ID - READ-ONLY; Resource ID
   862  	ID *string `json:"id,omitempty"`
   863  	// Name - READ-ONLY; Resource name
   864  	Name *string `json:"name,omitempty"`
   865  	// Type - READ-ONLY; Resource type
   866  	Type *string `json:"type,omitempty"`
   867  	// Location - Resource location
   868  	Location *string `json:"location,omitempty"`
   869  	// Tags - Resource tags
   870  	Tags map[string]*string `json:"tags"`
   871  }
   872  
   873  // MarshalJSON is the custom marshaler for ApplicationPatchable.
   874  func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
   875  	objectMap := make(map[string]interface{})
   876  	if ap.ApplicationPropertiesPatchable != nil {
   877  		objectMap["properties"] = ap.ApplicationPropertiesPatchable
   878  	}
   879  	if ap.Plan != nil {
   880  		objectMap["plan"] = ap.Plan
   881  	}
   882  	if ap.Kind != nil {
   883  		objectMap["kind"] = ap.Kind
   884  	}
   885  	if ap.ManagedBy != nil {
   886  		objectMap["managedBy"] = ap.ManagedBy
   887  	}
   888  	if ap.Sku != nil {
   889  		objectMap["sku"] = ap.Sku
   890  	}
   891  	if ap.Identity != nil {
   892  		objectMap["identity"] = ap.Identity
   893  	}
   894  	if ap.Location != nil {
   895  		objectMap["location"] = ap.Location
   896  	}
   897  	if ap.Tags != nil {
   898  		objectMap["tags"] = ap.Tags
   899  	}
   900  	return json.Marshal(objectMap)
   901  }
   902  
   903  // UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
   904  func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
   905  	var m map[string]*json.RawMessage
   906  	err := json.Unmarshal(body, &m)
   907  	if err != nil {
   908  		return err
   909  	}
   910  	for k, v := range m {
   911  		switch k {
   912  		case "properties":
   913  			if v != nil {
   914  				var applicationPropertiesPatchable ApplicationPropertiesPatchable
   915  				err = json.Unmarshal(*v, &applicationPropertiesPatchable)
   916  				if err != nil {
   917  					return err
   918  				}
   919  				ap.ApplicationPropertiesPatchable = &applicationPropertiesPatchable
   920  			}
   921  		case "plan":
   922  			if v != nil {
   923  				var plan PlanPatchable
   924  				err = json.Unmarshal(*v, &plan)
   925  				if err != nil {
   926  					return err
   927  				}
   928  				ap.Plan = &plan
   929  			}
   930  		case "kind":
   931  			if v != nil {
   932  				var kind string
   933  				err = json.Unmarshal(*v, &kind)
   934  				if err != nil {
   935  					return err
   936  				}
   937  				ap.Kind = &kind
   938  			}
   939  		case "managedBy":
   940  			if v != nil {
   941  				var managedBy string
   942  				err = json.Unmarshal(*v, &managedBy)
   943  				if err != nil {
   944  					return err
   945  				}
   946  				ap.ManagedBy = &managedBy
   947  			}
   948  		case "sku":
   949  			if v != nil {
   950  				var sku Sku
   951  				err = json.Unmarshal(*v, &sku)
   952  				if err != nil {
   953  					return err
   954  				}
   955  				ap.Sku = &sku
   956  			}
   957  		case "identity":
   958  			if v != nil {
   959  				var identity Identity
   960  				err = json.Unmarshal(*v, &identity)
   961  				if err != nil {
   962  					return err
   963  				}
   964  				ap.Identity = &identity
   965  			}
   966  		case "id":
   967  			if v != nil {
   968  				var ID string
   969  				err = json.Unmarshal(*v, &ID)
   970  				if err != nil {
   971  					return err
   972  				}
   973  				ap.ID = &ID
   974  			}
   975  		case "name":
   976  			if v != nil {
   977  				var name string
   978  				err = json.Unmarshal(*v, &name)
   979  				if err != nil {
   980  					return err
   981  				}
   982  				ap.Name = &name
   983  			}
   984  		case "type":
   985  			if v != nil {
   986  				var typeVar string
   987  				err = json.Unmarshal(*v, &typeVar)
   988  				if err != nil {
   989  					return err
   990  				}
   991  				ap.Type = &typeVar
   992  			}
   993  		case "location":
   994  			if v != nil {
   995  				var location string
   996  				err = json.Unmarshal(*v, &location)
   997  				if err != nil {
   998  					return err
   999  				}
  1000  				ap.Location = &location
  1001  			}
  1002  		case "tags":
  1003  			if v != nil {
  1004  				var tags map[string]*string
  1005  				err = json.Unmarshal(*v, &tags)
  1006  				if err != nil {
  1007  					return err
  1008  				}
  1009  				ap.Tags = tags
  1010  			}
  1011  		}
  1012  	}
  1013  
  1014  	return nil
  1015  }
  1016  
  1017  // ApplicationProperties the managed application properties.
  1018  type ApplicationProperties struct {
  1019  	// ManagedResourceGroupID - The managed resource group Id.
  1020  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
  1021  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
  1022  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
  1023  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
  1024  	Parameters interface{} `json:"parameters,omitempty"`
  1025  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
  1026  	Outputs interface{} `json:"outputs,omitempty"`
  1027  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
  1028  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1029  	// UIDefinitionURI - The blob URI where the UI definition file is located.
  1030  	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
  1031  }
  1032  
  1033  // MarshalJSON is the custom marshaler for ApplicationProperties.
  1034  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
  1035  	objectMap := make(map[string]interface{})
  1036  	if ap.ManagedResourceGroupID != nil {
  1037  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
  1038  	}
  1039  	if ap.ApplicationDefinitionID != nil {
  1040  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
  1041  	}
  1042  	if ap.Parameters != nil {
  1043  		objectMap["parameters"] = ap.Parameters
  1044  	}
  1045  	if ap.UIDefinitionURI != nil {
  1046  		objectMap["uiDefinitionUri"] = ap.UIDefinitionURI
  1047  	}
  1048  	return json.Marshal(objectMap)
  1049  }
  1050  
  1051  // ApplicationPropertiesPatchable the managed application properties.
  1052  type ApplicationPropertiesPatchable struct {
  1053  	// ManagedResourceGroupID - The managed resource group Id.
  1054  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
  1055  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
  1056  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
  1057  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
  1058  	Parameters interface{} `json:"parameters,omitempty"`
  1059  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
  1060  	Outputs interface{} `json:"outputs,omitempty"`
  1061  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
  1062  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1063  	// UIDefinitionURI - The blob URI where the UI definition file is located.
  1064  	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
  1065  }
  1066  
  1067  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
  1068  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
  1069  	objectMap := make(map[string]interface{})
  1070  	if app.ManagedResourceGroupID != nil {
  1071  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
  1072  	}
  1073  	if app.ApplicationDefinitionID != nil {
  1074  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
  1075  	}
  1076  	if app.Parameters != nil {
  1077  		objectMap["parameters"] = app.Parameters
  1078  	}
  1079  	if app.UIDefinitionURI != nil {
  1080  		objectMap["uiDefinitionUri"] = app.UIDefinitionURI
  1081  	}
  1082  	return json.Marshal(objectMap)
  1083  }
  1084  
  1085  // ApplicationProviderAuthorization the managed application provider authorization.
  1086  type ApplicationProviderAuthorization struct {
  1087  	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
  1088  	PrincipalID *string `json:"principalId,omitempty"`
  1089  	// RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group.
  1090  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
  1091  }
  1092  
  1093  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
  1094  // long-running operation.
  1095  type ApplicationsCreateOrUpdateByIDFuture struct {
  1096  	azure.FutureAPI
  1097  	// Result returns the result of the asynchronous operation.
  1098  	// If the operation has not completed it will return an error.
  1099  	Result func(ApplicationsClient) (Application, error)
  1100  }
  1101  
  1102  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1103  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1104  	var azFuture azure.Future
  1105  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1106  		return err
  1107  	}
  1108  	future.FutureAPI = &azFuture
  1109  	future.Result = future.result
  1110  	return nil
  1111  }
  1112  
  1113  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
  1114  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
  1115  	var done bool
  1116  	done, err = future.DoneWithContext(context.Background(), client)
  1117  	if err != nil {
  1118  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1119  		return
  1120  	}
  1121  	if !done {
  1122  		a.Response.Response = future.Response()
  1123  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
  1124  		return
  1125  	}
  1126  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1127  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1128  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
  1129  		if err != nil {
  1130  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
  1131  		}
  1132  	}
  1133  	return
  1134  }
  1135  
  1136  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1137  // long-running operation.
  1138  type ApplicationsCreateOrUpdateFuture struct {
  1139  	azure.FutureAPI
  1140  	// Result returns the result of the asynchronous operation.
  1141  	// If the operation has not completed it will return an error.
  1142  	Result func(ApplicationsClient) (Application, error)
  1143  }
  1144  
  1145  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1146  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1147  	var azFuture azure.Future
  1148  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1149  		return err
  1150  	}
  1151  	future.FutureAPI = &azFuture
  1152  	future.Result = future.result
  1153  	return nil
  1154  }
  1155  
  1156  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1157  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1158  	var done bool
  1159  	done, err = future.DoneWithContext(context.Background(), client)
  1160  	if err != nil {
  1161  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1162  		return
  1163  	}
  1164  	if !done {
  1165  		a.Response.Response = future.Response()
  1166  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1167  		return
  1168  	}
  1169  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1170  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1171  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1172  		if err != nil {
  1173  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1174  		}
  1175  	}
  1176  	return
  1177  }
  1178  
  1179  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1180  // operation.
  1181  type ApplicationsDeleteByIDFuture struct {
  1182  	azure.FutureAPI
  1183  	// Result returns the result of the asynchronous operation.
  1184  	// If the operation has not completed it will return an error.
  1185  	Result func(ApplicationsClient) (autorest.Response, error)
  1186  }
  1187  
  1188  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1189  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1190  	var azFuture azure.Future
  1191  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1192  		return err
  1193  	}
  1194  	future.FutureAPI = &azFuture
  1195  	future.Result = future.result
  1196  	return nil
  1197  }
  1198  
  1199  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1200  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1201  	var done bool
  1202  	done, err = future.DoneWithContext(context.Background(), client)
  1203  	if err != nil {
  1204  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1205  		return
  1206  	}
  1207  	if !done {
  1208  		ar.Response = future.Response()
  1209  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1210  		return
  1211  	}
  1212  	ar.Response = future.Response()
  1213  	return
  1214  }
  1215  
  1216  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1217  // operation.
  1218  type ApplicationsDeleteFuture struct {
  1219  	azure.FutureAPI
  1220  	// Result returns the result of the asynchronous operation.
  1221  	// If the operation has not completed it will return an error.
  1222  	Result func(ApplicationsClient) (autorest.Response, error)
  1223  }
  1224  
  1225  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1226  func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
  1227  	var azFuture azure.Future
  1228  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1229  		return err
  1230  	}
  1231  	future.FutureAPI = &azFuture
  1232  	future.Result = future.result
  1233  	return nil
  1234  }
  1235  
  1236  // result is the default implementation for ApplicationsDeleteFuture.Result.
  1237  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1238  	var done bool
  1239  	done, err = future.DoneWithContext(context.Background(), client)
  1240  	if err != nil {
  1241  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1242  		return
  1243  	}
  1244  	if !done {
  1245  		ar.Response = future.Response()
  1246  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1247  		return
  1248  	}
  1249  	ar.Response = future.Response()
  1250  	return
  1251  }
  1252  
  1253  // ErrorResponse error response indicates managed application is not able to process the incoming request.
  1254  // The reason is provided in the error message.
  1255  type ErrorResponse struct {
  1256  	// HTTPStatus - Http status code.
  1257  	HTTPStatus *string `json:"httpStatus,omitempty"`
  1258  	// ErrorCode - Error code.
  1259  	ErrorCode *string `json:"errorCode,omitempty"`
  1260  	// ErrorMessage - Error message indicating why the operation failed.
  1261  	ErrorMessage *string `json:"errorMessage,omitempty"`
  1262  }
  1263  
  1264  // GenericResource resource information.
  1265  type GenericResource struct {
  1266  	// ManagedBy - ID of the resource that manages this resource.
  1267  	ManagedBy *string `json:"managedBy,omitempty"`
  1268  	// Sku - The SKU of the resource.
  1269  	Sku *Sku `json:"sku,omitempty"`
  1270  	// Identity - The identity of the resource.
  1271  	Identity *Identity `json:"identity,omitempty"`
  1272  	// ID - READ-ONLY; Resource ID
  1273  	ID *string `json:"id,omitempty"`
  1274  	// Name - READ-ONLY; Resource name
  1275  	Name *string `json:"name,omitempty"`
  1276  	// Type - READ-ONLY; Resource type
  1277  	Type *string `json:"type,omitempty"`
  1278  	// Location - Resource location
  1279  	Location *string `json:"location,omitempty"`
  1280  	// Tags - Resource tags
  1281  	Tags map[string]*string `json:"tags"`
  1282  }
  1283  
  1284  // MarshalJSON is the custom marshaler for GenericResource.
  1285  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1286  	objectMap := make(map[string]interface{})
  1287  	if gr.ManagedBy != nil {
  1288  		objectMap["managedBy"] = gr.ManagedBy
  1289  	}
  1290  	if gr.Sku != nil {
  1291  		objectMap["sku"] = gr.Sku
  1292  	}
  1293  	if gr.Identity != nil {
  1294  		objectMap["identity"] = gr.Identity
  1295  	}
  1296  	if gr.Location != nil {
  1297  		objectMap["location"] = gr.Location
  1298  	}
  1299  	if gr.Tags != nil {
  1300  		objectMap["tags"] = gr.Tags
  1301  	}
  1302  	return json.Marshal(objectMap)
  1303  }
  1304  
  1305  // Identity identity for the resource.
  1306  type Identity struct {
  1307  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1308  	PrincipalID *string `json:"principalId,omitempty"`
  1309  	// TenantID - READ-ONLY; The tenant ID of resource.
  1310  	TenantID *string `json:"tenantId,omitempty"`
  1311  	// Type - The identity type. Possible values include: 'SystemAssigned'
  1312  	Type ResourceIdentityType `json:"type,omitempty"`
  1313  }
  1314  
  1315  // MarshalJSON is the custom marshaler for Identity.
  1316  func (i Identity) MarshalJSON() ([]byte, error) {
  1317  	objectMap := make(map[string]interface{})
  1318  	if i.Type != "" {
  1319  		objectMap["type"] = i.Type
  1320  	}
  1321  	return json.Marshal(objectMap)
  1322  }
  1323  
  1324  // Plan plan for the managed application.
  1325  type Plan struct {
  1326  	// Name - The plan name.
  1327  	Name *string `json:"name,omitempty"`
  1328  	// Publisher - The publisher ID.
  1329  	Publisher *string `json:"publisher,omitempty"`
  1330  	// Product - The product code.
  1331  	Product *string `json:"product,omitempty"`
  1332  	// PromotionCode - The promotion code.
  1333  	PromotionCode *string `json:"promotionCode,omitempty"`
  1334  	// Version - The plan's version.
  1335  	Version *string `json:"version,omitempty"`
  1336  }
  1337  
  1338  // PlanPatchable plan for the managed application.
  1339  type PlanPatchable struct {
  1340  	// Name - The plan name.
  1341  	Name *string `json:"name,omitempty"`
  1342  	// Publisher - The publisher ID.
  1343  	Publisher *string `json:"publisher,omitempty"`
  1344  	// Product - The product code.
  1345  	Product *string `json:"product,omitempty"`
  1346  	// PromotionCode - The promotion code.
  1347  	PromotionCode *string `json:"promotionCode,omitempty"`
  1348  	// Version - The plan's version.
  1349  	Version *string `json:"version,omitempty"`
  1350  }
  1351  
  1352  // Resource resource information.
  1353  type Resource struct {
  1354  	// ID - READ-ONLY; Resource ID
  1355  	ID *string `json:"id,omitempty"`
  1356  	// Name - READ-ONLY; Resource name
  1357  	Name *string `json:"name,omitempty"`
  1358  	// Type - READ-ONLY; Resource type
  1359  	Type *string `json:"type,omitempty"`
  1360  	// Location - Resource location
  1361  	Location *string `json:"location,omitempty"`
  1362  	// Tags - Resource tags
  1363  	Tags map[string]*string `json:"tags"`
  1364  }
  1365  
  1366  // MarshalJSON is the custom marshaler for Resource.
  1367  func (r Resource) MarshalJSON() ([]byte, error) {
  1368  	objectMap := make(map[string]interface{})
  1369  	if r.Location != nil {
  1370  		objectMap["location"] = r.Location
  1371  	}
  1372  	if r.Tags != nil {
  1373  		objectMap["tags"] = r.Tags
  1374  	}
  1375  	return json.Marshal(objectMap)
  1376  }
  1377  
  1378  // Sku SKU for the resource.
  1379  type Sku struct {
  1380  	// Name - The SKU name.
  1381  	Name *string `json:"name,omitempty"`
  1382  	// Tier - The SKU tier.
  1383  	Tier *string `json:"tier,omitempty"`
  1384  	// Size - The SKU size.
  1385  	Size *string `json:"size,omitempty"`
  1386  	// Family - The SKU family.
  1387  	Family *string `json:"family,omitempty"`
  1388  	// Model - The SKU model.
  1389  	Model *string `json:"model,omitempty"`
  1390  	// Capacity - The SKU capacity.
  1391  	Capacity *int32 `json:"capacity,omitempty"`
  1392  }
  1393  

View as plain text