...

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

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

View as plain text