...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/solutions/mgmt/2018-09-01-preview/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/date"
    15  	"github.com/Azure/go-autorest/autorest/to"
    16  	"github.com/Azure/go-autorest/tracing"
    17  	"net/http"
    18  )
    19  
    20  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/solutions/mgmt/2018-09-01-preview/managedapplications"
    22  
    23  // Application information about managed application.
    24  type Application struct {
    25  	autorest.Response `json:"-"`
    26  	// ApplicationProperties - The managed application properties.
    27  	*ApplicationProperties `json:"properties,omitempty"`
    28  	// Plan - The plan information.
    29  	Plan *Plan `json:"plan,omitempty"`
    30  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
    31  	Kind *string `json:"kind,omitempty"`
    32  	// Identity - The identity of the resource.
    33  	Identity *Identity `json:"identity,omitempty"`
    34  	// ManagedBy - ID of the resource that manages this resource.
    35  	ManagedBy *string `json:"managedBy,omitempty"`
    36  	// Sku - The SKU of the resource.
    37  	Sku *Sku `json:"sku,omitempty"`
    38  	// ID - READ-ONLY; Resource ID
    39  	ID *string `json:"id,omitempty"`
    40  	// Name - READ-ONLY; Resource name
    41  	Name *string `json:"name,omitempty"`
    42  	// Type - READ-ONLY; Resource type
    43  	Type *string `json:"type,omitempty"`
    44  	// Location - Resource location
    45  	Location *string `json:"location,omitempty"`
    46  	// Tags - Resource tags
    47  	Tags map[string]*string `json:"tags"`
    48  }
    49  
    50  // MarshalJSON is the custom marshaler for Application.
    51  func (a Application) MarshalJSON() ([]byte, error) {
    52  	objectMap := make(map[string]interface{})
    53  	if a.ApplicationProperties != nil {
    54  		objectMap["properties"] = a.ApplicationProperties
    55  	}
    56  	if a.Plan != nil {
    57  		objectMap["plan"] = a.Plan
    58  	}
    59  	if a.Kind != nil {
    60  		objectMap["kind"] = a.Kind
    61  	}
    62  	if a.Identity != nil {
    63  		objectMap["identity"] = a.Identity
    64  	}
    65  	if a.ManagedBy != nil {
    66  		objectMap["managedBy"] = a.ManagedBy
    67  	}
    68  	if a.Sku != nil {
    69  		objectMap["sku"] = a.Sku
    70  	}
    71  	if a.Location != nil {
    72  		objectMap["location"] = a.Location
    73  	}
    74  	if a.Tags != nil {
    75  		objectMap["tags"] = a.Tags
    76  	}
    77  	return json.Marshal(objectMap)
    78  }
    79  
    80  // UnmarshalJSON is the custom unmarshaler for Application struct.
    81  func (a *Application) UnmarshalJSON(body []byte) error {
    82  	var m map[string]*json.RawMessage
    83  	err := json.Unmarshal(body, &m)
    84  	if err != nil {
    85  		return err
    86  	}
    87  	for k, v := range m {
    88  		switch k {
    89  		case "properties":
    90  			if v != nil {
    91  				var applicationProperties ApplicationProperties
    92  				err = json.Unmarshal(*v, &applicationProperties)
    93  				if err != nil {
    94  					return err
    95  				}
    96  				a.ApplicationProperties = &applicationProperties
    97  			}
    98  		case "plan":
    99  			if v != nil {
   100  				var plan Plan
   101  				err = json.Unmarshal(*v, &plan)
   102  				if err != nil {
   103  					return err
   104  				}
   105  				a.Plan = &plan
   106  			}
   107  		case "kind":
   108  			if v != nil {
   109  				var kind string
   110  				err = json.Unmarshal(*v, &kind)
   111  				if err != nil {
   112  					return err
   113  				}
   114  				a.Kind = &kind
   115  			}
   116  		case "identity":
   117  			if v != nil {
   118  				var identity Identity
   119  				err = json.Unmarshal(*v, &identity)
   120  				if err != nil {
   121  					return err
   122  				}
   123  				a.Identity = &identity
   124  			}
   125  		case "managedBy":
   126  			if v != nil {
   127  				var managedBy string
   128  				err = json.Unmarshal(*v, &managedBy)
   129  				if err != nil {
   130  					return err
   131  				}
   132  				a.ManagedBy = &managedBy
   133  			}
   134  		case "sku":
   135  			if v != nil {
   136  				var sku Sku
   137  				err = json.Unmarshal(*v, &sku)
   138  				if err != nil {
   139  					return err
   140  				}
   141  				a.Sku = &sku
   142  			}
   143  		case "id":
   144  			if v != nil {
   145  				var ID string
   146  				err = json.Unmarshal(*v, &ID)
   147  				if err != nil {
   148  					return err
   149  				}
   150  				a.ID = &ID
   151  			}
   152  		case "name":
   153  			if v != nil {
   154  				var name string
   155  				err = json.Unmarshal(*v, &name)
   156  				if err != nil {
   157  					return err
   158  				}
   159  				a.Name = &name
   160  			}
   161  		case "type":
   162  			if v != nil {
   163  				var typeVar string
   164  				err = json.Unmarshal(*v, &typeVar)
   165  				if err != nil {
   166  					return err
   167  				}
   168  				a.Type = &typeVar
   169  			}
   170  		case "location":
   171  			if v != nil {
   172  				var location string
   173  				err = json.Unmarshal(*v, &location)
   174  				if err != nil {
   175  					return err
   176  				}
   177  				a.Location = &location
   178  			}
   179  		case "tags":
   180  			if v != nil {
   181  				var tags map[string]*string
   182  				err = json.Unmarshal(*v, &tags)
   183  				if err != nil {
   184  					return err
   185  				}
   186  				a.Tags = tags
   187  			}
   188  		}
   189  	}
   190  
   191  	return nil
   192  }
   193  
   194  // ApplicationArtifact managed application artifact.
   195  type ApplicationArtifact struct {
   196  	// Name - The managed application artifact name. Possible values include: 'NotSpecified', 'ViewDefinition', 'Authorizations', 'CustomRoleDefinition'
   197  	Name ApplicationArtifactName `json:"name,omitempty"`
   198  	// URI - The managed application artifact blob uri.
   199  	URI *string `json:"uri,omitempty"`
   200  	// Type - The managed application artifact type. Possible values include: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom'
   201  	Type ApplicationArtifactType `json:"type,omitempty"`
   202  }
   203  
   204  // ApplicationAuthorization the managed application provider authorization.
   205  type ApplicationAuthorization struct {
   206  	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
   207  	PrincipalID *string `json:"principalId,omitempty"`
   208  	// 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.
   209  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
   210  }
   211  
   212  // ApplicationBillingDetailsDefinition managed application billing details definition.
   213  type ApplicationBillingDetailsDefinition struct {
   214  	// ResourceUsageID - The managed application resource usage Id.
   215  	ResourceUsageID *string `json:"resourceUsageId,omitempty"`
   216  }
   217  
   218  // ApplicationClientDetails the application client details to track the entity creating/updating the
   219  // managed app resource.
   220  type ApplicationClientDetails struct {
   221  	// Oid - The client Oid.
   222  	Oid *string `json:"oid,omitempty"`
   223  	// Puid - The client Puid
   224  	Puid *string `json:"puid,omitempty"`
   225  	// ApplicationID - The client application Id.
   226  	ApplicationID *string `json:"applicationId,omitempty"`
   227  }
   228  
   229  // ApplicationDefinition information about managed application definition.
   230  type ApplicationDefinition struct {
   231  	autorest.Response `json:"-"`
   232  	// ApplicationDefinitionProperties - The managed application definition properties.
   233  	*ApplicationDefinitionProperties `json:"properties,omitempty"`
   234  	// ManagedBy - ID of the resource that manages this resource.
   235  	ManagedBy *string `json:"managedBy,omitempty"`
   236  	// Sku - The SKU of the resource.
   237  	Sku *Sku `json:"sku,omitempty"`
   238  	// ID - READ-ONLY; Resource ID
   239  	ID *string `json:"id,omitempty"`
   240  	// Name - READ-ONLY; Resource name
   241  	Name *string `json:"name,omitempty"`
   242  	// Type - READ-ONLY; Resource type
   243  	Type *string `json:"type,omitempty"`
   244  	// Location - Resource location
   245  	Location *string `json:"location,omitempty"`
   246  	// Tags - Resource tags
   247  	Tags map[string]*string `json:"tags"`
   248  }
   249  
   250  // MarshalJSON is the custom marshaler for ApplicationDefinition.
   251  func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
   252  	objectMap := make(map[string]interface{})
   253  	if ad.ApplicationDefinitionProperties != nil {
   254  		objectMap["properties"] = ad.ApplicationDefinitionProperties
   255  	}
   256  	if ad.ManagedBy != nil {
   257  		objectMap["managedBy"] = ad.ManagedBy
   258  	}
   259  	if ad.Sku != nil {
   260  		objectMap["sku"] = ad.Sku
   261  	}
   262  	if ad.Location != nil {
   263  		objectMap["location"] = ad.Location
   264  	}
   265  	if ad.Tags != nil {
   266  		objectMap["tags"] = ad.Tags
   267  	}
   268  	return json.Marshal(objectMap)
   269  }
   270  
   271  // UnmarshalJSON is the custom unmarshaler for ApplicationDefinition struct.
   272  func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
   273  	var m map[string]*json.RawMessage
   274  	err := json.Unmarshal(body, &m)
   275  	if err != nil {
   276  		return err
   277  	}
   278  	for k, v := range m {
   279  		switch k {
   280  		case "properties":
   281  			if v != nil {
   282  				var applicationDefinitionProperties ApplicationDefinitionProperties
   283  				err = json.Unmarshal(*v, &applicationDefinitionProperties)
   284  				if err != nil {
   285  					return err
   286  				}
   287  				ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
   288  			}
   289  		case "managedBy":
   290  			if v != nil {
   291  				var managedBy string
   292  				err = json.Unmarshal(*v, &managedBy)
   293  				if err != nil {
   294  					return err
   295  				}
   296  				ad.ManagedBy = &managedBy
   297  			}
   298  		case "sku":
   299  			if v != nil {
   300  				var sku Sku
   301  				err = json.Unmarshal(*v, &sku)
   302  				if err != nil {
   303  					return err
   304  				}
   305  				ad.Sku = &sku
   306  			}
   307  		case "id":
   308  			if v != nil {
   309  				var ID string
   310  				err = json.Unmarshal(*v, &ID)
   311  				if err != nil {
   312  					return err
   313  				}
   314  				ad.ID = &ID
   315  			}
   316  		case "name":
   317  			if v != nil {
   318  				var name string
   319  				err = json.Unmarshal(*v, &name)
   320  				if err != nil {
   321  					return err
   322  				}
   323  				ad.Name = &name
   324  			}
   325  		case "type":
   326  			if v != nil {
   327  				var typeVar string
   328  				err = json.Unmarshal(*v, &typeVar)
   329  				if err != nil {
   330  					return err
   331  				}
   332  				ad.Type = &typeVar
   333  			}
   334  		case "location":
   335  			if v != nil {
   336  				var location string
   337  				err = json.Unmarshal(*v, &location)
   338  				if err != nil {
   339  					return err
   340  				}
   341  				ad.Location = &location
   342  			}
   343  		case "tags":
   344  			if v != nil {
   345  				var tags map[string]*string
   346  				err = json.Unmarshal(*v, &tags)
   347  				if err != nil {
   348  					return err
   349  				}
   350  				ad.Tags = tags
   351  			}
   352  		}
   353  	}
   354  
   355  	return nil
   356  }
   357  
   358  // ApplicationDefinitionArtifact application definition artifact.
   359  type ApplicationDefinitionArtifact struct {
   360  	// Name - The managed application definition artifact name. Possible values include: 'ApplicationDefinitionArtifactNameNotSpecified', 'ApplicationDefinitionArtifactNameApplicationResourceTemplate', 'ApplicationDefinitionArtifactNameCreateUIDefinition', 'ApplicationDefinitionArtifactNameMainTemplateParameters'
   361  	Name ApplicationDefinitionArtifactName `json:"name,omitempty"`
   362  	// URI - The managed application definition artifact blob uri.
   363  	URI *string `json:"uri,omitempty"`
   364  	// Type - The managed application definition artifact type. Possible values include: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom'
   365  	Type ApplicationArtifactType `json:"type,omitempty"`
   366  }
   367  
   368  // ApplicationDefinitionListResult list of managed application definitions.
   369  type ApplicationDefinitionListResult struct {
   370  	autorest.Response `json:"-"`
   371  	// Value - The array of managed application definitions.
   372  	Value *[]ApplicationDefinition `json:"value,omitempty"`
   373  	// NextLink - The URL to use for getting the next set of results.
   374  	NextLink *string `json:"nextLink,omitempty"`
   375  }
   376  
   377  // ApplicationDefinitionListResultIterator provides access to a complete listing of ApplicationDefinition
   378  // values.
   379  type ApplicationDefinitionListResultIterator struct {
   380  	i    int
   381  	page ApplicationDefinitionListResultPage
   382  }
   383  
   384  // NextWithContext advances to the next value.  If there was an error making
   385  // the request the iterator does not advance and the error is returned.
   386  func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   387  	if tracing.IsEnabled() {
   388  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
   389  		defer func() {
   390  			sc := -1
   391  			if iter.Response().Response.Response != nil {
   392  				sc = iter.Response().Response.Response.StatusCode
   393  			}
   394  			tracing.EndSpan(ctx, sc, err)
   395  		}()
   396  	}
   397  	iter.i++
   398  	if iter.i < len(iter.page.Values()) {
   399  		return nil
   400  	}
   401  	err = iter.page.NextWithContext(ctx)
   402  	if err != nil {
   403  		iter.i--
   404  		return err
   405  	}
   406  	iter.i = 0
   407  	return nil
   408  }
   409  
   410  // Next advances to the next value.  If there was an error making
   411  // the request the iterator does not advance and the error is returned.
   412  // Deprecated: Use NextWithContext() instead.
   413  func (iter *ApplicationDefinitionListResultIterator) Next() error {
   414  	return iter.NextWithContext(context.Background())
   415  }
   416  
   417  // NotDone returns true if the enumeration should be started or is not yet complete.
   418  func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
   419  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   420  }
   421  
   422  // Response returns the raw server response from the last page request.
   423  func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
   424  	return iter.page.Response()
   425  }
   426  
   427  // Value returns the current value or a zero-initialized value if the
   428  // iterator has advanced beyond the end of the collection.
   429  func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
   430  	if !iter.page.NotDone() {
   431  		return ApplicationDefinition{}
   432  	}
   433  	return iter.page.Values()[iter.i]
   434  }
   435  
   436  // Creates a new instance of the ApplicationDefinitionListResultIterator type.
   437  func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
   438  	return ApplicationDefinitionListResultIterator{page: page}
   439  }
   440  
   441  // IsEmpty returns true if the ListResult contains no values.
   442  func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
   443  	return adlr.Value == nil || len(*adlr.Value) == 0
   444  }
   445  
   446  // hasNextLink returns true if the NextLink is not empty.
   447  func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
   448  	return adlr.NextLink != nil && len(*adlr.NextLink) != 0
   449  }
   450  
   451  // applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results.
   452  // It returns nil if no more results exist.
   453  func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
   454  	if !adlr.hasNextLink() {
   455  		return nil, nil
   456  	}
   457  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   458  		autorest.AsJSON(),
   459  		autorest.AsGet(),
   460  		autorest.WithBaseURL(to.String(adlr.NextLink)))
   461  }
   462  
   463  // ApplicationDefinitionListResultPage contains a page of ApplicationDefinition values.
   464  type ApplicationDefinitionListResultPage struct {
   465  	fn   func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
   466  	adlr ApplicationDefinitionListResult
   467  }
   468  
   469  // NextWithContext advances to the next page of values.  If there was an error making
   470  // the request the page does not advance and the error is returned.
   471  func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
   472  	if tracing.IsEnabled() {
   473  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
   474  		defer func() {
   475  			sc := -1
   476  			if page.Response().Response.Response != nil {
   477  				sc = page.Response().Response.Response.StatusCode
   478  			}
   479  			tracing.EndSpan(ctx, sc, err)
   480  		}()
   481  	}
   482  	for {
   483  		next, err := page.fn(ctx, page.adlr)
   484  		if err != nil {
   485  			return err
   486  		}
   487  		page.adlr = next
   488  		if !next.hasNextLink() || !next.IsEmpty() {
   489  			break
   490  		}
   491  	}
   492  	return nil
   493  }
   494  
   495  // Next advances to the next page of values.  If there was an error making
   496  // the request the page does not advance and the error is returned.
   497  // Deprecated: Use NextWithContext() instead.
   498  func (page *ApplicationDefinitionListResultPage) Next() error {
   499  	return page.NextWithContext(context.Background())
   500  }
   501  
   502  // NotDone returns true if the page enumeration should be started or is not yet complete.
   503  func (page ApplicationDefinitionListResultPage) NotDone() bool {
   504  	return !page.adlr.IsEmpty()
   505  }
   506  
   507  // Response returns the raw server response from the last page request.
   508  func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
   509  	return page.adlr
   510  }
   511  
   512  // Values returns the slice of values for the current page or nil if there are no values.
   513  func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
   514  	if page.adlr.IsEmpty() {
   515  		return nil
   516  	}
   517  	return *page.adlr.Value
   518  }
   519  
   520  // Creates a new instance of the ApplicationDefinitionListResultPage type.
   521  func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
   522  	return ApplicationDefinitionListResultPage{
   523  		fn:   getNextPage,
   524  		adlr: cur,
   525  	}
   526  }
   527  
   528  // ApplicationDefinitionPatchable information about an application definition request.
   529  type ApplicationDefinitionPatchable struct {
   530  	// Tags - Application definition tags
   531  	Tags map[string]*string `json:"tags"`
   532  }
   533  
   534  // MarshalJSON is the custom marshaler for ApplicationDefinitionPatchable.
   535  func (adp ApplicationDefinitionPatchable) MarshalJSON() ([]byte, error) {
   536  	objectMap := make(map[string]interface{})
   537  	if adp.Tags != nil {
   538  		objectMap["tags"] = adp.Tags
   539  	}
   540  	return json.Marshal(objectMap)
   541  }
   542  
   543  // ApplicationDefinitionProperties the managed application definition properties.
   544  type ApplicationDefinitionProperties struct {
   545  	// LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
   546  	LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
   547  	// DisplayName - The managed application definition display name.
   548  	DisplayName *string `json:"displayName,omitempty"`
   549  	// IsEnabled - A value indicating whether the package is enabled or not.
   550  	IsEnabled *bool `json:"isEnabled,omitempty"`
   551  	// Authorizations - The managed application provider authorizations.
   552  	Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
   553  	// 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.
   554  	Artifacts *[]ApplicationDefinitionArtifact `json:"artifacts,omitempty"`
   555  	// Description - The managed application definition description.
   556  	Description *string `json:"description,omitempty"`
   557  	// PackageFileURI - The managed application definition package file Uri. Use this element
   558  	PackageFileURI *string `json:"packageFileUri,omitempty"`
   559  	// MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string.
   560  	MainTemplate interface{} `json:"mainTemplate,omitempty"`
   561  	// CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.
   562  	CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
   563  	// Policies - The managed application provider policies.
   564  	Policies *[]ApplicationPolicy `json:"policies,omitempty"`
   565  }
   566  
   567  // ApplicationJitAccessPolicy managed application Jit access policy.
   568  type ApplicationJitAccessPolicy struct {
   569  	// JitAccessEnabled - Whether the JIT access is enabled.
   570  	JitAccessEnabled *bool `json:"jitAccessEnabled,omitempty"`
   571  	// JitApprovalMode - JIT approval mode. Possible values include: 'JitApprovalModeNotSpecified', 'JitApprovalModeAutoApprove', 'JitApprovalModeManualApprove'
   572  	JitApprovalMode JitApprovalMode `json:"jitApprovalMode,omitempty"`
   573  	// JitApprovers - The JIT approvers
   574  	JitApprovers *[]JitApproverDefinition `json:"jitApprovers,omitempty"`
   575  	// MaximumJitAccessDuration - The maximum duration JIT access is granted. This is an ISO8601 time period value.
   576  	MaximumJitAccessDuration *string `json:"maximumJitAccessDuration,omitempty"`
   577  }
   578  
   579  // ApplicationListResult list of managed applications.
   580  type ApplicationListResult struct {
   581  	autorest.Response `json:"-"`
   582  	// Value - The array of managed applications.
   583  	Value *[]Application `json:"value,omitempty"`
   584  	// NextLink - The URL to use for getting the next set of results.
   585  	NextLink *string `json:"nextLink,omitempty"`
   586  }
   587  
   588  // ApplicationListResultIterator provides access to a complete listing of Application values.
   589  type ApplicationListResultIterator struct {
   590  	i    int
   591  	page ApplicationListResultPage
   592  }
   593  
   594  // NextWithContext advances to the next value.  If there was an error making
   595  // the request the iterator does not advance and the error is returned.
   596  func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   597  	if tracing.IsEnabled() {
   598  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
   599  		defer func() {
   600  			sc := -1
   601  			if iter.Response().Response.Response != nil {
   602  				sc = iter.Response().Response.Response.StatusCode
   603  			}
   604  			tracing.EndSpan(ctx, sc, err)
   605  		}()
   606  	}
   607  	iter.i++
   608  	if iter.i < len(iter.page.Values()) {
   609  		return nil
   610  	}
   611  	err = iter.page.NextWithContext(ctx)
   612  	if err != nil {
   613  		iter.i--
   614  		return err
   615  	}
   616  	iter.i = 0
   617  	return nil
   618  }
   619  
   620  // Next advances to the next value.  If there was an error making
   621  // the request the iterator does not advance and the error is returned.
   622  // Deprecated: Use NextWithContext() instead.
   623  func (iter *ApplicationListResultIterator) Next() error {
   624  	return iter.NextWithContext(context.Background())
   625  }
   626  
   627  // NotDone returns true if the enumeration should be started or is not yet complete.
   628  func (iter ApplicationListResultIterator) NotDone() bool {
   629  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   630  }
   631  
   632  // Response returns the raw server response from the last page request.
   633  func (iter ApplicationListResultIterator) Response() ApplicationListResult {
   634  	return iter.page.Response()
   635  }
   636  
   637  // Value returns the current value or a zero-initialized value if the
   638  // iterator has advanced beyond the end of the collection.
   639  func (iter ApplicationListResultIterator) Value() Application {
   640  	if !iter.page.NotDone() {
   641  		return Application{}
   642  	}
   643  	return iter.page.Values()[iter.i]
   644  }
   645  
   646  // Creates a new instance of the ApplicationListResultIterator type.
   647  func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
   648  	return ApplicationListResultIterator{page: page}
   649  }
   650  
   651  // IsEmpty returns true if the ListResult contains no values.
   652  func (alr ApplicationListResult) IsEmpty() bool {
   653  	return alr.Value == nil || len(*alr.Value) == 0
   654  }
   655  
   656  // hasNextLink returns true if the NextLink is not empty.
   657  func (alr ApplicationListResult) hasNextLink() bool {
   658  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   659  }
   660  
   661  // applicationListResultPreparer prepares a request to retrieve the next set of results.
   662  // It returns nil if no more results exist.
   663  func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
   664  	if !alr.hasNextLink() {
   665  		return nil, nil
   666  	}
   667  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   668  		autorest.AsJSON(),
   669  		autorest.AsGet(),
   670  		autorest.WithBaseURL(to.String(alr.NextLink)))
   671  }
   672  
   673  // ApplicationListResultPage contains a page of Application values.
   674  type ApplicationListResultPage struct {
   675  	fn  func(context.Context, ApplicationListResult) (ApplicationListResult, error)
   676  	alr ApplicationListResult
   677  }
   678  
   679  // NextWithContext advances to the next page of values.  If there was an error making
   680  // the request the page does not advance and the error is returned.
   681  func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
   682  	if tracing.IsEnabled() {
   683  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
   684  		defer func() {
   685  			sc := -1
   686  			if page.Response().Response.Response != nil {
   687  				sc = page.Response().Response.Response.StatusCode
   688  			}
   689  			tracing.EndSpan(ctx, sc, err)
   690  		}()
   691  	}
   692  	for {
   693  		next, err := page.fn(ctx, page.alr)
   694  		if err != nil {
   695  			return err
   696  		}
   697  		page.alr = next
   698  		if !next.hasNextLink() || !next.IsEmpty() {
   699  			break
   700  		}
   701  	}
   702  	return nil
   703  }
   704  
   705  // Next advances to the next page of values.  If there was an error making
   706  // the request the page does not advance and the error is returned.
   707  // Deprecated: Use NextWithContext() instead.
   708  func (page *ApplicationListResultPage) Next() error {
   709  	return page.NextWithContext(context.Background())
   710  }
   711  
   712  // NotDone returns true if the page enumeration should be started or is not yet complete.
   713  func (page ApplicationListResultPage) NotDone() bool {
   714  	return !page.alr.IsEmpty()
   715  }
   716  
   717  // Response returns the raw server response from the last page request.
   718  func (page ApplicationListResultPage) Response() ApplicationListResult {
   719  	return page.alr
   720  }
   721  
   722  // Values returns the slice of values for the current page or nil if there are no values.
   723  func (page ApplicationListResultPage) Values() []Application {
   724  	if page.alr.IsEmpty() {
   725  		return nil
   726  	}
   727  	return *page.alr.Value
   728  }
   729  
   730  // Creates a new instance of the ApplicationListResultPage type.
   731  func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
   732  	return ApplicationListResultPage{
   733  		fn:  getNextPage,
   734  		alr: cur,
   735  	}
   736  }
   737  
   738  // ApplicationPackageContact the application package contact information.
   739  type ApplicationPackageContact struct {
   740  	// ContactName - The contact name.
   741  	ContactName *string `json:"contactName,omitempty"`
   742  	// Email - The contact email.
   743  	Email *string `json:"email,omitempty"`
   744  	// Phone - The contact phone number.
   745  	Phone *string `json:"phone,omitempty"`
   746  }
   747  
   748  // ApplicationPackageSupportUrls the appliance package support URLs.
   749  type ApplicationPackageSupportUrls struct {
   750  	// PublicAzure - The public azure support URL.
   751  	PublicAzure *string `json:"publicAzure,omitempty"`
   752  	// GovernmentCloud - The government cloud support URL.
   753  	GovernmentCloud *string `json:"governmentCloud,omitempty"`
   754  }
   755  
   756  // ApplicationPatchable information about managed application.
   757  type ApplicationPatchable struct {
   758  	autorest.Response `json:"-"`
   759  	// ApplicationProperties - The managed application properties.
   760  	*ApplicationProperties `json:"properties,omitempty"`
   761  	// Plan - The plan information.
   762  	Plan *PlanPatchable `json:"plan,omitempty"`
   763  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
   764  	Kind *string `json:"kind,omitempty"`
   765  	// Identity - The identity of the resource.
   766  	Identity *Identity `json:"identity,omitempty"`
   767  	// ManagedBy - ID of the resource that manages this resource.
   768  	ManagedBy *string `json:"managedBy,omitempty"`
   769  	// Sku - The SKU of the resource.
   770  	Sku *Sku `json:"sku,omitempty"`
   771  	// ID - READ-ONLY; Resource ID
   772  	ID *string `json:"id,omitempty"`
   773  	// Name - READ-ONLY; Resource name
   774  	Name *string `json:"name,omitempty"`
   775  	// Type - READ-ONLY; Resource type
   776  	Type *string `json:"type,omitempty"`
   777  	// Location - Resource location
   778  	Location *string `json:"location,omitempty"`
   779  	// Tags - Resource tags
   780  	Tags map[string]*string `json:"tags"`
   781  }
   782  
   783  // MarshalJSON is the custom marshaler for ApplicationPatchable.
   784  func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
   785  	objectMap := make(map[string]interface{})
   786  	if ap.ApplicationProperties != nil {
   787  		objectMap["properties"] = ap.ApplicationProperties
   788  	}
   789  	if ap.Plan != nil {
   790  		objectMap["plan"] = ap.Plan
   791  	}
   792  	if ap.Kind != nil {
   793  		objectMap["kind"] = ap.Kind
   794  	}
   795  	if ap.Identity != nil {
   796  		objectMap["identity"] = ap.Identity
   797  	}
   798  	if ap.ManagedBy != nil {
   799  		objectMap["managedBy"] = ap.ManagedBy
   800  	}
   801  	if ap.Sku != nil {
   802  		objectMap["sku"] = ap.Sku
   803  	}
   804  	if ap.Location != nil {
   805  		objectMap["location"] = ap.Location
   806  	}
   807  	if ap.Tags != nil {
   808  		objectMap["tags"] = ap.Tags
   809  	}
   810  	return json.Marshal(objectMap)
   811  }
   812  
   813  // UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
   814  func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
   815  	var m map[string]*json.RawMessage
   816  	err := json.Unmarshal(body, &m)
   817  	if err != nil {
   818  		return err
   819  	}
   820  	for k, v := range m {
   821  		switch k {
   822  		case "properties":
   823  			if v != nil {
   824  				var applicationProperties ApplicationProperties
   825  				err = json.Unmarshal(*v, &applicationProperties)
   826  				if err != nil {
   827  					return err
   828  				}
   829  				ap.ApplicationProperties = &applicationProperties
   830  			}
   831  		case "plan":
   832  			if v != nil {
   833  				var plan PlanPatchable
   834  				err = json.Unmarshal(*v, &plan)
   835  				if err != nil {
   836  					return err
   837  				}
   838  				ap.Plan = &plan
   839  			}
   840  		case "kind":
   841  			if v != nil {
   842  				var kind string
   843  				err = json.Unmarshal(*v, &kind)
   844  				if err != nil {
   845  					return err
   846  				}
   847  				ap.Kind = &kind
   848  			}
   849  		case "identity":
   850  			if v != nil {
   851  				var identity Identity
   852  				err = json.Unmarshal(*v, &identity)
   853  				if err != nil {
   854  					return err
   855  				}
   856  				ap.Identity = &identity
   857  			}
   858  		case "managedBy":
   859  			if v != nil {
   860  				var managedBy string
   861  				err = json.Unmarshal(*v, &managedBy)
   862  				if err != nil {
   863  					return err
   864  				}
   865  				ap.ManagedBy = &managedBy
   866  			}
   867  		case "sku":
   868  			if v != nil {
   869  				var sku Sku
   870  				err = json.Unmarshal(*v, &sku)
   871  				if err != nil {
   872  					return err
   873  				}
   874  				ap.Sku = &sku
   875  			}
   876  		case "id":
   877  			if v != nil {
   878  				var ID string
   879  				err = json.Unmarshal(*v, &ID)
   880  				if err != nil {
   881  					return err
   882  				}
   883  				ap.ID = &ID
   884  			}
   885  		case "name":
   886  			if v != nil {
   887  				var name string
   888  				err = json.Unmarshal(*v, &name)
   889  				if err != nil {
   890  					return err
   891  				}
   892  				ap.Name = &name
   893  			}
   894  		case "type":
   895  			if v != nil {
   896  				var typeVar string
   897  				err = json.Unmarshal(*v, &typeVar)
   898  				if err != nil {
   899  					return err
   900  				}
   901  				ap.Type = &typeVar
   902  			}
   903  		case "location":
   904  			if v != nil {
   905  				var location string
   906  				err = json.Unmarshal(*v, &location)
   907  				if err != nil {
   908  					return err
   909  				}
   910  				ap.Location = &location
   911  			}
   912  		case "tags":
   913  			if v != nil {
   914  				var tags map[string]*string
   915  				err = json.Unmarshal(*v, &tags)
   916  				if err != nil {
   917  					return err
   918  				}
   919  				ap.Tags = tags
   920  			}
   921  		}
   922  	}
   923  
   924  	return nil
   925  }
   926  
   927  // ApplicationPolicy managed application policy.
   928  type ApplicationPolicy struct {
   929  	// Name - The policy name
   930  	Name *string `json:"name,omitempty"`
   931  	// PolicyDefinitionID - The policy definition Id.
   932  	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
   933  	// Parameters - The policy parameters.
   934  	Parameters *string `json:"parameters,omitempty"`
   935  }
   936  
   937  // ApplicationProperties the managed application properties.
   938  type ApplicationProperties struct {
   939  	// ManagedResourceGroupID - The managed resource group Id.
   940  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   941  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   942  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   943  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   944  	Parameters interface{} `json:"parameters,omitempty"`
   945  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   946  	Outputs interface{} `json:"outputs,omitempty"`
   947  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
   948  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   949  	// BillingDetails - READ-ONLY; The managed application billing details.
   950  	BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"`
   951  	// JitAccessPolicy - The managed application Jit access policy.
   952  	JitAccessPolicy *ApplicationJitAccessPolicy `json:"jitAccessPolicy,omitempty"`
   953  	// PublisherTenantID - READ-ONLY; The publisher tenant Id.
   954  	PublisherTenantID *string `json:"publisherTenantId,omitempty"`
   955  	// Authorizations - READ-ONLY; The  read-only authorizations property that is retrieved from the application package.
   956  	Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
   957  	// CustomerSupport - READ-ONLY; The read-only customer support property that is retrieved from the application package.
   958  	CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"`
   959  	// SupportUrls - READ-ONLY; The read-only support URLs property that is retrieved from the application package.
   960  	SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"`
   961  	// Artifacts - READ-ONLY; The collection of managed application artifacts.
   962  	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
   963  	// CreatedBy - READ-ONLY; The client entity that created the JIT request.
   964  	CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
   965  	// UpdatedBy - READ-ONLY; The client entity that last updated the JIT request.
   966  	UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
   967  }
   968  
   969  // MarshalJSON is the custom marshaler for ApplicationProperties.
   970  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
   971  	objectMap := make(map[string]interface{})
   972  	if ap.ManagedResourceGroupID != nil {
   973  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
   974  	}
   975  	if ap.ApplicationDefinitionID != nil {
   976  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
   977  	}
   978  	if ap.Parameters != nil {
   979  		objectMap["parameters"] = ap.Parameters
   980  	}
   981  	if ap.JitAccessPolicy != nil {
   982  		objectMap["jitAccessPolicy"] = ap.JitAccessPolicy
   983  	}
   984  	return json.Marshal(objectMap)
   985  }
   986  
   987  // ApplicationPropertiesPatchable the managed application properties.
   988  type ApplicationPropertiesPatchable struct {
   989  	// ManagedResourceGroupID - The managed resource group Id.
   990  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   991  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   992  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   993  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   994  	Parameters interface{} `json:"parameters,omitempty"`
   995  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   996  	Outputs interface{} `json:"outputs,omitempty"`
   997  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
   998  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   999  }
  1000  
  1001  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
  1002  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
  1003  	objectMap := make(map[string]interface{})
  1004  	if app.ManagedResourceGroupID != nil {
  1005  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
  1006  	}
  1007  	if app.ApplicationDefinitionID != nil {
  1008  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
  1009  	}
  1010  	if app.Parameters != nil {
  1011  		objectMap["parameters"] = app.Parameters
  1012  	}
  1013  	return json.Marshal(objectMap)
  1014  }
  1015  
  1016  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
  1017  // long-running operation.
  1018  type ApplicationsCreateOrUpdateByIDFuture struct {
  1019  	azure.FutureAPI
  1020  	// Result returns the result of the asynchronous operation.
  1021  	// If the operation has not completed it will return an error.
  1022  	Result func(ApplicationsClient) (Application, error)
  1023  }
  1024  
  1025  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1026  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1027  	var azFuture azure.Future
  1028  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1029  		return err
  1030  	}
  1031  	future.FutureAPI = &azFuture
  1032  	future.Result = future.result
  1033  	return nil
  1034  }
  1035  
  1036  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
  1037  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
  1038  	var done bool
  1039  	done, err = future.DoneWithContext(context.Background(), client)
  1040  	if err != nil {
  1041  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1042  		return
  1043  	}
  1044  	if !done {
  1045  		a.Response.Response = future.Response()
  1046  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
  1047  		return
  1048  	}
  1049  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1050  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1051  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
  1052  		if err != nil {
  1053  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
  1054  		}
  1055  	}
  1056  	return
  1057  }
  1058  
  1059  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1060  // long-running operation.
  1061  type ApplicationsCreateOrUpdateFuture struct {
  1062  	azure.FutureAPI
  1063  	// Result returns the result of the asynchronous operation.
  1064  	// If the operation has not completed it will return an error.
  1065  	Result func(ApplicationsClient) (Application, error)
  1066  }
  1067  
  1068  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1069  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1070  	var azFuture azure.Future
  1071  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1072  		return err
  1073  	}
  1074  	future.FutureAPI = &azFuture
  1075  	future.Result = future.result
  1076  	return nil
  1077  }
  1078  
  1079  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1080  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1081  	var done bool
  1082  	done, err = future.DoneWithContext(context.Background(), client)
  1083  	if err != nil {
  1084  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1085  		return
  1086  	}
  1087  	if !done {
  1088  		a.Response.Response = future.Response()
  1089  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1090  		return
  1091  	}
  1092  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1093  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1094  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1095  		if err != nil {
  1096  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1097  		}
  1098  	}
  1099  	return
  1100  }
  1101  
  1102  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1103  // operation.
  1104  type ApplicationsDeleteByIDFuture struct {
  1105  	azure.FutureAPI
  1106  	// Result returns the result of the asynchronous operation.
  1107  	// If the operation has not completed it will return an error.
  1108  	Result func(ApplicationsClient) (autorest.Response, error)
  1109  }
  1110  
  1111  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1112  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1113  	var azFuture azure.Future
  1114  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1115  		return err
  1116  	}
  1117  	future.FutureAPI = &azFuture
  1118  	future.Result = future.result
  1119  	return nil
  1120  }
  1121  
  1122  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1123  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1124  	var done bool
  1125  	done, err = future.DoneWithContext(context.Background(), client)
  1126  	if err != nil {
  1127  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1128  		return
  1129  	}
  1130  	if !done {
  1131  		ar.Response = future.Response()
  1132  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1133  		return
  1134  	}
  1135  	ar.Response = future.Response()
  1136  	return
  1137  }
  1138  
  1139  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1140  // operation.
  1141  type ApplicationsDeleteFuture struct {
  1142  	azure.FutureAPI
  1143  	// Result returns the result of the asynchronous operation.
  1144  	// If the operation has not completed it will return an error.
  1145  	Result func(ApplicationsClient) (autorest.Response, error)
  1146  }
  1147  
  1148  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1149  func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
  1150  	var azFuture azure.Future
  1151  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1152  		return err
  1153  	}
  1154  	future.FutureAPI = &azFuture
  1155  	future.Result = future.result
  1156  	return nil
  1157  }
  1158  
  1159  // result is the default implementation for ApplicationsDeleteFuture.Result.
  1160  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1161  	var done bool
  1162  	done, err = future.DoneWithContext(context.Background(), client)
  1163  	if err != nil {
  1164  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1165  		return
  1166  	}
  1167  	if !done {
  1168  		ar.Response = future.Response()
  1169  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1170  		return
  1171  	}
  1172  	ar.Response = future.Response()
  1173  	return
  1174  }
  1175  
  1176  // ApplicationsRefreshPermissionsFuture an abstraction for monitoring and retrieving the results of a
  1177  // long-running operation.
  1178  type ApplicationsRefreshPermissionsFuture struct {
  1179  	azure.FutureAPI
  1180  	// Result returns the result of the asynchronous operation.
  1181  	// If the operation has not completed it will return an error.
  1182  	Result func(ApplicationsClient) (autorest.Response, error)
  1183  }
  1184  
  1185  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1186  func (future *ApplicationsRefreshPermissionsFuture) UnmarshalJSON(body []byte) error {
  1187  	var azFuture azure.Future
  1188  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1189  		return err
  1190  	}
  1191  	future.FutureAPI = &azFuture
  1192  	future.Result = future.result
  1193  	return nil
  1194  }
  1195  
  1196  // result is the default implementation for ApplicationsRefreshPermissionsFuture.Result.
  1197  func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1198  	var done bool
  1199  	done, err = future.DoneWithContext(context.Background(), client)
  1200  	if err != nil {
  1201  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsRefreshPermissionsFuture", "Result", future.Response(), "Polling failure")
  1202  		return
  1203  	}
  1204  	if !done {
  1205  		ar.Response = future.Response()
  1206  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsRefreshPermissionsFuture")
  1207  		return
  1208  	}
  1209  	ar.Response = future.Response()
  1210  	return
  1211  }
  1212  
  1213  // ApplicationsUpdateAccessFuture an abstraction for monitoring and retrieving the results of a
  1214  // long-running operation.
  1215  type ApplicationsUpdateAccessFuture struct {
  1216  	azure.FutureAPI
  1217  	// Result returns the result of the asynchronous operation.
  1218  	// If the operation has not completed it will return an error.
  1219  	Result func(ApplicationsClient) (UpdateAccessDefinition, error)
  1220  }
  1221  
  1222  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1223  func (future *ApplicationsUpdateAccessFuture) UnmarshalJSON(body []byte) error {
  1224  	var azFuture azure.Future
  1225  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1226  		return err
  1227  	}
  1228  	future.FutureAPI = &azFuture
  1229  	future.Result = future.result
  1230  	return nil
  1231  }
  1232  
  1233  // result is the default implementation for ApplicationsUpdateAccessFuture.Result.
  1234  func (future *ApplicationsUpdateAccessFuture) result(client ApplicationsClient) (uad UpdateAccessDefinition, err error) {
  1235  	var done bool
  1236  	done, err = future.DoneWithContext(context.Background(), client)
  1237  	if err != nil {
  1238  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", future.Response(), "Polling failure")
  1239  		return
  1240  	}
  1241  	if !done {
  1242  		uad.Response.Response = future.Response()
  1243  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateAccessFuture")
  1244  		return
  1245  	}
  1246  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1247  	if uad.Response.Response, err = future.GetResult(sender); err == nil && uad.Response.Response.StatusCode != http.StatusNoContent {
  1248  		uad, err = client.UpdateAccessResponder(uad.Response.Response)
  1249  		if err != nil {
  1250  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", uad.Response.Response, "Failure responding to request")
  1251  		}
  1252  	}
  1253  	return
  1254  }
  1255  
  1256  // ApplicationsUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1257  // operation.
  1258  type ApplicationsUpdateByIDFuture struct {
  1259  	azure.FutureAPI
  1260  	// Result returns the result of the asynchronous operation.
  1261  	// If the operation has not completed it will return an error.
  1262  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1263  }
  1264  
  1265  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1266  func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1267  	var azFuture azure.Future
  1268  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1269  		return err
  1270  	}
  1271  	future.FutureAPI = &azFuture
  1272  	future.Result = future.result
  1273  	return nil
  1274  }
  1275  
  1276  // result is the default implementation for ApplicationsUpdateByIDFuture.Result.
  1277  func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1278  	var done bool
  1279  	done, err = future.DoneWithContext(context.Background(), client)
  1280  	if err != nil {
  1281  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1282  		return
  1283  	}
  1284  	if !done {
  1285  		ap.Response.Response = future.Response()
  1286  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
  1287  		return
  1288  	}
  1289  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1290  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1291  		ap, err = client.UpdateByIDResponder(ap.Response.Response)
  1292  		if err != nil {
  1293  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
  1294  		}
  1295  	}
  1296  	return
  1297  }
  1298  
  1299  // ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1300  // operation.
  1301  type ApplicationsUpdateFuture struct {
  1302  	azure.FutureAPI
  1303  	// Result returns the result of the asynchronous operation.
  1304  	// If the operation has not completed it will return an error.
  1305  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1306  }
  1307  
  1308  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1309  func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
  1310  	var azFuture azure.Future
  1311  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1312  		return err
  1313  	}
  1314  	future.FutureAPI = &azFuture
  1315  	future.Result = future.result
  1316  	return nil
  1317  }
  1318  
  1319  // result is the default implementation for ApplicationsUpdateFuture.Result.
  1320  func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1321  	var done bool
  1322  	done, err = future.DoneWithContext(context.Background(), client)
  1323  	if err != nil {
  1324  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
  1325  		return
  1326  	}
  1327  	if !done {
  1328  		ap.Response.Response = future.Response()
  1329  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateFuture")
  1330  		return
  1331  	}
  1332  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1333  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1334  		ap, err = client.UpdateResponder(ap.Response.Response)
  1335  		if err != nil {
  1336  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request")
  1337  		}
  1338  	}
  1339  	return
  1340  }
  1341  
  1342  // ErrorAdditionalInfo the resource management error additional info.
  1343  type ErrorAdditionalInfo struct {
  1344  	// Type - READ-ONLY; The additional info type.
  1345  	Type *string `json:"type,omitempty"`
  1346  	// Info - READ-ONLY; The additional info.
  1347  	Info interface{} `json:"info,omitempty"`
  1348  }
  1349  
  1350  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1351  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1352  	objectMap := make(map[string]interface{})
  1353  	return json.Marshal(objectMap)
  1354  }
  1355  
  1356  // ErrorDetail the error detail.
  1357  type ErrorDetail struct {
  1358  	// Code - READ-ONLY; The error code.
  1359  	Code *string `json:"code,omitempty"`
  1360  	// Message - READ-ONLY; The error message.
  1361  	Message *string `json:"message,omitempty"`
  1362  	// Target - READ-ONLY; The error target.
  1363  	Target *string `json:"target,omitempty"`
  1364  	// Details - READ-ONLY; The error details.
  1365  	Details *[]ErrorDetail `json:"details,omitempty"`
  1366  	// AdditionalInfo - READ-ONLY; The error additional info.
  1367  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1368  }
  1369  
  1370  // MarshalJSON is the custom marshaler for ErrorDetail.
  1371  func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
  1372  	objectMap := make(map[string]interface{})
  1373  	return json.Marshal(objectMap)
  1374  }
  1375  
  1376  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1377  // failed operations. (This also follows the OData error response format.).
  1378  type ErrorResponse struct {
  1379  	// Error - The error object.
  1380  	Error *ErrorDetail `json:"error,omitempty"`
  1381  }
  1382  
  1383  // GenericResource resource information.
  1384  type GenericResource struct {
  1385  	// ManagedBy - ID of the resource that manages this resource.
  1386  	ManagedBy *string `json:"managedBy,omitempty"`
  1387  	// Sku - The SKU of the resource.
  1388  	Sku *Sku `json:"sku,omitempty"`
  1389  	// ID - READ-ONLY; Resource ID
  1390  	ID *string `json:"id,omitempty"`
  1391  	// Name - READ-ONLY; Resource name
  1392  	Name *string `json:"name,omitempty"`
  1393  	// Type - READ-ONLY; Resource type
  1394  	Type *string `json:"type,omitempty"`
  1395  	// Location - Resource location
  1396  	Location *string `json:"location,omitempty"`
  1397  	// Tags - Resource tags
  1398  	Tags map[string]*string `json:"tags"`
  1399  }
  1400  
  1401  // MarshalJSON is the custom marshaler for GenericResource.
  1402  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1403  	objectMap := make(map[string]interface{})
  1404  	if gr.ManagedBy != nil {
  1405  		objectMap["managedBy"] = gr.ManagedBy
  1406  	}
  1407  	if gr.Sku != nil {
  1408  		objectMap["sku"] = gr.Sku
  1409  	}
  1410  	if gr.Location != nil {
  1411  		objectMap["location"] = gr.Location
  1412  	}
  1413  	if gr.Tags != nil {
  1414  		objectMap["tags"] = gr.Tags
  1415  	}
  1416  	return json.Marshal(objectMap)
  1417  }
  1418  
  1419  // Identity identity for the resource.
  1420  type Identity struct {
  1421  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1422  	PrincipalID *string `json:"principalId,omitempty"`
  1423  	// TenantID - READ-ONLY; The tenant ID of resource.
  1424  	TenantID *string `json:"tenantId,omitempty"`
  1425  	// Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone'
  1426  	Type ResourceIdentityType `json:"type,omitempty"`
  1427  	// 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}'.
  1428  	UserAssignedIdentities map[string]*UserAssignedResourceIdentity `json:"userAssignedIdentities"`
  1429  }
  1430  
  1431  // MarshalJSON is the custom marshaler for Identity.
  1432  func (i Identity) MarshalJSON() ([]byte, error) {
  1433  	objectMap := make(map[string]interface{})
  1434  	if i.Type != "" {
  1435  		objectMap["type"] = i.Type
  1436  	}
  1437  	if i.UserAssignedIdentities != nil {
  1438  		objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
  1439  	}
  1440  	return json.Marshal(objectMap)
  1441  }
  1442  
  1443  // JitApproverDefinition JIT approver definition.
  1444  type JitApproverDefinition struct {
  1445  	// ID - The approver service principal Id.
  1446  	ID *string `json:"id,omitempty"`
  1447  	// Type - The approver type. Possible values include: 'User', 'Group'
  1448  	Type JitApproverType `json:"type,omitempty"`
  1449  	// DisplayName - The approver display name.
  1450  	DisplayName *string `json:"displayName,omitempty"`
  1451  }
  1452  
  1453  // JitAuthorizationPolicies the JIT authorization policies.
  1454  type JitAuthorizationPolicies struct {
  1455  	// PrincipalID - The the principal id that will be granted JIT access.
  1456  	PrincipalID *string `json:"principalId,omitempty"`
  1457  	// RoleDefinitionID - The role definition id that will be granted to the Principal.
  1458  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
  1459  }
  1460  
  1461  // JitRequestDefinition information about JIT request definition.
  1462  type JitRequestDefinition struct {
  1463  	autorest.Response `json:"-"`
  1464  	// JitRequestProperties - The JIT request properties.
  1465  	*JitRequestProperties `json:"properties,omitempty"`
  1466  	// ID - READ-ONLY; Resource ID
  1467  	ID *string `json:"id,omitempty"`
  1468  	// Name - READ-ONLY; Resource name
  1469  	Name *string `json:"name,omitempty"`
  1470  	// Type - READ-ONLY; Resource type
  1471  	Type *string `json:"type,omitempty"`
  1472  	// Location - Resource location
  1473  	Location *string `json:"location,omitempty"`
  1474  	// Tags - Resource tags
  1475  	Tags map[string]*string `json:"tags"`
  1476  }
  1477  
  1478  // MarshalJSON is the custom marshaler for JitRequestDefinition.
  1479  func (jrd JitRequestDefinition) MarshalJSON() ([]byte, error) {
  1480  	objectMap := make(map[string]interface{})
  1481  	if jrd.JitRequestProperties != nil {
  1482  		objectMap["properties"] = jrd.JitRequestProperties
  1483  	}
  1484  	if jrd.Location != nil {
  1485  		objectMap["location"] = jrd.Location
  1486  	}
  1487  	if jrd.Tags != nil {
  1488  		objectMap["tags"] = jrd.Tags
  1489  	}
  1490  	return json.Marshal(objectMap)
  1491  }
  1492  
  1493  // UnmarshalJSON is the custom unmarshaler for JitRequestDefinition struct.
  1494  func (jrd *JitRequestDefinition) UnmarshalJSON(body []byte) error {
  1495  	var m map[string]*json.RawMessage
  1496  	err := json.Unmarshal(body, &m)
  1497  	if err != nil {
  1498  		return err
  1499  	}
  1500  	for k, v := range m {
  1501  		switch k {
  1502  		case "properties":
  1503  			if v != nil {
  1504  				var jitRequestProperties JitRequestProperties
  1505  				err = json.Unmarshal(*v, &jitRequestProperties)
  1506  				if err != nil {
  1507  					return err
  1508  				}
  1509  				jrd.JitRequestProperties = &jitRequestProperties
  1510  			}
  1511  		case "id":
  1512  			if v != nil {
  1513  				var ID string
  1514  				err = json.Unmarshal(*v, &ID)
  1515  				if err != nil {
  1516  					return err
  1517  				}
  1518  				jrd.ID = &ID
  1519  			}
  1520  		case "name":
  1521  			if v != nil {
  1522  				var name string
  1523  				err = json.Unmarshal(*v, &name)
  1524  				if err != nil {
  1525  					return err
  1526  				}
  1527  				jrd.Name = &name
  1528  			}
  1529  		case "type":
  1530  			if v != nil {
  1531  				var typeVar string
  1532  				err = json.Unmarshal(*v, &typeVar)
  1533  				if err != nil {
  1534  					return err
  1535  				}
  1536  				jrd.Type = &typeVar
  1537  			}
  1538  		case "location":
  1539  			if v != nil {
  1540  				var location string
  1541  				err = json.Unmarshal(*v, &location)
  1542  				if err != nil {
  1543  					return err
  1544  				}
  1545  				jrd.Location = &location
  1546  			}
  1547  		case "tags":
  1548  			if v != nil {
  1549  				var tags map[string]*string
  1550  				err = json.Unmarshal(*v, &tags)
  1551  				if err != nil {
  1552  					return err
  1553  				}
  1554  				jrd.Tags = tags
  1555  			}
  1556  		}
  1557  	}
  1558  
  1559  	return nil
  1560  }
  1561  
  1562  // JitRequestDefinitionListResult list of JIT requests.
  1563  type JitRequestDefinitionListResult struct {
  1564  	autorest.Response `json:"-"`
  1565  	// Value - The array of Jit request definition.
  1566  	Value *[]JitRequestDefinition `json:"value,omitempty"`
  1567  	// NextLink - The URL to use for getting the next set of results.
  1568  	NextLink *string `json:"nextLink,omitempty"`
  1569  }
  1570  
  1571  // JitRequestMetadata the JIT request metadata.
  1572  type JitRequestMetadata struct {
  1573  	// OriginRequestID - The origin request id.
  1574  	OriginRequestID *string `json:"originRequestId,omitempty"`
  1575  	// RequestorID - The requestor id.
  1576  	RequestorID *string `json:"requestorId,omitempty"`
  1577  	// TenantDisplayName - The publisher's tenant name.
  1578  	TenantDisplayName *string `json:"tenantDisplayName,omitempty"`
  1579  	// SubjectDisplayName - The subject display name.
  1580  	SubjectDisplayName *string `json:"subjectDisplayName,omitempty"`
  1581  }
  1582  
  1583  // JitRequestPatchable information about JIT request.
  1584  type JitRequestPatchable struct {
  1585  	// Tags - Jit request tags
  1586  	Tags map[string]*string `json:"tags"`
  1587  }
  1588  
  1589  // MarshalJSON is the custom marshaler for JitRequestPatchable.
  1590  func (jrp JitRequestPatchable) MarshalJSON() ([]byte, error) {
  1591  	objectMap := make(map[string]interface{})
  1592  	if jrp.Tags != nil {
  1593  		objectMap["tags"] = jrp.Tags
  1594  	}
  1595  	return json.Marshal(objectMap)
  1596  }
  1597  
  1598  // JitRequestProperties information about JIT request properties
  1599  type JitRequestProperties struct {
  1600  	// ApplicationResourceID - The parent application id.
  1601  	ApplicationResourceID *string `json:"applicationResourceId,omitempty"`
  1602  	// PublisherTenantID - READ-ONLY; The publisher tenant id.
  1603  	PublisherTenantID *string `json:"publisherTenantId,omitempty"`
  1604  	// JitAuthorizationPolicies - The JIT authorization policies.
  1605  	JitAuthorizationPolicies *[]JitAuthorizationPolicies `json:"jitAuthorizationPolicies,omitempty"`
  1606  	// JitSchedulingPolicy - The JIT request properties.
  1607  	JitSchedulingPolicy *JitSchedulingPolicy `json:"jitSchedulingPolicy,omitempty"`
  1608  	// ProvisioningState - READ-ONLY; The JIT request provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
  1609  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1610  	// JitRequestState - READ-ONLY; The JIT request state. Possible values include: 'JitRequestStateNotSpecified', 'JitRequestStatePending', 'JitRequestStateApproved', 'JitRequestStateDenied', 'JitRequestStateFailed', 'JitRequestStateCanceled', 'JitRequestStateExpired', 'JitRequestStateTimeout'
  1611  	JitRequestState JitRequestState `json:"jitRequestState,omitempty"`
  1612  	// CreatedBy - READ-ONLY; The client entity that created the JIT request.
  1613  	CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
  1614  	// UpdatedBy - READ-ONLY; The client entity that last updated the JIT request.
  1615  	UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
  1616  }
  1617  
  1618  // MarshalJSON is the custom marshaler for JitRequestProperties.
  1619  func (jrp JitRequestProperties) MarshalJSON() ([]byte, error) {
  1620  	objectMap := make(map[string]interface{})
  1621  	if jrp.ApplicationResourceID != nil {
  1622  		objectMap["applicationResourceId"] = jrp.ApplicationResourceID
  1623  	}
  1624  	if jrp.JitAuthorizationPolicies != nil {
  1625  		objectMap["jitAuthorizationPolicies"] = jrp.JitAuthorizationPolicies
  1626  	}
  1627  	if jrp.JitSchedulingPolicy != nil {
  1628  		objectMap["jitSchedulingPolicy"] = jrp.JitSchedulingPolicy
  1629  	}
  1630  	return json.Marshal(objectMap)
  1631  }
  1632  
  1633  // JitRequestsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1634  // long-running operation.
  1635  type JitRequestsCreateOrUpdateFuture struct {
  1636  	azure.FutureAPI
  1637  	// Result returns the result of the asynchronous operation.
  1638  	// If the operation has not completed it will return an error.
  1639  	Result func(JitRequestsClient) (JitRequestDefinition, error)
  1640  }
  1641  
  1642  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1643  func (future *JitRequestsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1644  	var azFuture azure.Future
  1645  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1646  		return err
  1647  	}
  1648  	future.FutureAPI = &azFuture
  1649  	future.Result = future.result
  1650  	return nil
  1651  }
  1652  
  1653  // result is the default implementation for JitRequestsCreateOrUpdateFuture.Result.
  1654  func (future *JitRequestsCreateOrUpdateFuture) result(client JitRequestsClient) (jrd JitRequestDefinition, err error) {
  1655  	var done bool
  1656  	done, err = future.DoneWithContext(context.Background(), client)
  1657  	if err != nil {
  1658  		err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1659  		return
  1660  	}
  1661  	if !done {
  1662  		jrd.Response.Response = future.Response()
  1663  		err = azure.NewAsyncOpIncompleteError("managedapplications.JitRequestsCreateOrUpdateFuture")
  1664  		return
  1665  	}
  1666  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1667  	if jrd.Response.Response, err = future.GetResult(sender); err == nil && jrd.Response.Response.StatusCode != http.StatusNoContent {
  1668  		jrd, err = client.CreateOrUpdateResponder(jrd.Response.Response)
  1669  		if err != nil {
  1670  			err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", jrd.Response.Response, "Failure responding to request")
  1671  		}
  1672  	}
  1673  	return
  1674  }
  1675  
  1676  // JitSchedulingPolicy the JIT scheduling policies.
  1677  type JitSchedulingPolicy struct {
  1678  	// Type - The type of JIT schedule. Possible values include: 'JitSchedulingTypeNotSpecified', 'JitSchedulingTypeOnce', 'JitSchedulingTypeRecurring'
  1679  	Type     JitSchedulingType `json:"type,omitempty"`
  1680  	Duration *string           `json:"duration,omitempty"`
  1681  	// StartTime - The start time of the request.
  1682  	StartTime *date.Time `json:"startTime,omitempty"`
  1683  }
  1684  
  1685  // ListTokenRequest list token request body.
  1686  type ListTokenRequest struct {
  1687  	// AuthorizationAudience - The authorization audience.
  1688  	AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
  1689  	// UserAssignedIdentities - The user assigned identities.
  1690  	UserAssignedIdentities *[]string `json:"userAssignedIdentities,omitempty"`
  1691  }
  1692  
  1693  // ManagedIdentityToken the managed identity token for the managed app resource.
  1694  type ManagedIdentityToken struct {
  1695  	// AccessToken - The requested access token.
  1696  	AccessToken *string `json:"accessToken,omitempty"`
  1697  	// ExpiresIn - The number of seconds the access token will be valid.
  1698  	ExpiresIn *string `json:"expiresIn,omitempty"`
  1699  	// ExpiresOn - The timespan when the access token expires. This is represented as the number of seconds from epoch.
  1700  	ExpiresOn *string `json:"expiresOn,omitempty"`
  1701  	// NotBefore - The timespan when the access token takes effect. This is represented as the number of seconds from epoch.
  1702  	NotBefore *string `json:"notBefore,omitempty"`
  1703  	// AuthorizationAudience - The aud (audience) the access token was request for. This is the same as what was provided in the listTokens request.
  1704  	AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
  1705  	// ResourceID - The Azure resource ID for the issued token. This is either the managed application ID or the user-assigned identity ID.
  1706  	ResourceID *string `json:"resourceId,omitempty"`
  1707  	// TokenType - The type of the token.
  1708  	TokenType *string `json:"tokenType,omitempty"`
  1709  }
  1710  
  1711  // ManagedIdentityTokenResult the array of managed identity tokens.
  1712  type ManagedIdentityTokenResult struct {
  1713  	autorest.Response `json:"-"`
  1714  	// Value - The array of managed identity tokens.
  1715  	Value *[]ManagedIdentityToken `json:"value,omitempty"`
  1716  }
  1717  
  1718  // Operation microsoft.Solutions operation
  1719  type Operation struct {
  1720  	// Name - Operation name: {provider}/{resource}/{operation}
  1721  	Name *string `json:"name,omitempty"`
  1722  	// Display - The object that represents the operation.
  1723  	Display *OperationDisplay `json:"display,omitempty"`
  1724  }
  1725  
  1726  // OperationDisplay the object that represents the operation.
  1727  type OperationDisplay struct {
  1728  	// Provider - Service provider: Microsoft.Solutions
  1729  	Provider *string `json:"provider,omitempty"`
  1730  	// Resource - Resource on which the operation is performed: Application, JitRequest, etc.
  1731  	Resource *string `json:"resource,omitempty"`
  1732  	// Operation - Operation type: Read, write, delete, etc.
  1733  	Operation *string `json:"operation,omitempty"`
  1734  }
  1735  
  1736  // OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains
  1737  // an URL link to get the next set of results.
  1738  type OperationListResult struct {
  1739  	autorest.Response `json:"-"`
  1740  	// Value - READ-ONLY; List of operations supported by the resource provider
  1741  	Value *[]Operation `json:"value,omitempty"`
  1742  	// NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any).
  1743  	NextLink *string `json:"nextLink,omitempty"`
  1744  }
  1745  
  1746  // MarshalJSON is the custom marshaler for OperationListResult.
  1747  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1748  	objectMap := make(map[string]interface{})
  1749  	return json.Marshal(objectMap)
  1750  }
  1751  
  1752  // OperationListResultIterator provides access to a complete listing of Operation values.
  1753  type OperationListResultIterator struct {
  1754  	i    int
  1755  	page OperationListResultPage
  1756  }
  1757  
  1758  // NextWithContext advances to the next value.  If there was an error making
  1759  // the request the iterator does not advance and the error is returned.
  1760  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1761  	if tracing.IsEnabled() {
  1762  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1763  		defer func() {
  1764  			sc := -1
  1765  			if iter.Response().Response.Response != nil {
  1766  				sc = iter.Response().Response.Response.StatusCode
  1767  			}
  1768  			tracing.EndSpan(ctx, sc, err)
  1769  		}()
  1770  	}
  1771  	iter.i++
  1772  	if iter.i < len(iter.page.Values()) {
  1773  		return nil
  1774  	}
  1775  	err = iter.page.NextWithContext(ctx)
  1776  	if err != nil {
  1777  		iter.i--
  1778  		return err
  1779  	}
  1780  	iter.i = 0
  1781  	return nil
  1782  }
  1783  
  1784  // Next advances to the next value.  If there was an error making
  1785  // the request the iterator does not advance and the error is returned.
  1786  // Deprecated: Use NextWithContext() instead.
  1787  func (iter *OperationListResultIterator) Next() error {
  1788  	return iter.NextWithContext(context.Background())
  1789  }
  1790  
  1791  // NotDone returns true if the enumeration should be started or is not yet complete.
  1792  func (iter OperationListResultIterator) NotDone() bool {
  1793  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1794  }
  1795  
  1796  // Response returns the raw server response from the last page request.
  1797  func (iter OperationListResultIterator) Response() OperationListResult {
  1798  	return iter.page.Response()
  1799  }
  1800  
  1801  // Value returns the current value or a zero-initialized value if the
  1802  // iterator has advanced beyond the end of the collection.
  1803  func (iter OperationListResultIterator) Value() Operation {
  1804  	if !iter.page.NotDone() {
  1805  		return Operation{}
  1806  	}
  1807  	return iter.page.Values()[iter.i]
  1808  }
  1809  
  1810  // Creates a new instance of the OperationListResultIterator type.
  1811  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1812  	return OperationListResultIterator{page: page}
  1813  }
  1814  
  1815  // IsEmpty returns true if the ListResult contains no values.
  1816  func (olr OperationListResult) IsEmpty() bool {
  1817  	return olr.Value == nil || len(*olr.Value) == 0
  1818  }
  1819  
  1820  // hasNextLink returns true if the NextLink is not empty.
  1821  func (olr OperationListResult) hasNextLink() bool {
  1822  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1823  }
  1824  
  1825  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1826  // It returns nil if no more results exist.
  1827  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1828  	if !olr.hasNextLink() {
  1829  		return nil, nil
  1830  	}
  1831  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1832  		autorest.AsJSON(),
  1833  		autorest.AsGet(),
  1834  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1835  }
  1836  
  1837  // OperationListResultPage contains a page of Operation values.
  1838  type OperationListResultPage struct {
  1839  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1840  	olr OperationListResult
  1841  }
  1842  
  1843  // NextWithContext advances to the next page of values.  If there was an error making
  1844  // the request the page does not advance and the error is returned.
  1845  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1846  	if tracing.IsEnabled() {
  1847  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1848  		defer func() {
  1849  			sc := -1
  1850  			if page.Response().Response.Response != nil {
  1851  				sc = page.Response().Response.Response.StatusCode
  1852  			}
  1853  			tracing.EndSpan(ctx, sc, err)
  1854  		}()
  1855  	}
  1856  	for {
  1857  		next, err := page.fn(ctx, page.olr)
  1858  		if err != nil {
  1859  			return err
  1860  		}
  1861  		page.olr = next
  1862  		if !next.hasNextLink() || !next.IsEmpty() {
  1863  			break
  1864  		}
  1865  	}
  1866  	return nil
  1867  }
  1868  
  1869  // Next advances to the next page of values.  If there was an error making
  1870  // the request the page does not advance and the error is returned.
  1871  // Deprecated: Use NextWithContext() instead.
  1872  func (page *OperationListResultPage) Next() error {
  1873  	return page.NextWithContext(context.Background())
  1874  }
  1875  
  1876  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1877  func (page OperationListResultPage) NotDone() bool {
  1878  	return !page.olr.IsEmpty()
  1879  }
  1880  
  1881  // Response returns the raw server response from the last page request.
  1882  func (page OperationListResultPage) Response() OperationListResult {
  1883  	return page.olr
  1884  }
  1885  
  1886  // Values returns the slice of values for the current page or nil if there are no values.
  1887  func (page OperationListResultPage) Values() []Operation {
  1888  	if page.olr.IsEmpty() {
  1889  		return nil
  1890  	}
  1891  	return *page.olr.Value
  1892  }
  1893  
  1894  // Creates a new instance of the OperationListResultPage type.
  1895  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1896  	return OperationListResultPage{
  1897  		fn:  getNextPage,
  1898  		olr: cur,
  1899  	}
  1900  }
  1901  
  1902  // Plan plan for the managed application.
  1903  type Plan struct {
  1904  	// Name - The plan name.
  1905  	Name *string `json:"name,omitempty"`
  1906  	// Publisher - The publisher ID.
  1907  	Publisher *string `json:"publisher,omitempty"`
  1908  	// Product - The product code.
  1909  	Product *string `json:"product,omitempty"`
  1910  	// PromotionCode - The promotion code.
  1911  	PromotionCode *string `json:"promotionCode,omitempty"`
  1912  	// Version - The plan's version.
  1913  	Version *string `json:"version,omitempty"`
  1914  }
  1915  
  1916  // PlanPatchable plan for the managed application.
  1917  type PlanPatchable struct {
  1918  	// Name - The plan name.
  1919  	Name *string `json:"name,omitempty"`
  1920  	// Publisher - The publisher ID.
  1921  	Publisher *string `json:"publisher,omitempty"`
  1922  	// Product - The product code.
  1923  	Product *string `json:"product,omitempty"`
  1924  	// PromotionCode - The promotion code.
  1925  	PromotionCode *string `json:"promotionCode,omitempty"`
  1926  	// Version - The plan's version.
  1927  	Version *string `json:"version,omitempty"`
  1928  }
  1929  
  1930  // Resource resource information.
  1931  type Resource struct {
  1932  	// ID - READ-ONLY; Resource ID
  1933  	ID *string `json:"id,omitempty"`
  1934  	// Name - READ-ONLY; Resource name
  1935  	Name *string `json:"name,omitempty"`
  1936  	// Type - READ-ONLY; Resource type
  1937  	Type *string `json:"type,omitempty"`
  1938  	// Location - Resource location
  1939  	Location *string `json:"location,omitempty"`
  1940  	// Tags - Resource tags
  1941  	Tags map[string]*string `json:"tags"`
  1942  }
  1943  
  1944  // MarshalJSON is the custom marshaler for Resource.
  1945  func (r Resource) MarshalJSON() ([]byte, error) {
  1946  	objectMap := make(map[string]interface{})
  1947  	if r.Location != nil {
  1948  		objectMap["location"] = r.Location
  1949  	}
  1950  	if r.Tags != nil {
  1951  		objectMap["tags"] = r.Tags
  1952  	}
  1953  	return json.Marshal(objectMap)
  1954  }
  1955  
  1956  // Sku SKU for the resource.
  1957  type Sku struct {
  1958  	// Name - The SKU name.
  1959  	Name *string `json:"name,omitempty"`
  1960  	// Tier - The SKU tier.
  1961  	Tier *string `json:"tier,omitempty"`
  1962  	// Size - The SKU size.
  1963  	Size *string `json:"size,omitempty"`
  1964  	// Family - The SKU family.
  1965  	Family *string `json:"family,omitempty"`
  1966  	// Model - The SKU model.
  1967  	Model *string `json:"model,omitempty"`
  1968  	// Capacity - The SKU capacity.
  1969  	Capacity *int32 `json:"capacity,omitempty"`
  1970  }
  1971  
  1972  // UpdateAccessDefinition update access request definition.
  1973  type UpdateAccessDefinition struct {
  1974  	autorest.Response `json:"-"`
  1975  	// Approver - The approver name.
  1976  	Approver *string `json:"approver,omitempty"`
  1977  	// Metadata - The JIT request metadata.
  1978  	Metadata *JitRequestMetadata `json:"metadata,omitempty"`
  1979  	// Status - The JIT status. Possible values include: 'StatusNotSpecified', 'StatusElevate', 'StatusRemove'
  1980  	Status Status `json:"status,omitempty"`
  1981  	// SubStatus - The JIT status. Possible values include: 'SubstatusNotSpecified', 'SubstatusApproved', 'SubstatusDenied', 'SubstatusFailed', 'SubstatusExpired', 'SubstatusTimeout'
  1982  	SubStatus Substatus `json:"subStatus,omitempty"`
  1983  }
  1984  
  1985  // UserAssignedResourceIdentity represents the user assigned identity that is contained within the
  1986  // UserAssignedIdentities dictionary on ResourceIdentity
  1987  type UserAssignedResourceIdentity struct {
  1988  	// PrincipalID - READ-ONLY; The principal id of user assigned identity.
  1989  	PrincipalID *string `json:"principalId,omitempty"`
  1990  	// TenantID - READ-ONLY; The tenant id of user assigned identity.
  1991  	TenantID *string `json:"tenantId,omitempty"`
  1992  }
  1993  
  1994  // MarshalJSON is the custom marshaler for UserAssignedResourceIdentity.
  1995  func (uari UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) {
  1996  	objectMap := make(map[string]interface{})
  1997  	return json.Marshal(objectMap)
  1998  }
  1999  

View as plain text