...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-02-01/managementgroups/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-02-01/managementgroups

     1  package managementgroups
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/azure"
    14  	"github.com/Azure/go-autorest/autorest/date"
    15  	"github.com/Azure/go-autorest/autorest/to"
    16  	"github.com/Azure/go-autorest/tracing"
    17  	"net/http"
    18  )
    19  
    20  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-02-01/managementgroups"
    22  
    23  // AzureAsyncOperationResults the results of Azure-AsyncOperation.
    24  type AzureAsyncOperationResults struct {
    25  	autorest.Response `json:"-"`
    26  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
    27  	ID *string `json:"id,omitempty"`
    28  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups
    29  	Type *string `json:"type,omitempty"`
    30  	// Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000
    31  	Name *string `json:"name,omitempty"`
    32  	// Status - READ-ONLY; The current status of the asynchronous operation performed . For example, Running, Succeeded, Failed
    33  	Status          *string `json:"status,omitempty"`
    34  	*InfoProperties `json:"properties,omitempty"`
    35  }
    36  
    37  // MarshalJSON is the custom marshaler for AzureAsyncOperationResults.
    38  func (aaor AzureAsyncOperationResults) MarshalJSON() ([]byte, error) {
    39  	objectMap := make(map[string]interface{})
    40  	if aaor.InfoProperties != nil {
    41  		objectMap["properties"] = aaor.InfoProperties
    42  	}
    43  	return json.Marshal(objectMap)
    44  }
    45  
    46  // UnmarshalJSON is the custom unmarshaler for AzureAsyncOperationResults struct.
    47  func (aaor *AzureAsyncOperationResults) UnmarshalJSON(body []byte) error {
    48  	var m map[string]*json.RawMessage
    49  	err := json.Unmarshal(body, &m)
    50  	if err != nil {
    51  		return err
    52  	}
    53  	for k, v := range m {
    54  		switch k {
    55  		case "id":
    56  			if v != nil {
    57  				var ID string
    58  				err = json.Unmarshal(*v, &ID)
    59  				if err != nil {
    60  					return err
    61  				}
    62  				aaor.ID = &ID
    63  			}
    64  		case "type":
    65  			if v != nil {
    66  				var typeVar string
    67  				err = json.Unmarshal(*v, &typeVar)
    68  				if err != nil {
    69  					return err
    70  				}
    71  				aaor.Type = &typeVar
    72  			}
    73  		case "name":
    74  			if v != nil {
    75  				var name string
    76  				err = json.Unmarshal(*v, &name)
    77  				if err != nil {
    78  					return err
    79  				}
    80  				aaor.Name = &name
    81  			}
    82  		case "status":
    83  			if v != nil {
    84  				var status string
    85  				err = json.Unmarshal(*v, &status)
    86  				if err != nil {
    87  					return err
    88  				}
    89  				aaor.Status = &status
    90  			}
    91  		case "properties":
    92  			if v != nil {
    93  				var infoProperties InfoProperties
    94  				err = json.Unmarshal(*v, &infoProperties)
    95  				if err != nil {
    96  					return err
    97  				}
    98  				aaor.InfoProperties = &infoProperties
    99  			}
   100  		}
   101  	}
   102  
   103  	return nil
   104  }
   105  
   106  // CheckNameAvailabilityRequest management group name availability check parameters.
   107  type CheckNameAvailabilityRequest struct {
   108  	// Name - the name to check for availability
   109  	Name *string `json:"name,omitempty"`
   110  	// Type - fully qualified resource type which includes provider namespace. Possible values include: 'MicrosoftManagementmanagementGroups'
   111  	Type Type `json:"type,omitempty"`
   112  }
   113  
   114  // CheckNameAvailabilityResult describes the result of the request to check management group name
   115  // availability.
   116  type CheckNameAvailabilityResult struct {
   117  	autorest.Response `json:"-"`
   118  	// NameAvailable - READ-ONLY; Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both.
   119  	NameAvailable *bool `json:"nameAvailable,omitempty"`
   120  	// Reason - READ-ONLY; Required if nameAvailable == false. Invalid indicates the name provided does not match the resource provider's naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Invalid', 'AlreadyExists'
   121  	Reason Reason `json:"reason,omitempty"`
   122  	// Message - READ-ONLY; Required if nameAvailable == false. Localized. If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name.
   123  	Message *string `json:"message,omitempty"`
   124  }
   125  
   126  // MarshalJSON is the custom marshaler for CheckNameAvailabilityResult.
   127  func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) {
   128  	objectMap := make(map[string]interface{})
   129  	return json.Marshal(objectMap)
   130  }
   131  
   132  // ChildInfo the child information of a management group.
   133  type ChildInfo struct {
   134  	// Type - The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups). Possible values include: 'Type1MicrosoftManagementmanagementGroups', 'Type1Subscriptions'
   135  	Type Type1 `json:"type,omitempty"`
   136  	// ID - The fully qualified ID for the child resource (management group or subscription).  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   137  	ID *string `json:"id,omitempty"`
   138  	// Name - The name of the child entity.
   139  	Name *string `json:"name,omitempty"`
   140  	// DisplayName - The friendly name of the child resource.
   141  	DisplayName *string `json:"displayName,omitempty"`
   142  	// Roles - The roles definitions associated with the management group.
   143  	Roles *[]string `json:"roles,omitempty"`
   144  	// Children - The list of children.
   145  	Children *[]ChildInfo `json:"children,omitempty"`
   146  }
   147  
   148  // CreateManagementGroupChildInfo the child information of a management group used during creation.
   149  type CreateManagementGroupChildInfo struct {
   150  	// Type - READ-ONLY; The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups). Possible values include: 'Type2MicrosoftManagementmanagementGroups', 'Type2Subscriptions'
   151  	Type Type2 `json:"type,omitempty"`
   152  	// ID - READ-ONLY; The fully qualified ID for the child resource (management group or subscription).  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   153  	ID *string `json:"id,omitempty"`
   154  	// Name - READ-ONLY; The name of the child entity.
   155  	Name *string `json:"name,omitempty"`
   156  	// DisplayName - READ-ONLY; The friendly name of the child resource.
   157  	DisplayName *string `json:"displayName,omitempty"`
   158  	// Roles - READ-ONLY; The roles definitions associated with the management group.
   159  	Roles *[]string `json:"roles,omitempty"`
   160  	// Children - READ-ONLY; The list of children.
   161  	Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"`
   162  }
   163  
   164  // MarshalJSON is the custom marshaler for CreateManagementGroupChildInfo.
   165  func (cmgci CreateManagementGroupChildInfo) MarshalJSON() ([]byte, error) {
   166  	objectMap := make(map[string]interface{})
   167  	return json.Marshal(objectMap)
   168  }
   169  
   170  // CreateManagementGroupDetails the details of a management group used during creation.
   171  type CreateManagementGroupDetails struct {
   172  	// Version - READ-ONLY; The version number of the object.
   173  	Version *float64 `json:"version,omitempty"`
   174  	// UpdatedTime - READ-ONLY; The date and time when this object was last updated.
   175  	UpdatedTime *date.Time `json:"updatedTime,omitempty"`
   176  	// UpdatedBy - READ-ONLY; The identity of the principal or process that updated the object.
   177  	UpdatedBy *string                `json:"updatedBy,omitempty"`
   178  	Parent    *CreateParentGroupInfo `json:"parent,omitempty"`
   179  }
   180  
   181  // MarshalJSON is the custom marshaler for CreateManagementGroupDetails.
   182  func (cmgd CreateManagementGroupDetails) MarshalJSON() ([]byte, error) {
   183  	objectMap := make(map[string]interface{})
   184  	if cmgd.Parent != nil {
   185  		objectMap["parent"] = cmgd.Parent
   186  	}
   187  	return json.Marshal(objectMap)
   188  }
   189  
   190  // CreateManagementGroupProperties the generic properties of a management group used during creation.
   191  type CreateManagementGroupProperties struct {
   192  	// TenantID - READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
   193  	TenantID *string `json:"tenantId,omitempty"`
   194  	// DisplayName - The friendly name of the management group. If no value is passed then this  field will be set to the groupId.
   195  	DisplayName *string `json:"displayName,omitempty"`
   196  	// Roles - READ-ONLY; The roles definitions associated with the management group.
   197  	Roles   *[]string                     `json:"roles,omitempty"`
   198  	Details *CreateManagementGroupDetails `json:"details,omitempty"`
   199  	// Children - READ-ONLY; The list of children.
   200  	Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"`
   201  }
   202  
   203  // MarshalJSON is the custom marshaler for CreateManagementGroupProperties.
   204  func (cmgp CreateManagementGroupProperties) MarshalJSON() ([]byte, error) {
   205  	objectMap := make(map[string]interface{})
   206  	if cmgp.DisplayName != nil {
   207  		objectMap["displayName"] = cmgp.DisplayName
   208  	}
   209  	if cmgp.Details != nil {
   210  		objectMap["details"] = cmgp.Details
   211  	}
   212  	return json.Marshal(objectMap)
   213  }
   214  
   215  // CreateManagementGroupRequest management group creation parameters.
   216  type CreateManagementGroupRequest struct {
   217  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   218  	ID *string `json:"id,omitempty"`
   219  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups
   220  	Type *string `json:"type,omitempty"`
   221  	// Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000
   222  	Name                             *string `json:"name,omitempty"`
   223  	*CreateManagementGroupProperties `json:"properties,omitempty"`
   224  }
   225  
   226  // MarshalJSON is the custom marshaler for CreateManagementGroupRequest.
   227  func (cmgr CreateManagementGroupRequest) MarshalJSON() ([]byte, error) {
   228  	objectMap := make(map[string]interface{})
   229  	if cmgr.Name != nil {
   230  		objectMap["name"] = cmgr.Name
   231  	}
   232  	if cmgr.CreateManagementGroupProperties != nil {
   233  		objectMap["properties"] = cmgr.CreateManagementGroupProperties
   234  	}
   235  	return json.Marshal(objectMap)
   236  }
   237  
   238  // UnmarshalJSON is the custom unmarshaler for CreateManagementGroupRequest struct.
   239  func (cmgr *CreateManagementGroupRequest) UnmarshalJSON(body []byte) error {
   240  	var m map[string]*json.RawMessage
   241  	err := json.Unmarshal(body, &m)
   242  	if err != nil {
   243  		return err
   244  	}
   245  	for k, v := range m {
   246  		switch k {
   247  		case "id":
   248  			if v != nil {
   249  				var ID string
   250  				err = json.Unmarshal(*v, &ID)
   251  				if err != nil {
   252  					return err
   253  				}
   254  				cmgr.ID = &ID
   255  			}
   256  		case "type":
   257  			if v != nil {
   258  				var typeVar string
   259  				err = json.Unmarshal(*v, &typeVar)
   260  				if err != nil {
   261  					return err
   262  				}
   263  				cmgr.Type = &typeVar
   264  			}
   265  		case "name":
   266  			if v != nil {
   267  				var name string
   268  				err = json.Unmarshal(*v, &name)
   269  				if err != nil {
   270  					return err
   271  				}
   272  				cmgr.Name = &name
   273  			}
   274  		case "properties":
   275  			if v != nil {
   276  				var createManagementGroupProperties CreateManagementGroupProperties
   277  				err = json.Unmarshal(*v, &createManagementGroupProperties)
   278  				if err != nil {
   279  					return err
   280  				}
   281  				cmgr.CreateManagementGroupProperties = &createManagementGroupProperties
   282  			}
   283  		}
   284  	}
   285  
   286  	return nil
   287  }
   288  
   289  // CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   290  // operation.
   291  type CreateOrUpdateFuture struct {
   292  	azure.FutureAPI
   293  	// Result returns the result of the asynchronous operation.
   294  	// If the operation has not completed it will return an error.
   295  	Result func(Client) (SetObject, error)
   296  }
   297  
   298  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   299  func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   300  	var azFuture azure.Future
   301  	if err := json.Unmarshal(body, &azFuture); err != nil {
   302  		return err
   303  	}
   304  	future.FutureAPI = &azFuture
   305  	future.Result = future.result
   306  	return nil
   307  }
   308  
   309  // result is the default implementation for CreateOrUpdateFuture.Result.
   310  func (future *CreateOrUpdateFuture) result(client Client) (so SetObject, err error) {
   311  	var done bool
   312  	done, err = future.DoneWithContext(context.Background(), client)
   313  	if err != nil {
   314  		err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   315  		return
   316  	}
   317  	if !done {
   318  		so.Response.Response = future.Response()
   319  		err = azure.NewAsyncOpIncompleteError("managementgroups.CreateOrUpdateFuture")
   320  		return
   321  	}
   322  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   323  	if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
   324  		so, err = client.CreateOrUpdateResponder(so.Response.Response)
   325  		if err != nil {
   326  			err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", so.Response.Response, "Failure responding to request")
   327  		}
   328  	}
   329  	return
   330  }
   331  
   332  // CreateOrUpdateSettingsProperties the properties of the request to create or update Management Group
   333  // settings
   334  type CreateOrUpdateSettingsProperties struct {
   335  	// RequireAuthorizationForGroupCreation - Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access.
   336  	RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"`
   337  	// DefaultManagementGroup - Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup
   338  	DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"`
   339  }
   340  
   341  // CreateOrUpdateSettingsRequest parameters for creating or updating Management Group settings
   342  type CreateOrUpdateSettingsRequest struct {
   343  	*CreateOrUpdateSettingsProperties `json:"properties,omitempty"`
   344  }
   345  
   346  // MarshalJSON is the custom marshaler for CreateOrUpdateSettingsRequest.
   347  func (cousr CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) {
   348  	objectMap := make(map[string]interface{})
   349  	if cousr.CreateOrUpdateSettingsProperties != nil {
   350  		objectMap["properties"] = cousr.CreateOrUpdateSettingsProperties
   351  	}
   352  	return json.Marshal(objectMap)
   353  }
   354  
   355  // UnmarshalJSON is the custom unmarshaler for CreateOrUpdateSettingsRequest struct.
   356  func (cousr *CreateOrUpdateSettingsRequest) UnmarshalJSON(body []byte) error {
   357  	var m map[string]*json.RawMessage
   358  	err := json.Unmarshal(body, &m)
   359  	if err != nil {
   360  		return err
   361  	}
   362  	for k, v := range m {
   363  		switch k {
   364  		case "properties":
   365  			if v != nil {
   366  				var createOrUpdateSettingsProperties CreateOrUpdateSettingsProperties
   367  				err = json.Unmarshal(*v, &createOrUpdateSettingsProperties)
   368  				if err != nil {
   369  					return err
   370  				}
   371  				cousr.CreateOrUpdateSettingsProperties = &createOrUpdateSettingsProperties
   372  			}
   373  		}
   374  	}
   375  
   376  	return nil
   377  }
   378  
   379  // CreateParentGroupInfo (Optional) The ID of the parent management group used during creation.
   380  type CreateParentGroupInfo struct {
   381  	// ID - The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   382  	ID *string `json:"id,omitempty"`
   383  	// Name - READ-ONLY; The name of the parent management group
   384  	Name *string `json:"name,omitempty"`
   385  	// DisplayName - READ-ONLY; The friendly name of the parent management group.
   386  	DisplayName *string `json:"displayName,omitempty"`
   387  }
   388  
   389  // MarshalJSON is the custom marshaler for CreateParentGroupInfo.
   390  func (cpgi CreateParentGroupInfo) MarshalJSON() ([]byte, error) {
   391  	objectMap := make(map[string]interface{})
   392  	if cpgi.ID != nil {
   393  		objectMap["id"] = cpgi.ID
   394  	}
   395  	return json.Marshal(objectMap)
   396  }
   397  
   398  // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
   399  type DeleteFuture struct {
   400  	azure.FutureAPI
   401  	// Result returns the result of the asynchronous operation.
   402  	// If the operation has not completed it will return an error.
   403  	Result func(Client) (AzureAsyncOperationResults, error)
   404  }
   405  
   406  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   407  func (future *DeleteFuture) UnmarshalJSON(body []byte) error {
   408  	var azFuture azure.Future
   409  	if err := json.Unmarshal(body, &azFuture); err != nil {
   410  		return err
   411  	}
   412  	future.FutureAPI = &azFuture
   413  	future.Result = future.result
   414  	return nil
   415  }
   416  
   417  // result is the default implementation for DeleteFuture.Result.
   418  func (future *DeleteFuture) result(client Client) (aaor AzureAsyncOperationResults, err error) {
   419  	var done bool
   420  	done, err = future.DoneWithContext(context.Background(), client)
   421  	if err != nil {
   422  		err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", future.Response(), "Polling failure")
   423  		return
   424  	}
   425  	if !done {
   426  		aaor.Response.Response = future.Response()
   427  		err = azure.NewAsyncOpIncompleteError("managementgroups.DeleteFuture")
   428  		return
   429  	}
   430  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   431  	if aaor.Response.Response, err = future.GetResult(sender); err == nil && aaor.Response.Response.StatusCode != http.StatusNoContent {
   432  		aaor, err = client.DeleteResponder(aaor.Response.Response)
   433  		if err != nil {
   434  			err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", aaor.Response.Response, "Failure responding to request")
   435  		}
   436  	}
   437  	return
   438  }
   439  
   440  // DescendantInfo the descendant.
   441  type DescendantInfo struct {
   442  	// ID - READ-ONLY; The fully qualified ID for the descendant.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or /subscriptions/0000000-0000-0000-0000-000000000000
   443  	ID *string `json:"id,omitempty"`
   444  	// Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups or /subscriptions
   445  	Type *string `json:"type,omitempty"`
   446  	// Name - READ-ONLY; The name of the descendant. For example, 00000000-0000-0000-0000-000000000000
   447  	Name                      *string `json:"name,omitempty"`
   448  	*DescendantInfoProperties `json:"properties,omitempty"`
   449  }
   450  
   451  // MarshalJSON is the custom marshaler for DescendantInfo.
   452  func (di DescendantInfo) MarshalJSON() ([]byte, error) {
   453  	objectMap := make(map[string]interface{})
   454  	if di.DescendantInfoProperties != nil {
   455  		objectMap["properties"] = di.DescendantInfoProperties
   456  	}
   457  	return json.Marshal(objectMap)
   458  }
   459  
   460  // UnmarshalJSON is the custom unmarshaler for DescendantInfo struct.
   461  func (di *DescendantInfo) UnmarshalJSON(body []byte) error {
   462  	var m map[string]*json.RawMessage
   463  	err := json.Unmarshal(body, &m)
   464  	if err != nil {
   465  		return err
   466  	}
   467  	for k, v := range m {
   468  		switch k {
   469  		case "id":
   470  			if v != nil {
   471  				var ID string
   472  				err = json.Unmarshal(*v, &ID)
   473  				if err != nil {
   474  					return err
   475  				}
   476  				di.ID = &ID
   477  			}
   478  		case "type":
   479  			if v != nil {
   480  				var typeVar string
   481  				err = json.Unmarshal(*v, &typeVar)
   482  				if err != nil {
   483  					return err
   484  				}
   485  				di.Type = &typeVar
   486  			}
   487  		case "name":
   488  			if v != nil {
   489  				var name string
   490  				err = json.Unmarshal(*v, &name)
   491  				if err != nil {
   492  					return err
   493  				}
   494  				di.Name = &name
   495  			}
   496  		case "properties":
   497  			if v != nil {
   498  				var descendantInfoProperties DescendantInfoProperties
   499  				err = json.Unmarshal(*v, &descendantInfoProperties)
   500  				if err != nil {
   501  					return err
   502  				}
   503  				di.DescendantInfoProperties = &descendantInfoProperties
   504  			}
   505  		}
   506  	}
   507  
   508  	return nil
   509  }
   510  
   511  // DescendantInfoProperties the generic properties of an descendant.
   512  type DescendantInfoProperties struct {
   513  	// DisplayName - The friendly name of the management group.
   514  	DisplayName *string                    `json:"displayName,omitempty"`
   515  	Parent      *DescendantParentGroupInfo `json:"parent,omitempty"`
   516  }
   517  
   518  // DescendantListResult describes the result of the request to view descendants.
   519  type DescendantListResult struct {
   520  	autorest.Response `json:"-"`
   521  	// Value - The list of descendants.
   522  	Value *[]DescendantInfo `json:"value,omitempty"`
   523  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
   524  	NextLink *string `json:"nextLink,omitempty"`
   525  }
   526  
   527  // MarshalJSON is the custom marshaler for DescendantListResult.
   528  func (dlr DescendantListResult) MarshalJSON() ([]byte, error) {
   529  	objectMap := make(map[string]interface{})
   530  	if dlr.Value != nil {
   531  		objectMap["value"] = dlr.Value
   532  	}
   533  	return json.Marshal(objectMap)
   534  }
   535  
   536  // DescendantListResultIterator provides access to a complete listing of DescendantInfo values.
   537  type DescendantListResultIterator struct {
   538  	i    int
   539  	page DescendantListResultPage
   540  }
   541  
   542  // NextWithContext advances to the next value.  If there was an error making
   543  // the request the iterator does not advance and the error is returned.
   544  func (iter *DescendantListResultIterator) NextWithContext(ctx context.Context) (err error) {
   545  	if tracing.IsEnabled() {
   546  		ctx = tracing.StartSpan(ctx, fqdn+"/DescendantListResultIterator.NextWithContext")
   547  		defer func() {
   548  			sc := -1
   549  			if iter.Response().Response.Response != nil {
   550  				sc = iter.Response().Response.Response.StatusCode
   551  			}
   552  			tracing.EndSpan(ctx, sc, err)
   553  		}()
   554  	}
   555  	iter.i++
   556  	if iter.i < len(iter.page.Values()) {
   557  		return nil
   558  	}
   559  	err = iter.page.NextWithContext(ctx)
   560  	if err != nil {
   561  		iter.i--
   562  		return err
   563  	}
   564  	iter.i = 0
   565  	return nil
   566  }
   567  
   568  // Next advances to the next value.  If there was an error making
   569  // the request the iterator does not advance and the error is returned.
   570  // Deprecated: Use NextWithContext() instead.
   571  func (iter *DescendantListResultIterator) Next() error {
   572  	return iter.NextWithContext(context.Background())
   573  }
   574  
   575  // NotDone returns true if the enumeration should be started or is not yet complete.
   576  func (iter DescendantListResultIterator) NotDone() bool {
   577  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   578  }
   579  
   580  // Response returns the raw server response from the last page request.
   581  func (iter DescendantListResultIterator) Response() DescendantListResult {
   582  	return iter.page.Response()
   583  }
   584  
   585  // Value returns the current value or a zero-initialized value if the
   586  // iterator has advanced beyond the end of the collection.
   587  func (iter DescendantListResultIterator) Value() DescendantInfo {
   588  	if !iter.page.NotDone() {
   589  		return DescendantInfo{}
   590  	}
   591  	return iter.page.Values()[iter.i]
   592  }
   593  
   594  // Creates a new instance of the DescendantListResultIterator type.
   595  func NewDescendantListResultIterator(page DescendantListResultPage) DescendantListResultIterator {
   596  	return DescendantListResultIterator{page: page}
   597  }
   598  
   599  // IsEmpty returns true if the ListResult contains no values.
   600  func (dlr DescendantListResult) IsEmpty() bool {
   601  	return dlr.Value == nil || len(*dlr.Value) == 0
   602  }
   603  
   604  // hasNextLink returns true if the NextLink is not empty.
   605  func (dlr DescendantListResult) hasNextLink() bool {
   606  	return dlr.NextLink != nil && len(*dlr.NextLink) != 0
   607  }
   608  
   609  // descendantListResultPreparer prepares a request to retrieve the next set of results.
   610  // It returns nil if no more results exist.
   611  func (dlr DescendantListResult) descendantListResultPreparer(ctx context.Context) (*http.Request, error) {
   612  	if !dlr.hasNextLink() {
   613  		return nil, nil
   614  	}
   615  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   616  		autorest.AsJSON(),
   617  		autorest.AsGet(),
   618  		autorest.WithBaseURL(to.String(dlr.NextLink)))
   619  }
   620  
   621  // DescendantListResultPage contains a page of DescendantInfo values.
   622  type DescendantListResultPage struct {
   623  	fn  func(context.Context, DescendantListResult) (DescendantListResult, error)
   624  	dlr DescendantListResult
   625  }
   626  
   627  // NextWithContext advances to the next page of values.  If there was an error making
   628  // the request the page does not advance and the error is returned.
   629  func (page *DescendantListResultPage) NextWithContext(ctx context.Context) (err error) {
   630  	if tracing.IsEnabled() {
   631  		ctx = tracing.StartSpan(ctx, fqdn+"/DescendantListResultPage.NextWithContext")
   632  		defer func() {
   633  			sc := -1
   634  			if page.Response().Response.Response != nil {
   635  				sc = page.Response().Response.Response.StatusCode
   636  			}
   637  			tracing.EndSpan(ctx, sc, err)
   638  		}()
   639  	}
   640  	for {
   641  		next, err := page.fn(ctx, page.dlr)
   642  		if err != nil {
   643  			return err
   644  		}
   645  		page.dlr = next
   646  		if !next.hasNextLink() || !next.IsEmpty() {
   647  			break
   648  		}
   649  	}
   650  	return nil
   651  }
   652  
   653  // Next advances to the next page of values.  If there was an error making
   654  // the request the page does not advance and the error is returned.
   655  // Deprecated: Use NextWithContext() instead.
   656  func (page *DescendantListResultPage) Next() error {
   657  	return page.NextWithContext(context.Background())
   658  }
   659  
   660  // NotDone returns true if the page enumeration should be started or is not yet complete.
   661  func (page DescendantListResultPage) NotDone() bool {
   662  	return !page.dlr.IsEmpty()
   663  }
   664  
   665  // Response returns the raw server response from the last page request.
   666  func (page DescendantListResultPage) Response() DescendantListResult {
   667  	return page.dlr
   668  }
   669  
   670  // Values returns the slice of values for the current page or nil if there are no values.
   671  func (page DescendantListResultPage) Values() []DescendantInfo {
   672  	if page.dlr.IsEmpty() {
   673  		return nil
   674  	}
   675  	return *page.dlr.Value
   676  }
   677  
   678  // Creates a new instance of the DescendantListResultPage type.
   679  func NewDescendantListResultPage(cur DescendantListResult, getNextPage func(context.Context, DescendantListResult) (DescendantListResult, error)) DescendantListResultPage {
   680  	return DescendantListResultPage{
   681  		fn:  getNextPage,
   682  		dlr: cur,
   683  	}
   684  }
   685  
   686  // DescendantParentGroupInfo the ID of the parent management group.
   687  type DescendantParentGroupInfo struct {
   688  	// ID - The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   689  	ID *string `json:"id,omitempty"`
   690  }
   691  
   692  // Details the details of a management group.
   693  type Details struct {
   694  	// Version - The version number of the object.
   695  	Version *float64 `json:"version,omitempty"`
   696  	// UpdatedTime - The date and time when this object was last updated.
   697  	UpdatedTime *date.Time `json:"updatedTime,omitempty"`
   698  	// UpdatedBy - The identity of the principal or process that updated the object.
   699  	UpdatedBy *string          `json:"updatedBy,omitempty"`
   700  	Parent    *ParentGroupInfo `json:"parent,omitempty"`
   701  }
   702  
   703  // EntityHierarchyItem the management group details for the hierarchy view.
   704  type EntityHierarchyItem struct {
   705  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   706  	ID *string `json:"id,omitempty"`
   707  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups
   708  	Type *string `json:"type,omitempty"`
   709  	// Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000
   710  	Name                           *string `json:"name,omitempty"`
   711  	*EntityHierarchyItemProperties `json:"properties,omitempty"`
   712  }
   713  
   714  // MarshalJSON is the custom marshaler for EntityHierarchyItem.
   715  func (ehi EntityHierarchyItem) MarshalJSON() ([]byte, error) {
   716  	objectMap := make(map[string]interface{})
   717  	if ehi.EntityHierarchyItemProperties != nil {
   718  		objectMap["properties"] = ehi.EntityHierarchyItemProperties
   719  	}
   720  	return json.Marshal(objectMap)
   721  }
   722  
   723  // UnmarshalJSON is the custom unmarshaler for EntityHierarchyItem struct.
   724  func (ehi *EntityHierarchyItem) UnmarshalJSON(body []byte) error {
   725  	var m map[string]*json.RawMessage
   726  	err := json.Unmarshal(body, &m)
   727  	if err != nil {
   728  		return err
   729  	}
   730  	for k, v := range m {
   731  		switch k {
   732  		case "id":
   733  			if v != nil {
   734  				var ID string
   735  				err = json.Unmarshal(*v, &ID)
   736  				if err != nil {
   737  					return err
   738  				}
   739  				ehi.ID = &ID
   740  			}
   741  		case "type":
   742  			if v != nil {
   743  				var typeVar string
   744  				err = json.Unmarshal(*v, &typeVar)
   745  				if err != nil {
   746  					return err
   747  				}
   748  				ehi.Type = &typeVar
   749  			}
   750  		case "name":
   751  			if v != nil {
   752  				var name string
   753  				err = json.Unmarshal(*v, &name)
   754  				if err != nil {
   755  					return err
   756  				}
   757  				ehi.Name = &name
   758  			}
   759  		case "properties":
   760  			if v != nil {
   761  				var entityHierarchyItemProperties EntityHierarchyItemProperties
   762  				err = json.Unmarshal(*v, &entityHierarchyItemProperties)
   763  				if err != nil {
   764  					return err
   765  				}
   766  				ehi.EntityHierarchyItemProperties = &entityHierarchyItemProperties
   767  			}
   768  		}
   769  	}
   770  
   771  	return nil
   772  }
   773  
   774  // EntityHierarchyItemProperties the generic properties of a management group.
   775  type EntityHierarchyItemProperties struct {
   776  	// DisplayName - The friendly name of the management group.
   777  	DisplayName *string `json:"displayName,omitempty"`
   778  	// Permissions - Possible values include: 'Permissions1Noaccess', 'Permissions1View', 'Permissions1Edit', 'Permissions1Delete'
   779  	Permissions Permissions1 `json:"permissions,omitempty"`
   780  	// Children - The list of children.
   781  	Children *[]EntityHierarchyItem `json:"children,omitempty"`
   782  }
   783  
   784  // EntityInfo the entity.
   785  type EntityInfo struct {
   786  	// ID - READ-ONLY; The fully qualified ID for the entity.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
   787  	ID *string `json:"id,omitempty"`
   788  	// Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups
   789  	Type *string `json:"type,omitempty"`
   790  	// Name - READ-ONLY; The name of the entity. For example, 00000000-0000-0000-0000-000000000000
   791  	Name                  *string `json:"name,omitempty"`
   792  	*EntityInfoProperties `json:"properties,omitempty"`
   793  }
   794  
   795  // MarshalJSON is the custom marshaler for EntityInfo.
   796  func (ei EntityInfo) MarshalJSON() ([]byte, error) {
   797  	objectMap := make(map[string]interface{})
   798  	if ei.EntityInfoProperties != nil {
   799  		objectMap["properties"] = ei.EntityInfoProperties
   800  	}
   801  	return json.Marshal(objectMap)
   802  }
   803  
   804  // UnmarshalJSON is the custom unmarshaler for EntityInfo struct.
   805  func (ei *EntityInfo) UnmarshalJSON(body []byte) error {
   806  	var m map[string]*json.RawMessage
   807  	err := json.Unmarshal(body, &m)
   808  	if err != nil {
   809  		return err
   810  	}
   811  	for k, v := range m {
   812  		switch k {
   813  		case "id":
   814  			if v != nil {
   815  				var ID string
   816  				err = json.Unmarshal(*v, &ID)
   817  				if err != nil {
   818  					return err
   819  				}
   820  				ei.ID = &ID
   821  			}
   822  		case "type":
   823  			if v != nil {
   824  				var typeVar string
   825  				err = json.Unmarshal(*v, &typeVar)
   826  				if err != nil {
   827  					return err
   828  				}
   829  				ei.Type = &typeVar
   830  			}
   831  		case "name":
   832  			if v != nil {
   833  				var name string
   834  				err = json.Unmarshal(*v, &name)
   835  				if err != nil {
   836  					return err
   837  				}
   838  				ei.Name = &name
   839  			}
   840  		case "properties":
   841  			if v != nil {
   842  				var entityInfoProperties EntityInfoProperties
   843  				err = json.Unmarshal(*v, &entityInfoProperties)
   844  				if err != nil {
   845  					return err
   846  				}
   847  				ei.EntityInfoProperties = &entityInfoProperties
   848  			}
   849  		}
   850  	}
   851  
   852  	return nil
   853  }
   854  
   855  // EntityInfoProperties the generic properties of an entity.
   856  type EntityInfoProperties struct {
   857  	// TenantID - The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000
   858  	TenantID *string `json:"tenantId,omitempty"`
   859  	// DisplayName - The friendly name of the management group.
   860  	DisplayName *string                `json:"displayName,omitempty"`
   861  	Parent      *EntityParentGroupInfo `json:"parent,omitempty"`
   862  	// Permissions - Possible values include: 'PermissionsNoaccess', 'PermissionsView', 'PermissionsEdit', 'PermissionsDelete'
   863  	Permissions Permissions `json:"permissions,omitempty"`
   864  	// InheritedPermissions - Possible values include: 'Noaccess', 'View', 'Edit', 'Delete'
   865  	InheritedPermissions InheritedPermissions `json:"inheritedPermissions,omitempty"`
   866  	NumberOfDescendants  *int32               `json:"numberOfDescendants,omitempty"`
   867  	// NumberOfChildren - Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current Group.
   868  	NumberOfChildren *int32 `json:"numberOfChildren,omitempty"`
   869  	// NumberOfChildGroups - Number of children is the number of Groups that are exactly one level underneath the current Group.
   870  	NumberOfChildGroups *int32 `json:"numberOfChildGroups,omitempty"`
   871  	// ParentDisplayNameChain - The parent display name chain from the root group to the immediate parent
   872  	ParentDisplayNameChain *[]string `json:"parentDisplayNameChain,omitempty"`
   873  	// ParentNameChain - The parent name chain from the root group to the immediate parent
   874  	ParentNameChain *[]string `json:"parentNameChain,omitempty"`
   875  }
   876  
   877  // EntityListResult describes the result of the request to view entities.
   878  type EntityListResult struct {
   879  	autorest.Response `json:"-"`
   880  	// Value - The list of entities.
   881  	Value *[]EntityInfo `json:"value,omitempty"`
   882  	// Count - READ-ONLY; Total count of records that match the filter
   883  	Count *int32 `json:"count,omitempty"`
   884  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
   885  	NextLink *string `json:"nextLink,omitempty"`
   886  }
   887  
   888  // MarshalJSON is the custom marshaler for EntityListResult.
   889  func (elr EntityListResult) MarshalJSON() ([]byte, error) {
   890  	objectMap := make(map[string]interface{})
   891  	if elr.Value != nil {
   892  		objectMap["value"] = elr.Value
   893  	}
   894  	return json.Marshal(objectMap)
   895  }
   896  
   897  // EntityListResultIterator provides access to a complete listing of EntityInfo values.
   898  type EntityListResultIterator struct {
   899  	i    int
   900  	page EntityListResultPage
   901  }
   902  
   903  // NextWithContext advances to the next value.  If there was an error making
   904  // the request the iterator does not advance and the error is returned.
   905  func (iter *EntityListResultIterator) NextWithContext(ctx context.Context) (err error) {
   906  	if tracing.IsEnabled() {
   907  		ctx = tracing.StartSpan(ctx, fqdn+"/EntityListResultIterator.NextWithContext")
   908  		defer func() {
   909  			sc := -1
   910  			if iter.Response().Response.Response != nil {
   911  				sc = iter.Response().Response.Response.StatusCode
   912  			}
   913  			tracing.EndSpan(ctx, sc, err)
   914  		}()
   915  	}
   916  	iter.i++
   917  	if iter.i < len(iter.page.Values()) {
   918  		return nil
   919  	}
   920  	err = iter.page.NextWithContext(ctx)
   921  	if err != nil {
   922  		iter.i--
   923  		return err
   924  	}
   925  	iter.i = 0
   926  	return nil
   927  }
   928  
   929  // Next advances to the next value.  If there was an error making
   930  // the request the iterator does not advance and the error is returned.
   931  // Deprecated: Use NextWithContext() instead.
   932  func (iter *EntityListResultIterator) Next() error {
   933  	return iter.NextWithContext(context.Background())
   934  }
   935  
   936  // NotDone returns true if the enumeration should be started or is not yet complete.
   937  func (iter EntityListResultIterator) NotDone() bool {
   938  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   939  }
   940  
   941  // Response returns the raw server response from the last page request.
   942  func (iter EntityListResultIterator) Response() EntityListResult {
   943  	return iter.page.Response()
   944  }
   945  
   946  // Value returns the current value or a zero-initialized value if the
   947  // iterator has advanced beyond the end of the collection.
   948  func (iter EntityListResultIterator) Value() EntityInfo {
   949  	if !iter.page.NotDone() {
   950  		return EntityInfo{}
   951  	}
   952  	return iter.page.Values()[iter.i]
   953  }
   954  
   955  // Creates a new instance of the EntityListResultIterator type.
   956  func NewEntityListResultIterator(page EntityListResultPage) EntityListResultIterator {
   957  	return EntityListResultIterator{page: page}
   958  }
   959  
   960  // IsEmpty returns true if the ListResult contains no values.
   961  func (elr EntityListResult) IsEmpty() bool {
   962  	return elr.Value == nil || len(*elr.Value) == 0
   963  }
   964  
   965  // hasNextLink returns true if the NextLink is not empty.
   966  func (elr EntityListResult) hasNextLink() bool {
   967  	return elr.NextLink != nil && len(*elr.NextLink) != 0
   968  }
   969  
   970  // entityListResultPreparer prepares a request to retrieve the next set of results.
   971  // It returns nil if no more results exist.
   972  func (elr EntityListResult) entityListResultPreparer(ctx context.Context) (*http.Request, error) {
   973  	if !elr.hasNextLink() {
   974  		return nil, nil
   975  	}
   976  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   977  		autorest.AsJSON(),
   978  		autorest.AsGet(),
   979  		autorest.WithBaseURL(to.String(elr.NextLink)))
   980  }
   981  
   982  // EntityListResultPage contains a page of EntityInfo values.
   983  type EntityListResultPage struct {
   984  	fn  func(context.Context, EntityListResult) (EntityListResult, error)
   985  	elr EntityListResult
   986  }
   987  
   988  // NextWithContext advances to the next page of values.  If there was an error making
   989  // the request the page does not advance and the error is returned.
   990  func (page *EntityListResultPage) NextWithContext(ctx context.Context) (err error) {
   991  	if tracing.IsEnabled() {
   992  		ctx = tracing.StartSpan(ctx, fqdn+"/EntityListResultPage.NextWithContext")
   993  		defer func() {
   994  			sc := -1
   995  			if page.Response().Response.Response != nil {
   996  				sc = page.Response().Response.Response.StatusCode
   997  			}
   998  			tracing.EndSpan(ctx, sc, err)
   999  		}()
  1000  	}
  1001  	for {
  1002  		next, err := page.fn(ctx, page.elr)
  1003  		if err != nil {
  1004  			return err
  1005  		}
  1006  		page.elr = next
  1007  		if !next.hasNextLink() || !next.IsEmpty() {
  1008  			break
  1009  		}
  1010  	}
  1011  	return nil
  1012  }
  1013  
  1014  // Next advances to the next page of values.  If there was an error making
  1015  // the request the page does not advance and the error is returned.
  1016  // Deprecated: Use NextWithContext() instead.
  1017  func (page *EntityListResultPage) Next() error {
  1018  	return page.NextWithContext(context.Background())
  1019  }
  1020  
  1021  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1022  func (page EntityListResultPage) NotDone() bool {
  1023  	return !page.elr.IsEmpty()
  1024  }
  1025  
  1026  // Response returns the raw server response from the last page request.
  1027  func (page EntityListResultPage) Response() EntityListResult {
  1028  	return page.elr
  1029  }
  1030  
  1031  // Values returns the slice of values for the current page or nil if there are no values.
  1032  func (page EntityListResultPage) Values() []EntityInfo {
  1033  	if page.elr.IsEmpty() {
  1034  		return nil
  1035  	}
  1036  	return *page.elr.Value
  1037  }
  1038  
  1039  // Creates a new instance of the EntityListResultPage type.
  1040  func NewEntityListResultPage(cur EntityListResult, getNextPage func(context.Context, EntityListResult) (EntityListResult, error)) EntityListResultPage {
  1041  	return EntityListResultPage{
  1042  		fn:  getNextPage,
  1043  		elr: cur,
  1044  	}
  1045  }
  1046  
  1047  // EntityParentGroupInfo (Optional) The ID of the parent management group.
  1048  type EntityParentGroupInfo struct {
  1049  	// ID - The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1050  	ID *string `json:"id,omitempty"`
  1051  }
  1052  
  1053  // ErrorDetails the details of the error.
  1054  type ErrorDetails struct {
  1055  	// Code - One of a server-defined set of error codes.
  1056  	Code *string `json:"code,omitempty"`
  1057  	// Message - A human-readable representation of the error.
  1058  	Message *string `json:"message,omitempty"`
  1059  	// Details - A human-readable representation of the error's details.
  1060  	Details *string `json:"details,omitempty"`
  1061  }
  1062  
  1063  // ErrorResponse the error object.
  1064  type ErrorResponse struct {
  1065  	Error *ErrorDetails `json:"error,omitempty"`
  1066  }
  1067  
  1068  // HierarchySettings settings defined at the Management Group scope.
  1069  type HierarchySettings struct {
  1070  	autorest.Response `json:"-"`
  1071  	// ID - READ-ONLY; The fully qualified ID for the settings object.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default.
  1072  	ID *string `json:"id,omitempty"`
  1073  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups/settings.
  1074  	Type *string `json:"type,omitempty"`
  1075  	// Name - READ-ONLY; The name of the object. In this case, default.
  1076  	Name                         *string `json:"name,omitempty"`
  1077  	*HierarchySettingsProperties `json:"properties,omitempty"`
  1078  }
  1079  
  1080  // MarshalJSON is the custom marshaler for HierarchySettings.
  1081  func (hs HierarchySettings) MarshalJSON() ([]byte, error) {
  1082  	objectMap := make(map[string]interface{})
  1083  	if hs.HierarchySettingsProperties != nil {
  1084  		objectMap["properties"] = hs.HierarchySettingsProperties
  1085  	}
  1086  	return json.Marshal(objectMap)
  1087  }
  1088  
  1089  // UnmarshalJSON is the custom unmarshaler for HierarchySettings struct.
  1090  func (hs *HierarchySettings) UnmarshalJSON(body []byte) error {
  1091  	var m map[string]*json.RawMessage
  1092  	err := json.Unmarshal(body, &m)
  1093  	if err != nil {
  1094  		return err
  1095  	}
  1096  	for k, v := range m {
  1097  		switch k {
  1098  		case "id":
  1099  			if v != nil {
  1100  				var ID string
  1101  				err = json.Unmarshal(*v, &ID)
  1102  				if err != nil {
  1103  					return err
  1104  				}
  1105  				hs.ID = &ID
  1106  			}
  1107  		case "type":
  1108  			if v != nil {
  1109  				var typeVar string
  1110  				err = json.Unmarshal(*v, &typeVar)
  1111  				if err != nil {
  1112  					return err
  1113  				}
  1114  				hs.Type = &typeVar
  1115  			}
  1116  		case "name":
  1117  			if v != nil {
  1118  				var name string
  1119  				err = json.Unmarshal(*v, &name)
  1120  				if err != nil {
  1121  					return err
  1122  				}
  1123  				hs.Name = &name
  1124  			}
  1125  		case "properties":
  1126  			if v != nil {
  1127  				var hierarchySettingsProperties HierarchySettingsProperties
  1128  				err = json.Unmarshal(*v, &hierarchySettingsProperties)
  1129  				if err != nil {
  1130  					return err
  1131  				}
  1132  				hs.HierarchySettingsProperties = &hierarchySettingsProperties
  1133  			}
  1134  		}
  1135  	}
  1136  
  1137  	return nil
  1138  }
  1139  
  1140  // HierarchySettingsInfo the hierarchy settings resource.
  1141  type HierarchySettingsInfo struct {
  1142  	// ID - READ-ONLY; The fully qualified ID for the settings object.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default.
  1143  	ID *string `json:"id,omitempty"`
  1144  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups/settings.
  1145  	Type *string `json:"type,omitempty"`
  1146  	// Name - READ-ONLY; The name of the object. In this case, default.
  1147  	Name                         *string `json:"name,omitempty"`
  1148  	*HierarchySettingsProperties `json:"properties,omitempty"`
  1149  }
  1150  
  1151  // MarshalJSON is the custom marshaler for HierarchySettingsInfo.
  1152  func (hsi HierarchySettingsInfo) MarshalJSON() ([]byte, error) {
  1153  	objectMap := make(map[string]interface{})
  1154  	if hsi.HierarchySettingsProperties != nil {
  1155  		objectMap["properties"] = hsi.HierarchySettingsProperties
  1156  	}
  1157  	return json.Marshal(objectMap)
  1158  }
  1159  
  1160  // UnmarshalJSON is the custom unmarshaler for HierarchySettingsInfo struct.
  1161  func (hsi *HierarchySettingsInfo) UnmarshalJSON(body []byte) error {
  1162  	var m map[string]*json.RawMessage
  1163  	err := json.Unmarshal(body, &m)
  1164  	if err != nil {
  1165  		return err
  1166  	}
  1167  	for k, v := range m {
  1168  		switch k {
  1169  		case "id":
  1170  			if v != nil {
  1171  				var ID string
  1172  				err = json.Unmarshal(*v, &ID)
  1173  				if err != nil {
  1174  					return err
  1175  				}
  1176  				hsi.ID = &ID
  1177  			}
  1178  		case "type":
  1179  			if v != nil {
  1180  				var typeVar string
  1181  				err = json.Unmarshal(*v, &typeVar)
  1182  				if err != nil {
  1183  					return err
  1184  				}
  1185  				hsi.Type = &typeVar
  1186  			}
  1187  		case "name":
  1188  			if v != nil {
  1189  				var name string
  1190  				err = json.Unmarshal(*v, &name)
  1191  				if err != nil {
  1192  					return err
  1193  				}
  1194  				hsi.Name = &name
  1195  			}
  1196  		case "properties":
  1197  			if v != nil {
  1198  				var hierarchySettingsProperties HierarchySettingsProperties
  1199  				err = json.Unmarshal(*v, &hierarchySettingsProperties)
  1200  				if err != nil {
  1201  					return err
  1202  				}
  1203  				hsi.HierarchySettingsProperties = &hierarchySettingsProperties
  1204  			}
  1205  		}
  1206  	}
  1207  
  1208  	return nil
  1209  }
  1210  
  1211  // HierarchySettingsList lists all hierarchy settings.
  1212  type HierarchySettingsList struct {
  1213  	autorest.Response `json:"-"`
  1214  	// Value - The list of hierarchy settings.
  1215  	Value *[]HierarchySettingsInfo `json:"value,omitempty"`
  1216  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
  1217  	NextLink *string `json:"nextLink,omitempty"`
  1218  }
  1219  
  1220  // MarshalJSON is the custom marshaler for HierarchySettingsList.
  1221  func (hsl HierarchySettingsList) MarshalJSON() ([]byte, error) {
  1222  	objectMap := make(map[string]interface{})
  1223  	if hsl.Value != nil {
  1224  		objectMap["value"] = hsl.Value
  1225  	}
  1226  	return json.Marshal(objectMap)
  1227  }
  1228  
  1229  // HierarchySettingsProperties the generic properties of hierarchy settings.
  1230  type HierarchySettingsProperties struct {
  1231  	// TenantID - The AAD Tenant ID associated with the hierarchy settings. For example, 00000000-0000-0000-0000-000000000000
  1232  	TenantID *string `json:"tenantId,omitempty"`
  1233  	// RequireAuthorizationForGroupCreation - Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access.
  1234  	RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"`
  1235  	// DefaultManagementGroup - Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup
  1236  	DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"`
  1237  }
  1238  
  1239  // Info the management group resource.
  1240  type Info struct {
  1241  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1242  	ID *string `json:"id,omitempty"`
  1243  	// Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups
  1244  	Type *string `json:"type,omitempty"`
  1245  	// Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000
  1246  	Name            *string `json:"name,omitempty"`
  1247  	*InfoProperties `json:"properties,omitempty"`
  1248  }
  1249  
  1250  // MarshalJSON is the custom marshaler for Info.
  1251  func (i Info) MarshalJSON() ([]byte, error) {
  1252  	objectMap := make(map[string]interface{})
  1253  	if i.InfoProperties != nil {
  1254  		objectMap["properties"] = i.InfoProperties
  1255  	}
  1256  	return json.Marshal(objectMap)
  1257  }
  1258  
  1259  // UnmarshalJSON is the custom unmarshaler for Info struct.
  1260  func (i *Info) UnmarshalJSON(body []byte) error {
  1261  	var m map[string]*json.RawMessage
  1262  	err := json.Unmarshal(body, &m)
  1263  	if err != nil {
  1264  		return err
  1265  	}
  1266  	for k, v := range m {
  1267  		switch k {
  1268  		case "id":
  1269  			if v != nil {
  1270  				var ID string
  1271  				err = json.Unmarshal(*v, &ID)
  1272  				if err != nil {
  1273  					return err
  1274  				}
  1275  				i.ID = &ID
  1276  			}
  1277  		case "type":
  1278  			if v != nil {
  1279  				var typeVar string
  1280  				err = json.Unmarshal(*v, &typeVar)
  1281  				if err != nil {
  1282  					return err
  1283  				}
  1284  				i.Type = &typeVar
  1285  			}
  1286  		case "name":
  1287  			if v != nil {
  1288  				var name string
  1289  				err = json.Unmarshal(*v, &name)
  1290  				if err != nil {
  1291  					return err
  1292  				}
  1293  				i.Name = &name
  1294  			}
  1295  		case "properties":
  1296  			if v != nil {
  1297  				var infoProperties InfoProperties
  1298  				err = json.Unmarshal(*v, &infoProperties)
  1299  				if err != nil {
  1300  					return err
  1301  				}
  1302  				i.InfoProperties = &infoProperties
  1303  			}
  1304  		}
  1305  	}
  1306  
  1307  	return nil
  1308  }
  1309  
  1310  // InfoProperties the generic properties of a management group.
  1311  type InfoProperties struct {
  1312  	// TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
  1313  	TenantID *string `json:"tenantId,omitempty"`
  1314  	// DisplayName - The friendly name of the management group.
  1315  	DisplayName *string `json:"displayName,omitempty"`
  1316  }
  1317  
  1318  // ListResult describes the result of the request to list management groups.
  1319  type ListResult struct {
  1320  	autorest.Response `json:"-"`
  1321  	// Value - The list of management groups.
  1322  	Value *[]Info `json:"value,omitempty"`
  1323  	// NextLink - READ-ONLY; The URL to use for getting the next set of results.
  1324  	NextLink *string `json:"nextLink,omitempty"`
  1325  }
  1326  
  1327  // MarshalJSON is the custom marshaler for ListResult.
  1328  func (lr ListResult) MarshalJSON() ([]byte, error) {
  1329  	objectMap := make(map[string]interface{})
  1330  	if lr.Value != nil {
  1331  		objectMap["value"] = lr.Value
  1332  	}
  1333  	return json.Marshal(objectMap)
  1334  }
  1335  
  1336  // ListResultIterator provides access to a complete listing of Info values.
  1337  type ListResultIterator struct {
  1338  	i    int
  1339  	page ListResultPage
  1340  }
  1341  
  1342  // NextWithContext advances to the next value.  If there was an error making
  1343  // the request the iterator does not advance and the error is returned.
  1344  func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1345  	if tracing.IsEnabled() {
  1346  		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
  1347  		defer func() {
  1348  			sc := -1
  1349  			if iter.Response().Response.Response != nil {
  1350  				sc = iter.Response().Response.Response.StatusCode
  1351  			}
  1352  			tracing.EndSpan(ctx, sc, err)
  1353  		}()
  1354  	}
  1355  	iter.i++
  1356  	if iter.i < len(iter.page.Values()) {
  1357  		return nil
  1358  	}
  1359  	err = iter.page.NextWithContext(ctx)
  1360  	if err != nil {
  1361  		iter.i--
  1362  		return err
  1363  	}
  1364  	iter.i = 0
  1365  	return nil
  1366  }
  1367  
  1368  // Next advances to the next value.  If there was an error making
  1369  // the request the iterator does not advance and the error is returned.
  1370  // Deprecated: Use NextWithContext() instead.
  1371  func (iter *ListResultIterator) Next() error {
  1372  	return iter.NextWithContext(context.Background())
  1373  }
  1374  
  1375  // NotDone returns true if the enumeration should be started or is not yet complete.
  1376  func (iter ListResultIterator) NotDone() bool {
  1377  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1378  }
  1379  
  1380  // Response returns the raw server response from the last page request.
  1381  func (iter ListResultIterator) Response() ListResult {
  1382  	return iter.page.Response()
  1383  }
  1384  
  1385  // Value returns the current value or a zero-initialized value if the
  1386  // iterator has advanced beyond the end of the collection.
  1387  func (iter ListResultIterator) Value() Info {
  1388  	if !iter.page.NotDone() {
  1389  		return Info{}
  1390  	}
  1391  	return iter.page.Values()[iter.i]
  1392  }
  1393  
  1394  // Creates a new instance of the ListResultIterator type.
  1395  func NewListResultIterator(page ListResultPage) ListResultIterator {
  1396  	return ListResultIterator{page: page}
  1397  }
  1398  
  1399  // IsEmpty returns true if the ListResult contains no values.
  1400  func (lr ListResult) IsEmpty() bool {
  1401  	return lr.Value == nil || len(*lr.Value) == 0
  1402  }
  1403  
  1404  // hasNextLink returns true if the NextLink is not empty.
  1405  func (lr ListResult) hasNextLink() bool {
  1406  	return lr.NextLink != nil && len(*lr.NextLink) != 0
  1407  }
  1408  
  1409  // listResultPreparer prepares a request to retrieve the next set of results.
  1410  // It returns nil if no more results exist.
  1411  func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
  1412  	if !lr.hasNextLink() {
  1413  		return nil, nil
  1414  	}
  1415  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1416  		autorest.AsJSON(),
  1417  		autorest.AsGet(),
  1418  		autorest.WithBaseURL(to.String(lr.NextLink)))
  1419  }
  1420  
  1421  // ListResultPage contains a page of Info values.
  1422  type ListResultPage struct {
  1423  	fn func(context.Context, ListResult) (ListResult, error)
  1424  	lr ListResult
  1425  }
  1426  
  1427  // NextWithContext advances to the next page of values.  If there was an error making
  1428  // the request the page does not advance and the error is returned.
  1429  func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
  1430  	if tracing.IsEnabled() {
  1431  		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
  1432  		defer func() {
  1433  			sc := -1
  1434  			if page.Response().Response.Response != nil {
  1435  				sc = page.Response().Response.Response.StatusCode
  1436  			}
  1437  			tracing.EndSpan(ctx, sc, err)
  1438  		}()
  1439  	}
  1440  	for {
  1441  		next, err := page.fn(ctx, page.lr)
  1442  		if err != nil {
  1443  			return err
  1444  		}
  1445  		page.lr = next
  1446  		if !next.hasNextLink() || !next.IsEmpty() {
  1447  			break
  1448  		}
  1449  	}
  1450  	return nil
  1451  }
  1452  
  1453  // Next advances to the next page of values.  If there was an error making
  1454  // the request the page does not advance and the error is returned.
  1455  // Deprecated: Use NextWithContext() instead.
  1456  func (page *ListResultPage) Next() error {
  1457  	return page.NextWithContext(context.Background())
  1458  }
  1459  
  1460  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1461  func (page ListResultPage) NotDone() bool {
  1462  	return !page.lr.IsEmpty()
  1463  }
  1464  
  1465  // Response returns the raw server response from the last page request.
  1466  func (page ListResultPage) Response() ListResult {
  1467  	return page.lr
  1468  }
  1469  
  1470  // Values returns the slice of values for the current page or nil if there are no values.
  1471  func (page ListResultPage) Values() []Info {
  1472  	if page.lr.IsEmpty() {
  1473  		return nil
  1474  	}
  1475  	return *page.lr.Value
  1476  }
  1477  
  1478  // Creates a new instance of the ListResultPage type.
  1479  func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
  1480  	return ListResultPage{
  1481  		fn: getNextPage,
  1482  		lr: cur,
  1483  	}
  1484  }
  1485  
  1486  // ManagementGroup the management group details.
  1487  type ManagementGroup struct {
  1488  	autorest.Response `json:"-"`
  1489  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1490  	ID *string `json:"id,omitempty"`
  1491  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups
  1492  	Type *string `json:"type,omitempty"`
  1493  	// Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000
  1494  	Name        *string `json:"name,omitempty"`
  1495  	*Properties `json:"properties,omitempty"`
  1496  }
  1497  
  1498  // MarshalJSON is the custom marshaler for ManagementGroup.
  1499  func (mg ManagementGroup) MarshalJSON() ([]byte, error) {
  1500  	objectMap := make(map[string]interface{})
  1501  	if mg.Properties != nil {
  1502  		objectMap["properties"] = mg.Properties
  1503  	}
  1504  	return json.Marshal(objectMap)
  1505  }
  1506  
  1507  // UnmarshalJSON is the custom unmarshaler for ManagementGroup struct.
  1508  func (mg *ManagementGroup) UnmarshalJSON(body []byte) error {
  1509  	var m map[string]*json.RawMessage
  1510  	err := json.Unmarshal(body, &m)
  1511  	if err != nil {
  1512  		return err
  1513  	}
  1514  	for k, v := range m {
  1515  		switch k {
  1516  		case "id":
  1517  			if v != nil {
  1518  				var ID string
  1519  				err = json.Unmarshal(*v, &ID)
  1520  				if err != nil {
  1521  					return err
  1522  				}
  1523  				mg.ID = &ID
  1524  			}
  1525  		case "type":
  1526  			if v != nil {
  1527  				var typeVar string
  1528  				err = json.Unmarshal(*v, &typeVar)
  1529  				if err != nil {
  1530  					return err
  1531  				}
  1532  				mg.Type = &typeVar
  1533  			}
  1534  		case "name":
  1535  			if v != nil {
  1536  				var name string
  1537  				err = json.Unmarshal(*v, &name)
  1538  				if err != nil {
  1539  					return err
  1540  				}
  1541  				mg.Name = &name
  1542  			}
  1543  		case "properties":
  1544  			if v != nil {
  1545  				var properties Properties
  1546  				err = json.Unmarshal(*v, &properties)
  1547  				if err != nil {
  1548  					return err
  1549  				}
  1550  				mg.Properties = &properties
  1551  			}
  1552  		}
  1553  	}
  1554  
  1555  	return nil
  1556  }
  1557  
  1558  // Operation operation supported by the Microsoft.Management resource provider.
  1559  type Operation struct {
  1560  	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
  1561  	Name    *string                     `json:"name,omitempty"`
  1562  	Display *OperationDisplayProperties `json:"display,omitempty"`
  1563  }
  1564  
  1565  // MarshalJSON is the custom marshaler for Operation.
  1566  func (o Operation) MarshalJSON() ([]byte, error) {
  1567  	objectMap := make(map[string]interface{})
  1568  	if o.Display != nil {
  1569  		objectMap["display"] = o.Display
  1570  	}
  1571  	return json.Marshal(objectMap)
  1572  }
  1573  
  1574  // OperationDisplayProperties the object that represents the operation.
  1575  type OperationDisplayProperties struct {
  1576  	// Provider - READ-ONLY; The name of the provider.
  1577  	Provider *string `json:"provider,omitempty"`
  1578  	// Resource - READ-ONLY; The resource on which the operation is performed.
  1579  	Resource *string `json:"resource,omitempty"`
  1580  	// Operation - READ-ONLY; The operation that can be performed.
  1581  	Operation *string `json:"operation,omitempty"`
  1582  	// Description - READ-ONLY; Operation description.
  1583  	Description *string `json:"description,omitempty"`
  1584  }
  1585  
  1586  // MarshalJSON is the custom marshaler for OperationDisplayProperties.
  1587  func (odp OperationDisplayProperties) MarshalJSON() ([]byte, error) {
  1588  	objectMap := make(map[string]interface{})
  1589  	return json.Marshal(objectMap)
  1590  }
  1591  
  1592  // OperationListResult describes the result of the request to list Microsoft.Management operations.
  1593  type OperationListResult struct {
  1594  	autorest.Response `json:"-"`
  1595  	// Value - READ-ONLY; List of operations supported by the Microsoft.Management resource provider.
  1596  	Value *[]Operation `json:"value,omitempty"`
  1597  	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
  1598  	NextLink *string `json:"nextLink,omitempty"`
  1599  }
  1600  
  1601  // MarshalJSON is the custom marshaler for OperationListResult.
  1602  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1603  	objectMap := make(map[string]interface{})
  1604  	return json.Marshal(objectMap)
  1605  }
  1606  
  1607  // OperationListResultIterator provides access to a complete listing of Operation values.
  1608  type OperationListResultIterator struct {
  1609  	i    int
  1610  	page OperationListResultPage
  1611  }
  1612  
  1613  // NextWithContext advances to the next value.  If there was an error making
  1614  // the request the iterator does not advance and the error is returned.
  1615  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1616  	if tracing.IsEnabled() {
  1617  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1618  		defer func() {
  1619  			sc := -1
  1620  			if iter.Response().Response.Response != nil {
  1621  				sc = iter.Response().Response.Response.StatusCode
  1622  			}
  1623  			tracing.EndSpan(ctx, sc, err)
  1624  		}()
  1625  	}
  1626  	iter.i++
  1627  	if iter.i < len(iter.page.Values()) {
  1628  		return nil
  1629  	}
  1630  	err = iter.page.NextWithContext(ctx)
  1631  	if err != nil {
  1632  		iter.i--
  1633  		return err
  1634  	}
  1635  	iter.i = 0
  1636  	return nil
  1637  }
  1638  
  1639  // Next advances to the next value.  If there was an error making
  1640  // the request the iterator does not advance and the error is returned.
  1641  // Deprecated: Use NextWithContext() instead.
  1642  func (iter *OperationListResultIterator) Next() error {
  1643  	return iter.NextWithContext(context.Background())
  1644  }
  1645  
  1646  // NotDone returns true if the enumeration should be started or is not yet complete.
  1647  func (iter OperationListResultIterator) NotDone() bool {
  1648  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1649  }
  1650  
  1651  // Response returns the raw server response from the last page request.
  1652  func (iter OperationListResultIterator) Response() OperationListResult {
  1653  	return iter.page.Response()
  1654  }
  1655  
  1656  // Value returns the current value or a zero-initialized value if the
  1657  // iterator has advanced beyond the end of the collection.
  1658  func (iter OperationListResultIterator) Value() Operation {
  1659  	if !iter.page.NotDone() {
  1660  		return Operation{}
  1661  	}
  1662  	return iter.page.Values()[iter.i]
  1663  }
  1664  
  1665  // Creates a new instance of the OperationListResultIterator type.
  1666  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1667  	return OperationListResultIterator{page: page}
  1668  }
  1669  
  1670  // IsEmpty returns true if the ListResult contains no values.
  1671  func (olr OperationListResult) IsEmpty() bool {
  1672  	return olr.Value == nil || len(*olr.Value) == 0
  1673  }
  1674  
  1675  // hasNextLink returns true if the NextLink is not empty.
  1676  func (olr OperationListResult) hasNextLink() bool {
  1677  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1678  }
  1679  
  1680  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1681  // It returns nil if no more results exist.
  1682  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1683  	if !olr.hasNextLink() {
  1684  		return nil, nil
  1685  	}
  1686  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1687  		autorest.AsJSON(),
  1688  		autorest.AsGet(),
  1689  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1690  }
  1691  
  1692  // OperationListResultPage contains a page of Operation values.
  1693  type OperationListResultPage struct {
  1694  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1695  	olr OperationListResult
  1696  }
  1697  
  1698  // NextWithContext advances to the next page of values.  If there was an error making
  1699  // the request the page does not advance and the error is returned.
  1700  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1701  	if tracing.IsEnabled() {
  1702  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1703  		defer func() {
  1704  			sc := -1
  1705  			if page.Response().Response.Response != nil {
  1706  				sc = page.Response().Response.Response.StatusCode
  1707  			}
  1708  			tracing.EndSpan(ctx, sc, err)
  1709  		}()
  1710  	}
  1711  	for {
  1712  		next, err := page.fn(ctx, page.olr)
  1713  		if err != nil {
  1714  			return err
  1715  		}
  1716  		page.olr = next
  1717  		if !next.hasNextLink() || !next.IsEmpty() {
  1718  			break
  1719  		}
  1720  	}
  1721  	return nil
  1722  }
  1723  
  1724  // Next advances to the next page of values.  If there was an error making
  1725  // the request the page does not advance and the error is returned.
  1726  // Deprecated: Use NextWithContext() instead.
  1727  func (page *OperationListResultPage) Next() error {
  1728  	return page.NextWithContext(context.Background())
  1729  }
  1730  
  1731  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1732  func (page OperationListResultPage) NotDone() bool {
  1733  	return !page.olr.IsEmpty()
  1734  }
  1735  
  1736  // Response returns the raw server response from the last page request.
  1737  func (page OperationListResultPage) Response() OperationListResult {
  1738  	return page.olr
  1739  }
  1740  
  1741  // Values returns the slice of values for the current page or nil if there are no values.
  1742  func (page OperationListResultPage) Values() []Operation {
  1743  	if page.olr.IsEmpty() {
  1744  		return nil
  1745  	}
  1746  	return *page.olr.Value
  1747  }
  1748  
  1749  // Creates a new instance of the OperationListResultPage type.
  1750  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1751  	return OperationListResultPage{
  1752  		fn:  getNextPage,
  1753  		olr: cur,
  1754  	}
  1755  }
  1756  
  1757  // OperationResults the results of an asynchronous operation.
  1758  type OperationResults struct {
  1759  	// ID - READ-ONLY; The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1760  	ID *string `json:"id,omitempty"`
  1761  	// Type - READ-ONLY; The type of the resource.  For example, Microsoft.Management/managementGroups
  1762  	Type *string `json:"type,omitempty"`
  1763  	// Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000
  1764  	Name            *string `json:"name,omitempty"`
  1765  	*InfoProperties `json:"properties,omitempty"`
  1766  }
  1767  
  1768  // MarshalJSON is the custom marshaler for OperationResults.
  1769  func (or OperationResults) MarshalJSON() ([]byte, error) {
  1770  	objectMap := make(map[string]interface{})
  1771  	if or.InfoProperties != nil {
  1772  		objectMap["properties"] = or.InfoProperties
  1773  	}
  1774  	return json.Marshal(objectMap)
  1775  }
  1776  
  1777  // UnmarshalJSON is the custom unmarshaler for OperationResults struct.
  1778  func (or *OperationResults) UnmarshalJSON(body []byte) error {
  1779  	var m map[string]*json.RawMessage
  1780  	err := json.Unmarshal(body, &m)
  1781  	if err != nil {
  1782  		return err
  1783  	}
  1784  	for k, v := range m {
  1785  		switch k {
  1786  		case "id":
  1787  			if v != nil {
  1788  				var ID string
  1789  				err = json.Unmarshal(*v, &ID)
  1790  				if err != nil {
  1791  					return err
  1792  				}
  1793  				or.ID = &ID
  1794  			}
  1795  		case "type":
  1796  			if v != nil {
  1797  				var typeVar string
  1798  				err = json.Unmarshal(*v, &typeVar)
  1799  				if err != nil {
  1800  					return err
  1801  				}
  1802  				or.Type = &typeVar
  1803  			}
  1804  		case "name":
  1805  			if v != nil {
  1806  				var name string
  1807  				err = json.Unmarshal(*v, &name)
  1808  				if err != nil {
  1809  					return err
  1810  				}
  1811  				or.Name = &name
  1812  			}
  1813  		case "properties":
  1814  			if v != nil {
  1815  				var infoProperties InfoProperties
  1816  				err = json.Unmarshal(*v, &infoProperties)
  1817  				if err != nil {
  1818  					return err
  1819  				}
  1820  				or.InfoProperties = &infoProperties
  1821  			}
  1822  		}
  1823  	}
  1824  
  1825  	return nil
  1826  }
  1827  
  1828  // ParentGroupInfo (Optional) The ID of the parent management group.
  1829  type ParentGroupInfo struct {
  1830  	// ID - The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1831  	ID *string `json:"id,omitempty"`
  1832  	// Name - The name of the parent management group
  1833  	Name *string `json:"name,omitempty"`
  1834  	// DisplayName - The friendly name of the parent management group.
  1835  	DisplayName *string `json:"displayName,omitempty"`
  1836  }
  1837  
  1838  // PatchManagementGroupRequest management group patch parameters.
  1839  type PatchManagementGroupRequest struct {
  1840  	// DisplayName - The friendly name of the management group.
  1841  	DisplayName *string `json:"displayName,omitempty"`
  1842  	// ParentID - (Optional) The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
  1843  	ParentID *string `json:"parentId,omitempty"`
  1844  }
  1845  
  1846  // PathElement a path element of a management group ancestors.
  1847  type PathElement struct {
  1848  	// Name - The name of the group.
  1849  	Name *string `json:"name,omitempty"`
  1850  	// DisplayName - The friendly name of the group.
  1851  	DisplayName *string `json:"displayName,omitempty"`
  1852  }
  1853  
  1854  // Properties the generic properties of a management group.
  1855  type Properties struct {
  1856  	// TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
  1857  	TenantID *string `json:"tenantId,omitempty"`
  1858  	// DisplayName - The friendly name of the management group.
  1859  	DisplayName *string `json:"displayName,omitempty"`
  1860  	// Roles - The role definitions associated with the management group.
  1861  	Roles   *[]string `json:"roles,omitempty"`
  1862  	Details *Details  `json:"details,omitempty"`
  1863  	// Children - The list of children.
  1864  	Children *[]ChildInfo `json:"children,omitempty"`
  1865  	// Path - The path from the root to the current group.
  1866  	Path *[]PathElement `json:"path,omitempty"`
  1867  }
  1868  
  1869  // SetObject ...
  1870  type SetObject struct {
  1871  	autorest.Response `json:"-"`
  1872  	Value             interface{} `json:"value,omitempty"`
  1873  }
  1874  
  1875  // TenantBackfillStatusResult the tenant backfill status
  1876  type TenantBackfillStatusResult struct {
  1877  	autorest.Response `json:"-"`
  1878  	// TenantID - READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
  1879  	TenantID *string `json:"tenantId,omitempty"`
  1880  	// Status - READ-ONLY; The status of the Tenant Backfill. Possible values include: 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', 'Cancelled', 'Completed'
  1881  	Status Status `json:"status,omitempty"`
  1882  }
  1883  
  1884  // MarshalJSON is the custom marshaler for TenantBackfillStatusResult.
  1885  func (tbsr TenantBackfillStatusResult) MarshalJSON() ([]byte, error) {
  1886  	objectMap := make(map[string]interface{})
  1887  	return json.Marshal(objectMap)
  1888  }
  1889  

View as plain text