...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-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/2018-06-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  }
  1030  
  1031  // MarshalJSON is the custom marshaler for ApplicationProperties.
  1032  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
  1033  	objectMap := make(map[string]interface{})
  1034  	if ap.ManagedResourceGroupID != nil {
  1035  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
  1036  	}
  1037  	if ap.ApplicationDefinitionID != nil {
  1038  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
  1039  	}
  1040  	if ap.Parameters != nil {
  1041  		objectMap["parameters"] = ap.Parameters
  1042  	}
  1043  	return json.Marshal(objectMap)
  1044  }
  1045  
  1046  // ApplicationPropertiesPatchable the managed application properties.
  1047  type ApplicationPropertiesPatchable struct {
  1048  	// ManagedResourceGroupID - The managed resource group Id.
  1049  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
  1050  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
  1051  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
  1052  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
  1053  	Parameters interface{} `json:"parameters,omitempty"`
  1054  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
  1055  	Outputs interface{} `json:"outputs,omitempty"`
  1056  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
  1057  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1058  }
  1059  
  1060  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
  1061  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
  1062  	objectMap := make(map[string]interface{})
  1063  	if app.ManagedResourceGroupID != nil {
  1064  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
  1065  	}
  1066  	if app.ApplicationDefinitionID != nil {
  1067  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
  1068  	}
  1069  	if app.Parameters != nil {
  1070  		objectMap["parameters"] = app.Parameters
  1071  	}
  1072  	return json.Marshal(objectMap)
  1073  }
  1074  
  1075  // ApplicationProviderAuthorization the managed application provider authorization.
  1076  type ApplicationProviderAuthorization struct {
  1077  	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
  1078  	PrincipalID *string `json:"principalId,omitempty"`
  1079  	// 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.
  1080  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
  1081  }
  1082  
  1083  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
  1084  // long-running operation.
  1085  type ApplicationsCreateOrUpdateByIDFuture struct {
  1086  	azure.FutureAPI
  1087  	// Result returns the result of the asynchronous operation.
  1088  	// If the operation has not completed it will return an error.
  1089  	Result func(ApplicationsClient) (Application, error)
  1090  }
  1091  
  1092  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1093  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1094  	var azFuture azure.Future
  1095  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1096  		return err
  1097  	}
  1098  	future.FutureAPI = &azFuture
  1099  	future.Result = future.result
  1100  	return nil
  1101  }
  1102  
  1103  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
  1104  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
  1105  	var done bool
  1106  	done, err = future.DoneWithContext(context.Background(), client)
  1107  	if err != nil {
  1108  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1109  		return
  1110  	}
  1111  	if !done {
  1112  		a.Response.Response = future.Response()
  1113  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
  1114  		return
  1115  	}
  1116  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1117  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1118  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
  1119  		if err != nil {
  1120  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
  1121  		}
  1122  	}
  1123  	return
  1124  }
  1125  
  1126  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1127  // long-running operation.
  1128  type ApplicationsCreateOrUpdateFuture struct {
  1129  	azure.FutureAPI
  1130  	// Result returns the result of the asynchronous operation.
  1131  	// If the operation has not completed it will return an error.
  1132  	Result func(ApplicationsClient) (Application, error)
  1133  }
  1134  
  1135  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1136  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1137  	var azFuture azure.Future
  1138  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1139  		return err
  1140  	}
  1141  	future.FutureAPI = &azFuture
  1142  	future.Result = future.result
  1143  	return nil
  1144  }
  1145  
  1146  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1147  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1148  	var done bool
  1149  	done, err = future.DoneWithContext(context.Background(), client)
  1150  	if err != nil {
  1151  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1152  		return
  1153  	}
  1154  	if !done {
  1155  		a.Response.Response = future.Response()
  1156  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1157  		return
  1158  	}
  1159  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1160  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1161  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1162  		if err != nil {
  1163  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1164  		}
  1165  	}
  1166  	return
  1167  }
  1168  
  1169  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1170  // operation.
  1171  type ApplicationsDeleteByIDFuture struct {
  1172  	azure.FutureAPI
  1173  	// Result returns the result of the asynchronous operation.
  1174  	// If the operation has not completed it will return an error.
  1175  	Result func(ApplicationsClient) (autorest.Response, error)
  1176  }
  1177  
  1178  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1179  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1180  	var azFuture azure.Future
  1181  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1182  		return err
  1183  	}
  1184  	future.FutureAPI = &azFuture
  1185  	future.Result = future.result
  1186  	return nil
  1187  }
  1188  
  1189  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1190  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1191  	var done bool
  1192  	done, err = future.DoneWithContext(context.Background(), client)
  1193  	if err != nil {
  1194  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1195  		return
  1196  	}
  1197  	if !done {
  1198  		ar.Response = future.Response()
  1199  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1200  		return
  1201  	}
  1202  	ar.Response = future.Response()
  1203  	return
  1204  }
  1205  
  1206  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1207  // operation.
  1208  type ApplicationsDeleteFuture struct {
  1209  	azure.FutureAPI
  1210  	// Result returns the result of the asynchronous operation.
  1211  	// If the operation has not completed it will return an error.
  1212  	Result func(ApplicationsClient) (autorest.Response, error)
  1213  }
  1214  
  1215  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1216  func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
  1217  	var azFuture azure.Future
  1218  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1219  		return err
  1220  	}
  1221  	future.FutureAPI = &azFuture
  1222  	future.Result = future.result
  1223  	return nil
  1224  }
  1225  
  1226  // result is the default implementation for ApplicationsDeleteFuture.Result.
  1227  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1228  	var done bool
  1229  	done, err = future.DoneWithContext(context.Background(), client)
  1230  	if err != nil {
  1231  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1232  		return
  1233  	}
  1234  	if !done {
  1235  		ar.Response = future.Response()
  1236  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1237  		return
  1238  	}
  1239  	ar.Response = future.Response()
  1240  	return
  1241  }
  1242  
  1243  // ErrorResponse error response indicates managed application is not able to process the incoming request.
  1244  // The reason is provided in the error message.
  1245  type ErrorResponse struct {
  1246  	// HTTPStatus - Http status code.
  1247  	HTTPStatus *string `json:"httpStatus,omitempty"`
  1248  	// ErrorCode - Error code.
  1249  	ErrorCode *string `json:"errorCode,omitempty"`
  1250  	// ErrorMessage - Error message indicating why the operation failed.
  1251  	ErrorMessage *string `json:"errorMessage,omitempty"`
  1252  }
  1253  
  1254  // GenericResource resource information.
  1255  type GenericResource struct {
  1256  	// ManagedBy - ID of the resource that manages this resource.
  1257  	ManagedBy *string `json:"managedBy,omitempty"`
  1258  	// Sku - The SKU of the resource.
  1259  	Sku *Sku `json:"sku,omitempty"`
  1260  	// Identity - The identity of the resource.
  1261  	Identity *Identity `json:"identity,omitempty"`
  1262  	// ID - READ-ONLY; Resource ID
  1263  	ID *string `json:"id,omitempty"`
  1264  	// Name - READ-ONLY; Resource name
  1265  	Name *string `json:"name,omitempty"`
  1266  	// Type - READ-ONLY; Resource type
  1267  	Type *string `json:"type,omitempty"`
  1268  	// Location - Resource location
  1269  	Location *string `json:"location,omitempty"`
  1270  	// Tags - Resource tags
  1271  	Tags map[string]*string `json:"tags"`
  1272  }
  1273  
  1274  // MarshalJSON is the custom marshaler for GenericResource.
  1275  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1276  	objectMap := make(map[string]interface{})
  1277  	if gr.ManagedBy != nil {
  1278  		objectMap["managedBy"] = gr.ManagedBy
  1279  	}
  1280  	if gr.Sku != nil {
  1281  		objectMap["sku"] = gr.Sku
  1282  	}
  1283  	if gr.Identity != nil {
  1284  		objectMap["identity"] = gr.Identity
  1285  	}
  1286  	if gr.Location != nil {
  1287  		objectMap["location"] = gr.Location
  1288  	}
  1289  	if gr.Tags != nil {
  1290  		objectMap["tags"] = gr.Tags
  1291  	}
  1292  	return json.Marshal(objectMap)
  1293  }
  1294  
  1295  // Identity identity for the resource.
  1296  type Identity struct {
  1297  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1298  	PrincipalID *string `json:"principalId,omitempty"`
  1299  	// TenantID - READ-ONLY; The tenant ID of resource.
  1300  	TenantID *string `json:"tenantId,omitempty"`
  1301  	// Type - The identity type. Possible values include: 'SystemAssigned'
  1302  	Type ResourceIdentityType `json:"type,omitempty"`
  1303  }
  1304  
  1305  // MarshalJSON is the custom marshaler for Identity.
  1306  func (i Identity) MarshalJSON() ([]byte, error) {
  1307  	objectMap := make(map[string]interface{})
  1308  	if i.Type != "" {
  1309  		objectMap["type"] = i.Type
  1310  	}
  1311  	return json.Marshal(objectMap)
  1312  }
  1313  
  1314  // Operation microsoft.Solutions operation
  1315  type Operation struct {
  1316  	// Name - Operation name: {provider}/{resource}/{operation}
  1317  	Name *string `json:"name,omitempty"`
  1318  	// Display - The object that represents the operation.
  1319  	Display *OperationDisplay `json:"display,omitempty"`
  1320  }
  1321  
  1322  // OperationDisplay the object that represents the operation.
  1323  type OperationDisplay struct {
  1324  	// Provider - Service provider: Microsoft.Solutions
  1325  	Provider *string `json:"provider,omitempty"`
  1326  	// Resource - Resource on which the operation is performed: Application, JitRequest, etc.
  1327  	Resource *string `json:"resource,omitempty"`
  1328  	// Operation - Operation type: Read, write, delete, etc.
  1329  	Operation *string `json:"operation,omitempty"`
  1330  }
  1331  
  1332  // OperationListResult result of the request to list Microsoft.Solutions operations. It contains a list of
  1333  // operations and a URL link to get the next set of results.
  1334  type OperationListResult struct {
  1335  	autorest.Response `json:"-"`
  1336  	// Value - List of Microsoft.Solutions operations.
  1337  	Value *[]Operation `json:"value,omitempty"`
  1338  	// NextLink - URL to get the next set of operation list results if there are any.
  1339  	NextLink *string `json:"nextLink,omitempty"`
  1340  }
  1341  
  1342  // OperationListResultIterator provides access to a complete listing of Operation values.
  1343  type OperationListResultIterator struct {
  1344  	i    int
  1345  	page OperationListResultPage
  1346  }
  1347  
  1348  // NextWithContext advances to the next value.  If there was an error making
  1349  // the request the iterator does not advance and the error is returned.
  1350  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1351  	if tracing.IsEnabled() {
  1352  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1353  		defer func() {
  1354  			sc := -1
  1355  			if iter.Response().Response.Response != nil {
  1356  				sc = iter.Response().Response.Response.StatusCode
  1357  			}
  1358  			tracing.EndSpan(ctx, sc, err)
  1359  		}()
  1360  	}
  1361  	iter.i++
  1362  	if iter.i < len(iter.page.Values()) {
  1363  		return nil
  1364  	}
  1365  	err = iter.page.NextWithContext(ctx)
  1366  	if err != nil {
  1367  		iter.i--
  1368  		return err
  1369  	}
  1370  	iter.i = 0
  1371  	return nil
  1372  }
  1373  
  1374  // Next advances to the next value.  If there was an error making
  1375  // the request the iterator does not advance and the error is returned.
  1376  // Deprecated: Use NextWithContext() instead.
  1377  func (iter *OperationListResultIterator) Next() error {
  1378  	return iter.NextWithContext(context.Background())
  1379  }
  1380  
  1381  // NotDone returns true if the enumeration should be started or is not yet complete.
  1382  func (iter OperationListResultIterator) NotDone() bool {
  1383  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1384  }
  1385  
  1386  // Response returns the raw server response from the last page request.
  1387  func (iter OperationListResultIterator) Response() OperationListResult {
  1388  	return iter.page.Response()
  1389  }
  1390  
  1391  // Value returns the current value or a zero-initialized value if the
  1392  // iterator has advanced beyond the end of the collection.
  1393  func (iter OperationListResultIterator) Value() Operation {
  1394  	if !iter.page.NotDone() {
  1395  		return Operation{}
  1396  	}
  1397  	return iter.page.Values()[iter.i]
  1398  }
  1399  
  1400  // Creates a new instance of the OperationListResultIterator type.
  1401  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1402  	return OperationListResultIterator{page: page}
  1403  }
  1404  
  1405  // IsEmpty returns true if the ListResult contains no values.
  1406  func (olr OperationListResult) IsEmpty() bool {
  1407  	return olr.Value == nil || len(*olr.Value) == 0
  1408  }
  1409  
  1410  // hasNextLink returns true if the NextLink is not empty.
  1411  func (olr OperationListResult) hasNextLink() bool {
  1412  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1413  }
  1414  
  1415  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1416  // It returns nil if no more results exist.
  1417  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1418  	if !olr.hasNextLink() {
  1419  		return nil, nil
  1420  	}
  1421  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1422  		autorest.AsJSON(),
  1423  		autorest.AsGet(),
  1424  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1425  }
  1426  
  1427  // OperationListResultPage contains a page of Operation values.
  1428  type OperationListResultPage struct {
  1429  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1430  	olr OperationListResult
  1431  }
  1432  
  1433  // NextWithContext advances to the next page of values.  If there was an error making
  1434  // the request the page does not advance and the error is returned.
  1435  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1436  	if tracing.IsEnabled() {
  1437  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1438  		defer func() {
  1439  			sc := -1
  1440  			if page.Response().Response.Response != nil {
  1441  				sc = page.Response().Response.Response.StatusCode
  1442  			}
  1443  			tracing.EndSpan(ctx, sc, err)
  1444  		}()
  1445  	}
  1446  	for {
  1447  		next, err := page.fn(ctx, page.olr)
  1448  		if err != nil {
  1449  			return err
  1450  		}
  1451  		page.olr = next
  1452  		if !next.hasNextLink() || !next.IsEmpty() {
  1453  			break
  1454  		}
  1455  	}
  1456  	return nil
  1457  }
  1458  
  1459  // Next advances to the next page of values.  If there was an error making
  1460  // the request the page does not advance and the error is returned.
  1461  // Deprecated: Use NextWithContext() instead.
  1462  func (page *OperationListResultPage) Next() error {
  1463  	return page.NextWithContext(context.Background())
  1464  }
  1465  
  1466  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1467  func (page OperationListResultPage) NotDone() bool {
  1468  	return !page.olr.IsEmpty()
  1469  }
  1470  
  1471  // Response returns the raw server response from the last page request.
  1472  func (page OperationListResultPage) Response() OperationListResult {
  1473  	return page.olr
  1474  }
  1475  
  1476  // Values returns the slice of values for the current page or nil if there are no values.
  1477  func (page OperationListResultPage) Values() []Operation {
  1478  	if page.olr.IsEmpty() {
  1479  		return nil
  1480  	}
  1481  	return *page.olr.Value
  1482  }
  1483  
  1484  // Creates a new instance of the OperationListResultPage type.
  1485  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1486  	return OperationListResultPage{
  1487  		fn:  getNextPage,
  1488  		olr: cur,
  1489  	}
  1490  }
  1491  
  1492  // Plan plan for the managed application.
  1493  type Plan struct {
  1494  	// Name - The plan name.
  1495  	Name *string `json:"name,omitempty"`
  1496  	// Publisher - The publisher ID.
  1497  	Publisher *string `json:"publisher,omitempty"`
  1498  	// Product - The product code.
  1499  	Product *string `json:"product,omitempty"`
  1500  	// PromotionCode - The promotion code.
  1501  	PromotionCode *string `json:"promotionCode,omitempty"`
  1502  	// Version - The plan's version.
  1503  	Version *string `json:"version,omitempty"`
  1504  }
  1505  
  1506  // PlanPatchable plan for the managed application.
  1507  type PlanPatchable struct {
  1508  	// Name - The plan name.
  1509  	Name *string `json:"name,omitempty"`
  1510  	// Publisher - The publisher ID.
  1511  	Publisher *string `json:"publisher,omitempty"`
  1512  	// Product - The product code.
  1513  	Product *string `json:"product,omitempty"`
  1514  	// PromotionCode - The promotion code.
  1515  	PromotionCode *string `json:"promotionCode,omitempty"`
  1516  	// Version - The plan's version.
  1517  	Version *string `json:"version,omitempty"`
  1518  }
  1519  
  1520  // Resource resource information.
  1521  type Resource struct {
  1522  	// ID - READ-ONLY; Resource ID
  1523  	ID *string `json:"id,omitempty"`
  1524  	// Name - READ-ONLY; Resource name
  1525  	Name *string `json:"name,omitempty"`
  1526  	// Type - READ-ONLY; Resource type
  1527  	Type *string `json:"type,omitempty"`
  1528  	// Location - Resource location
  1529  	Location *string `json:"location,omitempty"`
  1530  	// Tags - Resource tags
  1531  	Tags map[string]*string `json:"tags"`
  1532  }
  1533  
  1534  // MarshalJSON is the custom marshaler for Resource.
  1535  func (r Resource) MarshalJSON() ([]byte, error) {
  1536  	objectMap := make(map[string]interface{})
  1537  	if r.Location != nil {
  1538  		objectMap["location"] = r.Location
  1539  	}
  1540  	if r.Tags != nil {
  1541  		objectMap["tags"] = r.Tags
  1542  	}
  1543  	return json.Marshal(objectMap)
  1544  }
  1545  
  1546  // Sku SKU for the resource.
  1547  type Sku struct {
  1548  	// Name - The SKU name.
  1549  	Name *string `json:"name,omitempty"`
  1550  	// Tier - The SKU tier.
  1551  	Tier *string `json:"tier,omitempty"`
  1552  	// Size - The SKU size.
  1553  	Size *string `json:"size,omitempty"`
  1554  	// Family - The SKU family.
  1555  	Family *string `json:"family,omitempty"`
  1556  	// Model - The SKU model.
  1557  	Model *string `json:"model,omitempty"`
  1558  	// Capacity - The SKU capacity.
  1559  	Capacity *int32 `json:"capacity,omitempty"`
  1560  }
  1561  

View as plain text