...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/solutions/mgmt/2018-02-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/2018-02-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  	// Identity - The identity of the resource.
    32  	Identity *Identity `json:"identity,omitempty"`
    33  	// ManagedBy - ID of the resource that manages this resource.
    34  	ManagedBy *string `json:"managedBy,omitempty"`
    35  	// Sku - The SKU of the resource.
    36  	Sku *Sku `json:"sku,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.Identity != nil {
    62  		objectMap["identity"] = a.Identity
    63  	}
    64  	if a.ManagedBy != nil {
    65  		objectMap["managedBy"] = a.ManagedBy
    66  	}
    67  	if a.Sku != nil {
    68  		objectMap["sku"] = a.Sku
    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 "identity":
   116  			if v != nil {
   117  				var identity Identity
   118  				err = json.Unmarshal(*v, &identity)
   119  				if err != nil {
   120  					return err
   121  				}
   122  				a.Identity = &identity
   123  			}
   124  		case "managedBy":
   125  			if v != nil {
   126  				var managedBy string
   127  				err = json.Unmarshal(*v, &managedBy)
   128  				if err != nil {
   129  					return err
   130  				}
   131  				a.ManagedBy = &managedBy
   132  			}
   133  		case "sku":
   134  			if v != nil {
   135  				var sku Sku
   136  				err = json.Unmarshal(*v, &sku)
   137  				if err != nil {
   138  					return err
   139  				}
   140  				a.Sku = &sku
   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. Possible values include: 'NotSpecified', 'ViewDefinition', 'Authorizations', 'CustomRoleDefinition'
   196  	Name ApplicationArtifactName `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: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom'
   200  	Type ApplicationArtifactType `json:"type,omitempty"`
   201  }
   202  
   203  // ApplicationAuthorization the managed application provider authorization.
   204  type ApplicationAuthorization struct {
   205  	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
   206  	PrincipalID *string `json:"principalId,omitempty"`
   207  	// 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.
   208  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
   209  }
   210  
   211  // ApplicationBillingDetailsDefinition managed application billing details definition.
   212  type ApplicationBillingDetailsDefinition struct {
   213  	// ResourceUsageID - The managed application resource usage Id.
   214  	ResourceUsageID *string `json:"resourceUsageId,omitempty"`
   215  }
   216  
   217  // ApplicationClientDetails the application client details to track the entity creating/updating the
   218  // managed app resource.
   219  type ApplicationClientDetails struct {
   220  	// Oid - The client Oid.
   221  	Oid *string `json:"oid,omitempty"`
   222  	// Puid - The client Puid
   223  	Puid *string `json:"puid,omitempty"`
   224  	// ApplicationID - The client application Id.
   225  	ApplicationID *string `json:"applicationId,omitempty"`
   226  }
   227  
   228  // ApplicationDefinition information about managed application definition.
   229  type ApplicationDefinition struct {
   230  	autorest.Response `json:"-"`
   231  	// ApplicationDefinitionProperties - The managed application definition properties.
   232  	*ApplicationDefinitionProperties `json:"properties,omitempty"`
   233  	// ManagedBy - ID of the resource that manages this resource.
   234  	ManagedBy *string `json:"managedBy,omitempty"`
   235  	// Sku - The SKU of the resource.
   236  	Sku *Sku `json:"sku,omitempty"`
   237  	// ID - READ-ONLY; Resource ID
   238  	ID *string `json:"id,omitempty"`
   239  	// Name - READ-ONLY; Resource name
   240  	Name *string `json:"name,omitempty"`
   241  	// Type - READ-ONLY; Resource type
   242  	Type *string `json:"type,omitempty"`
   243  	// Location - Resource location
   244  	Location *string `json:"location,omitempty"`
   245  	// Tags - Resource tags
   246  	Tags map[string]*string `json:"tags"`
   247  }
   248  
   249  // MarshalJSON is the custom marshaler for ApplicationDefinition.
   250  func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
   251  	objectMap := make(map[string]interface{})
   252  	if ad.ApplicationDefinitionProperties != nil {
   253  		objectMap["properties"] = ad.ApplicationDefinitionProperties
   254  	}
   255  	if ad.ManagedBy != nil {
   256  		objectMap["managedBy"] = ad.ManagedBy
   257  	}
   258  	if ad.Sku != nil {
   259  		objectMap["sku"] = ad.Sku
   260  	}
   261  	if ad.Location != nil {
   262  		objectMap["location"] = ad.Location
   263  	}
   264  	if ad.Tags != nil {
   265  		objectMap["tags"] = ad.Tags
   266  	}
   267  	return json.Marshal(objectMap)
   268  }
   269  
   270  // UnmarshalJSON is the custom unmarshaler for ApplicationDefinition struct.
   271  func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
   272  	var m map[string]*json.RawMessage
   273  	err := json.Unmarshal(body, &m)
   274  	if err != nil {
   275  		return err
   276  	}
   277  	for k, v := range m {
   278  		switch k {
   279  		case "properties":
   280  			if v != nil {
   281  				var applicationDefinitionProperties ApplicationDefinitionProperties
   282  				err = json.Unmarshal(*v, &applicationDefinitionProperties)
   283  				if err != nil {
   284  					return err
   285  				}
   286  				ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
   287  			}
   288  		case "managedBy":
   289  			if v != nil {
   290  				var managedBy string
   291  				err = json.Unmarshal(*v, &managedBy)
   292  				if err != nil {
   293  					return err
   294  				}
   295  				ad.ManagedBy = &managedBy
   296  			}
   297  		case "sku":
   298  			if v != nil {
   299  				var sku Sku
   300  				err = json.Unmarshal(*v, &sku)
   301  				if err != nil {
   302  					return err
   303  				}
   304  				ad.Sku = &sku
   305  			}
   306  		case "id":
   307  			if v != nil {
   308  				var ID string
   309  				err = json.Unmarshal(*v, &ID)
   310  				if err != nil {
   311  					return err
   312  				}
   313  				ad.ID = &ID
   314  			}
   315  		case "name":
   316  			if v != nil {
   317  				var name string
   318  				err = json.Unmarshal(*v, &name)
   319  				if err != nil {
   320  					return err
   321  				}
   322  				ad.Name = &name
   323  			}
   324  		case "type":
   325  			if v != nil {
   326  				var typeVar string
   327  				err = json.Unmarshal(*v, &typeVar)
   328  				if err != nil {
   329  					return err
   330  				}
   331  				ad.Type = &typeVar
   332  			}
   333  		case "location":
   334  			if v != nil {
   335  				var location string
   336  				err = json.Unmarshal(*v, &location)
   337  				if err != nil {
   338  					return err
   339  				}
   340  				ad.Location = &location
   341  			}
   342  		case "tags":
   343  			if v != nil {
   344  				var tags map[string]*string
   345  				err = json.Unmarshal(*v, &tags)
   346  				if err != nil {
   347  					return err
   348  				}
   349  				ad.Tags = tags
   350  			}
   351  		}
   352  	}
   353  
   354  	return nil
   355  }
   356  
   357  // ApplicationDefinitionArtifact application definition artifact.
   358  type ApplicationDefinitionArtifact struct {
   359  	// Name - The managed application definition artifact name. Possible values include: 'ApplicationDefinitionArtifactNameNotSpecified', 'ApplicationDefinitionArtifactNameApplicationResourceTemplate', 'ApplicationDefinitionArtifactNameCreateUIDefinition', 'ApplicationDefinitionArtifactNameMainTemplateParameters'
   360  	Name ApplicationDefinitionArtifactName `json:"name,omitempty"`
   361  	// URI - The managed application definition artifact blob uri.
   362  	URI *string `json:"uri,omitempty"`
   363  	// Type - The managed application definition artifact type. Possible values include: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom'
   364  	Type ApplicationArtifactType `json:"type,omitempty"`
   365  }
   366  
   367  // ApplicationDefinitionListResult list of managed application definitions.
   368  type ApplicationDefinitionListResult struct {
   369  	autorest.Response `json:"-"`
   370  	// Value - The array of managed application definitions.
   371  	Value *[]ApplicationDefinition `json:"value,omitempty"`
   372  	// NextLink - The URL to use for getting the next set of results.
   373  	NextLink *string `json:"nextLink,omitempty"`
   374  }
   375  
   376  // ApplicationDefinitionListResultIterator provides access to a complete listing of ApplicationDefinition
   377  // values.
   378  type ApplicationDefinitionListResultIterator struct {
   379  	i    int
   380  	page ApplicationDefinitionListResultPage
   381  }
   382  
   383  // NextWithContext advances to the next value.  If there was an error making
   384  // the request the iterator does not advance and the error is returned.
   385  func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   386  	if tracing.IsEnabled() {
   387  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
   388  		defer func() {
   389  			sc := -1
   390  			if iter.Response().Response.Response != nil {
   391  				sc = iter.Response().Response.Response.StatusCode
   392  			}
   393  			tracing.EndSpan(ctx, sc, err)
   394  		}()
   395  	}
   396  	iter.i++
   397  	if iter.i < len(iter.page.Values()) {
   398  		return nil
   399  	}
   400  	err = iter.page.NextWithContext(ctx)
   401  	if err != nil {
   402  		iter.i--
   403  		return err
   404  	}
   405  	iter.i = 0
   406  	return nil
   407  }
   408  
   409  // Next advances to the next value.  If there was an error making
   410  // the request the iterator does not advance and the error is returned.
   411  // Deprecated: Use NextWithContext() instead.
   412  func (iter *ApplicationDefinitionListResultIterator) Next() error {
   413  	return iter.NextWithContext(context.Background())
   414  }
   415  
   416  // NotDone returns true if the enumeration should be started or is not yet complete.
   417  func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
   418  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   419  }
   420  
   421  // Response returns the raw server response from the last page request.
   422  func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
   423  	return iter.page.Response()
   424  }
   425  
   426  // Value returns the current value or a zero-initialized value if the
   427  // iterator has advanced beyond the end of the collection.
   428  func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
   429  	if !iter.page.NotDone() {
   430  		return ApplicationDefinition{}
   431  	}
   432  	return iter.page.Values()[iter.i]
   433  }
   434  
   435  // Creates a new instance of the ApplicationDefinitionListResultIterator type.
   436  func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
   437  	return ApplicationDefinitionListResultIterator{page: page}
   438  }
   439  
   440  // IsEmpty returns true if the ListResult contains no values.
   441  func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
   442  	return adlr.Value == nil || len(*adlr.Value) == 0
   443  }
   444  
   445  // hasNextLink returns true if the NextLink is not empty.
   446  func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
   447  	return adlr.NextLink != nil && len(*adlr.NextLink) != 0
   448  }
   449  
   450  // applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results.
   451  // It returns nil if no more results exist.
   452  func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
   453  	if !adlr.hasNextLink() {
   454  		return nil, nil
   455  	}
   456  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   457  		autorest.AsJSON(),
   458  		autorest.AsGet(),
   459  		autorest.WithBaseURL(to.String(adlr.NextLink)))
   460  }
   461  
   462  // ApplicationDefinitionListResultPage contains a page of ApplicationDefinition values.
   463  type ApplicationDefinitionListResultPage struct {
   464  	fn   func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
   465  	adlr ApplicationDefinitionListResult
   466  }
   467  
   468  // NextWithContext advances to the next page of values.  If there was an error making
   469  // the request the page does not advance and the error is returned.
   470  func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
   471  	if tracing.IsEnabled() {
   472  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
   473  		defer func() {
   474  			sc := -1
   475  			if page.Response().Response.Response != nil {
   476  				sc = page.Response().Response.Response.StatusCode
   477  			}
   478  			tracing.EndSpan(ctx, sc, err)
   479  		}()
   480  	}
   481  	for {
   482  		next, err := page.fn(ctx, page.adlr)
   483  		if err != nil {
   484  			return err
   485  		}
   486  		page.adlr = next
   487  		if !next.hasNextLink() || !next.IsEmpty() {
   488  			break
   489  		}
   490  	}
   491  	return nil
   492  }
   493  
   494  // Next advances to the next page of values.  If there was an error making
   495  // the request the page does not advance and the error is returned.
   496  // Deprecated: Use NextWithContext() instead.
   497  func (page *ApplicationDefinitionListResultPage) Next() error {
   498  	return page.NextWithContext(context.Background())
   499  }
   500  
   501  // NotDone returns true if the page enumeration should be started or is not yet complete.
   502  func (page ApplicationDefinitionListResultPage) NotDone() bool {
   503  	return !page.adlr.IsEmpty()
   504  }
   505  
   506  // Response returns the raw server response from the last page request.
   507  func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
   508  	return page.adlr
   509  }
   510  
   511  // Values returns the slice of values for the current page or nil if there are no values.
   512  func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
   513  	if page.adlr.IsEmpty() {
   514  		return nil
   515  	}
   516  	return *page.adlr.Value
   517  }
   518  
   519  // Creates a new instance of the ApplicationDefinitionListResultPage type.
   520  func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
   521  	return ApplicationDefinitionListResultPage{
   522  		fn:   getNextPage,
   523  		adlr: cur,
   524  	}
   525  }
   526  
   527  // ApplicationDefinitionPatchable information about an application definition request.
   528  type ApplicationDefinitionPatchable struct {
   529  	// Tags - Application definition tags
   530  	Tags map[string]*string `json:"tags"`
   531  }
   532  
   533  // MarshalJSON is the custom marshaler for ApplicationDefinitionPatchable.
   534  func (adp ApplicationDefinitionPatchable) MarshalJSON() ([]byte, error) {
   535  	objectMap := make(map[string]interface{})
   536  	if adp.Tags != nil {
   537  		objectMap["tags"] = adp.Tags
   538  	}
   539  	return json.Marshal(objectMap)
   540  }
   541  
   542  // ApplicationDefinitionProperties the managed application definition properties.
   543  type ApplicationDefinitionProperties struct {
   544  	// LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
   545  	LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
   546  	// DisplayName - The managed application definition display name.
   547  	DisplayName *string `json:"displayName,omitempty"`
   548  	// IsEnabled - A value indicating whether the package is enabled or not.
   549  	IsEnabled *bool `json:"isEnabled,omitempty"`
   550  	// Authorizations - The managed application provider authorizations.
   551  	Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
   552  	// 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.
   553  	Artifacts *[]ApplicationDefinitionArtifact `json:"artifacts,omitempty"`
   554  	// Description - The managed application definition description.
   555  	Description *string `json:"description,omitempty"`
   556  	// PackageFileURI - The managed application definition package file Uri. Use this element
   557  	PackageFileURI *string `json:"packageFileUri,omitempty"`
   558  	// MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string.
   559  	MainTemplate interface{} `json:"mainTemplate,omitempty"`
   560  	// CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.
   561  	CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
   562  	// Policies - The managed application provider policies.
   563  	Policies *[]ApplicationPolicy `json:"policies,omitempty"`
   564  }
   565  
   566  // ApplicationListResult list of managed applications.
   567  type ApplicationListResult struct {
   568  	autorest.Response `json:"-"`
   569  	// Value - The array of managed applications.
   570  	Value *[]Application `json:"value,omitempty"`
   571  	// NextLink - The URL to use for getting the next set of results.
   572  	NextLink *string `json:"nextLink,omitempty"`
   573  }
   574  
   575  // ApplicationListResultIterator provides access to a complete listing of Application values.
   576  type ApplicationListResultIterator struct {
   577  	i    int
   578  	page ApplicationListResultPage
   579  }
   580  
   581  // NextWithContext advances to the next value.  If there was an error making
   582  // the request the iterator does not advance and the error is returned.
   583  func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   584  	if tracing.IsEnabled() {
   585  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
   586  		defer func() {
   587  			sc := -1
   588  			if iter.Response().Response.Response != nil {
   589  				sc = iter.Response().Response.Response.StatusCode
   590  			}
   591  			tracing.EndSpan(ctx, sc, err)
   592  		}()
   593  	}
   594  	iter.i++
   595  	if iter.i < len(iter.page.Values()) {
   596  		return nil
   597  	}
   598  	err = iter.page.NextWithContext(ctx)
   599  	if err != nil {
   600  		iter.i--
   601  		return err
   602  	}
   603  	iter.i = 0
   604  	return nil
   605  }
   606  
   607  // Next advances to the next value.  If there was an error making
   608  // the request the iterator does not advance and the error is returned.
   609  // Deprecated: Use NextWithContext() instead.
   610  func (iter *ApplicationListResultIterator) Next() error {
   611  	return iter.NextWithContext(context.Background())
   612  }
   613  
   614  // NotDone returns true if the enumeration should be started or is not yet complete.
   615  func (iter ApplicationListResultIterator) NotDone() bool {
   616  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   617  }
   618  
   619  // Response returns the raw server response from the last page request.
   620  func (iter ApplicationListResultIterator) Response() ApplicationListResult {
   621  	return iter.page.Response()
   622  }
   623  
   624  // Value returns the current value or a zero-initialized value if the
   625  // iterator has advanced beyond the end of the collection.
   626  func (iter ApplicationListResultIterator) Value() Application {
   627  	if !iter.page.NotDone() {
   628  		return Application{}
   629  	}
   630  	return iter.page.Values()[iter.i]
   631  }
   632  
   633  // Creates a new instance of the ApplicationListResultIterator type.
   634  func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
   635  	return ApplicationListResultIterator{page: page}
   636  }
   637  
   638  // IsEmpty returns true if the ListResult contains no values.
   639  func (alr ApplicationListResult) IsEmpty() bool {
   640  	return alr.Value == nil || len(*alr.Value) == 0
   641  }
   642  
   643  // hasNextLink returns true if the NextLink is not empty.
   644  func (alr ApplicationListResult) hasNextLink() bool {
   645  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   646  }
   647  
   648  // applicationListResultPreparer prepares a request to retrieve the next set of results.
   649  // It returns nil if no more results exist.
   650  func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
   651  	if !alr.hasNextLink() {
   652  		return nil, nil
   653  	}
   654  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   655  		autorest.AsJSON(),
   656  		autorest.AsGet(),
   657  		autorest.WithBaseURL(to.String(alr.NextLink)))
   658  }
   659  
   660  // ApplicationListResultPage contains a page of Application values.
   661  type ApplicationListResultPage struct {
   662  	fn  func(context.Context, ApplicationListResult) (ApplicationListResult, error)
   663  	alr ApplicationListResult
   664  }
   665  
   666  // NextWithContext advances to the next page of values.  If there was an error making
   667  // the request the page does not advance and the error is returned.
   668  func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
   669  	if tracing.IsEnabled() {
   670  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
   671  		defer func() {
   672  			sc := -1
   673  			if page.Response().Response.Response != nil {
   674  				sc = page.Response().Response.Response.StatusCode
   675  			}
   676  			tracing.EndSpan(ctx, sc, err)
   677  		}()
   678  	}
   679  	for {
   680  		next, err := page.fn(ctx, page.alr)
   681  		if err != nil {
   682  			return err
   683  		}
   684  		page.alr = next
   685  		if !next.hasNextLink() || !next.IsEmpty() {
   686  			break
   687  		}
   688  	}
   689  	return nil
   690  }
   691  
   692  // Next advances to the next page of values.  If there was an error making
   693  // the request the page does not advance and the error is returned.
   694  // Deprecated: Use NextWithContext() instead.
   695  func (page *ApplicationListResultPage) Next() error {
   696  	return page.NextWithContext(context.Background())
   697  }
   698  
   699  // NotDone returns true if the page enumeration should be started or is not yet complete.
   700  func (page ApplicationListResultPage) NotDone() bool {
   701  	return !page.alr.IsEmpty()
   702  }
   703  
   704  // Response returns the raw server response from the last page request.
   705  func (page ApplicationListResultPage) Response() ApplicationListResult {
   706  	return page.alr
   707  }
   708  
   709  // Values returns the slice of values for the current page or nil if there are no values.
   710  func (page ApplicationListResultPage) Values() []Application {
   711  	if page.alr.IsEmpty() {
   712  		return nil
   713  	}
   714  	return *page.alr.Value
   715  }
   716  
   717  // Creates a new instance of the ApplicationListResultPage type.
   718  func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
   719  	return ApplicationListResultPage{
   720  		fn:  getNextPage,
   721  		alr: cur,
   722  	}
   723  }
   724  
   725  // ApplicationPackageContact the application package contact information.
   726  type ApplicationPackageContact struct {
   727  	// ContactName - The contact name.
   728  	ContactName *string `json:"contactName,omitempty"`
   729  	// Email - The contact email.
   730  	Email *string `json:"email,omitempty"`
   731  	// Phone - The contact phone number.
   732  	Phone *string `json:"phone,omitempty"`
   733  }
   734  
   735  // ApplicationPackageSupportUrls the appliance package support URLs.
   736  type ApplicationPackageSupportUrls struct {
   737  	// PublicAzure - The public azure support URL.
   738  	PublicAzure *string `json:"publicAzure,omitempty"`
   739  	// GovernmentCloud - The government cloud support URL.
   740  	GovernmentCloud *string `json:"governmentCloud,omitempty"`
   741  }
   742  
   743  // ApplicationPatchable information about managed application.
   744  type ApplicationPatchable struct {
   745  	autorest.Response `json:"-"`
   746  	// ApplicationProperties - The managed application properties.
   747  	*ApplicationProperties `json:"properties,omitempty"`
   748  	// Plan - The plan information.
   749  	Plan *PlanPatchable `json:"plan,omitempty"`
   750  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
   751  	Kind *string `json:"kind,omitempty"`
   752  	// Identity - The identity of the resource.
   753  	Identity *Identity `json:"identity,omitempty"`
   754  	// ManagedBy - ID of the resource that manages this resource.
   755  	ManagedBy *string `json:"managedBy,omitempty"`
   756  	// Sku - The SKU of the resource.
   757  	Sku *Sku `json:"sku,omitempty"`
   758  	// ID - READ-ONLY; Resource ID
   759  	ID *string `json:"id,omitempty"`
   760  	// Name - READ-ONLY; Resource name
   761  	Name *string `json:"name,omitempty"`
   762  	// Type - READ-ONLY; Resource type
   763  	Type *string `json:"type,omitempty"`
   764  	// Location - Resource location
   765  	Location *string `json:"location,omitempty"`
   766  	// Tags - Resource tags
   767  	Tags map[string]*string `json:"tags"`
   768  }
   769  
   770  // MarshalJSON is the custom marshaler for ApplicationPatchable.
   771  func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
   772  	objectMap := make(map[string]interface{})
   773  	if ap.ApplicationProperties != nil {
   774  		objectMap["properties"] = ap.ApplicationProperties
   775  	}
   776  	if ap.Plan != nil {
   777  		objectMap["plan"] = ap.Plan
   778  	}
   779  	if ap.Kind != nil {
   780  		objectMap["kind"] = ap.Kind
   781  	}
   782  	if ap.Identity != nil {
   783  		objectMap["identity"] = ap.Identity
   784  	}
   785  	if ap.ManagedBy != nil {
   786  		objectMap["managedBy"] = ap.ManagedBy
   787  	}
   788  	if ap.Sku != nil {
   789  		objectMap["sku"] = ap.Sku
   790  	}
   791  	if ap.Location != nil {
   792  		objectMap["location"] = ap.Location
   793  	}
   794  	if ap.Tags != nil {
   795  		objectMap["tags"] = ap.Tags
   796  	}
   797  	return json.Marshal(objectMap)
   798  }
   799  
   800  // UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
   801  func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
   802  	var m map[string]*json.RawMessage
   803  	err := json.Unmarshal(body, &m)
   804  	if err != nil {
   805  		return err
   806  	}
   807  	for k, v := range m {
   808  		switch k {
   809  		case "properties":
   810  			if v != nil {
   811  				var applicationProperties ApplicationProperties
   812  				err = json.Unmarshal(*v, &applicationProperties)
   813  				if err != nil {
   814  					return err
   815  				}
   816  				ap.ApplicationProperties = &applicationProperties
   817  			}
   818  		case "plan":
   819  			if v != nil {
   820  				var plan PlanPatchable
   821  				err = json.Unmarshal(*v, &plan)
   822  				if err != nil {
   823  					return err
   824  				}
   825  				ap.Plan = &plan
   826  			}
   827  		case "kind":
   828  			if v != nil {
   829  				var kind string
   830  				err = json.Unmarshal(*v, &kind)
   831  				if err != nil {
   832  					return err
   833  				}
   834  				ap.Kind = &kind
   835  			}
   836  		case "identity":
   837  			if v != nil {
   838  				var identity Identity
   839  				err = json.Unmarshal(*v, &identity)
   840  				if err != nil {
   841  					return err
   842  				}
   843  				ap.Identity = &identity
   844  			}
   845  		case "managedBy":
   846  			if v != nil {
   847  				var managedBy string
   848  				err = json.Unmarshal(*v, &managedBy)
   849  				if err != nil {
   850  					return err
   851  				}
   852  				ap.ManagedBy = &managedBy
   853  			}
   854  		case "sku":
   855  			if v != nil {
   856  				var sku Sku
   857  				err = json.Unmarshal(*v, &sku)
   858  				if err != nil {
   859  					return err
   860  				}
   861  				ap.Sku = &sku
   862  			}
   863  		case "id":
   864  			if v != nil {
   865  				var ID string
   866  				err = json.Unmarshal(*v, &ID)
   867  				if err != nil {
   868  					return err
   869  				}
   870  				ap.ID = &ID
   871  			}
   872  		case "name":
   873  			if v != nil {
   874  				var name string
   875  				err = json.Unmarshal(*v, &name)
   876  				if err != nil {
   877  					return err
   878  				}
   879  				ap.Name = &name
   880  			}
   881  		case "type":
   882  			if v != nil {
   883  				var typeVar string
   884  				err = json.Unmarshal(*v, &typeVar)
   885  				if err != nil {
   886  					return err
   887  				}
   888  				ap.Type = &typeVar
   889  			}
   890  		case "location":
   891  			if v != nil {
   892  				var location string
   893  				err = json.Unmarshal(*v, &location)
   894  				if err != nil {
   895  					return err
   896  				}
   897  				ap.Location = &location
   898  			}
   899  		case "tags":
   900  			if v != nil {
   901  				var tags map[string]*string
   902  				err = json.Unmarshal(*v, &tags)
   903  				if err != nil {
   904  					return err
   905  				}
   906  				ap.Tags = tags
   907  			}
   908  		}
   909  	}
   910  
   911  	return nil
   912  }
   913  
   914  // ApplicationPolicy managed application policy.
   915  type ApplicationPolicy struct {
   916  	// Name - The policy name
   917  	Name *string `json:"name,omitempty"`
   918  	// PolicyDefinitionID - The policy definition Id.
   919  	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
   920  	// Parameters - The policy parameters.
   921  	Parameters *string `json:"parameters,omitempty"`
   922  }
   923  
   924  // ApplicationProperties the managed application properties.
   925  type ApplicationProperties struct {
   926  	// ManagedResourceGroupID - The managed resource group Id.
   927  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   928  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   929  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   930  	// PublisherPackageID - The publisher package Id.
   931  	PublisherPackageID *string `json:"publisherPackageId,omitempty"`
   932  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   933  	Parameters interface{} `json:"parameters,omitempty"`
   934  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   935  	Outputs interface{} `json:"outputs,omitempty"`
   936  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
   937  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   938  	// BillingDetails - READ-ONLY; The managed application billing details.
   939  	BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"`
   940  	// PublisherTenantID - READ-ONLY; The publisher tenant Id.
   941  	PublisherTenantID *string `json:"publisherTenantId,omitempty"`
   942  	// Authorizations - READ-ONLY; The  read-only authorizations property that is retrieved from the application package.
   943  	Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
   944  	// CustomerSupport - READ-ONLY; The read-only customer support property that is retrieved from the application package.
   945  	CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"`
   946  	// SupportUrls - READ-ONLY; The read-only support URLs property that is retrieved from the application package.
   947  	SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"`
   948  	// Artifacts - READ-ONLY; The collection of managed application artifacts.
   949  	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
   950  	// CreatedBy - READ-ONLY; The client entity that created the JIT request.
   951  	CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
   952  	// UpdatedBy - READ-ONLY; The client entity that last updated the JIT request.
   953  	UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
   954  }
   955  
   956  // MarshalJSON is the custom marshaler for ApplicationProperties.
   957  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
   958  	objectMap := make(map[string]interface{})
   959  	if ap.ManagedResourceGroupID != nil {
   960  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
   961  	}
   962  	if ap.ApplicationDefinitionID != nil {
   963  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
   964  	}
   965  	if ap.PublisherPackageID != nil {
   966  		objectMap["publisherPackageId"] = ap.PublisherPackageID
   967  	}
   968  	if ap.Parameters != nil {
   969  		objectMap["parameters"] = ap.Parameters
   970  	}
   971  	return json.Marshal(objectMap)
   972  }
   973  
   974  // ApplicationPropertiesPatchable the managed application properties.
   975  type ApplicationPropertiesPatchable struct {
   976  	// ManagedResourceGroupID - The managed resource group Id.
   977  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   978  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   979  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   980  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   981  	Parameters interface{} `json:"parameters,omitempty"`
   982  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   983  	Outputs interface{} `json:"outputs,omitempty"`
   984  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
   985  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   986  }
   987  
   988  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
   989  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
   990  	objectMap := make(map[string]interface{})
   991  	if app.ManagedResourceGroupID != nil {
   992  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
   993  	}
   994  	if app.ApplicationDefinitionID != nil {
   995  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
   996  	}
   997  	if app.Parameters != nil {
   998  		objectMap["parameters"] = app.Parameters
   999  	}
  1000  	return json.Marshal(objectMap)
  1001  }
  1002  
  1003  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
  1004  // long-running operation.
  1005  type ApplicationsCreateOrUpdateByIDFuture struct {
  1006  	azure.FutureAPI
  1007  	// Result returns the result of the asynchronous operation.
  1008  	// If the operation has not completed it will return an error.
  1009  	Result func(ApplicationsClient) (Application, error)
  1010  }
  1011  
  1012  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1013  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1014  	var azFuture azure.Future
  1015  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1016  		return err
  1017  	}
  1018  	future.FutureAPI = &azFuture
  1019  	future.Result = future.result
  1020  	return nil
  1021  }
  1022  
  1023  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
  1024  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
  1025  	var done bool
  1026  	done, err = future.DoneWithContext(context.Background(), client)
  1027  	if err != nil {
  1028  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1029  		return
  1030  	}
  1031  	if !done {
  1032  		a.Response.Response = future.Response()
  1033  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
  1034  		return
  1035  	}
  1036  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1037  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1038  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
  1039  		if err != nil {
  1040  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
  1041  		}
  1042  	}
  1043  	return
  1044  }
  1045  
  1046  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1047  // long-running operation.
  1048  type ApplicationsCreateOrUpdateFuture struct {
  1049  	azure.FutureAPI
  1050  	// Result returns the result of the asynchronous operation.
  1051  	// If the operation has not completed it will return an error.
  1052  	Result func(ApplicationsClient) (Application, error)
  1053  }
  1054  
  1055  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1056  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1057  	var azFuture azure.Future
  1058  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1059  		return err
  1060  	}
  1061  	future.FutureAPI = &azFuture
  1062  	future.Result = future.result
  1063  	return nil
  1064  }
  1065  
  1066  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1067  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1068  	var done bool
  1069  	done, err = future.DoneWithContext(context.Background(), client)
  1070  	if err != nil {
  1071  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1072  		return
  1073  	}
  1074  	if !done {
  1075  		a.Response.Response = future.Response()
  1076  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1077  		return
  1078  	}
  1079  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1080  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1081  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1082  		if err != nil {
  1083  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1084  		}
  1085  	}
  1086  	return
  1087  }
  1088  
  1089  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1090  // operation.
  1091  type ApplicationsDeleteByIDFuture struct {
  1092  	azure.FutureAPI
  1093  	// Result returns the result of the asynchronous operation.
  1094  	// If the operation has not completed it will return an error.
  1095  	Result func(ApplicationsClient) (autorest.Response, error)
  1096  }
  1097  
  1098  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1099  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1100  	var azFuture azure.Future
  1101  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1102  		return err
  1103  	}
  1104  	future.FutureAPI = &azFuture
  1105  	future.Result = future.result
  1106  	return nil
  1107  }
  1108  
  1109  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1110  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1111  	var done bool
  1112  	done, err = future.DoneWithContext(context.Background(), client)
  1113  	if err != nil {
  1114  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1115  		return
  1116  	}
  1117  	if !done {
  1118  		ar.Response = future.Response()
  1119  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1120  		return
  1121  	}
  1122  	ar.Response = future.Response()
  1123  	return
  1124  }
  1125  
  1126  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1127  // operation.
  1128  type ApplicationsDeleteFuture 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) (autorest.Response, error)
  1133  }
  1134  
  1135  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1136  func (future *ApplicationsDeleteFuture) 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 ApplicationsDeleteFuture.Result.
  1147  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1148  	var done bool
  1149  	done, err = future.DoneWithContext(context.Background(), client)
  1150  	if err != nil {
  1151  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1152  		return
  1153  	}
  1154  	if !done {
  1155  		ar.Response = future.Response()
  1156  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1157  		return
  1158  	}
  1159  	ar.Response = future.Response()
  1160  	return
  1161  }
  1162  
  1163  // ApplicationsRefreshPermissionsFuture an abstraction for monitoring and retrieving the results of a
  1164  // long-running operation.
  1165  type ApplicationsRefreshPermissionsFuture struct {
  1166  	azure.FutureAPI
  1167  	// Result returns the result of the asynchronous operation.
  1168  	// If the operation has not completed it will return an error.
  1169  	Result func(ApplicationsClient) (autorest.Response, error)
  1170  }
  1171  
  1172  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1173  func (future *ApplicationsRefreshPermissionsFuture) UnmarshalJSON(body []byte) error {
  1174  	var azFuture azure.Future
  1175  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1176  		return err
  1177  	}
  1178  	future.FutureAPI = &azFuture
  1179  	future.Result = future.result
  1180  	return nil
  1181  }
  1182  
  1183  // result is the default implementation for ApplicationsRefreshPermissionsFuture.Result.
  1184  func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1185  	var done bool
  1186  	done, err = future.DoneWithContext(context.Background(), client)
  1187  	if err != nil {
  1188  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsRefreshPermissionsFuture", "Result", future.Response(), "Polling failure")
  1189  		return
  1190  	}
  1191  	if !done {
  1192  		ar.Response = future.Response()
  1193  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsRefreshPermissionsFuture")
  1194  		return
  1195  	}
  1196  	ar.Response = future.Response()
  1197  	return
  1198  }
  1199  
  1200  // ApplicationsUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1201  // operation.
  1202  type ApplicationsUpdateByIDFuture struct {
  1203  	azure.FutureAPI
  1204  	// Result returns the result of the asynchronous operation.
  1205  	// If the operation has not completed it will return an error.
  1206  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1207  }
  1208  
  1209  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1210  func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1211  	var azFuture azure.Future
  1212  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1213  		return err
  1214  	}
  1215  	future.FutureAPI = &azFuture
  1216  	future.Result = future.result
  1217  	return nil
  1218  }
  1219  
  1220  // result is the default implementation for ApplicationsUpdateByIDFuture.Result.
  1221  func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1222  	var done bool
  1223  	done, err = future.DoneWithContext(context.Background(), client)
  1224  	if err != nil {
  1225  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1226  		return
  1227  	}
  1228  	if !done {
  1229  		ap.Response.Response = future.Response()
  1230  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
  1231  		return
  1232  	}
  1233  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1234  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1235  		ap, err = client.UpdateByIDResponder(ap.Response.Response)
  1236  		if err != nil {
  1237  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
  1238  		}
  1239  	}
  1240  	return
  1241  }
  1242  
  1243  // ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1244  // operation.
  1245  type ApplicationsUpdateFuture struct {
  1246  	azure.FutureAPI
  1247  	// Result returns the result of the asynchronous operation.
  1248  	// If the operation has not completed it will return an error.
  1249  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1250  }
  1251  
  1252  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1253  func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
  1254  	var azFuture azure.Future
  1255  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1256  		return err
  1257  	}
  1258  	future.FutureAPI = &azFuture
  1259  	future.Result = future.result
  1260  	return nil
  1261  }
  1262  
  1263  // result is the default implementation for ApplicationsUpdateFuture.Result.
  1264  func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1265  	var done bool
  1266  	done, err = future.DoneWithContext(context.Background(), client)
  1267  	if err != nil {
  1268  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
  1269  		return
  1270  	}
  1271  	if !done {
  1272  		ap.Response.Response = future.Response()
  1273  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateFuture")
  1274  		return
  1275  	}
  1276  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1277  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1278  		ap, err = client.UpdateResponder(ap.Response.Response)
  1279  		if err != nil {
  1280  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request")
  1281  		}
  1282  	}
  1283  	return
  1284  }
  1285  
  1286  // ErrorAdditionalInfo the resource management error additional info.
  1287  type ErrorAdditionalInfo struct {
  1288  	// Type - READ-ONLY; The additional info type.
  1289  	Type *string `json:"type,omitempty"`
  1290  	// Info - READ-ONLY; The additional info.
  1291  	Info interface{} `json:"info,omitempty"`
  1292  }
  1293  
  1294  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1295  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1296  	objectMap := make(map[string]interface{})
  1297  	return json.Marshal(objectMap)
  1298  }
  1299  
  1300  // ErrorDetail the error detail.
  1301  type ErrorDetail struct {
  1302  	// Code - READ-ONLY; The error code.
  1303  	Code *string `json:"code,omitempty"`
  1304  	// Message - READ-ONLY; The error message.
  1305  	Message *string `json:"message,omitempty"`
  1306  	// Target - READ-ONLY; The error target.
  1307  	Target *string `json:"target,omitempty"`
  1308  	// Details - READ-ONLY; The error details.
  1309  	Details *[]ErrorDetail `json:"details,omitempty"`
  1310  	// AdditionalInfo - READ-ONLY; The error additional info.
  1311  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1312  }
  1313  
  1314  // MarshalJSON is the custom marshaler for ErrorDetail.
  1315  func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
  1316  	objectMap := make(map[string]interface{})
  1317  	return json.Marshal(objectMap)
  1318  }
  1319  
  1320  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1321  // failed operations. (This also follows the OData error response format.).
  1322  type ErrorResponse struct {
  1323  	// Error - The error object.
  1324  	Error *ErrorDetail `json:"error,omitempty"`
  1325  }
  1326  
  1327  // GenericResource resource information.
  1328  type GenericResource struct {
  1329  	// ManagedBy - ID of the resource that manages this resource.
  1330  	ManagedBy *string `json:"managedBy,omitempty"`
  1331  	// Sku - The SKU of the resource.
  1332  	Sku *Sku `json:"sku,omitempty"`
  1333  	// ID - READ-ONLY; Resource ID
  1334  	ID *string `json:"id,omitempty"`
  1335  	// Name - READ-ONLY; Resource name
  1336  	Name *string `json:"name,omitempty"`
  1337  	// Type - READ-ONLY; Resource type
  1338  	Type *string `json:"type,omitempty"`
  1339  	// Location - Resource location
  1340  	Location *string `json:"location,omitempty"`
  1341  	// Tags - Resource tags
  1342  	Tags map[string]*string `json:"tags"`
  1343  }
  1344  
  1345  // MarshalJSON is the custom marshaler for GenericResource.
  1346  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1347  	objectMap := make(map[string]interface{})
  1348  	if gr.ManagedBy != nil {
  1349  		objectMap["managedBy"] = gr.ManagedBy
  1350  	}
  1351  	if gr.Sku != nil {
  1352  		objectMap["sku"] = gr.Sku
  1353  	}
  1354  	if gr.Location != nil {
  1355  		objectMap["location"] = gr.Location
  1356  	}
  1357  	if gr.Tags != nil {
  1358  		objectMap["tags"] = gr.Tags
  1359  	}
  1360  	return json.Marshal(objectMap)
  1361  }
  1362  
  1363  // Identity identity for the resource.
  1364  type Identity struct {
  1365  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1366  	PrincipalID *string `json:"principalId,omitempty"`
  1367  	// TenantID - READ-ONLY; The tenant ID of resource.
  1368  	TenantID *string `json:"tenantId,omitempty"`
  1369  	// Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone'
  1370  	Type ResourceIdentityType `json:"type,omitempty"`
  1371  	// UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
  1372  	UserAssignedIdentities map[string]*UserAssignedResourceIdentity `json:"userAssignedIdentities"`
  1373  }
  1374  
  1375  // MarshalJSON is the custom marshaler for Identity.
  1376  func (i Identity) MarshalJSON() ([]byte, error) {
  1377  	objectMap := make(map[string]interface{})
  1378  	if i.Type != "" {
  1379  		objectMap["type"] = i.Type
  1380  	}
  1381  	if i.UserAssignedIdentities != nil {
  1382  		objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
  1383  	}
  1384  	return json.Marshal(objectMap)
  1385  }
  1386  
  1387  // Operation microsoft.Solutions operation
  1388  type Operation struct {
  1389  	// Name - Operation name: {provider}/{resource}/{operation}
  1390  	Name *string `json:"name,omitempty"`
  1391  	// Display - The object that represents the operation.
  1392  	Display *OperationDisplay `json:"display,omitempty"`
  1393  }
  1394  
  1395  // OperationDisplay the object that represents the operation.
  1396  type OperationDisplay struct {
  1397  	// Provider - Service provider: Microsoft.Solutions
  1398  	Provider *string `json:"provider,omitempty"`
  1399  	// Resource - Resource on which the operation is performed: Application, JitRequest, etc.
  1400  	Resource *string `json:"resource,omitempty"`
  1401  	// Operation - Operation type: Read, write, delete, etc.
  1402  	Operation *string `json:"operation,omitempty"`
  1403  }
  1404  
  1405  // OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains
  1406  // an URL link to get the next set of results.
  1407  type OperationListResult struct {
  1408  	autorest.Response `json:"-"`
  1409  	// Value - READ-ONLY; List of operations supported by the resource provider
  1410  	Value *[]Operation `json:"value,omitempty"`
  1411  	// NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any).
  1412  	NextLink *string `json:"nextLink,omitempty"`
  1413  }
  1414  
  1415  // MarshalJSON is the custom marshaler for OperationListResult.
  1416  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1417  	objectMap := make(map[string]interface{})
  1418  	return json.Marshal(objectMap)
  1419  }
  1420  
  1421  // OperationListResultIterator provides access to a complete listing of Operation values.
  1422  type OperationListResultIterator struct {
  1423  	i    int
  1424  	page OperationListResultPage
  1425  }
  1426  
  1427  // NextWithContext advances to the next value.  If there was an error making
  1428  // the request the iterator does not advance and the error is returned.
  1429  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1430  	if tracing.IsEnabled() {
  1431  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1432  		defer func() {
  1433  			sc := -1
  1434  			if iter.Response().Response.Response != nil {
  1435  				sc = iter.Response().Response.Response.StatusCode
  1436  			}
  1437  			tracing.EndSpan(ctx, sc, err)
  1438  		}()
  1439  	}
  1440  	iter.i++
  1441  	if iter.i < len(iter.page.Values()) {
  1442  		return nil
  1443  	}
  1444  	err = iter.page.NextWithContext(ctx)
  1445  	if err != nil {
  1446  		iter.i--
  1447  		return err
  1448  	}
  1449  	iter.i = 0
  1450  	return nil
  1451  }
  1452  
  1453  // Next advances to the next value.  If there was an error making
  1454  // the request the iterator does not advance and the error is returned.
  1455  // Deprecated: Use NextWithContext() instead.
  1456  func (iter *OperationListResultIterator) Next() error {
  1457  	return iter.NextWithContext(context.Background())
  1458  }
  1459  
  1460  // NotDone returns true if the enumeration should be started or is not yet complete.
  1461  func (iter OperationListResultIterator) NotDone() bool {
  1462  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1463  }
  1464  
  1465  // Response returns the raw server response from the last page request.
  1466  func (iter OperationListResultIterator) Response() OperationListResult {
  1467  	return iter.page.Response()
  1468  }
  1469  
  1470  // Value returns the current value or a zero-initialized value if the
  1471  // iterator has advanced beyond the end of the collection.
  1472  func (iter OperationListResultIterator) Value() Operation {
  1473  	if !iter.page.NotDone() {
  1474  		return Operation{}
  1475  	}
  1476  	return iter.page.Values()[iter.i]
  1477  }
  1478  
  1479  // Creates a new instance of the OperationListResultIterator type.
  1480  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1481  	return OperationListResultIterator{page: page}
  1482  }
  1483  
  1484  // IsEmpty returns true if the ListResult contains no values.
  1485  func (olr OperationListResult) IsEmpty() bool {
  1486  	return olr.Value == nil || len(*olr.Value) == 0
  1487  }
  1488  
  1489  // hasNextLink returns true if the NextLink is not empty.
  1490  func (olr OperationListResult) hasNextLink() bool {
  1491  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1492  }
  1493  
  1494  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1495  // It returns nil if no more results exist.
  1496  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1497  	if !olr.hasNextLink() {
  1498  		return nil, nil
  1499  	}
  1500  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1501  		autorest.AsJSON(),
  1502  		autorest.AsGet(),
  1503  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1504  }
  1505  
  1506  // OperationListResultPage contains a page of Operation values.
  1507  type OperationListResultPage struct {
  1508  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1509  	olr OperationListResult
  1510  }
  1511  
  1512  // NextWithContext advances to the next page of values.  If there was an error making
  1513  // the request the page does not advance and the error is returned.
  1514  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1515  	if tracing.IsEnabled() {
  1516  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1517  		defer func() {
  1518  			sc := -1
  1519  			if page.Response().Response.Response != nil {
  1520  				sc = page.Response().Response.Response.StatusCode
  1521  			}
  1522  			tracing.EndSpan(ctx, sc, err)
  1523  		}()
  1524  	}
  1525  	for {
  1526  		next, err := page.fn(ctx, page.olr)
  1527  		if err != nil {
  1528  			return err
  1529  		}
  1530  		page.olr = next
  1531  		if !next.hasNextLink() || !next.IsEmpty() {
  1532  			break
  1533  		}
  1534  	}
  1535  	return nil
  1536  }
  1537  
  1538  // Next advances to the next page of values.  If there was an error making
  1539  // the request the page does not advance and the error is returned.
  1540  // Deprecated: Use NextWithContext() instead.
  1541  func (page *OperationListResultPage) Next() error {
  1542  	return page.NextWithContext(context.Background())
  1543  }
  1544  
  1545  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1546  func (page OperationListResultPage) NotDone() bool {
  1547  	return !page.olr.IsEmpty()
  1548  }
  1549  
  1550  // Response returns the raw server response from the last page request.
  1551  func (page OperationListResultPage) Response() OperationListResult {
  1552  	return page.olr
  1553  }
  1554  
  1555  // Values returns the slice of values for the current page or nil if there are no values.
  1556  func (page OperationListResultPage) Values() []Operation {
  1557  	if page.olr.IsEmpty() {
  1558  		return nil
  1559  	}
  1560  	return *page.olr.Value
  1561  }
  1562  
  1563  // Creates a new instance of the OperationListResultPage type.
  1564  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1565  	return OperationListResultPage{
  1566  		fn:  getNextPage,
  1567  		olr: cur,
  1568  	}
  1569  }
  1570  
  1571  // Plan plan for the managed application.
  1572  type Plan struct {
  1573  	// Name - The plan name.
  1574  	Name *string `json:"name,omitempty"`
  1575  	// Publisher - The publisher ID.
  1576  	Publisher *string `json:"publisher,omitempty"`
  1577  	// Product - The product code.
  1578  	Product *string `json:"product,omitempty"`
  1579  	// PromotionCode - The promotion code.
  1580  	PromotionCode *string `json:"promotionCode,omitempty"`
  1581  	// Version - The plan's version.
  1582  	Version *string `json:"version,omitempty"`
  1583  }
  1584  
  1585  // PlanPatchable plan for the managed application.
  1586  type PlanPatchable struct {
  1587  	// Name - The plan name.
  1588  	Name *string `json:"name,omitempty"`
  1589  	// Publisher - The publisher ID.
  1590  	Publisher *string `json:"publisher,omitempty"`
  1591  	// Product - The product code.
  1592  	Product *string `json:"product,omitempty"`
  1593  	// PromotionCode - The promotion code.
  1594  	PromotionCode *string `json:"promotionCode,omitempty"`
  1595  	// Version - The plan's version.
  1596  	Version *string `json:"version,omitempty"`
  1597  }
  1598  
  1599  // Resource resource information.
  1600  type Resource struct {
  1601  	// ID - READ-ONLY; Resource ID
  1602  	ID *string `json:"id,omitempty"`
  1603  	// Name - READ-ONLY; Resource name
  1604  	Name *string `json:"name,omitempty"`
  1605  	// Type - READ-ONLY; Resource type
  1606  	Type *string `json:"type,omitempty"`
  1607  	// Location - Resource location
  1608  	Location *string `json:"location,omitempty"`
  1609  	// Tags - Resource tags
  1610  	Tags map[string]*string `json:"tags"`
  1611  }
  1612  
  1613  // MarshalJSON is the custom marshaler for Resource.
  1614  func (r Resource) MarshalJSON() ([]byte, error) {
  1615  	objectMap := make(map[string]interface{})
  1616  	if r.Location != nil {
  1617  		objectMap["location"] = r.Location
  1618  	}
  1619  	if r.Tags != nil {
  1620  		objectMap["tags"] = r.Tags
  1621  	}
  1622  	return json.Marshal(objectMap)
  1623  }
  1624  
  1625  // Sku SKU for the resource.
  1626  type Sku struct {
  1627  	// Name - The SKU name.
  1628  	Name *string `json:"name,omitempty"`
  1629  	// Tier - The SKU tier.
  1630  	Tier *string `json:"tier,omitempty"`
  1631  	// Size - The SKU size.
  1632  	Size *string `json:"size,omitempty"`
  1633  	// Family - The SKU family.
  1634  	Family *string `json:"family,omitempty"`
  1635  	// Model - The SKU model.
  1636  	Model *string `json:"model,omitempty"`
  1637  	// Capacity - The SKU capacity.
  1638  	Capacity *int32 `json:"capacity,omitempty"`
  1639  }
  1640  
  1641  // UserAssignedResourceIdentity represents the user assigned identity that is contained within the
  1642  // UserAssignedIdentities dictionary on ResourceIdentity
  1643  type UserAssignedResourceIdentity struct {
  1644  	// PrincipalID - READ-ONLY; The principal id of user assigned identity.
  1645  	PrincipalID *string `json:"principalId,omitempty"`
  1646  	// TenantID - READ-ONLY; The tenant id of user assigned identity.
  1647  	TenantID *string `json:"tenantId,omitempty"`
  1648  }
  1649  
  1650  // MarshalJSON is the custom marshaler for UserAssignedResourceIdentity.
  1651  func (uari UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) {
  1652  	objectMap := make(map[string]interface{})
  1653  	return json.Marshal(objectMap)
  1654  }
  1655  

View as plain text