...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy

     1  package policy
     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/date"
    14  	"github.com/Azure/go-autorest/autorest/to"
    15  	"github.com/Azure/go-autorest/tracing"
    16  	"net/http"
    17  )
    18  
    19  // The package's fully qualified name.
    20  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy"
    21  
    22  // Alias the alias type.
    23  type Alias struct {
    24  	// Name - The alias name.
    25  	Name *string `json:"name,omitempty"`
    26  	// Paths - The paths for an alias.
    27  	Paths *[]AliasPath `json:"paths,omitempty"`
    28  	// Type - The type of the alias. Possible values include: 'AliasTypeNotSpecified', 'AliasTypePlainText', 'AliasTypeMask'
    29  	Type AliasType `json:"type,omitempty"`
    30  	// DefaultPath - The default path for an alias.
    31  	DefaultPath *string `json:"defaultPath,omitempty"`
    32  	// DefaultPattern - The default pattern for an alias.
    33  	DefaultPattern *AliasPattern `json:"defaultPattern,omitempty"`
    34  	// DefaultMetadata - READ-ONLY; The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata
    35  	DefaultMetadata *AliasPathMetadata `json:"defaultMetadata,omitempty"`
    36  }
    37  
    38  // MarshalJSON is the custom marshaler for Alias.
    39  func (a Alias) MarshalJSON() ([]byte, error) {
    40  	objectMap := make(map[string]interface{})
    41  	if a.Name != nil {
    42  		objectMap["name"] = a.Name
    43  	}
    44  	if a.Paths != nil {
    45  		objectMap["paths"] = a.Paths
    46  	}
    47  	if a.Type != "" {
    48  		objectMap["type"] = a.Type
    49  	}
    50  	if a.DefaultPath != nil {
    51  		objectMap["defaultPath"] = a.DefaultPath
    52  	}
    53  	if a.DefaultPattern != nil {
    54  		objectMap["defaultPattern"] = a.DefaultPattern
    55  	}
    56  	return json.Marshal(objectMap)
    57  }
    58  
    59  // AliasPath the type of the paths for alias.
    60  type AliasPath struct {
    61  	// Path - The path of an alias.
    62  	Path *string `json:"path,omitempty"`
    63  	// APIVersions - The API versions.
    64  	APIVersions *[]string `json:"apiVersions,omitempty"`
    65  	// Pattern - The pattern for an alias path.
    66  	Pattern *AliasPattern `json:"pattern,omitempty"`
    67  	// Metadata - READ-ONLY; The metadata of the alias path. If missing, fall back to the default metadata of the alias.
    68  	Metadata *AliasPathMetadata `json:"metadata,omitempty"`
    69  }
    70  
    71  // MarshalJSON is the custom marshaler for AliasPath.
    72  func (ap AliasPath) MarshalJSON() ([]byte, error) {
    73  	objectMap := make(map[string]interface{})
    74  	if ap.Path != nil {
    75  		objectMap["path"] = ap.Path
    76  	}
    77  	if ap.APIVersions != nil {
    78  		objectMap["apiVersions"] = ap.APIVersions
    79  	}
    80  	if ap.Pattern != nil {
    81  		objectMap["pattern"] = ap.Pattern
    82  	}
    83  	return json.Marshal(objectMap)
    84  }
    85  
    86  // AliasPathMetadata ...
    87  type AliasPathMetadata struct {
    88  	// Type - READ-ONLY; The type of the token that the alias path is referring to. Possible values include: 'AliasPathTokenTypeNotSpecified', 'AliasPathTokenTypeAny', 'AliasPathTokenTypeString', 'AliasPathTokenTypeObject', 'AliasPathTokenTypeArray', 'AliasPathTokenTypeInteger', 'AliasPathTokenTypeNumber', 'AliasPathTokenTypeBoolean'
    89  	Type AliasPathTokenType `json:"type,omitempty"`
    90  	// Attributes - READ-ONLY; The attributes of the token that the alias path is referring to. Possible values include: 'AliasPathAttributesNone', 'AliasPathAttributesModifiable'
    91  	Attributes AliasPathAttributes `json:"attributes,omitempty"`
    92  }
    93  
    94  // MarshalJSON is the custom marshaler for AliasPathMetadata.
    95  func (apm AliasPathMetadata) MarshalJSON() ([]byte, error) {
    96  	objectMap := make(map[string]interface{})
    97  	return json.Marshal(objectMap)
    98  }
    99  
   100  // AliasPattern the type of the pattern for an alias path.
   101  type AliasPattern struct {
   102  	// Phrase - The alias pattern phrase.
   103  	Phrase *string `json:"phrase,omitempty"`
   104  	// Variable - The alias pattern variable.
   105  	Variable *string `json:"variable,omitempty"`
   106  	// Type - The type of alias pattern. Possible values include: 'AliasPatternTypeNotSpecified', 'AliasPatternTypeExtract'
   107  	Type AliasPatternType `json:"type,omitempty"`
   108  }
   109  
   110  // Assignment the policy assignment.
   111  type Assignment struct {
   112  	autorest.Response `json:"-"`
   113  	// AssignmentProperties - Properties for the policy assignment.
   114  	*AssignmentProperties `json:"properties,omitempty"`
   115  	// ID - READ-ONLY; The ID of the policy assignment.
   116  	ID *string `json:"id,omitempty"`
   117  	// Type - READ-ONLY; The type of the policy assignment.
   118  	Type *string `json:"type,omitempty"`
   119  	// Name - READ-ONLY; The name of the policy assignment.
   120  	Name *string `json:"name,omitempty"`
   121  	// Location - The location of the policy assignment. Only required when utilizing managed identity.
   122  	Location *string `json:"location,omitempty"`
   123  	// Identity - The managed identity associated with the policy assignment.
   124  	Identity *Identity `json:"identity,omitempty"`
   125  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   126  	SystemData *SystemData `json:"systemData,omitempty"`
   127  }
   128  
   129  // MarshalJSON is the custom marshaler for Assignment.
   130  func (a Assignment) MarshalJSON() ([]byte, error) {
   131  	objectMap := make(map[string]interface{})
   132  	if a.AssignmentProperties != nil {
   133  		objectMap["properties"] = a.AssignmentProperties
   134  	}
   135  	if a.Location != nil {
   136  		objectMap["location"] = a.Location
   137  	}
   138  	if a.Identity != nil {
   139  		objectMap["identity"] = a.Identity
   140  	}
   141  	return json.Marshal(objectMap)
   142  }
   143  
   144  // UnmarshalJSON is the custom unmarshaler for Assignment struct.
   145  func (a *Assignment) UnmarshalJSON(body []byte) error {
   146  	var m map[string]*json.RawMessage
   147  	err := json.Unmarshal(body, &m)
   148  	if err != nil {
   149  		return err
   150  	}
   151  	for k, v := range m {
   152  		switch k {
   153  		case "properties":
   154  			if v != nil {
   155  				var assignmentProperties AssignmentProperties
   156  				err = json.Unmarshal(*v, &assignmentProperties)
   157  				if err != nil {
   158  					return err
   159  				}
   160  				a.AssignmentProperties = &assignmentProperties
   161  			}
   162  		case "id":
   163  			if v != nil {
   164  				var ID string
   165  				err = json.Unmarshal(*v, &ID)
   166  				if err != nil {
   167  					return err
   168  				}
   169  				a.ID = &ID
   170  			}
   171  		case "type":
   172  			if v != nil {
   173  				var typeVar string
   174  				err = json.Unmarshal(*v, &typeVar)
   175  				if err != nil {
   176  					return err
   177  				}
   178  				a.Type = &typeVar
   179  			}
   180  		case "name":
   181  			if v != nil {
   182  				var name string
   183  				err = json.Unmarshal(*v, &name)
   184  				if err != nil {
   185  					return err
   186  				}
   187  				a.Name = &name
   188  			}
   189  		case "location":
   190  			if v != nil {
   191  				var location string
   192  				err = json.Unmarshal(*v, &location)
   193  				if err != nil {
   194  					return err
   195  				}
   196  				a.Location = &location
   197  			}
   198  		case "identity":
   199  			if v != nil {
   200  				var identity Identity
   201  				err = json.Unmarshal(*v, &identity)
   202  				if err != nil {
   203  					return err
   204  				}
   205  				a.Identity = &identity
   206  			}
   207  		case "systemData":
   208  			if v != nil {
   209  				var systemData SystemData
   210  				err = json.Unmarshal(*v, &systemData)
   211  				if err != nil {
   212  					return err
   213  				}
   214  				a.SystemData = &systemData
   215  			}
   216  		}
   217  	}
   218  
   219  	return nil
   220  }
   221  
   222  // AssignmentListResult list of policy assignments.
   223  type AssignmentListResult struct {
   224  	autorest.Response `json:"-"`
   225  	// Value - An array of policy assignments.
   226  	Value *[]Assignment `json:"value,omitempty"`
   227  	// NextLink - The URL to use for getting the next set of results.
   228  	NextLink *string `json:"nextLink,omitempty"`
   229  }
   230  
   231  // AssignmentListResultIterator provides access to a complete listing of Assignment values.
   232  type AssignmentListResultIterator struct {
   233  	i    int
   234  	page AssignmentListResultPage
   235  }
   236  
   237  // NextWithContext advances to the next value.  If there was an error making
   238  // the request the iterator does not advance and the error is returned.
   239  func (iter *AssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) {
   240  	if tracing.IsEnabled() {
   241  		ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentListResultIterator.NextWithContext")
   242  		defer func() {
   243  			sc := -1
   244  			if iter.Response().Response.Response != nil {
   245  				sc = iter.Response().Response.Response.StatusCode
   246  			}
   247  			tracing.EndSpan(ctx, sc, err)
   248  		}()
   249  	}
   250  	iter.i++
   251  	if iter.i < len(iter.page.Values()) {
   252  		return nil
   253  	}
   254  	err = iter.page.NextWithContext(ctx)
   255  	if err != nil {
   256  		iter.i--
   257  		return err
   258  	}
   259  	iter.i = 0
   260  	return nil
   261  }
   262  
   263  // Next advances to the next value.  If there was an error making
   264  // the request the iterator does not advance and the error is returned.
   265  // Deprecated: Use NextWithContext() instead.
   266  func (iter *AssignmentListResultIterator) Next() error {
   267  	return iter.NextWithContext(context.Background())
   268  }
   269  
   270  // NotDone returns true if the enumeration should be started or is not yet complete.
   271  func (iter AssignmentListResultIterator) NotDone() bool {
   272  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   273  }
   274  
   275  // Response returns the raw server response from the last page request.
   276  func (iter AssignmentListResultIterator) Response() AssignmentListResult {
   277  	return iter.page.Response()
   278  }
   279  
   280  // Value returns the current value or a zero-initialized value if the
   281  // iterator has advanced beyond the end of the collection.
   282  func (iter AssignmentListResultIterator) Value() Assignment {
   283  	if !iter.page.NotDone() {
   284  		return Assignment{}
   285  	}
   286  	return iter.page.Values()[iter.i]
   287  }
   288  
   289  // Creates a new instance of the AssignmentListResultIterator type.
   290  func NewAssignmentListResultIterator(page AssignmentListResultPage) AssignmentListResultIterator {
   291  	return AssignmentListResultIterator{page: page}
   292  }
   293  
   294  // IsEmpty returns true if the ListResult contains no values.
   295  func (alr AssignmentListResult) IsEmpty() bool {
   296  	return alr.Value == nil || len(*alr.Value) == 0
   297  }
   298  
   299  // hasNextLink returns true if the NextLink is not empty.
   300  func (alr AssignmentListResult) hasNextLink() bool {
   301  	return alr.NextLink != nil && len(*alr.NextLink) != 0
   302  }
   303  
   304  // assignmentListResultPreparer prepares a request to retrieve the next set of results.
   305  // It returns nil if no more results exist.
   306  func (alr AssignmentListResult) assignmentListResultPreparer(ctx context.Context) (*http.Request, error) {
   307  	if !alr.hasNextLink() {
   308  		return nil, nil
   309  	}
   310  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   311  		autorest.AsJSON(),
   312  		autorest.AsGet(),
   313  		autorest.WithBaseURL(to.String(alr.NextLink)))
   314  }
   315  
   316  // AssignmentListResultPage contains a page of Assignment values.
   317  type AssignmentListResultPage struct {
   318  	fn  func(context.Context, AssignmentListResult) (AssignmentListResult, error)
   319  	alr AssignmentListResult
   320  }
   321  
   322  // NextWithContext advances to the next page of values.  If there was an error making
   323  // the request the page does not advance and the error is returned.
   324  func (page *AssignmentListResultPage) NextWithContext(ctx context.Context) (err error) {
   325  	if tracing.IsEnabled() {
   326  		ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentListResultPage.NextWithContext")
   327  		defer func() {
   328  			sc := -1
   329  			if page.Response().Response.Response != nil {
   330  				sc = page.Response().Response.Response.StatusCode
   331  			}
   332  			tracing.EndSpan(ctx, sc, err)
   333  		}()
   334  	}
   335  	for {
   336  		next, err := page.fn(ctx, page.alr)
   337  		if err != nil {
   338  			return err
   339  		}
   340  		page.alr = next
   341  		if !next.hasNextLink() || !next.IsEmpty() {
   342  			break
   343  		}
   344  	}
   345  	return nil
   346  }
   347  
   348  // Next advances to the next page of values.  If there was an error making
   349  // the request the page does not advance and the error is returned.
   350  // Deprecated: Use NextWithContext() instead.
   351  func (page *AssignmentListResultPage) Next() error {
   352  	return page.NextWithContext(context.Background())
   353  }
   354  
   355  // NotDone returns true if the page enumeration should be started or is not yet complete.
   356  func (page AssignmentListResultPage) NotDone() bool {
   357  	return !page.alr.IsEmpty()
   358  }
   359  
   360  // Response returns the raw server response from the last page request.
   361  func (page AssignmentListResultPage) Response() AssignmentListResult {
   362  	return page.alr
   363  }
   364  
   365  // Values returns the slice of values for the current page or nil if there are no values.
   366  func (page AssignmentListResultPage) Values() []Assignment {
   367  	if page.alr.IsEmpty() {
   368  		return nil
   369  	}
   370  	return *page.alr.Value
   371  }
   372  
   373  // Creates a new instance of the AssignmentListResultPage type.
   374  func NewAssignmentListResultPage(cur AssignmentListResult, getNextPage func(context.Context, AssignmentListResult) (AssignmentListResult, error)) AssignmentListResultPage {
   375  	return AssignmentListResultPage{
   376  		fn:  getNextPage,
   377  		alr: cur,
   378  	}
   379  }
   380  
   381  // AssignmentProperties the policy assignment properties.
   382  type AssignmentProperties struct {
   383  	// DisplayName - The display name of the policy assignment.
   384  	DisplayName *string `json:"displayName,omitempty"`
   385  	// PolicyDefinitionID - The ID of the policy definition or policy set definition being assigned.
   386  	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
   387  	// Scope - READ-ONLY; The scope for the policy assignment.
   388  	Scope *string `json:"scope,omitempty"`
   389  	// NotScopes - The policy's excluded scopes.
   390  	NotScopes *[]string `json:"notScopes,omitempty"`
   391  	// Parameters - The parameter values for the assigned policy rule. The keys are the parameter names.
   392  	Parameters map[string]*ParameterValuesValue `json:"parameters"`
   393  	// Description - This message will be part of response in case of policy violation.
   394  	Description *string `json:"description,omitempty"`
   395  	// Metadata - The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs.
   396  	Metadata interface{} `json:"metadata,omitempty"`
   397  	// EnforcementMode - The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'EnforcementModeDefault', 'EnforcementModeDoNotEnforce'
   398  	EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"`
   399  	// NonComplianceMessages - The messages that describe why a resource is non-compliant with the policy.
   400  	NonComplianceMessages *[]NonComplianceMessage `json:"nonComplianceMessages,omitempty"`
   401  }
   402  
   403  // MarshalJSON is the custom marshaler for AssignmentProperties.
   404  func (ap AssignmentProperties) MarshalJSON() ([]byte, error) {
   405  	objectMap := make(map[string]interface{})
   406  	if ap.DisplayName != nil {
   407  		objectMap["displayName"] = ap.DisplayName
   408  	}
   409  	if ap.PolicyDefinitionID != nil {
   410  		objectMap["policyDefinitionId"] = ap.PolicyDefinitionID
   411  	}
   412  	if ap.NotScopes != nil {
   413  		objectMap["notScopes"] = ap.NotScopes
   414  	}
   415  	if ap.Parameters != nil {
   416  		objectMap["parameters"] = ap.Parameters
   417  	}
   418  	if ap.Description != nil {
   419  		objectMap["description"] = ap.Description
   420  	}
   421  	if ap.Metadata != nil {
   422  		objectMap["metadata"] = ap.Metadata
   423  	}
   424  	if ap.EnforcementMode != "" {
   425  		objectMap["enforcementMode"] = ap.EnforcementMode
   426  	}
   427  	if ap.NonComplianceMessages != nil {
   428  		objectMap["nonComplianceMessages"] = ap.NonComplianceMessages
   429  	}
   430  	return json.Marshal(objectMap)
   431  }
   432  
   433  // AssignmentUpdate ...
   434  type AssignmentUpdate struct {
   435  	// Location - The location of the policy assignment. Only required when utilizing managed identity.
   436  	Location *string `json:"location,omitempty"`
   437  	// Identity - The managed identity associated with the policy assignment.
   438  	Identity *Identity `json:"identity,omitempty"`
   439  }
   440  
   441  // CloudError an error response from a policy operation.
   442  type CloudError struct {
   443  	Error *ErrorResponse `json:"error,omitempty"`
   444  }
   445  
   446  // DataEffect the data effect definition.
   447  type DataEffect struct {
   448  	// Name - The data effect name.
   449  	Name *string `json:"name,omitempty"`
   450  	// DetailsSchema - The data effect details schema.
   451  	DetailsSchema interface{} `json:"detailsSchema,omitempty"`
   452  }
   453  
   454  // DataManifestCustomResourceFunctionDefinition the custom resource function definition.
   455  type DataManifestCustomResourceFunctionDefinition struct {
   456  	// Name - The function name as it will appear in the policy rule. eg - 'vault'.
   457  	Name *string `json:"name,omitempty"`
   458  	// FullyQualifiedResourceType - The fully qualified control plane resource type that this function represents. eg - 'Microsoft.KeyVault/vaults'.
   459  	FullyQualifiedResourceType *string `json:"fullyQualifiedResourceType,omitempty"`
   460  	// DefaultProperties - The top-level properties that can be selected on the function's output. eg - [ "name", "location" ] if vault().name and vault().location are supported
   461  	DefaultProperties *[]string `json:"defaultProperties,omitempty"`
   462  	// AllowCustomProperties - A value indicating whether the custom properties within the property bag are allowed. Needs api-version to be specified in the policy rule eg - vault('2019-06-01').
   463  	AllowCustomProperties *bool `json:"allowCustomProperties,omitempty"`
   464  }
   465  
   466  // DataManifestResourceFunctionsDefinition the resource functions supported by a manifest
   467  type DataManifestResourceFunctionsDefinition struct {
   468  	// Standard - The standard resource functions (subscription and/or resourceGroup).
   469  	Standard *[]string `json:"standard,omitempty"`
   470  	// Custom - An array of data manifest custom resource definition.
   471  	Custom *[]DataManifestCustomResourceFunctionDefinition `json:"custom,omitempty"`
   472  }
   473  
   474  // DataPolicyManifest the data policy manifest.
   475  type DataPolicyManifest struct {
   476  	autorest.Response `json:"-"`
   477  	// DataPolicyManifestProperties - The data policy manifest properties.
   478  	*DataPolicyManifestProperties `json:"properties,omitempty"`
   479  	// ID - READ-ONLY; The ID of the data policy manifest.
   480  	ID *string `json:"id,omitempty"`
   481  	// Name - READ-ONLY; The name of the data policy manifest (it's the same as the Policy Mode).
   482  	Name *string `json:"name,omitempty"`
   483  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/dataPolicyManifests).
   484  	Type *string `json:"type,omitempty"`
   485  }
   486  
   487  // MarshalJSON is the custom marshaler for DataPolicyManifest.
   488  func (dpm DataPolicyManifest) MarshalJSON() ([]byte, error) {
   489  	objectMap := make(map[string]interface{})
   490  	if dpm.DataPolicyManifestProperties != nil {
   491  		objectMap["properties"] = dpm.DataPolicyManifestProperties
   492  	}
   493  	return json.Marshal(objectMap)
   494  }
   495  
   496  // UnmarshalJSON is the custom unmarshaler for DataPolicyManifest struct.
   497  func (dpm *DataPolicyManifest) UnmarshalJSON(body []byte) error {
   498  	var m map[string]*json.RawMessage
   499  	err := json.Unmarshal(body, &m)
   500  	if err != nil {
   501  		return err
   502  	}
   503  	for k, v := range m {
   504  		switch k {
   505  		case "properties":
   506  			if v != nil {
   507  				var dataPolicyManifestProperties DataPolicyManifestProperties
   508  				err = json.Unmarshal(*v, &dataPolicyManifestProperties)
   509  				if err != nil {
   510  					return err
   511  				}
   512  				dpm.DataPolicyManifestProperties = &dataPolicyManifestProperties
   513  			}
   514  		case "id":
   515  			if v != nil {
   516  				var ID string
   517  				err = json.Unmarshal(*v, &ID)
   518  				if err != nil {
   519  					return err
   520  				}
   521  				dpm.ID = &ID
   522  			}
   523  		case "name":
   524  			if v != nil {
   525  				var name string
   526  				err = json.Unmarshal(*v, &name)
   527  				if err != nil {
   528  					return err
   529  				}
   530  				dpm.Name = &name
   531  			}
   532  		case "type":
   533  			if v != nil {
   534  				var typeVar string
   535  				err = json.Unmarshal(*v, &typeVar)
   536  				if err != nil {
   537  					return err
   538  				}
   539  				dpm.Type = &typeVar
   540  			}
   541  		}
   542  	}
   543  
   544  	return nil
   545  }
   546  
   547  // DataPolicyManifestListResult list of data policy manifests.
   548  type DataPolicyManifestListResult struct {
   549  	autorest.Response `json:"-"`
   550  	// Value - An array of data policy manifests.
   551  	Value *[]DataPolicyManifest `json:"value,omitempty"`
   552  	// NextLink - The URL to use for getting the next set of results.
   553  	NextLink *string `json:"nextLink,omitempty"`
   554  }
   555  
   556  // DataPolicyManifestListResultIterator provides access to a complete listing of DataPolicyManifest values.
   557  type DataPolicyManifestListResultIterator struct {
   558  	i    int
   559  	page DataPolicyManifestListResultPage
   560  }
   561  
   562  // NextWithContext advances to the next value.  If there was an error making
   563  // the request the iterator does not advance and the error is returned.
   564  func (iter *DataPolicyManifestListResultIterator) NextWithContext(ctx context.Context) (err error) {
   565  	if tracing.IsEnabled() {
   566  		ctx = tracing.StartSpan(ctx, fqdn+"/DataPolicyManifestListResultIterator.NextWithContext")
   567  		defer func() {
   568  			sc := -1
   569  			if iter.Response().Response.Response != nil {
   570  				sc = iter.Response().Response.Response.StatusCode
   571  			}
   572  			tracing.EndSpan(ctx, sc, err)
   573  		}()
   574  	}
   575  	iter.i++
   576  	if iter.i < len(iter.page.Values()) {
   577  		return nil
   578  	}
   579  	err = iter.page.NextWithContext(ctx)
   580  	if err != nil {
   581  		iter.i--
   582  		return err
   583  	}
   584  	iter.i = 0
   585  	return nil
   586  }
   587  
   588  // Next advances to the next value.  If there was an error making
   589  // the request the iterator does not advance and the error is returned.
   590  // Deprecated: Use NextWithContext() instead.
   591  func (iter *DataPolicyManifestListResultIterator) Next() error {
   592  	return iter.NextWithContext(context.Background())
   593  }
   594  
   595  // NotDone returns true if the enumeration should be started or is not yet complete.
   596  func (iter DataPolicyManifestListResultIterator) NotDone() bool {
   597  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   598  }
   599  
   600  // Response returns the raw server response from the last page request.
   601  func (iter DataPolicyManifestListResultIterator) Response() DataPolicyManifestListResult {
   602  	return iter.page.Response()
   603  }
   604  
   605  // Value returns the current value or a zero-initialized value if the
   606  // iterator has advanced beyond the end of the collection.
   607  func (iter DataPolicyManifestListResultIterator) Value() DataPolicyManifest {
   608  	if !iter.page.NotDone() {
   609  		return DataPolicyManifest{}
   610  	}
   611  	return iter.page.Values()[iter.i]
   612  }
   613  
   614  // Creates a new instance of the DataPolicyManifestListResultIterator type.
   615  func NewDataPolicyManifestListResultIterator(page DataPolicyManifestListResultPage) DataPolicyManifestListResultIterator {
   616  	return DataPolicyManifestListResultIterator{page: page}
   617  }
   618  
   619  // IsEmpty returns true if the ListResult contains no values.
   620  func (dpmlr DataPolicyManifestListResult) IsEmpty() bool {
   621  	return dpmlr.Value == nil || len(*dpmlr.Value) == 0
   622  }
   623  
   624  // hasNextLink returns true if the NextLink is not empty.
   625  func (dpmlr DataPolicyManifestListResult) hasNextLink() bool {
   626  	return dpmlr.NextLink != nil && len(*dpmlr.NextLink) != 0
   627  }
   628  
   629  // dataPolicyManifestListResultPreparer prepares a request to retrieve the next set of results.
   630  // It returns nil if no more results exist.
   631  func (dpmlr DataPolicyManifestListResult) dataPolicyManifestListResultPreparer(ctx context.Context) (*http.Request, error) {
   632  	if !dpmlr.hasNextLink() {
   633  		return nil, nil
   634  	}
   635  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   636  		autorest.AsJSON(),
   637  		autorest.AsGet(),
   638  		autorest.WithBaseURL(to.String(dpmlr.NextLink)))
   639  }
   640  
   641  // DataPolicyManifestListResultPage contains a page of DataPolicyManifest values.
   642  type DataPolicyManifestListResultPage struct {
   643  	fn    func(context.Context, DataPolicyManifestListResult) (DataPolicyManifestListResult, error)
   644  	dpmlr DataPolicyManifestListResult
   645  }
   646  
   647  // NextWithContext advances to the next page of values.  If there was an error making
   648  // the request the page does not advance and the error is returned.
   649  func (page *DataPolicyManifestListResultPage) NextWithContext(ctx context.Context) (err error) {
   650  	if tracing.IsEnabled() {
   651  		ctx = tracing.StartSpan(ctx, fqdn+"/DataPolicyManifestListResultPage.NextWithContext")
   652  		defer func() {
   653  			sc := -1
   654  			if page.Response().Response.Response != nil {
   655  				sc = page.Response().Response.Response.StatusCode
   656  			}
   657  			tracing.EndSpan(ctx, sc, err)
   658  		}()
   659  	}
   660  	for {
   661  		next, err := page.fn(ctx, page.dpmlr)
   662  		if err != nil {
   663  			return err
   664  		}
   665  		page.dpmlr = next
   666  		if !next.hasNextLink() || !next.IsEmpty() {
   667  			break
   668  		}
   669  	}
   670  	return nil
   671  }
   672  
   673  // Next advances to the next page of values.  If there was an error making
   674  // the request the page does not advance and the error is returned.
   675  // Deprecated: Use NextWithContext() instead.
   676  func (page *DataPolicyManifestListResultPage) Next() error {
   677  	return page.NextWithContext(context.Background())
   678  }
   679  
   680  // NotDone returns true if the page enumeration should be started or is not yet complete.
   681  func (page DataPolicyManifestListResultPage) NotDone() bool {
   682  	return !page.dpmlr.IsEmpty()
   683  }
   684  
   685  // Response returns the raw server response from the last page request.
   686  func (page DataPolicyManifestListResultPage) Response() DataPolicyManifestListResult {
   687  	return page.dpmlr
   688  }
   689  
   690  // Values returns the slice of values for the current page or nil if there are no values.
   691  func (page DataPolicyManifestListResultPage) Values() []DataPolicyManifest {
   692  	if page.dpmlr.IsEmpty() {
   693  		return nil
   694  	}
   695  	return *page.dpmlr.Value
   696  }
   697  
   698  // Creates a new instance of the DataPolicyManifestListResultPage type.
   699  func NewDataPolicyManifestListResultPage(cur DataPolicyManifestListResult, getNextPage func(context.Context, DataPolicyManifestListResult) (DataPolicyManifestListResult, error)) DataPolicyManifestListResultPage {
   700  	return DataPolicyManifestListResultPage{
   701  		fn:    getNextPage,
   702  		dpmlr: cur,
   703  	}
   704  }
   705  
   706  // DataPolicyManifestProperties the properties of the data policy manifest.
   707  type DataPolicyManifestProperties struct {
   708  	// Namespaces - The list of namespaces for the data policy manifest.
   709  	Namespaces *[]string `json:"namespaces,omitempty"`
   710  	// PolicyMode - The policy mode of the data policy manifest.
   711  	PolicyMode *string `json:"policyMode,omitempty"`
   712  	// IsBuiltInOnly - A value indicating whether policy mode is allowed only in built-in definitions.
   713  	IsBuiltInOnly *bool `json:"isBuiltInOnly,omitempty"`
   714  	// ResourceTypeAliases - An array of resource type aliases.
   715  	ResourceTypeAliases *[]ResourceTypeAliases `json:"resourceTypeAliases,omitempty"`
   716  	// Effects - The effect definition.
   717  	Effects *[]DataEffect `json:"effects,omitempty"`
   718  	// FieldValues - The non-alias field accessor values that can be used in the policy rule.
   719  	FieldValues *[]string `json:"fieldValues,omitempty"`
   720  	// DataManifestResourceFunctionsDefinition - The resource functions definition specified in the data manifest.
   721  	*DataManifestResourceFunctionsDefinition `json:"resourceFunctions,omitempty"`
   722  }
   723  
   724  // MarshalJSON is the custom marshaler for DataPolicyManifestProperties.
   725  func (dpmp DataPolicyManifestProperties) MarshalJSON() ([]byte, error) {
   726  	objectMap := make(map[string]interface{})
   727  	if dpmp.Namespaces != nil {
   728  		objectMap["namespaces"] = dpmp.Namespaces
   729  	}
   730  	if dpmp.PolicyMode != nil {
   731  		objectMap["policyMode"] = dpmp.PolicyMode
   732  	}
   733  	if dpmp.IsBuiltInOnly != nil {
   734  		objectMap["isBuiltInOnly"] = dpmp.IsBuiltInOnly
   735  	}
   736  	if dpmp.ResourceTypeAliases != nil {
   737  		objectMap["resourceTypeAliases"] = dpmp.ResourceTypeAliases
   738  	}
   739  	if dpmp.Effects != nil {
   740  		objectMap["effects"] = dpmp.Effects
   741  	}
   742  	if dpmp.FieldValues != nil {
   743  		objectMap["fieldValues"] = dpmp.FieldValues
   744  	}
   745  	if dpmp.DataManifestResourceFunctionsDefinition != nil {
   746  		objectMap["resourceFunctions"] = dpmp.DataManifestResourceFunctionsDefinition
   747  	}
   748  	return json.Marshal(objectMap)
   749  }
   750  
   751  // UnmarshalJSON is the custom unmarshaler for DataPolicyManifestProperties struct.
   752  func (dpmp *DataPolicyManifestProperties) UnmarshalJSON(body []byte) error {
   753  	var m map[string]*json.RawMessage
   754  	err := json.Unmarshal(body, &m)
   755  	if err != nil {
   756  		return err
   757  	}
   758  	for k, v := range m {
   759  		switch k {
   760  		case "namespaces":
   761  			if v != nil {
   762  				var namespaces []string
   763  				err = json.Unmarshal(*v, &namespaces)
   764  				if err != nil {
   765  					return err
   766  				}
   767  				dpmp.Namespaces = &namespaces
   768  			}
   769  		case "policyMode":
   770  			if v != nil {
   771  				var policyMode string
   772  				err = json.Unmarshal(*v, &policyMode)
   773  				if err != nil {
   774  					return err
   775  				}
   776  				dpmp.PolicyMode = &policyMode
   777  			}
   778  		case "isBuiltInOnly":
   779  			if v != nil {
   780  				var isBuiltInOnly bool
   781  				err = json.Unmarshal(*v, &isBuiltInOnly)
   782  				if err != nil {
   783  					return err
   784  				}
   785  				dpmp.IsBuiltInOnly = &isBuiltInOnly
   786  			}
   787  		case "resourceTypeAliases":
   788  			if v != nil {
   789  				var resourceTypeAliases []ResourceTypeAliases
   790  				err = json.Unmarshal(*v, &resourceTypeAliases)
   791  				if err != nil {
   792  					return err
   793  				}
   794  				dpmp.ResourceTypeAliases = &resourceTypeAliases
   795  			}
   796  		case "effects":
   797  			if v != nil {
   798  				var effects []DataEffect
   799  				err = json.Unmarshal(*v, &effects)
   800  				if err != nil {
   801  					return err
   802  				}
   803  				dpmp.Effects = &effects
   804  			}
   805  		case "fieldValues":
   806  			if v != nil {
   807  				var fieldValues []string
   808  				err = json.Unmarshal(*v, &fieldValues)
   809  				if err != nil {
   810  					return err
   811  				}
   812  				dpmp.FieldValues = &fieldValues
   813  			}
   814  		case "resourceFunctions":
   815  			if v != nil {
   816  				var dataManifestResourceFunctionsDefinition DataManifestResourceFunctionsDefinition
   817  				err = json.Unmarshal(*v, &dataManifestResourceFunctionsDefinition)
   818  				if err != nil {
   819  					return err
   820  				}
   821  				dpmp.DataManifestResourceFunctionsDefinition = &dataManifestResourceFunctionsDefinition
   822  			}
   823  		}
   824  	}
   825  
   826  	return nil
   827  }
   828  
   829  // Definition the policy definition.
   830  type Definition struct {
   831  	autorest.Response `json:"-"`
   832  	// DefinitionProperties - The policy definition properties.
   833  	*DefinitionProperties `json:"properties,omitempty"`
   834  	// ID - READ-ONLY; The ID of the policy definition.
   835  	ID *string `json:"id,omitempty"`
   836  	// Name - READ-ONLY; The name of the policy definition.
   837  	Name *string `json:"name,omitempty"`
   838  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/policyDefinitions).
   839  	Type *string `json:"type,omitempty"`
   840  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   841  	SystemData *SystemData `json:"systemData,omitempty"`
   842  }
   843  
   844  // MarshalJSON is the custom marshaler for Definition.
   845  func (d Definition) MarshalJSON() ([]byte, error) {
   846  	objectMap := make(map[string]interface{})
   847  	if d.DefinitionProperties != nil {
   848  		objectMap["properties"] = d.DefinitionProperties
   849  	}
   850  	return json.Marshal(objectMap)
   851  }
   852  
   853  // UnmarshalJSON is the custom unmarshaler for Definition struct.
   854  func (d *Definition) UnmarshalJSON(body []byte) error {
   855  	var m map[string]*json.RawMessage
   856  	err := json.Unmarshal(body, &m)
   857  	if err != nil {
   858  		return err
   859  	}
   860  	for k, v := range m {
   861  		switch k {
   862  		case "properties":
   863  			if v != nil {
   864  				var definitionProperties DefinitionProperties
   865  				err = json.Unmarshal(*v, &definitionProperties)
   866  				if err != nil {
   867  					return err
   868  				}
   869  				d.DefinitionProperties = &definitionProperties
   870  			}
   871  		case "id":
   872  			if v != nil {
   873  				var ID string
   874  				err = json.Unmarshal(*v, &ID)
   875  				if err != nil {
   876  					return err
   877  				}
   878  				d.ID = &ID
   879  			}
   880  		case "name":
   881  			if v != nil {
   882  				var name string
   883  				err = json.Unmarshal(*v, &name)
   884  				if err != nil {
   885  					return err
   886  				}
   887  				d.Name = &name
   888  			}
   889  		case "type":
   890  			if v != nil {
   891  				var typeVar string
   892  				err = json.Unmarshal(*v, &typeVar)
   893  				if err != nil {
   894  					return err
   895  				}
   896  				d.Type = &typeVar
   897  			}
   898  		case "systemData":
   899  			if v != nil {
   900  				var systemData SystemData
   901  				err = json.Unmarshal(*v, &systemData)
   902  				if err != nil {
   903  					return err
   904  				}
   905  				d.SystemData = &systemData
   906  			}
   907  		}
   908  	}
   909  
   910  	return nil
   911  }
   912  
   913  // DefinitionGroup the policy definition group.
   914  type DefinitionGroup struct {
   915  	// Name - The name of the group.
   916  	Name *string `json:"name,omitempty"`
   917  	// DisplayName - The group's display name.
   918  	DisplayName *string `json:"displayName,omitempty"`
   919  	// Category - The group's category.
   920  	Category *string `json:"category,omitempty"`
   921  	// Description - The group's description.
   922  	Description *string `json:"description,omitempty"`
   923  	// AdditionalMetadataID - A resource ID of a resource that contains additional metadata about the group.
   924  	AdditionalMetadataID *string `json:"additionalMetadataId,omitempty"`
   925  }
   926  
   927  // DefinitionListResult list of policy definitions.
   928  type DefinitionListResult struct {
   929  	autorest.Response `json:"-"`
   930  	// Value - An array of policy definitions.
   931  	Value *[]Definition `json:"value,omitempty"`
   932  	// NextLink - The URL to use for getting the next set of results.
   933  	NextLink *string `json:"nextLink,omitempty"`
   934  }
   935  
   936  // DefinitionListResultIterator provides access to a complete listing of Definition values.
   937  type DefinitionListResultIterator struct {
   938  	i    int
   939  	page DefinitionListResultPage
   940  }
   941  
   942  // NextWithContext advances to the next value.  If there was an error making
   943  // the request the iterator does not advance and the error is returned.
   944  func (iter *DefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   945  	if tracing.IsEnabled() {
   946  		ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionListResultIterator.NextWithContext")
   947  		defer func() {
   948  			sc := -1
   949  			if iter.Response().Response.Response != nil {
   950  				sc = iter.Response().Response.Response.StatusCode
   951  			}
   952  			tracing.EndSpan(ctx, sc, err)
   953  		}()
   954  	}
   955  	iter.i++
   956  	if iter.i < len(iter.page.Values()) {
   957  		return nil
   958  	}
   959  	err = iter.page.NextWithContext(ctx)
   960  	if err != nil {
   961  		iter.i--
   962  		return err
   963  	}
   964  	iter.i = 0
   965  	return nil
   966  }
   967  
   968  // Next advances to the next value.  If there was an error making
   969  // the request the iterator does not advance and the error is returned.
   970  // Deprecated: Use NextWithContext() instead.
   971  func (iter *DefinitionListResultIterator) Next() error {
   972  	return iter.NextWithContext(context.Background())
   973  }
   974  
   975  // NotDone returns true if the enumeration should be started or is not yet complete.
   976  func (iter DefinitionListResultIterator) NotDone() bool {
   977  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   978  }
   979  
   980  // Response returns the raw server response from the last page request.
   981  func (iter DefinitionListResultIterator) Response() DefinitionListResult {
   982  	return iter.page.Response()
   983  }
   984  
   985  // Value returns the current value or a zero-initialized value if the
   986  // iterator has advanced beyond the end of the collection.
   987  func (iter DefinitionListResultIterator) Value() Definition {
   988  	if !iter.page.NotDone() {
   989  		return Definition{}
   990  	}
   991  	return iter.page.Values()[iter.i]
   992  }
   993  
   994  // Creates a new instance of the DefinitionListResultIterator type.
   995  func NewDefinitionListResultIterator(page DefinitionListResultPage) DefinitionListResultIterator {
   996  	return DefinitionListResultIterator{page: page}
   997  }
   998  
   999  // IsEmpty returns true if the ListResult contains no values.
  1000  func (dlr DefinitionListResult) IsEmpty() bool {
  1001  	return dlr.Value == nil || len(*dlr.Value) == 0
  1002  }
  1003  
  1004  // hasNextLink returns true if the NextLink is not empty.
  1005  func (dlr DefinitionListResult) hasNextLink() bool {
  1006  	return dlr.NextLink != nil && len(*dlr.NextLink) != 0
  1007  }
  1008  
  1009  // definitionListResultPreparer prepares a request to retrieve the next set of results.
  1010  // It returns nil if no more results exist.
  1011  func (dlr DefinitionListResult) definitionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1012  	if !dlr.hasNextLink() {
  1013  		return nil, nil
  1014  	}
  1015  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1016  		autorest.AsJSON(),
  1017  		autorest.AsGet(),
  1018  		autorest.WithBaseURL(to.String(dlr.NextLink)))
  1019  }
  1020  
  1021  // DefinitionListResultPage contains a page of Definition values.
  1022  type DefinitionListResultPage struct {
  1023  	fn  func(context.Context, DefinitionListResult) (DefinitionListResult, error)
  1024  	dlr DefinitionListResult
  1025  }
  1026  
  1027  // NextWithContext advances to the next page of values.  If there was an error making
  1028  // the request the page does not advance and the error is returned.
  1029  func (page *DefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1030  	if tracing.IsEnabled() {
  1031  		ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionListResultPage.NextWithContext")
  1032  		defer func() {
  1033  			sc := -1
  1034  			if page.Response().Response.Response != nil {
  1035  				sc = page.Response().Response.Response.StatusCode
  1036  			}
  1037  			tracing.EndSpan(ctx, sc, err)
  1038  		}()
  1039  	}
  1040  	for {
  1041  		next, err := page.fn(ctx, page.dlr)
  1042  		if err != nil {
  1043  			return err
  1044  		}
  1045  		page.dlr = next
  1046  		if !next.hasNextLink() || !next.IsEmpty() {
  1047  			break
  1048  		}
  1049  	}
  1050  	return nil
  1051  }
  1052  
  1053  // Next advances to the next page of values.  If there was an error making
  1054  // the request the page does not advance and the error is returned.
  1055  // Deprecated: Use NextWithContext() instead.
  1056  func (page *DefinitionListResultPage) Next() error {
  1057  	return page.NextWithContext(context.Background())
  1058  }
  1059  
  1060  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1061  func (page DefinitionListResultPage) NotDone() bool {
  1062  	return !page.dlr.IsEmpty()
  1063  }
  1064  
  1065  // Response returns the raw server response from the last page request.
  1066  func (page DefinitionListResultPage) Response() DefinitionListResult {
  1067  	return page.dlr
  1068  }
  1069  
  1070  // Values returns the slice of values for the current page or nil if there are no values.
  1071  func (page DefinitionListResultPage) Values() []Definition {
  1072  	if page.dlr.IsEmpty() {
  1073  		return nil
  1074  	}
  1075  	return *page.dlr.Value
  1076  }
  1077  
  1078  // Creates a new instance of the DefinitionListResultPage type.
  1079  func NewDefinitionListResultPage(cur DefinitionListResult, getNextPage func(context.Context, DefinitionListResult) (DefinitionListResult, error)) DefinitionListResultPage {
  1080  	return DefinitionListResultPage{
  1081  		fn:  getNextPage,
  1082  		dlr: cur,
  1083  	}
  1084  }
  1085  
  1086  // DefinitionProperties the policy definition properties.
  1087  type DefinitionProperties struct {
  1088  	// PolicyType - The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'TypeNotSpecified', 'TypeBuiltIn', 'TypeCustom', 'TypeStatic'
  1089  	PolicyType Type `json:"policyType,omitempty"`
  1090  	// Mode - The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data.
  1091  	Mode *string `json:"mode,omitempty"`
  1092  	// DisplayName - The display name of the policy definition.
  1093  	DisplayName *string `json:"displayName,omitempty"`
  1094  	// Description - The policy definition description.
  1095  	Description *string `json:"description,omitempty"`
  1096  	// PolicyRule - The policy rule.
  1097  	PolicyRule interface{} `json:"policyRule,omitempty"`
  1098  	// Metadata - The policy definition metadata.  Metadata is an open ended object and is typically a collection of key value pairs.
  1099  	Metadata interface{} `json:"metadata,omitempty"`
  1100  	// Parameters - The parameter definitions for parameters used in the policy rule. The keys are the parameter names.
  1101  	Parameters map[string]*ParameterDefinitionsValue `json:"parameters"`
  1102  }
  1103  
  1104  // MarshalJSON is the custom marshaler for DefinitionProperties.
  1105  func (dp DefinitionProperties) MarshalJSON() ([]byte, error) {
  1106  	objectMap := make(map[string]interface{})
  1107  	if dp.PolicyType != "" {
  1108  		objectMap["policyType"] = dp.PolicyType
  1109  	}
  1110  	if dp.Mode != nil {
  1111  		objectMap["mode"] = dp.Mode
  1112  	}
  1113  	if dp.DisplayName != nil {
  1114  		objectMap["displayName"] = dp.DisplayName
  1115  	}
  1116  	if dp.Description != nil {
  1117  		objectMap["description"] = dp.Description
  1118  	}
  1119  	if dp.PolicyRule != nil {
  1120  		objectMap["policyRule"] = dp.PolicyRule
  1121  	}
  1122  	if dp.Metadata != nil {
  1123  		objectMap["metadata"] = dp.Metadata
  1124  	}
  1125  	if dp.Parameters != nil {
  1126  		objectMap["parameters"] = dp.Parameters
  1127  	}
  1128  	return json.Marshal(objectMap)
  1129  }
  1130  
  1131  // DefinitionReference the policy definition reference.
  1132  type DefinitionReference struct {
  1133  	// PolicyDefinitionID - The ID of the policy definition or policy set definition.
  1134  	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
  1135  	// Parameters - The parameter values for the referenced policy rule. The keys are the parameter names.
  1136  	Parameters map[string]*ParameterValuesValue `json:"parameters"`
  1137  	// PolicyDefinitionReferenceID - A unique id (within the policy set definition) for this policy definition reference.
  1138  	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
  1139  	// GroupNames - The name of the groups that this policy definition reference belongs to.
  1140  	GroupNames *[]string `json:"groupNames,omitempty"`
  1141  }
  1142  
  1143  // MarshalJSON is the custom marshaler for DefinitionReference.
  1144  func (dr DefinitionReference) MarshalJSON() ([]byte, error) {
  1145  	objectMap := make(map[string]interface{})
  1146  	if dr.PolicyDefinitionID != nil {
  1147  		objectMap["policyDefinitionId"] = dr.PolicyDefinitionID
  1148  	}
  1149  	if dr.Parameters != nil {
  1150  		objectMap["parameters"] = dr.Parameters
  1151  	}
  1152  	if dr.PolicyDefinitionReferenceID != nil {
  1153  		objectMap["policyDefinitionReferenceId"] = dr.PolicyDefinitionReferenceID
  1154  	}
  1155  	if dr.GroupNames != nil {
  1156  		objectMap["groupNames"] = dr.GroupNames
  1157  	}
  1158  	return json.Marshal(objectMap)
  1159  }
  1160  
  1161  // ErrorAdditionalInfo the resource management error additional info.
  1162  type ErrorAdditionalInfo struct {
  1163  	// Type - READ-ONLY; The additional info type.
  1164  	Type *string `json:"type,omitempty"`
  1165  	// Info - READ-ONLY; The additional info.
  1166  	Info interface{} `json:"info,omitempty"`
  1167  }
  1168  
  1169  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1170  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1171  	objectMap := make(map[string]interface{})
  1172  	return json.Marshal(objectMap)
  1173  }
  1174  
  1175  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1176  // failed operations. (This also follows the OData error response format.)
  1177  type ErrorResponse struct {
  1178  	// Code - READ-ONLY; The error code.
  1179  	Code *string `json:"code,omitempty"`
  1180  	// Message - READ-ONLY; The error message.
  1181  	Message *string `json:"message,omitempty"`
  1182  	// Target - READ-ONLY; The error target.
  1183  	Target *string `json:"target,omitempty"`
  1184  	// Details - READ-ONLY; The error details.
  1185  	Details *[]ErrorResponse `json:"details,omitempty"`
  1186  	// AdditionalInfo - READ-ONLY; The error additional info.
  1187  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1188  }
  1189  
  1190  // MarshalJSON is the custom marshaler for ErrorResponse.
  1191  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
  1192  	objectMap := make(map[string]interface{})
  1193  	return json.Marshal(objectMap)
  1194  }
  1195  
  1196  // Exemption the policy exemption.
  1197  type Exemption struct {
  1198  	autorest.Response `json:"-"`
  1199  	// ExemptionProperties - Properties for the policy exemption.
  1200  	*ExemptionProperties `json:"properties,omitempty"`
  1201  	// SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
  1202  	SystemData *SystemData `json:"systemData,omitempty"`
  1203  	// ID - READ-ONLY; The ID of the policy exemption.
  1204  	ID *string `json:"id,omitempty"`
  1205  	// Name - READ-ONLY; The name of the policy exemption.
  1206  	Name *string `json:"name,omitempty"`
  1207  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/policyExemptions).
  1208  	Type *string `json:"type,omitempty"`
  1209  }
  1210  
  1211  // MarshalJSON is the custom marshaler for Exemption.
  1212  func (e Exemption) MarshalJSON() ([]byte, error) {
  1213  	objectMap := make(map[string]interface{})
  1214  	if e.ExemptionProperties != nil {
  1215  		objectMap["properties"] = e.ExemptionProperties
  1216  	}
  1217  	return json.Marshal(objectMap)
  1218  }
  1219  
  1220  // UnmarshalJSON is the custom unmarshaler for Exemption struct.
  1221  func (e *Exemption) UnmarshalJSON(body []byte) error {
  1222  	var m map[string]*json.RawMessage
  1223  	err := json.Unmarshal(body, &m)
  1224  	if err != nil {
  1225  		return err
  1226  	}
  1227  	for k, v := range m {
  1228  		switch k {
  1229  		case "properties":
  1230  			if v != nil {
  1231  				var exemptionProperties ExemptionProperties
  1232  				err = json.Unmarshal(*v, &exemptionProperties)
  1233  				if err != nil {
  1234  					return err
  1235  				}
  1236  				e.ExemptionProperties = &exemptionProperties
  1237  			}
  1238  		case "systemData":
  1239  			if v != nil {
  1240  				var systemData SystemData
  1241  				err = json.Unmarshal(*v, &systemData)
  1242  				if err != nil {
  1243  					return err
  1244  				}
  1245  				e.SystemData = &systemData
  1246  			}
  1247  		case "id":
  1248  			if v != nil {
  1249  				var ID string
  1250  				err = json.Unmarshal(*v, &ID)
  1251  				if err != nil {
  1252  					return err
  1253  				}
  1254  				e.ID = &ID
  1255  			}
  1256  		case "name":
  1257  			if v != nil {
  1258  				var name string
  1259  				err = json.Unmarshal(*v, &name)
  1260  				if err != nil {
  1261  					return err
  1262  				}
  1263  				e.Name = &name
  1264  			}
  1265  		case "type":
  1266  			if v != nil {
  1267  				var typeVar string
  1268  				err = json.Unmarshal(*v, &typeVar)
  1269  				if err != nil {
  1270  					return err
  1271  				}
  1272  				e.Type = &typeVar
  1273  			}
  1274  		}
  1275  	}
  1276  
  1277  	return nil
  1278  }
  1279  
  1280  // ExemptionListResult list of policy exemptions.
  1281  type ExemptionListResult struct {
  1282  	autorest.Response `json:"-"`
  1283  	// Value - An array of policy exemptions.
  1284  	Value *[]Exemption `json:"value,omitempty"`
  1285  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
  1286  	NextLink *string `json:"nextLink,omitempty"`
  1287  }
  1288  
  1289  // MarshalJSON is the custom marshaler for ExemptionListResult.
  1290  func (elr ExemptionListResult) MarshalJSON() ([]byte, error) {
  1291  	objectMap := make(map[string]interface{})
  1292  	if elr.Value != nil {
  1293  		objectMap["value"] = elr.Value
  1294  	}
  1295  	return json.Marshal(objectMap)
  1296  }
  1297  
  1298  // ExemptionListResultIterator provides access to a complete listing of Exemption values.
  1299  type ExemptionListResultIterator struct {
  1300  	i    int
  1301  	page ExemptionListResultPage
  1302  }
  1303  
  1304  // NextWithContext advances to the next value.  If there was an error making
  1305  // the request the iterator does not advance and the error is returned.
  1306  func (iter *ExemptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1307  	if tracing.IsEnabled() {
  1308  		ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionListResultIterator.NextWithContext")
  1309  		defer func() {
  1310  			sc := -1
  1311  			if iter.Response().Response.Response != nil {
  1312  				sc = iter.Response().Response.Response.StatusCode
  1313  			}
  1314  			tracing.EndSpan(ctx, sc, err)
  1315  		}()
  1316  	}
  1317  	iter.i++
  1318  	if iter.i < len(iter.page.Values()) {
  1319  		return nil
  1320  	}
  1321  	err = iter.page.NextWithContext(ctx)
  1322  	if err != nil {
  1323  		iter.i--
  1324  		return err
  1325  	}
  1326  	iter.i = 0
  1327  	return nil
  1328  }
  1329  
  1330  // Next advances to the next value.  If there was an error making
  1331  // the request the iterator does not advance and the error is returned.
  1332  // Deprecated: Use NextWithContext() instead.
  1333  func (iter *ExemptionListResultIterator) Next() error {
  1334  	return iter.NextWithContext(context.Background())
  1335  }
  1336  
  1337  // NotDone returns true if the enumeration should be started or is not yet complete.
  1338  func (iter ExemptionListResultIterator) NotDone() bool {
  1339  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1340  }
  1341  
  1342  // Response returns the raw server response from the last page request.
  1343  func (iter ExemptionListResultIterator) Response() ExemptionListResult {
  1344  	return iter.page.Response()
  1345  }
  1346  
  1347  // Value returns the current value or a zero-initialized value if the
  1348  // iterator has advanced beyond the end of the collection.
  1349  func (iter ExemptionListResultIterator) Value() Exemption {
  1350  	if !iter.page.NotDone() {
  1351  		return Exemption{}
  1352  	}
  1353  	return iter.page.Values()[iter.i]
  1354  }
  1355  
  1356  // Creates a new instance of the ExemptionListResultIterator type.
  1357  func NewExemptionListResultIterator(page ExemptionListResultPage) ExemptionListResultIterator {
  1358  	return ExemptionListResultIterator{page: page}
  1359  }
  1360  
  1361  // IsEmpty returns true if the ListResult contains no values.
  1362  func (elr ExemptionListResult) IsEmpty() bool {
  1363  	return elr.Value == nil || len(*elr.Value) == 0
  1364  }
  1365  
  1366  // hasNextLink returns true if the NextLink is not empty.
  1367  func (elr ExemptionListResult) hasNextLink() bool {
  1368  	return elr.NextLink != nil && len(*elr.NextLink) != 0
  1369  }
  1370  
  1371  // exemptionListResultPreparer prepares a request to retrieve the next set of results.
  1372  // It returns nil if no more results exist.
  1373  func (elr ExemptionListResult) exemptionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1374  	if !elr.hasNextLink() {
  1375  		return nil, nil
  1376  	}
  1377  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1378  		autorest.AsJSON(),
  1379  		autorest.AsGet(),
  1380  		autorest.WithBaseURL(to.String(elr.NextLink)))
  1381  }
  1382  
  1383  // ExemptionListResultPage contains a page of Exemption values.
  1384  type ExemptionListResultPage struct {
  1385  	fn  func(context.Context, ExemptionListResult) (ExemptionListResult, error)
  1386  	elr ExemptionListResult
  1387  }
  1388  
  1389  // NextWithContext advances to the next page of values.  If there was an error making
  1390  // the request the page does not advance and the error is returned.
  1391  func (page *ExemptionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1392  	if tracing.IsEnabled() {
  1393  		ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionListResultPage.NextWithContext")
  1394  		defer func() {
  1395  			sc := -1
  1396  			if page.Response().Response.Response != nil {
  1397  				sc = page.Response().Response.Response.StatusCode
  1398  			}
  1399  			tracing.EndSpan(ctx, sc, err)
  1400  		}()
  1401  	}
  1402  	for {
  1403  		next, err := page.fn(ctx, page.elr)
  1404  		if err != nil {
  1405  			return err
  1406  		}
  1407  		page.elr = next
  1408  		if !next.hasNextLink() || !next.IsEmpty() {
  1409  			break
  1410  		}
  1411  	}
  1412  	return nil
  1413  }
  1414  
  1415  // Next advances to the next page of values.  If there was an error making
  1416  // the request the page does not advance and the error is returned.
  1417  // Deprecated: Use NextWithContext() instead.
  1418  func (page *ExemptionListResultPage) Next() error {
  1419  	return page.NextWithContext(context.Background())
  1420  }
  1421  
  1422  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1423  func (page ExemptionListResultPage) NotDone() bool {
  1424  	return !page.elr.IsEmpty()
  1425  }
  1426  
  1427  // Response returns the raw server response from the last page request.
  1428  func (page ExemptionListResultPage) Response() ExemptionListResult {
  1429  	return page.elr
  1430  }
  1431  
  1432  // Values returns the slice of values for the current page or nil if there are no values.
  1433  func (page ExemptionListResultPage) Values() []Exemption {
  1434  	if page.elr.IsEmpty() {
  1435  		return nil
  1436  	}
  1437  	return *page.elr.Value
  1438  }
  1439  
  1440  // Creates a new instance of the ExemptionListResultPage type.
  1441  func NewExemptionListResultPage(cur ExemptionListResult, getNextPage func(context.Context, ExemptionListResult) (ExemptionListResult, error)) ExemptionListResultPage {
  1442  	return ExemptionListResultPage{
  1443  		fn:  getNextPage,
  1444  		elr: cur,
  1445  	}
  1446  }
  1447  
  1448  // ExemptionProperties the policy exemption properties.
  1449  type ExemptionProperties struct {
  1450  	// PolicyAssignmentID - The ID of the policy assignment that is being exempted.
  1451  	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`
  1452  	// PolicyDefinitionReferenceIds - The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
  1453  	PolicyDefinitionReferenceIds *[]string `json:"policyDefinitionReferenceIds,omitempty"`
  1454  	// ExemptionCategory - The policy exemption category. Possible values are Waiver and Mitigated. Possible values include: 'ExemptionCategoryWaiver', 'ExemptionCategoryMitigated'
  1455  	ExemptionCategory ExemptionCategory `json:"exemptionCategory,omitempty"`
  1456  	// ExpiresOn - The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the policy exemption.
  1457  	ExpiresOn *date.Time `json:"expiresOn,omitempty"`
  1458  	// DisplayName - The display name of the policy exemption.
  1459  	DisplayName *string `json:"displayName,omitempty"`
  1460  	// Description - The description of the policy exemption.
  1461  	Description *string `json:"description,omitempty"`
  1462  	// Metadata - The policy exemption metadata. Metadata is an open ended object and is typically a collection of key value pairs.
  1463  	Metadata interface{} `json:"metadata,omitempty"`
  1464  }
  1465  
  1466  // Identity identity for the resource.  Policy assignments support a maximum of one identity.  That is
  1467  // either a system assigned identity or a single user assigned identity.
  1468  type Identity struct {
  1469  	// PrincipalID - READ-ONLY; The principal ID of the resource identity.  This property will only be provided for a system assigned identity
  1470  	PrincipalID *string `json:"principalId,omitempty"`
  1471  	// TenantID - READ-ONLY; The tenant ID of the resource identity.  This property will only be provided for a system assigned identity
  1472  	TenantID *string `json:"tenantId,omitempty"`
  1473  	// Type - The identity type. This is the only required field when adding a system or user assigned identity to a resource. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone'
  1474  	Type ResourceIdentityType `json:"type,omitempty"`
  1475  	// UserAssignedIdentities - The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
  1476  	UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"`
  1477  }
  1478  
  1479  // MarshalJSON is the custom marshaler for Identity.
  1480  func (i Identity) MarshalJSON() ([]byte, error) {
  1481  	objectMap := make(map[string]interface{})
  1482  	if i.Type != "" {
  1483  		objectMap["type"] = i.Type
  1484  	}
  1485  	if i.UserAssignedIdentities != nil {
  1486  		objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
  1487  	}
  1488  	return json.Marshal(objectMap)
  1489  }
  1490  
  1491  // IdentityUserAssignedIdentitiesValue ...
  1492  type IdentityUserAssignedIdentitiesValue struct {
  1493  	// PrincipalID - READ-ONLY; The principal id of user assigned identity.
  1494  	PrincipalID *string `json:"principalId,omitempty"`
  1495  	// ClientID - READ-ONLY; The client id of user assigned identity.
  1496  	ClientID *string `json:"clientId,omitempty"`
  1497  }
  1498  
  1499  // MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue.
  1500  func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) {
  1501  	objectMap := make(map[string]interface{})
  1502  	return json.Marshal(objectMap)
  1503  }
  1504  
  1505  // NonComplianceMessage a message that describes why a resource is non-compliant with the policy. This is
  1506  // shown in 'deny' error messages and on resource's non-compliant compliance results.
  1507  type NonComplianceMessage struct {
  1508  	// Message - A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results.
  1509  	Message *string `json:"message,omitempty"`
  1510  	// PolicyDefinitionReferenceID - The policy definition reference ID within a policy set definition the message is intended for. This is only applicable if the policy assignment assigns a policy set definition. If this is not provided the message applies to all policies assigned by this policy assignment.
  1511  	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
  1512  }
  1513  
  1514  // ParameterDefinitionsValue the definition of a parameter that can be provided to the policy.
  1515  type ParameterDefinitionsValue struct {
  1516  	// Type - The data type of the parameter. Possible values include: 'ParameterTypeString', 'ParameterTypeArray', 'ParameterTypeObject', 'ParameterTypeBoolean', 'ParameterTypeInteger', 'ParameterTypeFloat', 'ParameterTypeDateTime'
  1517  	Type ParameterType `json:"type,omitempty"`
  1518  	// AllowedValues - The allowed values for the parameter.
  1519  	AllowedValues *[]interface{} `json:"allowedValues,omitempty"`
  1520  	// DefaultValue - The default value for the parameter if no value is provided.
  1521  	DefaultValue interface{} `json:"defaultValue,omitempty"`
  1522  	// Metadata - General metadata for the parameter.
  1523  	Metadata *ParameterDefinitionsValueMetadata `json:"metadata,omitempty"`
  1524  }
  1525  
  1526  // ParameterDefinitionsValueMetadata general metadata for the parameter.
  1527  type ParameterDefinitionsValueMetadata struct {
  1528  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  1529  	AdditionalProperties map[string]interface{} `json:""`
  1530  	// DisplayName - The display name for the parameter.
  1531  	DisplayName *string `json:"displayName,omitempty"`
  1532  	// Description - The description of the parameter.
  1533  	Description *string `json:"description,omitempty"`
  1534  	// StrongType - Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from.
  1535  	StrongType *string `json:"strongType,omitempty"`
  1536  	// AssignPermissions - Set to true to have Azure portal create role assignments on the resource ID or resource scope value of this parameter during policy assignment. This property is useful in case you wish to assign permissions outside the assignment scope.
  1537  	AssignPermissions *bool `json:"assignPermissions,omitempty"`
  1538  }
  1539  
  1540  // MarshalJSON is the custom marshaler for ParameterDefinitionsValueMetadata.
  1541  func (pdv ParameterDefinitionsValueMetadata) MarshalJSON() ([]byte, error) {
  1542  	objectMap := make(map[string]interface{})
  1543  	if pdv.DisplayName != nil {
  1544  		objectMap["displayName"] = pdv.DisplayName
  1545  	}
  1546  	if pdv.Description != nil {
  1547  		objectMap["description"] = pdv.Description
  1548  	}
  1549  	if pdv.StrongType != nil {
  1550  		objectMap["strongType"] = pdv.StrongType
  1551  	}
  1552  	if pdv.AssignPermissions != nil {
  1553  		objectMap["assignPermissions"] = pdv.AssignPermissions
  1554  	}
  1555  	for k, v := range pdv.AdditionalProperties {
  1556  		objectMap[k] = v
  1557  	}
  1558  	return json.Marshal(objectMap)
  1559  }
  1560  
  1561  // UnmarshalJSON is the custom unmarshaler for ParameterDefinitionsValueMetadata struct.
  1562  func (pdv *ParameterDefinitionsValueMetadata) UnmarshalJSON(body []byte) error {
  1563  	var m map[string]*json.RawMessage
  1564  	err := json.Unmarshal(body, &m)
  1565  	if err != nil {
  1566  		return err
  1567  	}
  1568  	for k, v := range m {
  1569  		switch k {
  1570  		default:
  1571  			if v != nil {
  1572  				var additionalProperties interface{}
  1573  				err = json.Unmarshal(*v, &additionalProperties)
  1574  				if err != nil {
  1575  					return err
  1576  				}
  1577  				if pdv.AdditionalProperties == nil {
  1578  					pdv.AdditionalProperties = make(map[string]interface{})
  1579  				}
  1580  				pdv.AdditionalProperties[k] = additionalProperties
  1581  			}
  1582  		case "displayName":
  1583  			if v != nil {
  1584  				var displayName string
  1585  				err = json.Unmarshal(*v, &displayName)
  1586  				if err != nil {
  1587  					return err
  1588  				}
  1589  				pdv.DisplayName = &displayName
  1590  			}
  1591  		case "description":
  1592  			if v != nil {
  1593  				var description string
  1594  				err = json.Unmarshal(*v, &description)
  1595  				if err != nil {
  1596  					return err
  1597  				}
  1598  				pdv.Description = &description
  1599  			}
  1600  		case "strongType":
  1601  			if v != nil {
  1602  				var strongType string
  1603  				err = json.Unmarshal(*v, &strongType)
  1604  				if err != nil {
  1605  					return err
  1606  				}
  1607  				pdv.StrongType = &strongType
  1608  			}
  1609  		case "assignPermissions":
  1610  			if v != nil {
  1611  				var assignPermissions bool
  1612  				err = json.Unmarshal(*v, &assignPermissions)
  1613  				if err != nil {
  1614  					return err
  1615  				}
  1616  				pdv.AssignPermissions = &assignPermissions
  1617  			}
  1618  		}
  1619  	}
  1620  
  1621  	return nil
  1622  }
  1623  
  1624  // ParameterValuesValue the value of a parameter.
  1625  type ParameterValuesValue struct {
  1626  	// Value - The value of the parameter.
  1627  	Value interface{} `json:"value,omitempty"`
  1628  }
  1629  
  1630  // ResourceTypeAliases the resource type aliases definition.
  1631  type ResourceTypeAliases struct {
  1632  	// ResourceType - The resource type name.
  1633  	ResourceType *string `json:"resourceType,omitempty"`
  1634  	// Aliases - The aliases for property names.
  1635  	Aliases *[]Alias `json:"aliases,omitempty"`
  1636  }
  1637  
  1638  // SetDefinition the policy set definition.
  1639  type SetDefinition struct {
  1640  	autorest.Response `json:"-"`
  1641  	// SetDefinitionProperties - The policy definition properties.
  1642  	*SetDefinitionProperties `json:"properties,omitempty"`
  1643  	// ID - READ-ONLY; The ID of the policy set definition.
  1644  	ID *string `json:"id,omitempty"`
  1645  	// Name - READ-ONLY; The name of the policy set definition.
  1646  	Name *string `json:"name,omitempty"`
  1647  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/policySetDefinitions).
  1648  	Type *string `json:"type,omitempty"`
  1649  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1650  	SystemData *SystemData `json:"systemData,omitempty"`
  1651  }
  1652  
  1653  // MarshalJSON is the custom marshaler for SetDefinition.
  1654  func (sd SetDefinition) MarshalJSON() ([]byte, error) {
  1655  	objectMap := make(map[string]interface{})
  1656  	if sd.SetDefinitionProperties != nil {
  1657  		objectMap["properties"] = sd.SetDefinitionProperties
  1658  	}
  1659  	return json.Marshal(objectMap)
  1660  }
  1661  
  1662  // UnmarshalJSON is the custom unmarshaler for SetDefinition struct.
  1663  func (sd *SetDefinition) UnmarshalJSON(body []byte) error {
  1664  	var m map[string]*json.RawMessage
  1665  	err := json.Unmarshal(body, &m)
  1666  	if err != nil {
  1667  		return err
  1668  	}
  1669  	for k, v := range m {
  1670  		switch k {
  1671  		case "properties":
  1672  			if v != nil {
  1673  				var setDefinitionProperties SetDefinitionProperties
  1674  				err = json.Unmarshal(*v, &setDefinitionProperties)
  1675  				if err != nil {
  1676  					return err
  1677  				}
  1678  				sd.SetDefinitionProperties = &setDefinitionProperties
  1679  			}
  1680  		case "id":
  1681  			if v != nil {
  1682  				var ID string
  1683  				err = json.Unmarshal(*v, &ID)
  1684  				if err != nil {
  1685  					return err
  1686  				}
  1687  				sd.ID = &ID
  1688  			}
  1689  		case "name":
  1690  			if v != nil {
  1691  				var name string
  1692  				err = json.Unmarshal(*v, &name)
  1693  				if err != nil {
  1694  					return err
  1695  				}
  1696  				sd.Name = &name
  1697  			}
  1698  		case "type":
  1699  			if v != nil {
  1700  				var typeVar string
  1701  				err = json.Unmarshal(*v, &typeVar)
  1702  				if err != nil {
  1703  					return err
  1704  				}
  1705  				sd.Type = &typeVar
  1706  			}
  1707  		case "systemData":
  1708  			if v != nil {
  1709  				var systemData SystemData
  1710  				err = json.Unmarshal(*v, &systemData)
  1711  				if err != nil {
  1712  					return err
  1713  				}
  1714  				sd.SystemData = &systemData
  1715  			}
  1716  		}
  1717  	}
  1718  
  1719  	return nil
  1720  }
  1721  
  1722  // SetDefinitionListResult list of policy set definitions.
  1723  type SetDefinitionListResult struct {
  1724  	autorest.Response `json:"-"`
  1725  	// Value - An array of policy set definitions.
  1726  	Value *[]SetDefinition `json:"value,omitempty"`
  1727  	// NextLink - The URL to use for getting the next set of results.
  1728  	NextLink *string `json:"nextLink,omitempty"`
  1729  }
  1730  
  1731  // SetDefinitionListResultIterator provides access to a complete listing of SetDefinition values.
  1732  type SetDefinitionListResultIterator struct {
  1733  	i    int
  1734  	page SetDefinitionListResultPage
  1735  }
  1736  
  1737  // NextWithContext advances to the next value.  If there was an error making
  1738  // the request the iterator does not advance and the error is returned.
  1739  func (iter *SetDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1740  	if tracing.IsEnabled() {
  1741  		ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionListResultIterator.NextWithContext")
  1742  		defer func() {
  1743  			sc := -1
  1744  			if iter.Response().Response.Response != nil {
  1745  				sc = iter.Response().Response.Response.StatusCode
  1746  			}
  1747  			tracing.EndSpan(ctx, sc, err)
  1748  		}()
  1749  	}
  1750  	iter.i++
  1751  	if iter.i < len(iter.page.Values()) {
  1752  		return nil
  1753  	}
  1754  	err = iter.page.NextWithContext(ctx)
  1755  	if err != nil {
  1756  		iter.i--
  1757  		return err
  1758  	}
  1759  	iter.i = 0
  1760  	return nil
  1761  }
  1762  
  1763  // Next advances to the next value.  If there was an error making
  1764  // the request the iterator does not advance and the error is returned.
  1765  // Deprecated: Use NextWithContext() instead.
  1766  func (iter *SetDefinitionListResultIterator) Next() error {
  1767  	return iter.NextWithContext(context.Background())
  1768  }
  1769  
  1770  // NotDone returns true if the enumeration should be started or is not yet complete.
  1771  func (iter SetDefinitionListResultIterator) NotDone() bool {
  1772  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1773  }
  1774  
  1775  // Response returns the raw server response from the last page request.
  1776  func (iter SetDefinitionListResultIterator) Response() SetDefinitionListResult {
  1777  	return iter.page.Response()
  1778  }
  1779  
  1780  // Value returns the current value or a zero-initialized value if the
  1781  // iterator has advanced beyond the end of the collection.
  1782  func (iter SetDefinitionListResultIterator) Value() SetDefinition {
  1783  	if !iter.page.NotDone() {
  1784  		return SetDefinition{}
  1785  	}
  1786  	return iter.page.Values()[iter.i]
  1787  }
  1788  
  1789  // Creates a new instance of the SetDefinitionListResultIterator type.
  1790  func NewSetDefinitionListResultIterator(page SetDefinitionListResultPage) SetDefinitionListResultIterator {
  1791  	return SetDefinitionListResultIterator{page: page}
  1792  }
  1793  
  1794  // IsEmpty returns true if the ListResult contains no values.
  1795  func (sdlr SetDefinitionListResult) IsEmpty() bool {
  1796  	return sdlr.Value == nil || len(*sdlr.Value) == 0
  1797  }
  1798  
  1799  // hasNextLink returns true if the NextLink is not empty.
  1800  func (sdlr SetDefinitionListResult) hasNextLink() bool {
  1801  	return sdlr.NextLink != nil && len(*sdlr.NextLink) != 0
  1802  }
  1803  
  1804  // setDefinitionListResultPreparer prepares a request to retrieve the next set of results.
  1805  // It returns nil if no more results exist.
  1806  func (sdlr SetDefinitionListResult) setDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1807  	if !sdlr.hasNextLink() {
  1808  		return nil, nil
  1809  	}
  1810  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1811  		autorest.AsJSON(),
  1812  		autorest.AsGet(),
  1813  		autorest.WithBaseURL(to.String(sdlr.NextLink)))
  1814  }
  1815  
  1816  // SetDefinitionListResultPage contains a page of SetDefinition values.
  1817  type SetDefinitionListResultPage struct {
  1818  	fn   func(context.Context, SetDefinitionListResult) (SetDefinitionListResult, error)
  1819  	sdlr SetDefinitionListResult
  1820  }
  1821  
  1822  // NextWithContext advances to the next page of values.  If there was an error making
  1823  // the request the page does not advance and the error is returned.
  1824  func (page *SetDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1825  	if tracing.IsEnabled() {
  1826  		ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionListResultPage.NextWithContext")
  1827  		defer func() {
  1828  			sc := -1
  1829  			if page.Response().Response.Response != nil {
  1830  				sc = page.Response().Response.Response.StatusCode
  1831  			}
  1832  			tracing.EndSpan(ctx, sc, err)
  1833  		}()
  1834  	}
  1835  	for {
  1836  		next, err := page.fn(ctx, page.sdlr)
  1837  		if err != nil {
  1838  			return err
  1839  		}
  1840  		page.sdlr = next
  1841  		if !next.hasNextLink() || !next.IsEmpty() {
  1842  			break
  1843  		}
  1844  	}
  1845  	return nil
  1846  }
  1847  
  1848  // Next advances to the next page of values.  If there was an error making
  1849  // the request the page does not advance and the error is returned.
  1850  // Deprecated: Use NextWithContext() instead.
  1851  func (page *SetDefinitionListResultPage) Next() error {
  1852  	return page.NextWithContext(context.Background())
  1853  }
  1854  
  1855  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1856  func (page SetDefinitionListResultPage) NotDone() bool {
  1857  	return !page.sdlr.IsEmpty()
  1858  }
  1859  
  1860  // Response returns the raw server response from the last page request.
  1861  func (page SetDefinitionListResultPage) Response() SetDefinitionListResult {
  1862  	return page.sdlr
  1863  }
  1864  
  1865  // Values returns the slice of values for the current page or nil if there are no values.
  1866  func (page SetDefinitionListResultPage) Values() []SetDefinition {
  1867  	if page.sdlr.IsEmpty() {
  1868  		return nil
  1869  	}
  1870  	return *page.sdlr.Value
  1871  }
  1872  
  1873  // Creates a new instance of the SetDefinitionListResultPage type.
  1874  func NewSetDefinitionListResultPage(cur SetDefinitionListResult, getNextPage func(context.Context, SetDefinitionListResult) (SetDefinitionListResult, error)) SetDefinitionListResultPage {
  1875  	return SetDefinitionListResultPage{
  1876  		fn:   getNextPage,
  1877  		sdlr: cur,
  1878  	}
  1879  }
  1880  
  1881  // SetDefinitionProperties the policy set definition properties.
  1882  type SetDefinitionProperties struct {
  1883  	// PolicyType - The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'TypeNotSpecified', 'TypeBuiltIn', 'TypeCustom', 'TypeStatic'
  1884  	PolicyType Type `json:"policyType,omitempty"`
  1885  	// DisplayName - The display name of the policy set definition.
  1886  	DisplayName *string `json:"displayName,omitempty"`
  1887  	// Description - The policy set definition description.
  1888  	Description *string `json:"description,omitempty"`
  1889  	// Metadata - The policy set definition metadata.  Metadata is an open ended object and is typically a collection of key value pairs.
  1890  	Metadata interface{} `json:"metadata,omitempty"`
  1891  	// Parameters - The policy set definition parameters that can be used in policy definition references.
  1892  	Parameters map[string]*ParameterDefinitionsValue `json:"parameters"`
  1893  	// PolicyDefinitions - An array of policy definition references.
  1894  	PolicyDefinitions *[]DefinitionReference `json:"policyDefinitions,omitempty"`
  1895  	// PolicyDefinitionGroups - The metadata describing groups of policy definition references within the policy set definition.
  1896  	PolicyDefinitionGroups *[]DefinitionGroup `json:"policyDefinitionGroups,omitempty"`
  1897  }
  1898  
  1899  // MarshalJSON is the custom marshaler for SetDefinitionProperties.
  1900  func (sdp SetDefinitionProperties) MarshalJSON() ([]byte, error) {
  1901  	objectMap := make(map[string]interface{})
  1902  	if sdp.PolicyType != "" {
  1903  		objectMap["policyType"] = sdp.PolicyType
  1904  	}
  1905  	if sdp.DisplayName != nil {
  1906  		objectMap["displayName"] = sdp.DisplayName
  1907  	}
  1908  	if sdp.Description != nil {
  1909  		objectMap["description"] = sdp.Description
  1910  	}
  1911  	if sdp.Metadata != nil {
  1912  		objectMap["metadata"] = sdp.Metadata
  1913  	}
  1914  	if sdp.Parameters != nil {
  1915  		objectMap["parameters"] = sdp.Parameters
  1916  	}
  1917  	if sdp.PolicyDefinitions != nil {
  1918  		objectMap["policyDefinitions"] = sdp.PolicyDefinitions
  1919  	}
  1920  	if sdp.PolicyDefinitionGroups != nil {
  1921  		objectMap["policyDefinitionGroups"] = sdp.PolicyDefinitionGroups
  1922  	}
  1923  	return json.Marshal(objectMap)
  1924  }
  1925  
  1926  // SystemData metadata pertaining to creation and last modification of the resource.
  1927  type SystemData struct {
  1928  	// CreatedBy - The identity that created the resource.
  1929  	CreatedBy *string `json:"createdBy,omitempty"`
  1930  	// CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  1931  	CreatedByType CreatedByType `json:"createdByType,omitempty"`
  1932  	// CreatedAt - The timestamp of resource creation (UTC).
  1933  	CreatedAt *date.Time `json:"createdAt,omitempty"`
  1934  	// LastModifiedBy - The identity that last modified the resource.
  1935  	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
  1936  	// LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  1937  	LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
  1938  	// LastModifiedAt - The timestamp of resource last modification (UTC)
  1939  	LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
  1940  }
  1941  
  1942  // Variable the variable.
  1943  type Variable struct {
  1944  	autorest.Response `json:"-"`
  1945  	// VariableProperties - Properties for the variable.
  1946  	*VariableProperties `json:"properties,omitempty"`
  1947  	// SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
  1948  	SystemData *SystemData `json:"systemData,omitempty"`
  1949  	// ID - READ-ONLY; The ID of the variable.
  1950  	ID *string `json:"id,omitempty"`
  1951  	// Name - READ-ONLY; The name of the variable.
  1952  	Name *string `json:"name,omitempty"`
  1953  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/variables).
  1954  	Type *string `json:"type,omitempty"`
  1955  }
  1956  
  1957  // MarshalJSON is the custom marshaler for Variable.
  1958  func (vVar Variable) MarshalJSON() ([]byte, error) {
  1959  	objectMap := make(map[string]interface{})
  1960  	if vVar.VariableProperties != nil {
  1961  		objectMap["properties"] = vVar.VariableProperties
  1962  	}
  1963  	return json.Marshal(objectMap)
  1964  }
  1965  
  1966  // UnmarshalJSON is the custom unmarshaler for Variable struct.
  1967  func (vVar *Variable) UnmarshalJSON(body []byte) error {
  1968  	var m map[string]*json.RawMessage
  1969  	err := json.Unmarshal(body, &m)
  1970  	if err != nil {
  1971  		return err
  1972  	}
  1973  	for k, v := range m {
  1974  		switch k {
  1975  		case "properties":
  1976  			if v != nil {
  1977  				var variableProperties VariableProperties
  1978  				err = json.Unmarshal(*v, &variableProperties)
  1979  				if err != nil {
  1980  					return err
  1981  				}
  1982  				vVar.VariableProperties = &variableProperties
  1983  			}
  1984  		case "systemData":
  1985  			if v != nil {
  1986  				var systemData SystemData
  1987  				err = json.Unmarshal(*v, &systemData)
  1988  				if err != nil {
  1989  					return err
  1990  				}
  1991  				vVar.SystemData = &systemData
  1992  			}
  1993  		case "id":
  1994  			if v != nil {
  1995  				var ID string
  1996  				err = json.Unmarshal(*v, &ID)
  1997  				if err != nil {
  1998  					return err
  1999  				}
  2000  				vVar.ID = &ID
  2001  			}
  2002  		case "name":
  2003  			if v != nil {
  2004  				var name string
  2005  				err = json.Unmarshal(*v, &name)
  2006  				if err != nil {
  2007  					return err
  2008  				}
  2009  				vVar.Name = &name
  2010  			}
  2011  		case "type":
  2012  			if v != nil {
  2013  				var typeVar string
  2014  				err = json.Unmarshal(*v, &typeVar)
  2015  				if err != nil {
  2016  					return err
  2017  				}
  2018  				vVar.Type = &typeVar
  2019  			}
  2020  		}
  2021  	}
  2022  
  2023  	return nil
  2024  }
  2025  
  2026  // VariableColumn the variable column.
  2027  type VariableColumn struct {
  2028  	// ColumnName - The name of this policy variable column.
  2029  	ColumnName *string `json:"columnName,omitempty"`
  2030  }
  2031  
  2032  // VariableListResult list of variables.
  2033  type VariableListResult struct {
  2034  	autorest.Response `json:"-"`
  2035  	// Value - An array of variables.
  2036  	Value *[]Variable `json:"value,omitempty"`
  2037  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
  2038  	NextLink *string `json:"nextLink,omitempty"`
  2039  }
  2040  
  2041  // MarshalJSON is the custom marshaler for VariableListResult.
  2042  func (vlr VariableListResult) MarshalJSON() ([]byte, error) {
  2043  	objectMap := make(map[string]interface{})
  2044  	if vlr.Value != nil {
  2045  		objectMap["value"] = vlr.Value
  2046  	}
  2047  	return json.Marshal(objectMap)
  2048  }
  2049  
  2050  // VariableListResultIterator provides access to a complete listing of Variable values.
  2051  type VariableListResultIterator struct {
  2052  	i    int
  2053  	page VariableListResultPage
  2054  }
  2055  
  2056  // NextWithContext advances to the next value.  If there was an error making
  2057  // the request the iterator does not advance and the error is returned.
  2058  func (iter *VariableListResultIterator) NextWithContext(ctx context.Context) (err error) {
  2059  	if tracing.IsEnabled() {
  2060  		ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultIterator.NextWithContext")
  2061  		defer func() {
  2062  			sc := -1
  2063  			if iter.Response().Response.Response != nil {
  2064  				sc = iter.Response().Response.Response.StatusCode
  2065  			}
  2066  			tracing.EndSpan(ctx, sc, err)
  2067  		}()
  2068  	}
  2069  	iter.i++
  2070  	if iter.i < len(iter.page.Values()) {
  2071  		return nil
  2072  	}
  2073  	err = iter.page.NextWithContext(ctx)
  2074  	if err != nil {
  2075  		iter.i--
  2076  		return err
  2077  	}
  2078  	iter.i = 0
  2079  	return nil
  2080  }
  2081  
  2082  // Next advances to the next value.  If there was an error making
  2083  // the request the iterator does not advance and the error is returned.
  2084  // Deprecated: Use NextWithContext() instead.
  2085  func (iter *VariableListResultIterator) Next() error {
  2086  	return iter.NextWithContext(context.Background())
  2087  }
  2088  
  2089  // NotDone returns true if the enumeration should be started or is not yet complete.
  2090  func (iter VariableListResultIterator) NotDone() bool {
  2091  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  2092  }
  2093  
  2094  // Response returns the raw server response from the last page request.
  2095  func (iter VariableListResultIterator) Response() VariableListResult {
  2096  	return iter.page.Response()
  2097  }
  2098  
  2099  // Value returns the current value or a zero-initialized value if the
  2100  // iterator has advanced beyond the end of the collection.
  2101  func (iter VariableListResultIterator) Value() Variable {
  2102  	if !iter.page.NotDone() {
  2103  		return Variable{}
  2104  	}
  2105  	return iter.page.Values()[iter.i]
  2106  }
  2107  
  2108  // Creates a new instance of the VariableListResultIterator type.
  2109  func NewVariableListResultIterator(page VariableListResultPage) VariableListResultIterator {
  2110  	return VariableListResultIterator{page: page}
  2111  }
  2112  
  2113  // IsEmpty returns true if the ListResult contains no values.
  2114  func (vlr VariableListResult) IsEmpty() bool {
  2115  	return vlr.Value == nil || len(*vlr.Value) == 0
  2116  }
  2117  
  2118  // hasNextLink returns true if the NextLink is not empty.
  2119  func (vlr VariableListResult) hasNextLink() bool {
  2120  	return vlr.NextLink != nil && len(*vlr.NextLink) != 0
  2121  }
  2122  
  2123  // variableListResultPreparer prepares a request to retrieve the next set of results.
  2124  // It returns nil if no more results exist.
  2125  func (vlr VariableListResult) variableListResultPreparer(ctx context.Context) (*http.Request, error) {
  2126  	if !vlr.hasNextLink() {
  2127  		return nil, nil
  2128  	}
  2129  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  2130  		autorest.AsJSON(),
  2131  		autorest.AsGet(),
  2132  		autorest.WithBaseURL(to.String(vlr.NextLink)))
  2133  }
  2134  
  2135  // VariableListResultPage contains a page of Variable values.
  2136  type VariableListResultPage struct {
  2137  	fn  func(context.Context, VariableListResult) (VariableListResult, error)
  2138  	vlr VariableListResult
  2139  }
  2140  
  2141  // NextWithContext advances to the next page of values.  If there was an error making
  2142  // the request the page does not advance and the error is returned.
  2143  func (page *VariableListResultPage) NextWithContext(ctx context.Context) (err error) {
  2144  	if tracing.IsEnabled() {
  2145  		ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultPage.NextWithContext")
  2146  		defer func() {
  2147  			sc := -1
  2148  			if page.Response().Response.Response != nil {
  2149  				sc = page.Response().Response.Response.StatusCode
  2150  			}
  2151  			tracing.EndSpan(ctx, sc, err)
  2152  		}()
  2153  	}
  2154  	for {
  2155  		next, err := page.fn(ctx, page.vlr)
  2156  		if err != nil {
  2157  			return err
  2158  		}
  2159  		page.vlr = next
  2160  		if !next.hasNextLink() || !next.IsEmpty() {
  2161  			break
  2162  		}
  2163  	}
  2164  	return nil
  2165  }
  2166  
  2167  // Next advances to the next page of values.  If there was an error making
  2168  // the request the page does not advance and the error is returned.
  2169  // Deprecated: Use NextWithContext() instead.
  2170  func (page *VariableListResultPage) Next() error {
  2171  	return page.NextWithContext(context.Background())
  2172  }
  2173  
  2174  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2175  func (page VariableListResultPage) NotDone() bool {
  2176  	return !page.vlr.IsEmpty()
  2177  }
  2178  
  2179  // Response returns the raw server response from the last page request.
  2180  func (page VariableListResultPage) Response() VariableListResult {
  2181  	return page.vlr
  2182  }
  2183  
  2184  // Values returns the slice of values for the current page or nil if there are no values.
  2185  func (page VariableListResultPage) Values() []Variable {
  2186  	if page.vlr.IsEmpty() {
  2187  		return nil
  2188  	}
  2189  	return *page.vlr.Value
  2190  }
  2191  
  2192  // Creates a new instance of the VariableListResultPage type.
  2193  func NewVariableListResultPage(cur VariableListResult, getNextPage func(context.Context, VariableListResult) (VariableListResult, error)) VariableListResultPage {
  2194  	return VariableListResultPage{
  2195  		fn:  getNextPage,
  2196  		vlr: cur,
  2197  	}
  2198  }
  2199  
  2200  // VariableProperties the variable properties.
  2201  type VariableProperties struct {
  2202  	// Columns - Variable column definitions.
  2203  	Columns *[]VariableColumn `json:"columns,omitempty"`
  2204  }
  2205  
  2206  // VariableValue the variable value.
  2207  type VariableValue struct {
  2208  	autorest.Response `json:"-"`
  2209  	// VariableValueProperties - Properties for the variable value.
  2210  	*VariableValueProperties `json:"properties,omitempty"`
  2211  	// SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
  2212  	SystemData *SystemData `json:"systemData,omitempty"`
  2213  	// ID - READ-ONLY; The ID of the variable.
  2214  	ID *string `json:"id,omitempty"`
  2215  	// Name - READ-ONLY; The name of the variable.
  2216  	Name *string `json:"name,omitempty"`
  2217  	// Type - READ-ONLY; The type of the resource (Microsoft.Authorization/variables/values).
  2218  	Type *string `json:"type,omitempty"`
  2219  }
  2220  
  2221  // MarshalJSON is the custom marshaler for VariableValue.
  2222  func (vv VariableValue) MarshalJSON() ([]byte, error) {
  2223  	objectMap := make(map[string]interface{})
  2224  	if vv.VariableValueProperties != nil {
  2225  		objectMap["properties"] = vv.VariableValueProperties
  2226  	}
  2227  	return json.Marshal(objectMap)
  2228  }
  2229  
  2230  // UnmarshalJSON is the custom unmarshaler for VariableValue struct.
  2231  func (vv *VariableValue) UnmarshalJSON(body []byte) error {
  2232  	var m map[string]*json.RawMessage
  2233  	err := json.Unmarshal(body, &m)
  2234  	if err != nil {
  2235  		return err
  2236  	}
  2237  	for k, v := range m {
  2238  		switch k {
  2239  		case "properties":
  2240  			if v != nil {
  2241  				var variableValueProperties VariableValueProperties
  2242  				err = json.Unmarshal(*v, &variableValueProperties)
  2243  				if err != nil {
  2244  					return err
  2245  				}
  2246  				vv.VariableValueProperties = &variableValueProperties
  2247  			}
  2248  		case "systemData":
  2249  			if v != nil {
  2250  				var systemData SystemData
  2251  				err = json.Unmarshal(*v, &systemData)
  2252  				if err != nil {
  2253  					return err
  2254  				}
  2255  				vv.SystemData = &systemData
  2256  			}
  2257  		case "id":
  2258  			if v != nil {
  2259  				var ID string
  2260  				err = json.Unmarshal(*v, &ID)
  2261  				if err != nil {
  2262  					return err
  2263  				}
  2264  				vv.ID = &ID
  2265  			}
  2266  		case "name":
  2267  			if v != nil {
  2268  				var name string
  2269  				err = json.Unmarshal(*v, &name)
  2270  				if err != nil {
  2271  					return err
  2272  				}
  2273  				vv.Name = &name
  2274  			}
  2275  		case "type":
  2276  			if v != nil {
  2277  				var typeVar string
  2278  				err = json.Unmarshal(*v, &typeVar)
  2279  				if err != nil {
  2280  					return err
  2281  				}
  2282  				vv.Type = &typeVar
  2283  			}
  2284  		}
  2285  	}
  2286  
  2287  	return nil
  2288  }
  2289  
  2290  // VariableValueColumnValue the name value tuple for this variable value column.
  2291  type VariableValueColumnValue struct {
  2292  	// ColumnName - Column name for the variable value
  2293  	ColumnName *string `json:"columnName,omitempty"`
  2294  	// ColumnValue - Column value for the variable value; this can be an integer, double, boolean, null or a string.
  2295  	ColumnValue interface{} `json:"columnValue,omitempty"`
  2296  }
  2297  
  2298  // VariableValueListResult list of variable values.
  2299  type VariableValueListResult struct {
  2300  	autorest.Response `json:"-"`
  2301  	// Value - An array of variable values.
  2302  	Value *[]VariableValue `json:"value,omitempty"`
  2303  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
  2304  	NextLink *string `json:"nextLink,omitempty"`
  2305  }
  2306  
  2307  // MarshalJSON is the custom marshaler for VariableValueListResult.
  2308  func (vvlr VariableValueListResult) MarshalJSON() ([]byte, error) {
  2309  	objectMap := make(map[string]interface{})
  2310  	if vvlr.Value != nil {
  2311  		objectMap["value"] = vvlr.Value
  2312  	}
  2313  	return json.Marshal(objectMap)
  2314  }
  2315  
  2316  // VariableValueListResultIterator provides access to a complete listing of VariableValue values.
  2317  type VariableValueListResultIterator struct {
  2318  	i    int
  2319  	page VariableValueListResultPage
  2320  }
  2321  
  2322  // NextWithContext advances to the next value.  If there was an error making
  2323  // the request the iterator does not advance and the error is returned.
  2324  func (iter *VariableValueListResultIterator) NextWithContext(ctx context.Context) (err error) {
  2325  	if tracing.IsEnabled() {
  2326  		ctx = tracing.StartSpan(ctx, fqdn+"/VariableValueListResultIterator.NextWithContext")
  2327  		defer func() {
  2328  			sc := -1
  2329  			if iter.Response().Response.Response != nil {
  2330  				sc = iter.Response().Response.Response.StatusCode
  2331  			}
  2332  			tracing.EndSpan(ctx, sc, err)
  2333  		}()
  2334  	}
  2335  	iter.i++
  2336  	if iter.i < len(iter.page.Values()) {
  2337  		return nil
  2338  	}
  2339  	err = iter.page.NextWithContext(ctx)
  2340  	if err != nil {
  2341  		iter.i--
  2342  		return err
  2343  	}
  2344  	iter.i = 0
  2345  	return nil
  2346  }
  2347  
  2348  // Next advances to the next value.  If there was an error making
  2349  // the request the iterator does not advance and the error is returned.
  2350  // Deprecated: Use NextWithContext() instead.
  2351  func (iter *VariableValueListResultIterator) Next() error {
  2352  	return iter.NextWithContext(context.Background())
  2353  }
  2354  
  2355  // NotDone returns true if the enumeration should be started or is not yet complete.
  2356  func (iter VariableValueListResultIterator) NotDone() bool {
  2357  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  2358  }
  2359  
  2360  // Response returns the raw server response from the last page request.
  2361  func (iter VariableValueListResultIterator) Response() VariableValueListResult {
  2362  	return iter.page.Response()
  2363  }
  2364  
  2365  // Value returns the current value or a zero-initialized value if the
  2366  // iterator has advanced beyond the end of the collection.
  2367  func (iter VariableValueListResultIterator) Value() VariableValue {
  2368  	if !iter.page.NotDone() {
  2369  		return VariableValue{}
  2370  	}
  2371  	return iter.page.Values()[iter.i]
  2372  }
  2373  
  2374  // Creates a new instance of the VariableValueListResultIterator type.
  2375  func NewVariableValueListResultIterator(page VariableValueListResultPage) VariableValueListResultIterator {
  2376  	return VariableValueListResultIterator{page: page}
  2377  }
  2378  
  2379  // IsEmpty returns true if the ListResult contains no values.
  2380  func (vvlr VariableValueListResult) IsEmpty() bool {
  2381  	return vvlr.Value == nil || len(*vvlr.Value) == 0
  2382  }
  2383  
  2384  // hasNextLink returns true if the NextLink is not empty.
  2385  func (vvlr VariableValueListResult) hasNextLink() bool {
  2386  	return vvlr.NextLink != nil && len(*vvlr.NextLink) != 0
  2387  }
  2388  
  2389  // variableValueListResultPreparer prepares a request to retrieve the next set of results.
  2390  // It returns nil if no more results exist.
  2391  func (vvlr VariableValueListResult) variableValueListResultPreparer(ctx context.Context) (*http.Request, error) {
  2392  	if !vvlr.hasNextLink() {
  2393  		return nil, nil
  2394  	}
  2395  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  2396  		autorest.AsJSON(),
  2397  		autorest.AsGet(),
  2398  		autorest.WithBaseURL(to.String(vvlr.NextLink)))
  2399  }
  2400  
  2401  // VariableValueListResultPage contains a page of VariableValue values.
  2402  type VariableValueListResultPage struct {
  2403  	fn   func(context.Context, VariableValueListResult) (VariableValueListResult, error)
  2404  	vvlr VariableValueListResult
  2405  }
  2406  
  2407  // NextWithContext advances to the next page of values.  If there was an error making
  2408  // the request the page does not advance and the error is returned.
  2409  func (page *VariableValueListResultPage) NextWithContext(ctx context.Context) (err error) {
  2410  	if tracing.IsEnabled() {
  2411  		ctx = tracing.StartSpan(ctx, fqdn+"/VariableValueListResultPage.NextWithContext")
  2412  		defer func() {
  2413  			sc := -1
  2414  			if page.Response().Response.Response != nil {
  2415  				sc = page.Response().Response.Response.StatusCode
  2416  			}
  2417  			tracing.EndSpan(ctx, sc, err)
  2418  		}()
  2419  	}
  2420  	for {
  2421  		next, err := page.fn(ctx, page.vvlr)
  2422  		if err != nil {
  2423  			return err
  2424  		}
  2425  		page.vvlr = next
  2426  		if !next.hasNextLink() || !next.IsEmpty() {
  2427  			break
  2428  		}
  2429  	}
  2430  	return nil
  2431  }
  2432  
  2433  // Next advances to the next page of values.  If there was an error making
  2434  // the request the page does not advance and the error is returned.
  2435  // Deprecated: Use NextWithContext() instead.
  2436  func (page *VariableValueListResultPage) Next() error {
  2437  	return page.NextWithContext(context.Background())
  2438  }
  2439  
  2440  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2441  func (page VariableValueListResultPage) NotDone() bool {
  2442  	return !page.vvlr.IsEmpty()
  2443  }
  2444  
  2445  // Response returns the raw server response from the last page request.
  2446  func (page VariableValueListResultPage) Response() VariableValueListResult {
  2447  	return page.vvlr
  2448  }
  2449  
  2450  // Values returns the slice of values for the current page or nil if there are no values.
  2451  func (page VariableValueListResultPage) Values() []VariableValue {
  2452  	if page.vvlr.IsEmpty() {
  2453  		return nil
  2454  	}
  2455  	return *page.vvlr.Value
  2456  }
  2457  
  2458  // Creates a new instance of the VariableValueListResultPage type.
  2459  func NewVariableValueListResultPage(cur VariableValueListResult, getNextPage func(context.Context, VariableValueListResult) (VariableValueListResult, error)) VariableValueListResultPage {
  2460  	return VariableValueListResultPage{
  2461  		fn:   getNextPage,
  2462  		vvlr: cur,
  2463  	}
  2464  }
  2465  
  2466  // VariableValueProperties the variable value properties.
  2467  type VariableValueProperties struct {
  2468  	// Values - Variable value column value array.
  2469  	Values *[]VariableValueColumnValue `json:"values,omitempty"`
  2470  }
  2471  

View as plain text