...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/solutions/mgmt/2018-06-01/managedapplications

     1  package managedapplications
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/azure"
    14  	"github.com/Azure/go-autorest/autorest/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/solutions/mgmt/2018-06-01/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  // ApplicationNotificationEndpoint managed application notification endpoint.
   739  type ApplicationNotificationEndpoint struct {
   740  	// URI - The managed application notification endpoint uri.
   741  	URI *string `json:"uri,omitempty"`
   742  }
   743  
   744  // ApplicationNotificationPolicy managed application notification policy.
   745  type ApplicationNotificationPolicy struct {
   746  	// NotificationEndpoints - The managed application notification endpoint.
   747  	NotificationEndpoints *[]ApplicationNotificationEndpoint `json:"notificationEndpoints,omitempty"`
   748  }
   749  
   750  // ApplicationPackageContact the application package contact information.
   751  type ApplicationPackageContact struct {
   752  	// ContactName - The contact name.
   753  	ContactName *string `json:"contactName,omitempty"`
   754  	// Email - The contact email.
   755  	Email *string `json:"email,omitempty"`
   756  	// Phone - The contact phone number.
   757  	Phone *string `json:"phone,omitempty"`
   758  }
   759  
   760  // ApplicationPackageLockingPolicyDefinition managed application locking policy.
   761  type ApplicationPackageLockingPolicyDefinition struct {
   762  	// AllowedActions - The deny assignment excluded actions.
   763  	AllowedActions *[]string `json:"allowedActions,omitempty"`
   764  	// AllowedDataActions - The deny assignment excluded data actions.
   765  	AllowedDataActions *[]string `json:"allowedDataActions,omitempty"`
   766  }
   767  
   768  // ApplicationPackageSupportUrls the appliance package support URLs.
   769  type ApplicationPackageSupportUrls struct {
   770  	// PublicAzure - The public azure support URL.
   771  	PublicAzure *string `json:"publicAzure,omitempty"`
   772  	// GovernmentCloud - The government cloud support URL.
   773  	GovernmentCloud *string `json:"governmentCloud,omitempty"`
   774  }
   775  
   776  // ApplicationPatchable information about managed application.
   777  type ApplicationPatchable struct {
   778  	autorest.Response `json:"-"`
   779  	// ApplicationProperties - The managed application properties.
   780  	*ApplicationProperties `json:"properties,omitempty"`
   781  	// Plan - The plan information.
   782  	Plan *PlanPatchable `json:"plan,omitempty"`
   783  	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
   784  	Kind *string `json:"kind,omitempty"`
   785  	// Identity - The identity of the resource.
   786  	Identity *Identity `json:"identity,omitempty"`
   787  	// ManagedBy - ID of the resource that manages this resource.
   788  	ManagedBy *string `json:"managedBy,omitempty"`
   789  	// Sku - The SKU of the resource.
   790  	Sku *Sku `json:"sku,omitempty"`
   791  	// ID - READ-ONLY; Resource ID
   792  	ID *string `json:"id,omitempty"`
   793  	// Name - READ-ONLY; Resource name
   794  	Name *string `json:"name,omitempty"`
   795  	// Type - READ-ONLY; Resource type
   796  	Type *string `json:"type,omitempty"`
   797  	// Location - Resource location
   798  	Location *string `json:"location,omitempty"`
   799  	// Tags - Resource tags
   800  	Tags map[string]*string `json:"tags"`
   801  }
   802  
   803  // MarshalJSON is the custom marshaler for ApplicationPatchable.
   804  func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
   805  	objectMap := make(map[string]interface{})
   806  	if ap.ApplicationProperties != nil {
   807  		objectMap["properties"] = ap.ApplicationProperties
   808  	}
   809  	if ap.Plan != nil {
   810  		objectMap["plan"] = ap.Plan
   811  	}
   812  	if ap.Kind != nil {
   813  		objectMap["kind"] = ap.Kind
   814  	}
   815  	if ap.Identity != nil {
   816  		objectMap["identity"] = ap.Identity
   817  	}
   818  	if ap.ManagedBy != nil {
   819  		objectMap["managedBy"] = ap.ManagedBy
   820  	}
   821  	if ap.Sku != nil {
   822  		objectMap["sku"] = ap.Sku
   823  	}
   824  	if ap.Location != nil {
   825  		objectMap["location"] = ap.Location
   826  	}
   827  	if ap.Tags != nil {
   828  		objectMap["tags"] = ap.Tags
   829  	}
   830  	return json.Marshal(objectMap)
   831  }
   832  
   833  // UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
   834  func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
   835  	var m map[string]*json.RawMessage
   836  	err := json.Unmarshal(body, &m)
   837  	if err != nil {
   838  		return err
   839  	}
   840  	for k, v := range m {
   841  		switch k {
   842  		case "properties":
   843  			if v != nil {
   844  				var applicationProperties ApplicationProperties
   845  				err = json.Unmarshal(*v, &applicationProperties)
   846  				if err != nil {
   847  					return err
   848  				}
   849  				ap.ApplicationProperties = &applicationProperties
   850  			}
   851  		case "plan":
   852  			if v != nil {
   853  				var plan PlanPatchable
   854  				err = json.Unmarshal(*v, &plan)
   855  				if err != nil {
   856  					return err
   857  				}
   858  				ap.Plan = &plan
   859  			}
   860  		case "kind":
   861  			if v != nil {
   862  				var kind string
   863  				err = json.Unmarshal(*v, &kind)
   864  				if err != nil {
   865  					return err
   866  				}
   867  				ap.Kind = &kind
   868  			}
   869  		case "identity":
   870  			if v != nil {
   871  				var identity Identity
   872  				err = json.Unmarshal(*v, &identity)
   873  				if err != nil {
   874  					return err
   875  				}
   876  				ap.Identity = &identity
   877  			}
   878  		case "managedBy":
   879  			if v != nil {
   880  				var managedBy string
   881  				err = json.Unmarshal(*v, &managedBy)
   882  				if err != nil {
   883  					return err
   884  				}
   885  				ap.ManagedBy = &managedBy
   886  			}
   887  		case "sku":
   888  			if v != nil {
   889  				var sku Sku
   890  				err = json.Unmarshal(*v, &sku)
   891  				if err != nil {
   892  					return err
   893  				}
   894  				ap.Sku = &sku
   895  			}
   896  		case "id":
   897  			if v != nil {
   898  				var ID string
   899  				err = json.Unmarshal(*v, &ID)
   900  				if err != nil {
   901  					return err
   902  				}
   903  				ap.ID = &ID
   904  			}
   905  		case "name":
   906  			if v != nil {
   907  				var name string
   908  				err = json.Unmarshal(*v, &name)
   909  				if err != nil {
   910  					return err
   911  				}
   912  				ap.Name = &name
   913  			}
   914  		case "type":
   915  			if v != nil {
   916  				var typeVar string
   917  				err = json.Unmarshal(*v, &typeVar)
   918  				if err != nil {
   919  					return err
   920  				}
   921  				ap.Type = &typeVar
   922  			}
   923  		case "location":
   924  			if v != nil {
   925  				var location string
   926  				err = json.Unmarshal(*v, &location)
   927  				if err != nil {
   928  					return err
   929  				}
   930  				ap.Location = &location
   931  			}
   932  		case "tags":
   933  			if v != nil {
   934  				var tags map[string]*string
   935  				err = json.Unmarshal(*v, &tags)
   936  				if err != nil {
   937  					return err
   938  				}
   939  				ap.Tags = tags
   940  			}
   941  		}
   942  	}
   943  
   944  	return nil
   945  }
   946  
   947  // ApplicationPolicy managed application policy.
   948  type ApplicationPolicy struct {
   949  	// Name - The policy name
   950  	Name *string `json:"name,omitempty"`
   951  	// PolicyDefinitionID - The policy definition Id.
   952  	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
   953  	// Parameters - The policy parameters.
   954  	Parameters *string `json:"parameters,omitempty"`
   955  }
   956  
   957  // ApplicationProperties the managed application properties.
   958  type ApplicationProperties struct {
   959  	// ManagedResourceGroupID - The managed resource group Id.
   960  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
   961  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
   962  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
   963  	// PublisherPackageID - The publisher package Id.
   964  	PublisherPackageID *string `json:"publisherPackageId,omitempty"`
   965  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
   966  	Parameters interface{} `json:"parameters,omitempty"`
   967  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
   968  	Outputs interface{} `json:"outputs,omitempty"`
   969  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
   970  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
   971  	// BillingDetails - READ-ONLY; The managed application billing details.
   972  	BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"`
   973  	// JitAccessPolicy - The managed application Jit access policy.
   974  	JitAccessPolicy *ApplicationJitAccessPolicy `json:"jitAccessPolicy,omitempty"`
   975  	// PublisherTenantID - READ-ONLY; The publisher tenant Id.
   976  	PublisherTenantID *string `json:"publisherTenantId,omitempty"`
   977  	// Authorizations - READ-ONLY; The  read-only authorizations property that is retrieved from the application package.
   978  	Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
   979  	// CustomerSupport - READ-ONLY; The read-only customer support property that is retrieved from the application package.
   980  	CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"`
   981  	// SupportUrls - READ-ONLY; The read-only support URLs property that is retrieved from the application package.
   982  	SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"`
   983  	// Artifacts - READ-ONLY; The collection of managed application artifacts.
   984  	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
   985  	// CreatedBy - READ-ONLY; The client entity that created the JIT request.
   986  	CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
   987  	// UpdatedBy - READ-ONLY; The client entity that last updated the JIT request.
   988  	UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
   989  }
   990  
   991  // MarshalJSON is the custom marshaler for ApplicationProperties.
   992  func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
   993  	objectMap := make(map[string]interface{})
   994  	if ap.ManagedResourceGroupID != nil {
   995  		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
   996  	}
   997  	if ap.ApplicationDefinitionID != nil {
   998  		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
   999  	}
  1000  	if ap.PublisherPackageID != nil {
  1001  		objectMap["publisherPackageId"] = ap.PublisherPackageID
  1002  	}
  1003  	if ap.Parameters != nil {
  1004  		objectMap["parameters"] = ap.Parameters
  1005  	}
  1006  	if ap.JitAccessPolicy != nil {
  1007  		objectMap["jitAccessPolicy"] = ap.JitAccessPolicy
  1008  	}
  1009  	return json.Marshal(objectMap)
  1010  }
  1011  
  1012  // ApplicationPropertiesPatchable the managed application properties.
  1013  type ApplicationPropertiesPatchable struct {
  1014  	// ManagedResourceGroupID - The managed resource group Id.
  1015  	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
  1016  	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
  1017  	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
  1018  	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
  1019  	Parameters interface{} `json:"parameters,omitempty"`
  1020  	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
  1021  	Outputs interface{} `json:"outputs,omitempty"`
  1022  	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
  1023  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1024  }
  1025  
  1026  // MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
  1027  func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
  1028  	objectMap := make(map[string]interface{})
  1029  	if app.ManagedResourceGroupID != nil {
  1030  		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
  1031  	}
  1032  	if app.ApplicationDefinitionID != nil {
  1033  		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
  1034  	}
  1035  	if app.Parameters != nil {
  1036  		objectMap["parameters"] = app.Parameters
  1037  	}
  1038  	return json.Marshal(objectMap)
  1039  }
  1040  
  1041  // ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
  1042  // long-running operation.
  1043  type ApplicationsCreateOrUpdateByIDFuture struct {
  1044  	azure.FutureAPI
  1045  	// Result returns the result of the asynchronous operation.
  1046  	// If the operation has not completed it will return an error.
  1047  	Result func(ApplicationsClient) (Application, error)
  1048  }
  1049  
  1050  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1051  func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1052  	var azFuture azure.Future
  1053  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1054  		return err
  1055  	}
  1056  	future.FutureAPI = &azFuture
  1057  	future.Result = future.result
  1058  	return nil
  1059  }
  1060  
  1061  // result is the default implementation for ApplicationsCreateOrUpdateByIDFuture.Result.
  1062  func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
  1063  	var done bool
  1064  	done, err = future.DoneWithContext(context.Background(), client)
  1065  	if err != nil {
  1066  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1067  		return
  1068  	}
  1069  	if !done {
  1070  		a.Response.Response = future.Response()
  1071  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
  1072  		return
  1073  	}
  1074  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1075  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1076  		a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
  1077  		if err != nil {
  1078  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
  1079  		}
  1080  	}
  1081  	return
  1082  }
  1083  
  1084  // ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1085  // long-running operation.
  1086  type ApplicationsCreateOrUpdateFuture struct {
  1087  	azure.FutureAPI
  1088  	// Result returns the result of the asynchronous operation.
  1089  	// If the operation has not completed it will return an error.
  1090  	Result func(ApplicationsClient) (Application, error)
  1091  }
  1092  
  1093  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1094  func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1095  	var azFuture azure.Future
  1096  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1097  		return err
  1098  	}
  1099  	future.FutureAPI = &azFuture
  1100  	future.Result = future.result
  1101  	return nil
  1102  }
  1103  
  1104  // result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
  1105  func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
  1106  	var done bool
  1107  	done, err = future.DoneWithContext(context.Background(), client)
  1108  	if err != nil {
  1109  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1110  		return
  1111  	}
  1112  	if !done {
  1113  		a.Response.Response = future.Response()
  1114  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
  1115  		return
  1116  	}
  1117  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1118  	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
  1119  		a, err = client.CreateOrUpdateResponder(a.Response.Response)
  1120  		if err != nil {
  1121  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
  1122  		}
  1123  	}
  1124  	return
  1125  }
  1126  
  1127  // ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1128  // operation.
  1129  type ApplicationsDeleteByIDFuture struct {
  1130  	azure.FutureAPI
  1131  	// Result returns the result of the asynchronous operation.
  1132  	// If the operation has not completed it will return an error.
  1133  	Result func(ApplicationsClient) (autorest.Response, error)
  1134  }
  1135  
  1136  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1137  func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
  1138  	var azFuture azure.Future
  1139  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1140  		return err
  1141  	}
  1142  	future.FutureAPI = &azFuture
  1143  	future.Result = future.result
  1144  	return nil
  1145  }
  1146  
  1147  // result is the default implementation for ApplicationsDeleteByIDFuture.Result.
  1148  func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1149  	var done bool
  1150  	done, err = future.DoneWithContext(context.Background(), client)
  1151  	if err != nil {
  1152  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
  1153  		return
  1154  	}
  1155  	if !done {
  1156  		ar.Response = future.Response()
  1157  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
  1158  		return
  1159  	}
  1160  	ar.Response = future.Response()
  1161  	return
  1162  }
  1163  
  1164  // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1165  // operation.
  1166  type ApplicationsDeleteFuture struct {
  1167  	azure.FutureAPI
  1168  	// Result returns the result of the asynchronous operation.
  1169  	// If the operation has not completed it will return an error.
  1170  	Result func(ApplicationsClient) (autorest.Response, error)
  1171  }
  1172  
  1173  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1174  func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
  1175  	var azFuture azure.Future
  1176  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1177  		return err
  1178  	}
  1179  	future.FutureAPI = &azFuture
  1180  	future.Result = future.result
  1181  	return nil
  1182  }
  1183  
  1184  // result is the default implementation for ApplicationsDeleteFuture.Result.
  1185  func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1186  	var done bool
  1187  	done, err = future.DoneWithContext(context.Background(), client)
  1188  	if err != nil {
  1189  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
  1190  		return
  1191  	}
  1192  	if !done {
  1193  		ar.Response = future.Response()
  1194  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
  1195  		return
  1196  	}
  1197  	ar.Response = future.Response()
  1198  	return
  1199  }
  1200  
  1201  // ApplicationsRefreshPermissionsFuture an abstraction for monitoring and retrieving the results of a
  1202  // long-running operation.
  1203  type ApplicationsRefreshPermissionsFuture struct {
  1204  	azure.FutureAPI
  1205  	// Result returns the result of the asynchronous operation.
  1206  	// If the operation has not completed it will return an error.
  1207  	Result func(ApplicationsClient) (autorest.Response, error)
  1208  }
  1209  
  1210  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1211  func (future *ApplicationsRefreshPermissionsFuture) UnmarshalJSON(body []byte) error {
  1212  	var azFuture azure.Future
  1213  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1214  		return err
  1215  	}
  1216  	future.FutureAPI = &azFuture
  1217  	future.Result = future.result
  1218  	return nil
  1219  }
  1220  
  1221  // result is the default implementation for ApplicationsRefreshPermissionsFuture.Result.
  1222  func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
  1223  	var done bool
  1224  	done, err = future.DoneWithContext(context.Background(), client)
  1225  	if err != nil {
  1226  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsRefreshPermissionsFuture", "Result", future.Response(), "Polling failure")
  1227  		return
  1228  	}
  1229  	if !done {
  1230  		ar.Response = future.Response()
  1231  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsRefreshPermissionsFuture")
  1232  		return
  1233  	}
  1234  	ar.Response = future.Response()
  1235  	return
  1236  }
  1237  
  1238  // ApplicationsUpdateAccessFuture an abstraction for monitoring and retrieving the results of a
  1239  // long-running operation.
  1240  type ApplicationsUpdateAccessFuture struct {
  1241  	azure.FutureAPI
  1242  	// Result returns the result of the asynchronous operation.
  1243  	// If the operation has not completed it will return an error.
  1244  	Result func(ApplicationsClient) (UpdateAccessDefinition, error)
  1245  }
  1246  
  1247  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1248  func (future *ApplicationsUpdateAccessFuture) UnmarshalJSON(body []byte) error {
  1249  	var azFuture azure.Future
  1250  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1251  		return err
  1252  	}
  1253  	future.FutureAPI = &azFuture
  1254  	future.Result = future.result
  1255  	return nil
  1256  }
  1257  
  1258  // result is the default implementation for ApplicationsUpdateAccessFuture.Result.
  1259  func (future *ApplicationsUpdateAccessFuture) result(client ApplicationsClient) (uad UpdateAccessDefinition, err error) {
  1260  	var done bool
  1261  	done, err = future.DoneWithContext(context.Background(), client)
  1262  	if err != nil {
  1263  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", future.Response(), "Polling failure")
  1264  		return
  1265  	}
  1266  	if !done {
  1267  		uad.Response.Response = future.Response()
  1268  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateAccessFuture")
  1269  		return
  1270  	}
  1271  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1272  	if uad.Response.Response, err = future.GetResult(sender); err == nil && uad.Response.Response.StatusCode != http.StatusNoContent {
  1273  		uad, err = client.UpdateAccessResponder(uad.Response.Response)
  1274  		if err != nil {
  1275  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", uad.Response.Response, "Failure responding to request")
  1276  		}
  1277  	}
  1278  	return
  1279  }
  1280  
  1281  // ApplicationsUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running
  1282  // operation.
  1283  type ApplicationsUpdateByIDFuture struct {
  1284  	azure.FutureAPI
  1285  	// Result returns the result of the asynchronous operation.
  1286  	// If the operation has not completed it will return an error.
  1287  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1288  }
  1289  
  1290  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1291  func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
  1292  	var azFuture azure.Future
  1293  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1294  		return err
  1295  	}
  1296  	future.FutureAPI = &azFuture
  1297  	future.Result = future.result
  1298  	return nil
  1299  }
  1300  
  1301  // result is the default implementation for ApplicationsUpdateByIDFuture.Result.
  1302  func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1303  	var done bool
  1304  	done, err = future.DoneWithContext(context.Background(), client)
  1305  	if err != nil {
  1306  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
  1307  		return
  1308  	}
  1309  	if !done {
  1310  		ap.Response.Response = future.Response()
  1311  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
  1312  		return
  1313  	}
  1314  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1315  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1316  		ap, err = client.UpdateByIDResponder(ap.Response.Response)
  1317  		if err != nil {
  1318  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
  1319  		}
  1320  	}
  1321  	return
  1322  }
  1323  
  1324  // ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1325  // operation.
  1326  type ApplicationsUpdateFuture struct {
  1327  	azure.FutureAPI
  1328  	// Result returns the result of the asynchronous operation.
  1329  	// If the operation has not completed it will return an error.
  1330  	Result func(ApplicationsClient) (ApplicationPatchable, error)
  1331  }
  1332  
  1333  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1334  func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
  1335  	var azFuture azure.Future
  1336  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1337  		return err
  1338  	}
  1339  	future.FutureAPI = &azFuture
  1340  	future.Result = future.result
  1341  	return nil
  1342  }
  1343  
  1344  // result is the default implementation for ApplicationsUpdateFuture.Result.
  1345  func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
  1346  	var done bool
  1347  	done, err = future.DoneWithContext(context.Background(), client)
  1348  	if err != nil {
  1349  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
  1350  		return
  1351  	}
  1352  	if !done {
  1353  		ap.Response.Response = future.Response()
  1354  		err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateFuture")
  1355  		return
  1356  	}
  1357  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1358  	if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
  1359  		ap, err = client.UpdateResponder(ap.Response.Response)
  1360  		if err != nil {
  1361  			err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request")
  1362  		}
  1363  	}
  1364  	return
  1365  }
  1366  
  1367  // ErrorAdditionalInfo the resource management error additional info.
  1368  type ErrorAdditionalInfo struct {
  1369  	// Type - READ-ONLY; The additional info type.
  1370  	Type *string `json:"type,omitempty"`
  1371  	// Info - READ-ONLY; The additional info.
  1372  	Info interface{} `json:"info,omitempty"`
  1373  }
  1374  
  1375  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1376  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1377  	objectMap := make(map[string]interface{})
  1378  	return json.Marshal(objectMap)
  1379  }
  1380  
  1381  // ErrorDetail the error detail.
  1382  type ErrorDetail struct {
  1383  	// Code - READ-ONLY; The error code.
  1384  	Code *string `json:"code,omitempty"`
  1385  	// Message - READ-ONLY; The error message.
  1386  	Message *string `json:"message,omitempty"`
  1387  	// Target - READ-ONLY; The error target.
  1388  	Target *string `json:"target,omitempty"`
  1389  	// Details - READ-ONLY; The error details.
  1390  	Details *[]ErrorDetail `json:"details,omitempty"`
  1391  	// AdditionalInfo - READ-ONLY; The error additional info.
  1392  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1393  }
  1394  
  1395  // MarshalJSON is the custom marshaler for ErrorDetail.
  1396  func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
  1397  	objectMap := make(map[string]interface{})
  1398  	return json.Marshal(objectMap)
  1399  }
  1400  
  1401  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1402  // failed operations. (This also follows the OData error response format.).
  1403  type ErrorResponse struct {
  1404  	// Error - The error object.
  1405  	Error *ErrorDetail `json:"error,omitempty"`
  1406  }
  1407  
  1408  // GenericResource resource information.
  1409  type GenericResource struct {
  1410  	// ManagedBy - ID of the resource that manages this resource.
  1411  	ManagedBy *string `json:"managedBy,omitempty"`
  1412  	// Sku - The SKU of the resource.
  1413  	Sku *Sku `json:"sku,omitempty"`
  1414  	// ID - READ-ONLY; Resource ID
  1415  	ID *string `json:"id,omitempty"`
  1416  	// Name - READ-ONLY; Resource name
  1417  	Name *string `json:"name,omitempty"`
  1418  	// Type - READ-ONLY; Resource type
  1419  	Type *string `json:"type,omitempty"`
  1420  	// Location - Resource location
  1421  	Location *string `json:"location,omitempty"`
  1422  	// Tags - Resource tags
  1423  	Tags map[string]*string `json:"tags"`
  1424  }
  1425  
  1426  // MarshalJSON is the custom marshaler for GenericResource.
  1427  func (gr GenericResource) MarshalJSON() ([]byte, error) {
  1428  	objectMap := make(map[string]interface{})
  1429  	if gr.ManagedBy != nil {
  1430  		objectMap["managedBy"] = gr.ManagedBy
  1431  	}
  1432  	if gr.Sku != nil {
  1433  		objectMap["sku"] = gr.Sku
  1434  	}
  1435  	if gr.Location != nil {
  1436  		objectMap["location"] = gr.Location
  1437  	}
  1438  	if gr.Tags != nil {
  1439  		objectMap["tags"] = gr.Tags
  1440  	}
  1441  	return json.Marshal(objectMap)
  1442  }
  1443  
  1444  // Identity identity for the resource.
  1445  type Identity struct {
  1446  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1447  	PrincipalID *string `json:"principalId,omitempty"`
  1448  	// TenantID - READ-ONLY; The tenant ID of resource.
  1449  	TenantID *string `json:"tenantId,omitempty"`
  1450  	// Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone'
  1451  	Type ResourceIdentityType `json:"type,omitempty"`
  1452  	// 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}'.
  1453  	UserAssignedIdentities map[string]*UserAssignedResourceIdentity `json:"userAssignedIdentities"`
  1454  }
  1455  
  1456  // MarshalJSON is the custom marshaler for Identity.
  1457  func (i Identity) MarshalJSON() ([]byte, error) {
  1458  	objectMap := make(map[string]interface{})
  1459  	if i.Type != "" {
  1460  		objectMap["type"] = i.Type
  1461  	}
  1462  	if i.UserAssignedIdentities != nil {
  1463  		objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
  1464  	}
  1465  	return json.Marshal(objectMap)
  1466  }
  1467  
  1468  // JitApproverDefinition JIT approver definition.
  1469  type JitApproverDefinition struct {
  1470  	// ID - The approver service principal Id.
  1471  	ID *string `json:"id,omitempty"`
  1472  	// Type - The approver type. Possible values include: 'User', 'Group'
  1473  	Type JitApproverType `json:"type,omitempty"`
  1474  	// DisplayName - The approver display name.
  1475  	DisplayName *string `json:"displayName,omitempty"`
  1476  }
  1477  
  1478  // JitAuthorizationPolicies the JIT authorization policies.
  1479  type JitAuthorizationPolicies struct {
  1480  	// PrincipalID - The the principal id that will be granted JIT access.
  1481  	PrincipalID *string `json:"principalId,omitempty"`
  1482  	// RoleDefinitionID - The role definition id that will be granted to the Principal.
  1483  	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
  1484  }
  1485  
  1486  // JitRequestDefinition information about JIT request definition.
  1487  type JitRequestDefinition struct {
  1488  	autorest.Response `json:"-"`
  1489  	// JitRequestProperties - The JIT request properties.
  1490  	*JitRequestProperties `json:"properties,omitempty"`
  1491  	// ID - READ-ONLY; Resource ID
  1492  	ID *string `json:"id,omitempty"`
  1493  	// Name - READ-ONLY; Resource name
  1494  	Name *string `json:"name,omitempty"`
  1495  	// Type - READ-ONLY; Resource type
  1496  	Type *string `json:"type,omitempty"`
  1497  	// Location - Resource location
  1498  	Location *string `json:"location,omitempty"`
  1499  	// Tags - Resource tags
  1500  	Tags map[string]*string `json:"tags"`
  1501  }
  1502  
  1503  // MarshalJSON is the custom marshaler for JitRequestDefinition.
  1504  func (jrd JitRequestDefinition) MarshalJSON() ([]byte, error) {
  1505  	objectMap := make(map[string]interface{})
  1506  	if jrd.JitRequestProperties != nil {
  1507  		objectMap["properties"] = jrd.JitRequestProperties
  1508  	}
  1509  	if jrd.Location != nil {
  1510  		objectMap["location"] = jrd.Location
  1511  	}
  1512  	if jrd.Tags != nil {
  1513  		objectMap["tags"] = jrd.Tags
  1514  	}
  1515  	return json.Marshal(objectMap)
  1516  }
  1517  
  1518  // UnmarshalJSON is the custom unmarshaler for JitRequestDefinition struct.
  1519  func (jrd *JitRequestDefinition) UnmarshalJSON(body []byte) error {
  1520  	var m map[string]*json.RawMessage
  1521  	err := json.Unmarshal(body, &m)
  1522  	if err != nil {
  1523  		return err
  1524  	}
  1525  	for k, v := range m {
  1526  		switch k {
  1527  		case "properties":
  1528  			if v != nil {
  1529  				var jitRequestProperties JitRequestProperties
  1530  				err = json.Unmarshal(*v, &jitRequestProperties)
  1531  				if err != nil {
  1532  					return err
  1533  				}
  1534  				jrd.JitRequestProperties = &jitRequestProperties
  1535  			}
  1536  		case "id":
  1537  			if v != nil {
  1538  				var ID string
  1539  				err = json.Unmarshal(*v, &ID)
  1540  				if err != nil {
  1541  					return err
  1542  				}
  1543  				jrd.ID = &ID
  1544  			}
  1545  		case "name":
  1546  			if v != nil {
  1547  				var name string
  1548  				err = json.Unmarshal(*v, &name)
  1549  				if err != nil {
  1550  					return err
  1551  				}
  1552  				jrd.Name = &name
  1553  			}
  1554  		case "type":
  1555  			if v != nil {
  1556  				var typeVar string
  1557  				err = json.Unmarshal(*v, &typeVar)
  1558  				if err != nil {
  1559  					return err
  1560  				}
  1561  				jrd.Type = &typeVar
  1562  			}
  1563  		case "location":
  1564  			if v != nil {
  1565  				var location string
  1566  				err = json.Unmarshal(*v, &location)
  1567  				if err != nil {
  1568  					return err
  1569  				}
  1570  				jrd.Location = &location
  1571  			}
  1572  		case "tags":
  1573  			if v != nil {
  1574  				var tags map[string]*string
  1575  				err = json.Unmarshal(*v, &tags)
  1576  				if err != nil {
  1577  					return err
  1578  				}
  1579  				jrd.Tags = tags
  1580  			}
  1581  		}
  1582  	}
  1583  
  1584  	return nil
  1585  }
  1586  
  1587  // JitRequestDefinitionListResult list of JIT requests.
  1588  type JitRequestDefinitionListResult struct {
  1589  	autorest.Response `json:"-"`
  1590  	// Value - The array of Jit request definition.
  1591  	Value *[]JitRequestDefinition `json:"value,omitempty"`
  1592  	// NextLink - The URL to use for getting the next set of results.
  1593  	NextLink *string `json:"nextLink,omitempty"`
  1594  }
  1595  
  1596  // JitRequestMetadata the JIT request metadata.
  1597  type JitRequestMetadata struct {
  1598  	// OriginRequestID - The origin request id.
  1599  	OriginRequestID *string `json:"originRequestId,omitempty"`
  1600  	// RequestorID - The requestor id.
  1601  	RequestorID *string `json:"requestorId,omitempty"`
  1602  	// TenantDisplayName - The publisher's tenant name.
  1603  	TenantDisplayName *string `json:"tenantDisplayName,omitempty"`
  1604  	// SubjectDisplayName - The subject display name.
  1605  	SubjectDisplayName *string `json:"subjectDisplayName,omitempty"`
  1606  }
  1607  
  1608  // JitRequestPatchable information about JIT request.
  1609  type JitRequestPatchable struct {
  1610  	// Tags - Jit request tags
  1611  	Tags map[string]*string `json:"tags"`
  1612  }
  1613  
  1614  // MarshalJSON is the custom marshaler for JitRequestPatchable.
  1615  func (jrp JitRequestPatchable) MarshalJSON() ([]byte, error) {
  1616  	objectMap := make(map[string]interface{})
  1617  	if jrp.Tags != nil {
  1618  		objectMap["tags"] = jrp.Tags
  1619  	}
  1620  	return json.Marshal(objectMap)
  1621  }
  1622  
  1623  // JitRequestProperties information about JIT request properties
  1624  type JitRequestProperties struct {
  1625  	// ApplicationResourceID - The parent application id.
  1626  	ApplicationResourceID *string `json:"applicationResourceId,omitempty"`
  1627  	// PublisherTenantID - READ-ONLY; The publisher tenant id.
  1628  	PublisherTenantID *string `json:"publisherTenantId,omitempty"`
  1629  	// JitAuthorizationPolicies - The JIT authorization policies.
  1630  	JitAuthorizationPolicies *[]JitAuthorizationPolicies `json:"jitAuthorizationPolicies,omitempty"`
  1631  	// JitSchedulingPolicy - The JIT request properties.
  1632  	JitSchedulingPolicy *JitSchedulingPolicy `json:"jitSchedulingPolicy,omitempty"`
  1633  	// ProvisioningState - READ-ONLY; The JIT request provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating'
  1634  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  1635  	// JitRequestState - READ-ONLY; The JIT request state. Possible values include: 'JitRequestStateNotSpecified', 'JitRequestStatePending', 'JitRequestStateApproved', 'JitRequestStateDenied', 'JitRequestStateFailed', 'JitRequestStateCanceled', 'JitRequestStateExpired', 'JitRequestStateTimeout'
  1636  	JitRequestState JitRequestState `json:"jitRequestState,omitempty"`
  1637  	// CreatedBy - READ-ONLY; The client entity that created the JIT request.
  1638  	CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
  1639  	// UpdatedBy - READ-ONLY; The client entity that last updated the JIT request.
  1640  	UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
  1641  }
  1642  
  1643  // MarshalJSON is the custom marshaler for JitRequestProperties.
  1644  func (jrp JitRequestProperties) MarshalJSON() ([]byte, error) {
  1645  	objectMap := make(map[string]interface{})
  1646  	if jrp.ApplicationResourceID != nil {
  1647  		objectMap["applicationResourceId"] = jrp.ApplicationResourceID
  1648  	}
  1649  	if jrp.JitAuthorizationPolicies != nil {
  1650  		objectMap["jitAuthorizationPolicies"] = jrp.JitAuthorizationPolicies
  1651  	}
  1652  	if jrp.JitSchedulingPolicy != nil {
  1653  		objectMap["jitSchedulingPolicy"] = jrp.JitSchedulingPolicy
  1654  	}
  1655  	return json.Marshal(objectMap)
  1656  }
  1657  
  1658  // JitRequestsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1659  // long-running operation.
  1660  type JitRequestsCreateOrUpdateFuture struct {
  1661  	azure.FutureAPI
  1662  	// Result returns the result of the asynchronous operation.
  1663  	// If the operation has not completed it will return an error.
  1664  	Result func(JitRequestsClient) (JitRequestDefinition, error)
  1665  }
  1666  
  1667  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1668  func (future *JitRequestsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1669  	var azFuture azure.Future
  1670  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1671  		return err
  1672  	}
  1673  	future.FutureAPI = &azFuture
  1674  	future.Result = future.result
  1675  	return nil
  1676  }
  1677  
  1678  // result is the default implementation for JitRequestsCreateOrUpdateFuture.Result.
  1679  func (future *JitRequestsCreateOrUpdateFuture) result(client JitRequestsClient) (jrd JitRequestDefinition, err error) {
  1680  	var done bool
  1681  	done, err = future.DoneWithContext(context.Background(), client)
  1682  	if err != nil {
  1683  		err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1684  		return
  1685  	}
  1686  	if !done {
  1687  		jrd.Response.Response = future.Response()
  1688  		err = azure.NewAsyncOpIncompleteError("managedapplications.JitRequestsCreateOrUpdateFuture")
  1689  		return
  1690  	}
  1691  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1692  	if jrd.Response.Response, err = future.GetResult(sender); err == nil && jrd.Response.Response.StatusCode != http.StatusNoContent {
  1693  		jrd, err = client.CreateOrUpdateResponder(jrd.Response.Response)
  1694  		if err != nil {
  1695  			err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", jrd.Response.Response, "Failure responding to request")
  1696  		}
  1697  	}
  1698  	return
  1699  }
  1700  
  1701  // JitSchedulingPolicy the JIT scheduling policies.
  1702  type JitSchedulingPolicy struct {
  1703  	// Type - The type of JIT schedule. Possible values include: 'JitSchedulingTypeNotSpecified', 'JitSchedulingTypeOnce', 'JitSchedulingTypeRecurring'
  1704  	Type     JitSchedulingType `json:"type,omitempty"`
  1705  	Duration *string           `json:"duration,omitempty"`
  1706  	// StartTime - The start time of the request.
  1707  	StartTime *date.Time `json:"startTime,omitempty"`
  1708  }
  1709  
  1710  // ListTokenRequest list token request body.
  1711  type ListTokenRequest struct {
  1712  	// AuthorizationAudience - The authorization audience.
  1713  	AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
  1714  	// UserAssignedIdentities - The user assigned identities.
  1715  	UserAssignedIdentities *[]string `json:"userAssignedIdentities,omitempty"`
  1716  }
  1717  
  1718  // ManagedIdentityToken the managed identity token for the managed app resource.
  1719  type ManagedIdentityToken struct {
  1720  	// AccessToken - The requested access token.
  1721  	AccessToken *string `json:"accessToken,omitempty"`
  1722  	// ExpiresIn - The number of seconds the access token will be valid.
  1723  	ExpiresIn *string `json:"expiresIn,omitempty"`
  1724  	// ExpiresOn - The timespan when the access token expires. This is represented as the number of seconds from epoch.
  1725  	ExpiresOn *string `json:"expiresOn,omitempty"`
  1726  	// NotBefore - The timespan when the access token takes effect. This is represented as the number of seconds from epoch.
  1727  	NotBefore *string `json:"notBefore,omitempty"`
  1728  	// AuthorizationAudience - The aud (audience) the access token was request for. This is the same as what was provided in the listTokens request.
  1729  	AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
  1730  	// ResourceID - The Azure resource ID for the issued token. This is either the managed application ID or the user-assigned identity ID.
  1731  	ResourceID *string `json:"resourceId,omitempty"`
  1732  	// TokenType - The type of the token.
  1733  	TokenType *string `json:"tokenType,omitempty"`
  1734  }
  1735  
  1736  // ManagedIdentityTokenResult the array of managed identity tokens.
  1737  type ManagedIdentityTokenResult struct {
  1738  	autorest.Response `json:"-"`
  1739  	// Value - The array of managed identity tokens.
  1740  	Value *[]ManagedIdentityToken `json:"value,omitempty"`
  1741  }
  1742  
  1743  // Operation microsoft.Solutions operation
  1744  type Operation struct {
  1745  	// Name - Operation name: {provider}/{resource}/{operation}
  1746  	Name *string `json:"name,omitempty"`
  1747  	// Display - The object that represents the operation.
  1748  	Display *OperationDisplay `json:"display,omitempty"`
  1749  }
  1750  
  1751  // OperationDisplay the object that represents the operation.
  1752  type OperationDisplay struct {
  1753  	// Provider - Service provider: Microsoft.Solutions
  1754  	Provider *string `json:"provider,omitempty"`
  1755  	// Resource - Resource on which the operation is performed: Application, JitRequest, etc.
  1756  	Resource *string `json:"resource,omitempty"`
  1757  	// Operation - Operation type: Read, write, delete, etc.
  1758  	Operation *string `json:"operation,omitempty"`
  1759  }
  1760  
  1761  // OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains
  1762  // an URL link to get the next set of results.
  1763  type OperationListResult struct {
  1764  	autorest.Response `json:"-"`
  1765  	// Value - READ-ONLY; List of operations supported by the resource provider
  1766  	Value *[]Operation `json:"value,omitempty"`
  1767  	// NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any).
  1768  	NextLink *string `json:"nextLink,omitempty"`
  1769  }
  1770  
  1771  // MarshalJSON is the custom marshaler for OperationListResult.
  1772  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1773  	objectMap := make(map[string]interface{})
  1774  	return json.Marshal(objectMap)
  1775  }
  1776  
  1777  // OperationListResultIterator provides access to a complete listing of Operation values.
  1778  type OperationListResultIterator struct {
  1779  	i    int
  1780  	page OperationListResultPage
  1781  }
  1782  
  1783  // NextWithContext advances to the next value.  If there was an error making
  1784  // the request the iterator does not advance and the error is returned.
  1785  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1786  	if tracing.IsEnabled() {
  1787  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1788  		defer func() {
  1789  			sc := -1
  1790  			if iter.Response().Response.Response != nil {
  1791  				sc = iter.Response().Response.Response.StatusCode
  1792  			}
  1793  			tracing.EndSpan(ctx, sc, err)
  1794  		}()
  1795  	}
  1796  	iter.i++
  1797  	if iter.i < len(iter.page.Values()) {
  1798  		return nil
  1799  	}
  1800  	err = iter.page.NextWithContext(ctx)
  1801  	if err != nil {
  1802  		iter.i--
  1803  		return err
  1804  	}
  1805  	iter.i = 0
  1806  	return nil
  1807  }
  1808  
  1809  // Next advances to the next value.  If there was an error making
  1810  // the request the iterator does not advance and the error is returned.
  1811  // Deprecated: Use NextWithContext() instead.
  1812  func (iter *OperationListResultIterator) Next() error {
  1813  	return iter.NextWithContext(context.Background())
  1814  }
  1815  
  1816  // NotDone returns true if the enumeration should be started or is not yet complete.
  1817  func (iter OperationListResultIterator) NotDone() bool {
  1818  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1819  }
  1820  
  1821  // Response returns the raw server response from the last page request.
  1822  func (iter OperationListResultIterator) Response() OperationListResult {
  1823  	return iter.page.Response()
  1824  }
  1825  
  1826  // Value returns the current value or a zero-initialized value if the
  1827  // iterator has advanced beyond the end of the collection.
  1828  func (iter OperationListResultIterator) Value() Operation {
  1829  	if !iter.page.NotDone() {
  1830  		return Operation{}
  1831  	}
  1832  	return iter.page.Values()[iter.i]
  1833  }
  1834  
  1835  // Creates a new instance of the OperationListResultIterator type.
  1836  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1837  	return OperationListResultIterator{page: page}
  1838  }
  1839  
  1840  // IsEmpty returns true if the ListResult contains no values.
  1841  func (olr OperationListResult) IsEmpty() bool {
  1842  	return olr.Value == nil || len(*olr.Value) == 0
  1843  }
  1844  
  1845  // hasNextLink returns true if the NextLink is not empty.
  1846  func (olr OperationListResult) hasNextLink() bool {
  1847  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1848  }
  1849  
  1850  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1851  // It returns nil if no more results exist.
  1852  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1853  	if !olr.hasNextLink() {
  1854  		return nil, nil
  1855  	}
  1856  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1857  		autorest.AsJSON(),
  1858  		autorest.AsGet(),
  1859  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1860  }
  1861  
  1862  // OperationListResultPage contains a page of Operation values.
  1863  type OperationListResultPage struct {
  1864  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1865  	olr OperationListResult
  1866  }
  1867  
  1868  // NextWithContext advances to the next page of values.  If there was an error making
  1869  // the request the page does not advance and the error is returned.
  1870  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1871  	if tracing.IsEnabled() {
  1872  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1873  		defer func() {
  1874  			sc := -1
  1875  			if page.Response().Response.Response != nil {
  1876  				sc = page.Response().Response.Response.StatusCode
  1877  			}
  1878  			tracing.EndSpan(ctx, sc, err)
  1879  		}()
  1880  	}
  1881  	for {
  1882  		next, err := page.fn(ctx, page.olr)
  1883  		if err != nil {
  1884  			return err
  1885  		}
  1886  		page.olr = next
  1887  		if !next.hasNextLink() || !next.IsEmpty() {
  1888  			break
  1889  		}
  1890  	}
  1891  	return nil
  1892  }
  1893  
  1894  // Next advances to the next page of values.  If there was an error making
  1895  // the request the page does not advance and the error is returned.
  1896  // Deprecated: Use NextWithContext() instead.
  1897  func (page *OperationListResultPage) Next() error {
  1898  	return page.NextWithContext(context.Background())
  1899  }
  1900  
  1901  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1902  func (page OperationListResultPage) NotDone() bool {
  1903  	return !page.olr.IsEmpty()
  1904  }
  1905  
  1906  // Response returns the raw server response from the last page request.
  1907  func (page OperationListResultPage) Response() OperationListResult {
  1908  	return page.olr
  1909  }
  1910  
  1911  // Values returns the slice of values for the current page or nil if there are no values.
  1912  func (page OperationListResultPage) Values() []Operation {
  1913  	if page.olr.IsEmpty() {
  1914  		return nil
  1915  	}
  1916  	return *page.olr.Value
  1917  }
  1918  
  1919  // Creates a new instance of the OperationListResultPage type.
  1920  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1921  	return OperationListResultPage{
  1922  		fn:  getNextPage,
  1923  		olr: cur,
  1924  	}
  1925  }
  1926  
  1927  // Plan plan for the managed application.
  1928  type Plan struct {
  1929  	// Name - The plan name.
  1930  	Name *string `json:"name,omitempty"`
  1931  	// Publisher - The publisher ID.
  1932  	Publisher *string `json:"publisher,omitempty"`
  1933  	// Product - The product code.
  1934  	Product *string `json:"product,omitempty"`
  1935  	// PromotionCode - The promotion code.
  1936  	PromotionCode *string `json:"promotionCode,omitempty"`
  1937  	// Version - The plan's version.
  1938  	Version *string `json:"version,omitempty"`
  1939  }
  1940  
  1941  // PlanPatchable plan for the managed application.
  1942  type PlanPatchable struct {
  1943  	// Name - The plan name.
  1944  	Name *string `json:"name,omitempty"`
  1945  	// Publisher - The publisher ID.
  1946  	Publisher *string `json:"publisher,omitempty"`
  1947  	// Product - The product code.
  1948  	Product *string `json:"product,omitempty"`
  1949  	// PromotionCode - The promotion code.
  1950  	PromotionCode *string `json:"promotionCode,omitempty"`
  1951  	// Version - The plan's version.
  1952  	Version *string `json:"version,omitempty"`
  1953  }
  1954  
  1955  // Resource resource information.
  1956  type Resource struct {
  1957  	// ID - READ-ONLY; Resource ID
  1958  	ID *string `json:"id,omitempty"`
  1959  	// Name - READ-ONLY; Resource name
  1960  	Name *string `json:"name,omitempty"`
  1961  	// Type - READ-ONLY; Resource type
  1962  	Type *string `json:"type,omitempty"`
  1963  	// Location - Resource location
  1964  	Location *string `json:"location,omitempty"`
  1965  	// Tags - Resource tags
  1966  	Tags map[string]*string `json:"tags"`
  1967  }
  1968  
  1969  // MarshalJSON is the custom marshaler for Resource.
  1970  func (r Resource) MarshalJSON() ([]byte, error) {
  1971  	objectMap := make(map[string]interface{})
  1972  	if r.Location != nil {
  1973  		objectMap["location"] = r.Location
  1974  	}
  1975  	if r.Tags != nil {
  1976  		objectMap["tags"] = r.Tags
  1977  	}
  1978  	return json.Marshal(objectMap)
  1979  }
  1980  
  1981  // Sku SKU for the resource.
  1982  type Sku struct {
  1983  	// Name - The SKU name.
  1984  	Name *string `json:"name,omitempty"`
  1985  	// Tier - The SKU tier.
  1986  	Tier *string `json:"tier,omitempty"`
  1987  	// Size - The SKU size.
  1988  	Size *string `json:"size,omitempty"`
  1989  	// Family - The SKU family.
  1990  	Family *string `json:"family,omitempty"`
  1991  	// Model - The SKU model.
  1992  	Model *string `json:"model,omitempty"`
  1993  	// Capacity - The SKU capacity.
  1994  	Capacity *int32 `json:"capacity,omitempty"`
  1995  }
  1996  
  1997  // UpdateAccessDefinition update access request definition.
  1998  type UpdateAccessDefinition struct {
  1999  	autorest.Response `json:"-"`
  2000  	// Approver - The approver name.
  2001  	Approver *string `json:"approver,omitempty"`
  2002  	// Metadata - The JIT request metadata.
  2003  	Metadata *JitRequestMetadata `json:"metadata,omitempty"`
  2004  	// Status - The JIT status. Possible values include: 'StatusNotSpecified', 'StatusElevate', 'StatusRemove'
  2005  	Status Status `json:"status,omitempty"`
  2006  	// SubStatus - The JIT status. Possible values include: 'SubstatusNotSpecified', 'SubstatusApproved', 'SubstatusDenied', 'SubstatusFailed', 'SubstatusExpired', 'SubstatusTimeout'
  2007  	SubStatus Substatus `json:"subStatus,omitempty"`
  2008  }
  2009  
  2010  // UserAssignedResourceIdentity represents the user assigned identity that is contained within the
  2011  // UserAssignedIdentities dictionary on ResourceIdentity
  2012  type UserAssignedResourceIdentity struct {
  2013  	// PrincipalID - READ-ONLY; The principal id of user assigned identity.
  2014  	PrincipalID *string `json:"principalId,omitempty"`
  2015  	// TenantID - READ-ONLY; The tenant id of user assigned identity.
  2016  	TenantID *string `json:"tenantId,omitempty"`
  2017  }
  2018  
  2019  // MarshalJSON is the custom marshaler for UserAssignedResourceIdentity.
  2020  func (uari UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) {
  2021  	objectMap := make(map[string]interface{})
  2022  	return json.Marshal(objectMap)
  2023  }
  2024  

View as plain text