...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/solutions/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/solutions/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  // ApplicationDefinitionPatchable information about an application definition request.
   507  type ApplicationDefinitionPatchable struct {
   508  	// Tags - Application definition tags
   509  	Tags map[string]*string `json:"tags"`
   510  }
   511  
   512  // MarshalJSON is the custom marshaler for ApplicationDefinitionPatchable.
   513  func (adp ApplicationDefinitionPatchable) MarshalJSON() ([]byte, error) {
   514  	objectMap := make(map[string]interface{})
   515  	if adp.Tags != nil {
   516  		objectMap["tags"] = adp.Tags
   517  	}
   518  	return json.Marshal(objectMap)
   519  }
   520  
   521  // ApplicationDefinitionProperties the managed application definition properties.
   522  type ApplicationDefinitionProperties struct {
   523  	// LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
   524  	LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
   525  	// DisplayName - The managed application definition display name.
   526  	DisplayName *string `json:"displayName,omitempty"`
   527  	// IsEnabled - A value indicating whether the package is enabled or not.
   528  	IsEnabled *string `json:"isEnabled,omitempty"`
   529  	// Authorizations - The managed application provider authorizations.
   530  	Authorizations *[]ApplicationProviderAuthorization `json:"authorizations,omitempty"`
   531  	// 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.
   532  	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
   533  	// Description - The managed application definition description.
   534  	Description *string `json:"description,omitempty"`
   535  	// PackageFileURI - The managed application definition package file Uri. Use this element
   536  	PackageFileURI *string `json:"packageFileUri,omitempty"`
   537  	// MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string.
   538  	MainTemplate interface{} `json:"mainTemplate,omitempty"`
   539  	// CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.
   540  	CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
   541  }
   542  
   543  // ApplicationListResult list of managed applications.
   544  type ApplicationListResult struct {
   545  	autorest.Response `json:"-"`
   546  	// Value - The array of managed applications.
   547  	Value *[]Application `json:"value,omitempty"`
   548  	// NextLink - The URL to use for getting the next set of results.
   549  	NextLink *string `json:"nextLink,omitempty"`
   550  }
   551  
   552  // ApplicationListResultIterator provides access to a complete listing of Application values.
   553  type ApplicationListResultIterator struct {
   554  	i    int
   555  	page ApplicationListResultPage
   556  }
   557  
   558  // NextWithContext advances to the next value.  If there was an error making
   559  // the request the iterator does not advance and the error is returned.
   560  func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   561  	if tracing.IsEnabled() {
   562  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
   563  		defer func() {
   564  			sc := -1
   565  			if iter.Response().Response.Response != nil {
   566  				sc = iter.Response().Response.Response.StatusCode
   567  			}
   568  			tracing.EndSpan(ctx, sc, err)
   569  		}()
   570  	}
   571  	iter.i++
   572  	if iter.i < len(iter.page.Values()) {
   573  		return nil
   574  	}
   575  	err = iter.page.NextWithContext(ctx)
   576  	if err != nil {
   577  		iter.i--
   578  		return err
   579  	}
   580  	iter.i = 0
   581  	return nil
   582  }
   583  
   584  // Next advances to the next value.  If there was an error making
   585  // the request the iterator does not advance and the error is returned.
   586  // Deprecated: Use NextWithContext() instead.
   587  func (iter *ApplicationListResultIterator) Next() error {
   588  	return iter.NextWithContext(context.Background())
   589  }
   590  
   591  // NotDone returns true if the enumeration should be started or is not yet complete.
   592  func (iter ApplicationListResultIterator) NotDone() bool {
   593  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   594  }
   595  
   596  // Response returns the raw server response from the last page request.
   597  func (iter ApplicationListResultIterator) Response() ApplicationListResult {
   598  	return iter.page.Response()
   599  }
   600  
   601  // Value returns the current value or a zero-initialized value if the
   602  // iterator has advanced beyond the end of the collection.
   603  func (iter ApplicationListResultIterator) Value() Application {
   604  	if !iter.page.NotDone() {
   605  		return Application{}
   606  	}
   607  	return iter.page.Values()[iter.i]
   608  }
   609  
   610  // Creates a new instance of the ApplicationListResultIterator type.
   611  func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
   612  	return ApplicationListResultIterator{page: page}
   613  }
   614  
   615  // IsEmpty returns true if the ListResult contains no values.
   616  func (alr ApplicationListResult) IsEmpty() bool {
   617  	return alr.Value == nil || len(*alr.Value) == 0
   618  }
   619  
   620  // hasNextLink returns true if the NextLink is not empty.
   621  func (alr ApplicationListResult) hasNextLink() bool {
   622  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   623  }
   624  
   625  // applicationListResultPreparer prepares a request to retrieve the next set of results.
   626  // It returns nil if no more results exist.
   627  func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
   628  	if !alr.hasNextLink() {
   629  		return nil, nil
   630  	}
   631  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   632  		autorest.AsJSON(),
   633  		autorest.AsGet(),
   634  		autorest.WithBaseURL(to.String(alr.NextLink)))
   635  }
   636  
   637  // ApplicationListResultPage contains a page of Application values.
   638  type ApplicationListResultPage struct {
   639  	fn  func(context.Context, ApplicationListResult) (ApplicationListResult, error)
   640  	alr ApplicationListResult
   641  }
   642  
   643  // NextWithContext advances to the next page of values.  If there was an error making
   644  // the request the page does not advance and the error is returned.
   645  func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
   646  	if tracing.IsEnabled() {
   647  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
   648  		defer func() {
   649  			sc := -1
   650  			if page.Response().Response.Response != nil {
   651  				sc = page.Response().Response.Response.StatusCode
   652  			}
   653  			tracing.EndSpan(ctx, sc, err)
   654  		}()
   655  	}
   656  	for {
   657  		next, err := page.fn(ctx, page.alr)
   658  		if err != nil {
   659  			return err
   660  		}
   661  		page.alr = next
   662  		if !next.hasNextLink() || !next.IsEmpty() {
   663  			break
   664  		}
   665  	}
   666  	return nil
   667  }
   668  
   669  // Next advances to the next page of values.  If there was an error making
   670  // the request the page does not advance and the error is returned.
   671  // Deprecated: Use NextWithContext() instead.
   672  func (page *ApplicationListResultPage) Next() error {
   673  	return page.NextWithContext(context.Background())
   674  }
   675  
   676  // NotDone returns true if the page enumeration should be started or is not yet complete.
   677  func (page ApplicationListResultPage) NotDone() bool {
   678  	return !page.alr.IsEmpty()
   679  }
   680  
   681  // Response returns the raw server response from the last page request.
   682  func (page ApplicationListResultPage) Response() ApplicationListResult {
   683  	return page.alr
   684  }
   685  
   686  // Values returns the slice of values for the current page or nil if there are no values.
   687  func (page ApplicationListResultPage) Values() []Application {
   688  	if page.alr.IsEmpty() {
   689  		return nil
   690  	}
   691  	return *page.alr.Value
   692  }
   693  
   694  // Creates a new instance of the ApplicationListResultPage type.
   695  func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
   696  	return ApplicationListResultPage{
   697  		fn:  getNextPage,
   698  		alr: cur,
   699  	}
   700  }
   701  
   702  // ApplicationPatchable information about managed application.
   703  type ApplicationPatchable struct {
   704  	autorest.Response `json:"-"`
   705  	// ApplicationPropertiesPatchable - The managed application properties.
   706  	*ApplicationPropertiesPatchable `json:"properties,omitempty"`
   707  	// Plan - The plan information.
   708  	Plan *PlanPatchable `json:"plan,omitempty"`
   709  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
   710  	Kind *string `json:"kind,omitempty"`
   711  	// ManagedBy - ID of the resource that manages this resource.
   712  	ManagedBy *string `json:"managedBy,omitempty"`
   713  	// Sku - The SKU of the resource.
   714  	Sku *Sku `json:"sku,omitempty"`
   715  	// Identity - The identity of the resource.
   716  	Identity *Identity `json:"identity,omitempty"`
   717  	// ID - READ-ONLY; Resource ID
   718  	ID *string `json:"id,omitempty"`
   719  	// Name - READ-ONLY; Resource name
   720  	Name *string `json:"name,omitempty"`
   721  	// Type - READ-ONLY; Resource type
   722  	Type *string `json:"type,omitempty"`
   723  	// Location - Resource location
   724  	Location *string `json:"location,omitempty"`
   725  	// Tags - Resource tags
   726  	Tags map[string]*string `json:"tags"`
   727  }
   728  
   729  // MarshalJSON is the custom marshaler for ApplicationPatchable.
   730  func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
   731  	objectMap := make(map[string]interface{})
   732  	if ap.ApplicationPropertiesPatchable != nil {
   733  		objectMap["properties"] = ap.ApplicationPropertiesPatchable
   734  	}
   735  	if ap.Plan != nil {
   736  		objectMap["plan"] = ap.Plan
   737  	}
   738  	if ap.Kind != nil {
   739  		objectMap["kind"] = ap.Kind
   740  	}
   741  	if ap.ManagedBy != nil {
   742  		objectMap["managedBy"] = ap.ManagedBy
   743  	}
   744  	if ap.Sku != nil {
   745  		objectMap["sku"] = ap.Sku
   746  	}
   747  	if ap.Identity != nil {
   748  		objectMap["identity"] = ap.Identity
   749  	}
   750  	if ap.Location != nil {
   751  		objectMap["location"] = ap.Location
   752  	}
   753  	if ap.Tags != nil {
   754  		objectMap["tags"] = ap.Tags
   755  	}
   756  	return json.Marshal(objectMap)
   757  }
   758  
   759  // UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
   760  func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
   761  	var m map[string]*json.RawMessage
   762  	err := json.Unmarshal(body, &m)
   763  	if err != nil {
   764  		return err
   765  	}
   766  	for k, v := range m {
   767  		switch k {
   768  		case "properties":
   769  			if v != nil {
   770  				var applicationPropertiesPatchable ApplicationPropertiesPatchable
   771  				err = json.Unmarshal(*v, &applicationPropertiesPatchable)
   772  				if err != nil {
   773  					return err
   774  				}
   775  				ap.ApplicationPropertiesPatchable = &applicationPropertiesPatchable
   776  			}
   777  		case "plan":
   778  			if v != nil {
   779  				var plan PlanPatchable
   780  				err = json.Unmarshal(*v, &plan)
   781  				if err != nil {
   782  					return err
   783  				}
   784  				ap.Plan = &plan
   785  			}
   786  		case "kind":
   787  			if v != nil {
   788  				var kind string
   789  				err = json.Unmarshal(*v, &kind)
   790  				if err != nil {
   791  					return err
   792  				}
   793  				ap.Kind = &kind
   794  			}
   795  		case "managedBy":
   796  			if v != nil {
   797  				var managedBy string
   798  				err = json.Unmarshal(*v, &managedBy)
   799  				if err != nil {
   800  					return err
   801  				}
   802  				ap.ManagedBy = &managedBy
   803  			}
   804  		case "sku":
   805  			if v != nil {
   806  				var sku Sku
   807  				err = json.Unmarshal(*v, &sku)
   808  				if err != nil {
   809  					return err
   810  				}
   811  				ap.Sku = &sku
   812  			}
   813  		case "identity":
   814  			if v != nil {
   815  				var identity Identity
   816  				err = json.Unmarshal(*v, &identity)
   817  				if err != nil {
   818  					return err
   819  				}
   820  				ap.Identity = &identity
   821  			}
   822  		case "id":
   823  			if v != nil {
   824  				var ID string
   825  				err = json.Unmarshal(*v, &ID)
   826  				if err != nil {
   827  					return err
   828  				}
   829  				ap.ID = &ID
   830  			}
   831  		case "name":
   832  			if v != nil {
   833  				var name string
   834  				err = json.Unmarshal(*v, &name)
   835  				if err != nil {
   836  					return err
   837  				}
   838  				ap.Name = &name
   839  			}
   840  		case "type":
   841  			if v != nil {
   842  				var typeVar string
   843  				err = json.Unmarshal(*v, &typeVar)
   844  				if err != nil {
   845  					return err
   846  				}
   847  				ap.Type = &typeVar
   848  			}
   849  		case "location":
   850  			if v != nil {
   851  				var location string
   852  				err = json.Unmarshal(*v, &location)
   853  				if err != nil {
   854  					return err
   855  				}
   856  				ap.Location = &location
   857  			}
   858  		case "tags":
   859  			if v != nil {
   860  				var tags map[string]*string
   861  				err = json.Unmarshal(*v, &tags)
   862  				if err != nil {
   863  					return err
   864  				}
   865  				ap.Tags = tags
   866  			}
   867  		}
   868  	}
   869  
   870  	return nil
   871  }
   872  
   873  // ApplicationProperties the managed application properties.
   874  type ApplicationProperties struct {
   875  	// ManagedResourceGroupID - The managed resource group Id.
   876  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   877  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   878  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   879  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   880  	Parameters interface{} `json:"parameters,omitempty"`
   881  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   882  	Outputs interface{} `json:"outputs,omitempty"`
   883  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
   884  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   885  	// UIDefinitionURI - The blob URI where the UI definition file is located.
   886  	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
   887  }
   888  
   889  // MarshalJSON is the custom marshaler for ApplicationProperties.
   890  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
   891  	objectMap := make(map[string]interface{})
   892  	if ap.ManagedResourceGroupID != nil {
   893  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
   894  	}
   895  	if ap.ApplicationDefinitionID != nil {
   896  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
   897  	}
   898  	if ap.Parameters != nil {
   899  		objectMap["parameters"] = ap.Parameters
   900  	}
   901  	if ap.UIDefinitionURI != nil {
   902  		objectMap["uiDefinitionUri"] = ap.UIDefinitionURI
   903  	}
   904  	return json.Marshal(objectMap)
   905  }
   906  
   907  // ApplicationPropertiesPatchable the managed application properties.
   908  type ApplicationPropertiesPatchable struct {
   909  	// ManagedResourceGroupID - The managed resource group Id.
   910  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   911  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   912  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   913  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   914  	Parameters interface{} `json:"parameters,omitempty"`
   915  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   916  	Outputs interface{} `json:"outputs,omitempty"`
   917  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
   918  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   919  	// UIDefinitionURI - The blob URI where the UI definition file is located.
   920  	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
   921  }
   922  
   923  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
   924  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
   925  	objectMap := make(map[string]interface{})
   926  	if app.ManagedResourceGroupID != nil {
   927  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
   928  	}
   929  	if app.ApplicationDefinitionID != nil {
   930  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
   931  	}
   932  	if app.Parameters != nil {
   933  		objectMap["parameters"] = app.Parameters
   934  	}
   935  	if app.UIDefinitionURI != nil {
   936  		objectMap["uiDefinitionUri"] = app.UIDefinitionURI
   937  	}
   938  	return json.Marshal(objectMap)
   939  }
   940  
   941  // ApplicationProviderAuthorization the managed application provider authorization.
   942  type ApplicationProviderAuthorization struct {
   943  	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
   944  	PrincipalID *string `json:"principalId,omitempty"`
   945  	// 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.
   946  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
   947  }
   948  
   949  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
   950  // long-running operation.
   951  type ApplicationsCreateOrUpdateByIDFuture struct {
   952  	azure.FutureAPI
   953  	// Result returns the result of the asynchronous operation.
   954  	// If the operation has not completed it will return an error.
   955  	Result func(ApplicationsClient) (Application, error)
   956  }
   957  
   958  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   959  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
   960  	var azFuture azure.Future
   961  	if err := json.Unmarshal(body, &azFuture); err != nil {
   962  		return err
   963  	}
   964  	future.FutureAPI = &azFuture
   965  	future.Result = future.result
   966  	return nil
   967  }
   968  
   969  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
   970  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
   971  	var done bool
   972  	done, err = future.DoneWithContext(context.Background(), client)
   973  	if err != nil {
   974  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
   975  		return
   976  	}
   977  	if !done {
   978  		a.Response.Response = future.Response()
   979  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
   980  		return
   981  	}
   982  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   983  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
   984  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
   985  		if err != nil {
   986  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
   987  		}
   988  	}
   989  	return
   990  }
   991  
   992  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   993  // long-running operation.
   994  type ApplicationsCreateOrUpdateFuture struct {
   995  	azure.FutureAPI
   996  	// Result returns the result of the asynchronous operation.
   997  	// If the operation has not completed it will return an error.
   998  	Result func(ApplicationsClient) (Application, error)
   999  }
  1000  
  1001  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1002  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1003  	var azFuture azure.Future
  1004  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1005  		return err
  1006  	}
  1007  	future.FutureAPI = &azFuture
  1008  	future.Result = future.result
  1009  	return nil
  1010  }
  1011  
  1012  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1013  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1014  	var done bool
  1015  	done, err = future.DoneWithContext(context.Background(), client)
  1016  	if err != nil {
  1017  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1018  		return
  1019  	}
  1020  	if !done {
  1021  		a.Response.Response = future.Response()
  1022  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1023  		return
  1024  	}
  1025  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1026  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1027  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1028  		if err != nil {
  1029  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1030  		}
  1031  	}
  1032  	return
  1033  }
  1034  
  1035  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1036  // operation.
  1037  type ApplicationsDeleteByIDFuture struct {
  1038  	azure.FutureAPI
  1039  	// Result returns the result of the asynchronous operation.
  1040  	// If the operation has not completed it will return an error.
  1041  	Result func(ApplicationsClient) (autorest.Response, error)
  1042  }
  1043  
  1044  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1045  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1046  	var azFuture azure.Future
  1047  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1048  		return err
  1049  	}
  1050  	future.FutureAPI = &azFuture
  1051  	future.Result = future.result
  1052  	return nil
  1053  }
  1054  
  1055  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1056  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1057  	var done bool
  1058  	done, err = future.DoneWithContext(context.Background(), client)
  1059  	if err != nil {
  1060  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1061  		return
  1062  	}
  1063  	if !done {
  1064  		ar.Response = future.Response()
  1065  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1066  		return
  1067  	}
  1068  	ar.Response = future.Response()
  1069  	return
  1070  }
  1071  
  1072  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1073  // operation.
  1074  type ApplicationsDeleteFuture struct {
  1075  	azure.FutureAPI
  1076  	// Result returns the result of the asynchronous operation.
  1077  	// If the operation has not completed it will return an error.
  1078  	Result func(ApplicationsClient) (autorest.Response, error)
  1079  }
  1080  
  1081  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1082  func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
  1083  	var azFuture azure.Future
  1084  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1085  		return err
  1086  	}
  1087  	future.FutureAPI = &azFuture
  1088  	future.Result = future.result
  1089  	return nil
  1090  }
  1091  
  1092  // result is the default implementation for ApplicationsDeleteFuture.Result.
  1093  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1094  	var done bool
  1095  	done, err = future.DoneWithContext(context.Background(), client)
  1096  	if err != nil {
  1097  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1098  		return
  1099  	}
  1100  	if !done {
  1101  		ar.Response = future.Response()
  1102  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1103  		return
  1104  	}
  1105  	ar.Response = future.Response()
  1106  	return
  1107  }
  1108  
  1109  // ApplicationsUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1110  // operation.
  1111  type ApplicationsUpdateByIDFuture struct {
  1112  	azure.FutureAPI
  1113  	// Result returns the result of the asynchronous operation.
  1114  	// If the operation has not completed it will return an error.
  1115  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1116  }
  1117  
  1118  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1119  func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1120  	var azFuture azure.Future
  1121  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1122  		return err
  1123  	}
  1124  	future.FutureAPI = &azFuture
  1125  	future.Result = future.result
  1126  	return nil
  1127  }
  1128  
  1129  // result is the default implementation for ApplicationsUpdateByIDFuture.Result.
  1130  func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1131  	var done bool
  1132  	done, err = future.DoneWithContext(context.Background(), client)
  1133  	if err != nil {
  1134  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1135  		return
  1136  	}
  1137  	if !done {
  1138  		ap.Response.Response = future.Response()
  1139  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
  1140  		return
  1141  	}
  1142  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1143  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1144  		ap, err = client.UpdateByIDResponder(ap.Response.Response)
  1145  		if err != nil {
  1146  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
  1147  		}
  1148  	}
  1149  	return
  1150  }
  1151  
  1152  // ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1153  // operation.
  1154  type ApplicationsUpdateFuture struct {
  1155  	azure.FutureAPI
  1156  	// Result returns the result of the asynchronous operation.
  1157  	// If the operation has not completed it will return an error.
  1158  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1159  }
  1160  
  1161  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1162  func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
  1163  	var azFuture azure.Future
  1164  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1165  		return err
  1166  	}
  1167  	future.FutureAPI = &azFuture
  1168  	future.Result = future.result
  1169  	return nil
  1170  }
  1171  
  1172  // result is the default implementation for ApplicationsUpdateFuture.Result.
  1173  func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1174  	var done bool
  1175  	done, err = future.DoneWithContext(context.Background(), client)
  1176  	if err != nil {
  1177  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
  1178  		return
  1179  	}
  1180  	if !done {
  1181  		ap.Response.Response = future.Response()
  1182  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateFuture")
  1183  		return
  1184  	}
  1185  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1186  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1187  		ap, err = client.UpdateResponder(ap.Response.Response)
  1188  		if err != nil {
  1189  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request")
  1190  		}
  1191  	}
  1192  	return
  1193  }
  1194  
  1195  // ErrorAdditionalInfo the resource management error additional info.
  1196  type ErrorAdditionalInfo struct {
  1197  	// Type - READ-ONLY; The additional info type.
  1198  	Type *string `json:"type,omitempty"`
  1199  	// Info - READ-ONLY; The additional info.
  1200  	Info interface{} `json:"info,omitempty"`
  1201  }
  1202  
  1203  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1204  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1205  	objectMap := make(map[string]interface{})
  1206  	return json.Marshal(objectMap)
  1207  }
  1208  
  1209  // ErrorDetail the error detail.
  1210  type ErrorDetail struct {
  1211  	// Code - READ-ONLY; The error code.
  1212  	Code *string `json:"code,omitempty"`
  1213  	// Message - READ-ONLY; The error message.
  1214  	Message *string `json:"message,omitempty"`
  1215  	// Target - READ-ONLY; The error target.
  1216  	Target *string `json:"target,omitempty"`
  1217  	// Details - READ-ONLY; The error details.
  1218  	Details *[]ErrorDetail `json:"details,omitempty"`
  1219  	// AdditionalInfo - READ-ONLY; The error additional info.
  1220  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1221  }
  1222  
  1223  // MarshalJSON is the custom marshaler for ErrorDetail.
  1224  func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
  1225  	objectMap := make(map[string]interface{})
  1226  	return json.Marshal(objectMap)
  1227  }
  1228  
  1229  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1230  // failed operations. (This also follows the OData error response format.).
  1231  type ErrorResponse struct {
  1232  	// Error - The error object.
  1233  	Error *ErrorDetail `json:"error,omitempty"`
  1234  }
  1235  
  1236  // GenericResource resource information.
  1237  type GenericResource struct {
  1238  	// ManagedBy - ID of the resource that manages this resource.
  1239  	ManagedBy *string `json:"managedBy,omitempty"`
  1240  	// Sku - The SKU of the resource.
  1241  	Sku *Sku `json:"sku,omitempty"`
  1242  	// Identity - The identity of the resource.
  1243  	Identity *Identity `json:"identity,omitempty"`
  1244  	// ID - READ-ONLY; Resource ID
  1245  	ID *string `json:"id,omitempty"`
  1246  	// Name - READ-ONLY; Resource name
  1247  	Name *string `json:"name,omitempty"`
  1248  	// Type - READ-ONLY; Resource type
  1249  	Type *string `json:"type,omitempty"`
  1250  	// Location - Resource location
  1251  	Location *string `json:"location,omitempty"`
  1252  	// Tags - Resource tags
  1253  	Tags map[string]*string `json:"tags"`
  1254  }
  1255  
  1256  // MarshalJSON is the custom marshaler for GenericResource.
  1257  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1258  	objectMap := make(map[string]interface{})
  1259  	if gr.ManagedBy != nil {
  1260  		objectMap["managedBy"] = gr.ManagedBy
  1261  	}
  1262  	if gr.Sku != nil {
  1263  		objectMap["sku"] = gr.Sku
  1264  	}
  1265  	if gr.Identity != nil {
  1266  		objectMap["identity"] = gr.Identity
  1267  	}
  1268  	if gr.Location != nil {
  1269  		objectMap["location"] = gr.Location
  1270  	}
  1271  	if gr.Tags != nil {
  1272  		objectMap["tags"] = gr.Tags
  1273  	}
  1274  	return json.Marshal(objectMap)
  1275  }
  1276  
  1277  // Identity identity for the resource.
  1278  type Identity struct {
  1279  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1280  	PrincipalID *string `json:"principalId,omitempty"`
  1281  	// TenantID - READ-ONLY; The tenant ID of resource.
  1282  	TenantID *string `json:"tenantId,omitempty"`
  1283  	// Type - The identity type. Possible values include: 'SystemAssigned'
  1284  	Type ResourceIdentityType `json:"type,omitempty"`
  1285  }
  1286  
  1287  // MarshalJSON is the custom marshaler for Identity.
  1288  func (i Identity) MarshalJSON() ([]byte, error) {
  1289  	objectMap := make(map[string]interface{})
  1290  	if i.Type != "" {
  1291  		objectMap["type"] = i.Type
  1292  	}
  1293  	return json.Marshal(objectMap)
  1294  }
  1295  
  1296  // Operation details of a REST API operation, returned from the Resource Provider Operations API
  1297  type Operation struct {
  1298  	// Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
  1299  	Name *string `json:"name,omitempty"`
  1300  	// IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations.
  1301  	IsDataAction *bool `json:"isDataAction,omitempty"`
  1302  	// Display - Localized display information for this particular operation.
  1303  	Display *OperationDisplay `json:"display,omitempty"`
  1304  	// Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'User', 'System', 'Usersystem'
  1305  	Origin Origin `json:"origin,omitempty"`
  1306  	// ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal'
  1307  	ActionType ActionType `json:"actionType,omitempty"`
  1308  }
  1309  
  1310  // MarshalJSON is the custom marshaler for Operation.
  1311  func (o Operation) MarshalJSON() ([]byte, error) {
  1312  	objectMap := make(map[string]interface{})
  1313  	if o.Display != nil {
  1314  		objectMap["display"] = o.Display
  1315  	}
  1316  	return json.Marshal(objectMap)
  1317  }
  1318  
  1319  // OperationDisplay localized display information for this particular operation.
  1320  type OperationDisplay struct {
  1321  	// Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute".
  1322  	Provider *string `json:"provider,omitempty"`
  1323  	// Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections".
  1324  	Resource *string `json:"resource,omitempty"`
  1325  	// Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine".
  1326  	Operation *string `json:"operation,omitempty"`
  1327  	// Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
  1328  	Description *string `json:"description,omitempty"`
  1329  }
  1330  
  1331  // MarshalJSON is the custom marshaler for OperationDisplay.
  1332  func (o OperationDisplay) MarshalJSON() ([]byte, error) {
  1333  	objectMap := make(map[string]interface{})
  1334  	return json.Marshal(objectMap)
  1335  }
  1336  
  1337  // OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains
  1338  // an URL link to get the next set of results.
  1339  type OperationListResult struct {
  1340  	autorest.Response `json:"-"`
  1341  	// Value - READ-ONLY; List of operations supported by the resource provider
  1342  	Value *[]Operation `json:"value,omitempty"`
  1343  	// NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any).
  1344  	NextLink *string `json:"nextLink,omitempty"`
  1345  }
  1346  
  1347  // MarshalJSON is the custom marshaler for OperationListResult.
  1348  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1349  	objectMap := make(map[string]interface{})
  1350  	return json.Marshal(objectMap)
  1351  }
  1352  
  1353  // OperationListResultIterator provides access to a complete listing of Operation values.
  1354  type OperationListResultIterator struct {
  1355  	i    int
  1356  	page OperationListResultPage
  1357  }
  1358  
  1359  // NextWithContext advances to the next value.  If there was an error making
  1360  // the request the iterator does not advance and the error is returned.
  1361  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1362  	if tracing.IsEnabled() {
  1363  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1364  		defer func() {
  1365  			sc := -1
  1366  			if iter.Response().Response.Response != nil {
  1367  				sc = iter.Response().Response.Response.StatusCode
  1368  			}
  1369  			tracing.EndSpan(ctx, sc, err)
  1370  		}()
  1371  	}
  1372  	iter.i++
  1373  	if iter.i < len(iter.page.Values()) {
  1374  		return nil
  1375  	}
  1376  	err = iter.page.NextWithContext(ctx)
  1377  	if err != nil {
  1378  		iter.i--
  1379  		return err
  1380  	}
  1381  	iter.i = 0
  1382  	return nil
  1383  }
  1384  
  1385  // Next advances to the next value.  If there was an error making
  1386  // the request the iterator does not advance and the error is returned.
  1387  // Deprecated: Use NextWithContext() instead.
  1388  func (iter *OperationListResultIterator) Next() error {
  1389  	return iter.NextWithContext(context.Background())
  1390  }
  1391  
  1392  // NotDone returns true if the enumeration should be started or is not yet complete.
  1393  func (iter OperationListResultIterator) NotDone() bool {
  1394  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1395  }
  1396  
  1397  // Response returns the raw server response from the last page request.
  1398  func (iter OperationListResultIterator) Response() OperationListResult {
  1399  	return iter.page.Response()
  1400  }
  1401  
  1402  // Value returns the current value or a zero-initialized value if the
  1403  // iterator has advanced beyond the end of the collection.
  1404  func (iter OperationListResultIterator) Value() Operation {
  1405  	if !iter.page.NotDone() {
  1406  		return Operation{}
  1407  	}
  1408  	return iter.page.Values()[iter.i]
  1409  }
  1410  
  1411  // Creates a new instance of the OperationListResultIterator type.
  1412  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1413  	return OperationListResultIterator{page: page}
  1414  }
  1415  
  1416  // IsEmpty returns true if the ListResult contains no values.
  1417  func (olr OperationListResult) IsEmpty() bool {
  1418  	return olr.Value == nil || len(*olr.Value) == 0
  1419  }
  1420  
  1421  // hasNextLink returns true if the NextLink is not empty.
  1422  func (olr OperationListResult) hasNextLink() bool {
  1423  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1424  }
  1425  
  1426  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1427  // It returns nil if no more results exist.
  1428  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1429  	if !olr.hasNextLink() {
  1430  		return nil, nil
  1431  	}
  1432  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1433  		autorest.AsJSON(),
  1434  		autorest.AsGet(),
  1435  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1436  }
  1437  
  1438  // OperationListResultPage contains a page of Operation values.
  1439  type OperationListResultPage struct {
  1440  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1441  	olr OperationListResult
  1442  }
  1443  
  1444  // NextWithContext advances to the next page of values.  If there was an error making
  1445  // the request the page does not advance and the error is returned.
  1446  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1447  	if tracing.IsEnabled() {
  1448  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1449  		defer func() {
  1450  			sc := -1
  1451  			if page.Response().Response.Response != nil {
  1452  				sc = page.Response().Response.Response.StatusCode
  1453  			}
  1454  			tracing.EndSpan(ctx, sc, err)
  1455  		}()
  1456  	}
  1457  	for {
  1458  		next, err := page.fn(ctx, page.olr)
  1459  		if err != nil {
  1460  			return err
  1461  		}
  1462  		page.olr = next
  1463  		if !next.hasNextLink() || !next.IsEmpty() {
  1464  			break
  1465  		}
  1466  	}
  1467  	return nil
  1468  }
  1469  
  1470  // Next advances to the next page of values.  If there was an error making
  1471  // the request the page does not advance and the error is returned.
  1472  // Deprecated: Use NextWithContext() instead.
  1473  func (page *OperationListResultPage) Next() error {
  1474  	return page.NextWithContext(context.Background())
  1475  }
  1476  
  1477  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1478  func (page OperationListResultPage) NotDone() bool {
  1479  	return !page.olr.IsEmpty()
  1480  }
  1481  
  1482  // Response returns the raw server response from the last page request.
  1483  func (page OperationListResultPage) Response() OperationListResult {
  1484  	return page.olr
  1485  }
  1486  
  1487  // Values returns the slice of values for the current page or nil if there are no values.
  1488  func (page OperationListResultPage) Values() []Operation {
  1489  	if page.olr.IsEmpty() {
  1490  		return nil
  1491  	}
  1492  	return *page.olr.Value
  1493  }
  1494  
  1495  // Creates a new instance of the OperationListResultPage type.
  1496  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1497  	return OperationListResultPage{
  1498  		fn:  getNextPage,
  1499  		olr: cur,
  1500  	}
  1501  }
  1502  
  1503  // Plan plan for the managed application.
  1504  type Plan struct {
  1505  	// Name - The plan name.
  1506  	Name *string `json:"name,omitempty"`
  1507  	// Publisher - The publisher ID.
  1508  	Publisher *string `json:"publisher,omitempty"`
  1509  	// Product - The product code.
  1510  	Product *string `json:"product,omitempty"`
  1511  	// PromotionCode - The promotion code.
  1512  	PromotionCode *string `json:"promotionCode,omitempty"`
  1513  	// Version - The plan's version.
  1514  	Version *string `json:"version,omitempty"`
  1515  }
  1516  
  1517  // PlanPatchable plan for the managed application.
  1518  type PlanPatchable struct {
  1519  	// Name - The plan name.
  1520  	Name *string `json:"name,omitempty"`
  1521  	// Publisher - The publisher ID.
  1522  	Publisher *string `json:"publisher,omitempty"`
  1523  	// Product - The product code.
  1524  	Product *string `json:"product,omitempty"`
  1525  	// PromotionCode - The promotion code.
  1526  	PromotionCode *string `json:"promotionCode,omitempty"`
  1527  	// Version - The plan's version.
  1528  	Version *string `json:"version,omitempty"`
  1529  }
  1530  
  1531  // Resource resource information.
  1532  type Resource struct {
  1533  	// ID - READ-ONLY; Resource ID
  1534  	ID *string `json:"id,omitempty"`
  1535  	// Name - READ-ONLY; Resource name
  1536  	Name *string `json:"name,omitempty"`
  1537  	// Type - READ-ONLY; Resource type
  1538  	Type *string `json:"type,omitempty"`
  1539  	// Location - Resource location
  1540  	Location *string `json:"location,omitempty"`
  1541  	// Tags - Resource tags
  1542  	Tags map[string]*string `json:"tags"`
  1543  }
  1544  
  1545  // MarshalJSON is the custom marshaler for Resource.
  1546  func (r Resource) MarshalJSON() ([]byte, error) {
  1547  	objectMap := make(map[string]interface{})
  1548  	if r.Location != nil {
  1549  		objectMap["location"] = r.Location
  1550  	}
  1551  	if r.Tags != nil {
  1552  		objectMap["tags"] = r.Tags
  1553  	}
  1554  	return json.Marshal(objectMap)
  1555  }
  1556  
  1557  // Sku SKU for the resource.
  1558  type Sku struct {
  1559  	// Name - The SKU name.
  1560  	Name *string `json:"name,omitempty"`
  1561  	// Tier - The SKU tier.
  1562  	Tier *string `json:"tier,omitempty"`
  1563  	// Size - The SKU size.
  1564  	Size *string `json:"size,omitempty"`
  1565  	// Family - The SKU family.
  1566  	Family *string `json:"family,omitempty"`
  1567  	// Model - The SKU model.
  1568  	Model *string `json:"model,omitempty"`
  1569  	// Capacity - The SKU capacity.
  1570  	Capacity *int32 `json:"capacity,omitempty"`
  1571  }
  1572  

View as plain text