...

Source file src/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2017-06-01/aad/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2017-06-01/aad

     1  package aad
     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/domainservices/mgmt/2017-06-01/aad"
    22  
    23  // CloudError an error response from the Domain Services.
    24  type CloudError struct {
    25  	// Error - An error response from the Domain Services.
    26  	Error *CloudErrorBody `json:"error,omitempty"`
    27  }
    28  
    29  // CloudErrorBody an error response from the Domain Services.
    30  type CloudErrorBody struct {
    31  	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
    32  	Code *string `json:"code,omitempty"`
    33  	// Message - A message describing the error, intended to be suitable for display in a user interface.
    34  	Message *string `json:"message,omitempty"`
    35  	// Target - The target of the particular error. For example, the name of the property in error.
    36  	Target *string `json:"target,omitempty"`
    37  	// Details - A list of additional details about the error.
    38  	Details *[]CloudErrorBody `json:"details,omitempty"`
    39  }
    40  
    41  // ContainerAccount container Account Description
    42  type ContainerAccount struct {
    43  	// AccountName - The account name
    44  	AccountName *string `json:"accountName,omitempty"`
    45  	// Spn - The account spn
    46  	Spn *string `json:"spn,omitempty"`
    47  	// Password - The account password
    48  	Password *string `json:"password,omitempty"`
    49  }
    50  
    51  // DefaultErrorResponse domain Service error response.
    52  type DefaultErrorResponse struct {
    53  	// Error - READ-ONLY; Error model.
    54  	Error *DefaultErrorResponseError `json:"error,omitempty"`
    55  }
    56  
    57  // MarshalJSON is the custom marshaler for DefaultErrorResponse.
    58  func (der DefaultErrorResponse) MarshalJSON() ([]byte, error) {
    59  	objectMap := make(map[string]interface{})
    60  	return json.Marshal(objectMap)
    61  }
    62  
    63  // DefaultErrorResponseError error model.
    64  type DefaultErrorResponseError struct {
    65  	// Code - READ-ONLY; Standardized string to programmatically identify the error.
    66  	Code *string `json:"code,omitempty"`
    67  	// Message - READ-ONLY; Detailed error description and debugging information.
    68  	Message *string `json:"message,omitempty"`
    69  	// Target - READ-ONLY; Detailed error description and debugging information.
    70  	Target *string `json:"target,omitempty"`
    71  	// Details - Error details.
    72  	Details *[]DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"`
    73  	// Innererror - READ-ONLY; More information to debug error.
    74  	Innererror *string `json:"innererror,omitempty"`
    75  }
    76  
    77  // MarshalJSON is the custom marshaler for DefaultErrorResponseError.
    78  func (der DefaultErrorResponseError) MarshalJSON() ([]byte, error) {
    79  	objectMap := make(map[string]interface{})
    80  	if der.Details != nil {
    81  		objectMap["details"] = der.Details
    82  	}
    83  	return json.Marshal(objectMap)
    84  }
    85  
    86  // DefaultErrorResponseErrorDetailsItem detailed errors.
    87  type DefaultErrorResponseErrorDetailsItem struct {
    88  	// Code - READ-ONLY; Standardized string to programmatically identify the error.
    89  	Code *string `json:"code,omitempty"`
    90  	// Message - READ-ONLY; Detailed error description and debugging information.
    91  	Message *string `json:"message,omitempty"`
    92  	// Target - READ-ONLY; Detailed error description and debugging information.
    93  	Target *string `json:"target,omitempty"`
    94  }
    95  
    96  // MarshalJSON is the custom marshaler for DefaultErrorResponseErrorDetailsItem.
    97  func (derI DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) {
    98  	objectMap := make(map[string]interface{})
    99  	return json.Marshal(objectMap)
   100  }
   101  
   102  // DomainSecuritySettings domain Security Settings
   103  type DomainSecuritySettings struct {
   104  	// NtlmV1 - A flag to determine whether or not NtlmV1 is enabled or disabled. Possible values include: 'NtlmV1Enabled', 'NtlmV1Disabled'
   105  	NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"`
   106  	// TLSV1 - A flag to determine whether or not TlsV1 is enabled or disabled. Possible values include: 'TLSV1Enabled', 'TLSV1Disabled'
   107  	TLSV1 TLSV1 `json:"tlsV1,omitempty"`
   108  	// SyncNtlmPasswords - A flag to determine whether or not SyncNtlmPasswords is enabled or disabled. Possible values include: 'SyncNtlmPasswordsEnabled', 'SyncNtlmPasswordsDisabled'
   109  	SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"`
   110  	// SyncKerberosPasswords - A flag to determine whether or not SyncKerberosPasswords is enabled or disabled. Possible values include: 'SyncKerberosPasswordsEnabled', 'SyncKerberosPasswordsDisabled'
   111  	SyncKerberosPasswords SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"`
   112  	// SyncOnPremPasswords - A flag to determine whether or not SyncOnPremPasswords is enabled or disabled. Possible values include: 'SyncOnPremPasswordsEnabled', 'SyncOnPremPasswordsDisabled'
   113  	SyncOnPremPasswords SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"`
   114  }
   115  
   116  // DomainService domain service.
   117  type DomainService struct {
   118  	autorest.Response `json:"-"`
   119  	// DomainServiceProperties - Domain service properties
   120  	*DomainServiceProperties `json:"properties,omitempty"`
   121  	// ID - READ-ONLY; Resource Id
   122  	ID *string `json:"id,omitempty"`
   123  	// Name - READ-ONLY; Resource name
   124  	Name *string `json:"name,omitempty"`
   125  	// Type - READ-ONLY; Resource type
   126  	Type *string `json:"type,omitempty"`
   127  	// Location - Resource location
   128  	Location *string `json:"location,omitempty"`
   129  	// Tags - Resource tags
   130  	Tags map[string]*string `json:"tags"`
   131  	// Etag - Resource etag
   132  	Etag *string `json:"etag,omitempty"`
   133  }
   134  
   135  // MarshalJSON is the custom marshaler for DomainService.
   136  func (ds DomainService) MarshalJSON() ([]byte, error) {
   137  	objectMap := make(map[string]interface{})
   138  	if ds.DomainServiceProperties != nil {
   139  		objectMap["properties"] = ds.DomainServiceProperties
   140  	}
   141  	if ds.Location != nil {
   142  		objectMap["location"] = ds.Location
   143  	}
   144  	if ds.Tags != nil {
   145  		objectMap["tags"] = ds.Tags
   146  	}
   147  	if ds.Etag != nil {
   148  		objectMap["etag"] = ds.Etag
   149  	}
   150  	return json.Marshal(objectMap)
   151  }
   152  
   153  // UnmarshalJSON is the custom unmarshaler for DomainService struct.
   154  func (ds *DomainService) UnmarshalJSON(body []byte) error {
   155  	var m map[string]*json.RawMessage
   156  	err := json.Unmarshal(body, &m)
   157  	if err != nil {
   158  		return err
   159  	}
   160  	for k, v := range m {
   161  		switch k {
   162  		case "properties":
   163  			if v != nil {
   164  				var domainServiceProperties DomainServiceProperties
   165  				err = json.Unmarshal(*v, &domainServiceProperties)
   166  				if err != nil {
   167  					return err
   168  				}
   169  				ds.DomainServiceProperties = &domainServiceProperties
   170  			}
   171  		case "id":
   172  			if v != nil {
   173  				var ID string
   174  				err = json.Unmarshal(*v, &ID)
   175  				if err != nil {
   176  					return err
   177  				}
   178  				ds.ID = &ID
   179  			}
   180  		case "name":
   181  			if v != nil {
   182  				var name string
   183  				err = json.Unmarshal(*v, &name)
   184  				if err != nil {
   185  					return err
   186  				}
   187  				ds.Name = &name
   188  			}
   189  		case "type":
   190  			if v != nil {
   191  				var typeVar string
   192  				err = json.Unmarshal(*v, &typeVar)
   193  				if err != nil {
   194  					return err
   195  				}
   196  				ds.Type = &typeVar
   197  			}
   198  		case "location":
   199  			if v != nil {
   200  				var location string
   201  				err = json.Unmarshal(*v, &location)
   202  				if err != nil {
   203  					return err
   204  				}
   205  				ds.Location = &location
   206  			}
   207  		case "tags":
   208  			if v != nil {
   209  				var tags map[string]*string
   210  				err = json.Unmarshal(*v, &tags)
   211  				if err != nil {
   212  					return err
   213  				}
   214  				ds.Tags = tags
   215  			}
   216  		case "etag":
   217  			if v != nil {
   218  				var etag string
   219  				err = json.Unmarshal(*v, &etag)
   220  				if err != nil {
   221  					return err
   222  				}
   223  				ds.Etag = &etag
   224  			}
   225  		}
   226  	}
   227  
   228  	return nil
   229  }
   230  
   231  // DomainServiceListResult the response from the List Domain Services operation.
   232  type DomainServiceListResult struct {
   233  	autorest.Response `json:"-"`
   234  	// Value - the list of domain services.
   235  	Value *[]DomainService `json:"value,omitempty"`
   236  	// NextLink - READ-ONLY; The continuation token for the next page of results.
   237  	NextLink *string `json:"nextLink,omitempty"`
   238  }
   239  
   240  // MarshalJSON is the custom marshaler for DomainServiceListResult.
   241  func (dslr DomainServiceListResult) MarshalJSON() ([]byte, error) {
   242  	objectMap := make(map[string]interface{})
   243  	if dslr.Value != nil {
   244  		objectMap["value"] = dslr.Value
   245  	}
   246  	return json.Marshal(objectMap)
   247  }
   248  
   249  // DomainServiceListResultIterator provides access to a complete listing of DomainService values.
   250  type DomainServiceListResultIterator struct {
   251  	i    int
   252  	page DomainServiceListResultPage
   253  }
   254  
   255  // NextWithContext advances to the next value.  If there was an error making
   256  // the request the iterator does not advance and the error is returned.
   257  func (iter *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) {
   258  	if tracing.IsEnabled() {
   259  		ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext")
   260  		defer func() {
   261  			sc := -1
   262  			if iter.Response().Response.Response != nil {
   263  				sc = iter.Response().Response.Response.StatusCode
   264  			}
   265  			tracing.EndSpan(ctx, sc, err)
   266  		}()
   267  	}
   268  	iter.i++
   269  	if iter.i < len(iter.page.Values()) {
   270  		return nil
   271  	}
   272  	err = iter.page.NextWithContext(ctx)
   273  	if err != nil {
   274  		iter.i--
   275  		return err
   276  	}
   277  	iter.i = 0
   278  	return nil
   279  }
   280  
   281  // Next advances to the next value.  If there was an error making
   282  // the request the iterator does not advance and the error is returned.
   283  // Deprecated: Use NextWithContext() instead.
   284  func (iter *DomainServiceListResultIterator) Next() error {
   285  	return iter.NextWithContext(context.Background())
   286  }
   287  
   288  // NotDone returns true if the enumeration should be started or is not yet complete.
   289  func (iter DomainServiceListResultIterator) NotDone() bool {
   290  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   291  }
   292  
   293  // Response returns the raw server response from the last page request.
   294  func (iter DomainServiceListResultIterator) Response() DomainServiceListResult {
   295  	return iter.page.Response()
   296  }
   297  
   298  // Value returns the current value or a zero-initialized value if the
   299  // iterator has advanced beyond the end of the collection.
   300  func (iter DomainServiceListResultIterator) Value() DomainService {
   301  	if !iter.page.NotDone() {
   302  		return DomainService{}
   303  	}
   304  	return iter.page.Values()[iter.i]
   305  }
   306  
   307  // Creates a new instance of the DomainServiceListResultIterator type.
   308  func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator {
   309  	return DomainServiceListResultIterator{page: page}
   310  }
   311  
   312  // IsEmpty returns true if the ListResult contains no values.
   313  func (dslr DomainServiceListResult) IsEmpty() bool {
   314  	return dslr.Value == nil || len(*dslr.Value) == 0
   315  }
   316  
   317  // hasNextLink returns true if the NextLink is not empty.
   318  func (dslr DomainServiceListResult) hasNextLink() bool {
   319  	return dslr.NextLink != nil && len(*dslr.NextLink) != 0
   320  }
   321  
   322  // domainServiceListResultPreparer prepares a request to retrieve the next set of results.
   323  // It returns nil if no more results exist.
   324  func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) {
   325  	if !dslr.hasNextLink() {
   326  		return nil, nil
   327  	}
   328  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   329  		autorest.AsJSON(),
   330  		autorest.AsGet(),
   331  		autorest.WithBaseURL(to.String(dslr.NextLink)))
   332  }
   333  
   334  // DomainServiceListResultPage contains a page of DomainService values.
   335  type DomainServiceListResultPage struct {
   336  	fn   func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)
   337  	dslr DomainServiceListResult
   338  }
   339  
   340  // NextWithContext advances to the next page of values.  If there was an error making
   341  // the request the page does not advance and the error is returned.
   342  func (page *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) {
   343  	if tracing.IsEnabled() {
   344  		ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext")
   345  		defer func() {
   346  			sc := -1
   347  			if page.Response().Response.Response != nil {
   348  				sc = page.Response().Response.Response.StatusCode
   349  			}
   350  			tracing.EndSpan(ctx, sc, err)
   351  		}()
   352  	}
   353  	for {
   354  		next, err := page.fn(ctx, page.dslr)
   355  		if err != nil {
   356  			return err
   357  		}
   358  		page.dslr = next
   359  		if !next.hasNextLink() || !next.IsEmpty() {
   360  			break
   361  		}
   362  	}
   363  	return nil
   364  }
   365  
   366  // Next advances to the next page of values.  If there was an error making
   367  // the request the page does not advance and the error is returned.
   368  // Deprecated: Use NextWithContext() instead.
   369  func (page *DomainServiceListResultPage) Next() error {
   370  	return page.NextWithContext(context.Background())
   371  }
   372  
   373  // NotDone returns true if the page enumeration should be started or is not yet complete.
   374  func (page DomainServiceListResultPage) NotDone() bool {
   375  	return !page.dslr.IsEmpty()
   376  }
   377  
   378  // Response returns the raw server response from the last page request.
   379  func (page DomainServiceListResultPage) Response() DomainServiceListResult {
   380  	return page.dslr
   381  }
   382  
   383  // Values returns the slice of values for the current page or nil if there are no values.
   384  func (page DomainServiceListResultPage) Values() []DomainService {
   385  	if page.dslr.IsEmpty() {
   386  		return nil
   387  	}
   388  	return *page.dslr.Value
   389  }
   390  
   391  // Creates a new instance of the DomainServiceListResultPage type.
   392  func NewDomainServiceListResultPage(cur DomainServiceListResult, getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage {
   393  	return DomainServiceListResultPage{
   394  		fn:   getNextPage,
   395  		dslr: cur,
   396  	}
   397  }
   398  
   399  // DomainServiceProperties properties of the Domain Service.
   400  type DomainServiceProperties struct {
   401  	// Version - READ-ONLY; Data Model Version
   402  	Version *int32 `json:"version,omitempty"`
   403  	// TenantID - READ-ONLY; Azure Active Directory Tenant Id
   404  	TenantID *string `json:"tenantId,omitempty"`
   405  	// DomainName - The name of the Azure domain that the user would like to deploy Domain Services to.
   406  	DomainName *string `json:"domainName,omitempty"`
   407  	// DeploymentID - READ-ONLY; Deployment Id
   408  	DeploymentID *string `json:"deploymentId,omitempty"`
   409  	// VnetSiteID - READ-ONLY; Virtual network site id
   410  	VnetSiteID *string `json:"vnetSiteId,omitempty"`
   411  	// SubnetID - The name of the virtual network that Domain Services will be deployed on. The id of the subnet that Domain Services will be deployed on. /virtualNetwork/vnetName/subnets/subnetName.
   412  	SubnetID *string `json:"subnetId,omitempty"`
   413  	// LdapsSettings - Secure LDAP Settings
   414  	LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"`
   415  	// DomainSecuritySettings - DomainSecurity Settings
   416  	DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"`
   417  	// ResourceForestSettings - Resource Forest Settings
   418  	ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"`
   419  	// DomainConfigurationType - Domain Configuration Type
   420  	DomainConfigurationType *string `json:"domainConfigurationType,omitempty"`
   421  	// Sku - Sku Type
   422  	Sku *string `json:"sku,omitempty"`
   423  	// HealthLastEvaluated - READ-ONLY; Last domain evaluation run DateTime
   424  	HealthLastEvaluated *date.TimeRFC1123 `json:"healthLastEvaluated,omitempty"`
   425  	// HealthMonitors - READ-ONLY; List of Domain Health Monitors
   426  	HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"`
   427  	// HealthAlerts - READ-ONLY; List of Domain Health Alerts
   428  	HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"`
   429  	// NotificationSettings - Notification Settings
   430  	NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"`
   431  	// FilteredSync - Enabled or Disabled flag to turn on Group-based filtered sync. Possible values include: 'FilteredSyncEnabled', 'FilteredSyncDisabled'
   432  	FilteredSync FilteredSync `json:"filteredSync,omitempty"`
   433  	// DomainControllerIPAddress - READ-ONLY; List of Domain Controller IP Address
   434  	DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"`
   435  	// ServiceStatus - READ-ONLY; Status of Domain Service instance
   436  	ServiceStatus *string `json:"serviceStatus,omitempty"`
   437  	// ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response.
   438  	ProvisioningState *string `json:"provisioningState,omitempty"`
   439  }
   440  
   441  // MarshalJSON is the custom marshaler for DomainServiceProperties.
   442  func (dsp DomainServiceProperties) MarshalJSON() ([]byte, error) {
   443  	objectMap := make(map[string]interface{})
   444  	if dsp.DomainName != nil {
   445  		objectMap["domainName"] = dsp.DomainName
   446  	}
   447  	if dsp.SubnetID != nil {
   448  		objectMap["subnetId"] = dsp.SubnetID
   449  	}
   450  	if dsp.LdapsSettings != nil {
   451  		objectMap["ldapsSettings"] = dsp.LdapsSettings
   452  	}
   453  	if dsp.DomainSecuritySettings != nil {
   454  		objectMap["domainSecuritySettings"] = dsp.DomainSecuritySettings
   455  	}
   456  	if dsp.ResourceForestSettings != nil {
   457  		objectMap["resourceForestSettings"] = dsp.ResourceForestSettings
   458  	}
   459  	if dsp.DomainConfigurationType != nil {
   460  		objectMap["domainConfigurationType"] = dsp.DomainConfigurationType
   461  	}
   462  	if dsp.Sku != nil {
   463  		objectMap["sku"] = dsp.Sku
   464  	}
   465  	if dsp.NotificationSettings != nil {
   466  		objectMap["notificationSettings"] = dsp.NotificationSettings
   467  	}
   468  	if dsp.FilteredSync != "" {
   469  		objectMap["filteredSync"] = dsp.FilteredSync
   470  	}
   471  	return json.Marshal(objectMap)
   472  }
   473  
   474  // DomainServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   475  // long-running operation.
   476  type DomainServicesCreateOrUpdateFuture struct {
   477  	azure.FutureAPI
   478  	// Result returns the result of the asynchronous operation.
   479  	// If the operation has not completed it will return an error.
   480  	Result func(DomainServicesClient) (DomainService, error)
   481  }
   482  
   483  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   484  func (future *DomainServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   485  	var azFuture azure.Future
   486  	if err := json.Unmarshal(body, &azFuture); err != nil {
   487  		return err
   488  	}
   489  	future.FutureAPI = &azFuture
   490  	future.Result = future.result
   491  	return nil
   492  }
   493  
   494  // result is the default implementation for DomainServicesCreateOrUpdateFuture.Result.
   495  func (future *DomainServicesCreateOrUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
   496  	var done bool
   497  	done, err = future.DoneWithContext(context.Background(), client)
   498  	if err != nil {
   499  		err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   500  		return
   501  	}
   502  	if !done {
   503  		ds.Response.Response = future.Response()
   504  		err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture")
   505  		return
   506  	}
   507  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   508  	if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
   509  		ds, err = client.CreateOrUpdateResponder(ds.Response.Response)
   510  		if err != nil {
   511  			err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
   512  		}
   513  	}
   514  	return
   515  }
   516  
   517  // DomainServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   518  // operation.
   519  type DomainServicesDeleteFuture struct {
   520  	azure.FutureAPI
   521  	// Result returns the result of the asynchronous operation.
   522  	// If the operation has not completed it will return an error.
   523  	Result func(DomainServicesClient) (autorest.Response, error)
   524  }
   525  
   526  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   527  func (future *DomainServicesDeleteFuture) UnmarshalJSON(body []byte) error {
   528  	var azFuture azure.Future
   529  	if err := json.Unmarshal(body, &azFuture); err != nil {
   530  		return err
   531  	}
   532  	future.FutureAPI = &azFuture
   533  	future.Result = future.result
   534  	return nil
   535  }
   536  
   537  // result is the default implementation for DomainServicesDeleteFuture.Result.
   538  func (future *DomainServicesDeleteFuture) result(client DomainServicesClient) (ar autorest.Response, err error) {
   539  	var done bool
   540  	done, err = future.DoneWithContext(context.Background(), client)
   541  	if err != nil {
   542  		err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure")
   543  		return
   544  	}
   545  	if !done {
   546  		ar.Response = future.Response()
   547  		err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture")
   548  		return
   549  	}
   550  	ar.Response = future.Response()
   551  	return
   552  }
   553  
   554  // DomainServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   555  // operation.
   556  type DomainServicesUpdateFuture struct {
   557  	azure.FutureAPI
   558  	// Result returns the result of the asynchronous operation.
   559  	// If the operation has not completed it will return an error.
   560  	Result func(DomainServicesClient) (DomainService, error)
   561  }
   562  
   563  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   564  func (future *DomainServicesUpdateFuture) UnmarshalJSON(body []byte) error {
   565  	var azFuture azure.Future
   566  	if err := json.Unmarshal(body, &azFuture); err != nil {
   567  		return err
   568  	}
   569  	future.FutureAPI = &azFuture
   570  	future.Result = future.result
   571  	return nil
   572  }
   573  
   574  // result is the default implementation for DomainServicesUpdateFuture.Result.
   575  func (future *DomainServicesUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
   576  	var done bool
   577  	done, err = future.DoneWithContext(context.Background(), client)
   578  	if err != nil {
   579  		err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure")
   580  		return
   581  	}
   582  	if !done {
   583  		ds.Response.Response = future.Response()
   584  		err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture")
   585  		return
   586  	}
   587  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   588  	if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
   589  		ds, err = client.UpdateResponder(ds.Response.Response)
   590  		if err != nil {
   591  			err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
   592  		}
   593  	}
   594  	return
   595  }
   596  
   597  // ForestTrust forest Trust Setting
   598  type ForestTrust struct {
   599  	// TrustedDomainFqdn - Trusted Domain FQDN
   600  	TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"`
   601  	// TrustDirection - Trust Direction
   602  	TrustDirection *string `json:"trustDirection,omitempty"`
   603  	// FriendlyName - Friendly Name
   604  	FriendlyName *string `json:"friendlyName,omitempty"`
   605  	// RemoteDNSIps - Remote Dns ips
   606  	RemoteDNSIps *string `json:"remoteDnsIps,omitempty"`
   607  	// TrustPassword - Trust Password
   608  	TrustPassword *string `json:"trustPassword,omitempty"`
   609  }
   610  
   611  // HealthAlert health Alert Description
   612  type HealthAlert struct {
   613  	// ID - READ-ONLY; Health Alert Id
   614  	ID *string `json:"id,omitempty"`
   615  	// Name - READ-ONLY; Health Alert Name
   616  	Name *string `json:"name,omitempty"`
   617  	// Issue - READ-ONLY; Health Alert Issue
   618  	Issue *string `json:"issue,omitempty"`
   619  	// Severity - READ-ONLY; Health Alert Severity
   620  	Severity *string `json:"severity,omitempty"`
   621  	// Raised - READ-ONLY; Health Alert Raised DateTime
   622  	Raised *date.Time `json:"raised,omitempty"`
   623  	// LastDetected - READ-ONLY; Health Alert Last Detected DateTime
   624  	LastDetected *date.Time `json:"lastDetected,omitempty"`
   625  	// ResolutionURI - READ-ONLY; Health Alert TSG Link
   626  	ResolutionURI *string `json:"resolutionUri,omitempty"`
   627  }
   628  
   629  // MarshalJSON is the custom marshaler for HealthAlert.
   630  func (ha HealthAlert) MarshalJSON() ([]byte, error) {
   631  	objectMap := make(map[string]interface{})
   632  	return json.Marshal(objectMap)
   633  }
   634  
   635  // HealthMonitor health Monitor Description
   636  type HealthMonitor struct {
   637  	// ID - READ-ONLY; Health Monitor Id
   638  	ID *string `json:"id,omitempty"`
   639  	// Name - READ-ONLY; Health Monitor Name
   640  	Name *string `json:"name,omitempty"`
   641  	// Details - READ-ONLY; Health Monitor Details
   642  	Details *string `json:"details,omitempty"`
   643  }
   644  
   645  // MarshalJSON is the custom marshaler for HealthMonitor.
   646  func (hm HealthMonitor) MarshalJSON() ([]byte, error) {
   647  	objectMap := make(map[string]interface{})
   648  	return json.Marshal(objectMap)
   649  }
   650  
   651  // LdapsSettings secure LDAP Settings
   652  type LdapsSettings struct {
   653  	// Ldaps - A flag to determine whether or not Secure LDAP is enabled or disabled. Possible values include: 'LdapsEnabled', 'LdapsDisabled'
   654  	Ldaps Ldaps `json:"ldaps,omitempty"`
   655  	// PfxCertificate - The certificate required to configure Secure LDAP. The parameter passed here should be a base64encoded representation of the certificate pfx file.
   656  	PfxCertificate *string `json:"pfxCertificate,omitempty"`
   657  	// PfxCertificatePassword - The password to decrypt the provided Secure LDAP certificate pfx file.
   658  	PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"`
   659  	// PublicCertificate - READ-ONLY; Public certificate used to configure secure ldap.
   660  	PublicCertificate *string `json:"publicCertificate,omitempty"`
   661  	// CertificateThumbprint - READ-ONLY; Thumbprint of configure ldaps certificate.
   662  	CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
   663  	// CertificateNotAfter - READ-ONLY; NotAfter DateTime of configure ldaps certificate.
   664  	CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"`
   665  	// ExternalAccess - A flag to determine whether or not Secure LDAP access over the internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled'
   666  	ExternalAccess ExternalAccess `json:"externalAccess,omitempty"`
   667  	// ExternalAccessIPAddress - READ-ONLY; External access ip address.
   668  	ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"`
   669  }
   670  
   671  // MarshalJSON is the custom marshaler for LdapsSettings.
   672  func (ls LdapsSettings) MarshalJSON() ([]byte, error) {
   673  	objectMap := make(map[string]interface{})
   674  	if ls.Ldaps != "" {
   675  		objectMap["ldaps"] = ls.Ldaps
   676  	}
   677  	if ls.PfxCertificate != nil {
   678  		objectMap["pfxCertificate"] = ls.PfxCertificate
   679  	}
   680  	if ls.PfxCertificatePassword != nil {
   681  		objectMap["pfxCertificatePassword"] = ls.PfxCertificatePassword
   682  	}
   683  	if ls.ExternalAccess != "" {
   684  		objectMap["externalAccess"] = ls.ExternalAccess
   685  	}
   686  	return json.Marshal(objectMap)
   687  }
   688  
   689  // NotificationSettings settings for notification
   690  type NotificationSettings struct {
   691  	// NotifyGlobalAdmins - Should global admins be notified. Possible values include: 'NotifyGlobalAdminsEnabled', 'NotifyGlobalAdminsDisabled'
   692  	NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"`
   693  	// NotifyDcAdmins - Should domain controller admins be notified. Possible values include: 'NotifyDcAdminsEnabled', 'NotifyDcAdminsDisabled'
   694  	NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"`
   695  	// AdditionalRecipients - The list of additional recipients
   696  	AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"`
   697  }
   698  
   699  // OperationDisplayInfo the operation supported by Domain Services.
   700  type OperationDisplayInfo struct {
   701  	// Description - The description of the operation.
   702  	Description *string `json:"description,omitempty"`
   703  	// Operation - The action that users can perform, based on their permission level.
   704  	Operation *string `json:"operation,omitempty"`
   705  	// Provider - Service provider: Domain Services.
   706  	Provider *string `json:"provider,omitempty"`
   707  	// Resource - Resource on which the operation is performed.
   708  	Resource *string `json:"resource,omitempty"`
   709  }
   710  
   711  // OperationEntity the operation supported by Domain Services.
   712  type OperationEntity struct {
   713  	// Name - Operation name: {provider}/{resource}/{operation}.
   714  	Name *string `json:"name,omitempty"`
   715  	// Display - The operation supported by Domain Services.
   716  	Display *OperationDisplayInfo `json:"display,omitempty"`
   717  	// Origin - The origin of the operation.
   718  	Origin *string `json:"origin,omitempty"`
   719  }
   720  
   721  // OperationEntityListResult the list of domain service operation response.
   722  type OperationEntityListResult struct {
   723  	autorest.Response `json:"-"`
   724  	// Value - The list of operations.
   725  	Value *[]OperationEntity `json:"value,omitempty"`
   726  	// NextLink - READ-ONLY; The continuation token for the next page of results.
   727  	NextLink *string `json:"nextLink,omitempty"`
   728  }
   729  
   730  // MarshalJSON is the custom marshaler for OperationEntityListResult.
   731  func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) {
   732  	objectMap := make(map[string]interface{})
   733  	if oelr.Value != nil {
   734  		objectMap["value"] = oelr.Value
   735  	}
   736  	return json.Marshal(objectMap)
   737  }
   738  
   739  // OperationEntityListResultIterator provides access to a complete listing of OperationEntity values.
   740  type OperationEntityListResultIterator struct {
   741  	i    int
   742  	page OperationEntityListResultPage
   743  }
   744  
   745  // NextWithContext advances to the next value.  If there was an error making
   746  // the request the iterator does not advance and the error is returned.
   747  func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) {
   748  	if tracing.IsEnabled() {
   749  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext")
   750  		defer func() {
   751  			sc := -1
   752  			if iter.Response().Response.Response != nil {
   753  				sc = iter.Response().Response.Response.StatusCode
   754  			}
   755  			tracing.EndSpan(ctx, sc, err)
   756  		}()
   757  	}
   758  	iter.i++
   759  	if iter.i < len(iter.page.Values()) {
   760  		return nil
   761  	}
   762  	err = iter.page.NextWithContext(ctx)
   763  	if err != nil {
   764  		iter.i--
   765  		return err
   766  	}
   767  	iter.i = 0
   768  	return nil
   769  }
   770  
   771  // Next advances to the next value.  If there was an error making
   772  // the request the iterator does not advance and the error is returned.
   773  // Deprecated: Use NextWithContext() instead.
   774  func (iter *OperationEntityListResultIterator) Next() error {
   775  	return iter.NextWithContext(context.Background())
   776  }
   777  
   778  // NotDone returns true if the enumeration should be started or is not yet complete.
   779  func (iter OperationEntityListResultIterator) NotDone() bool {
   780  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   781  }
   782  
   783  // Response returns the raw server response from the last page request.
   784  func (iter OperationEntityListResultIterator) Response() OperationEntityListResult {
   785  	return iter.page.Response()
   786  }
   787  
   788  // Value returns the current value or a zero-initialized value if the
   789  // iterator has advanced beyond the end of the collection.
   790  func (iter OperationEntityListResultIterator) Value() OperationEntity {
   791  	if !iter.page.NotDone() {
   792  		return OperationEntity{}
   793  	}
   794  	return iter.page.Values()[iter.i]
   795  }
   796  
   797  // Creates a new instance of the OperationEntityListResultIterator type.
   798  func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator {
   799  	return OperationEntityListResultIterator{page: page}
   800  }
   801  
   802  // IsEmpty returns true if the ListResult contains no values.
   803  func (oelr OperationEntityListResult) IsEmpty() bool {
   804  	return oelr.Value == nil || len(*oelr.Value) == 0
   805  }
   806  
   807  // hasNextLink returns true if the NextLink is not empty.
   808  func (oelr OperationEntityListResult) hasNextLink() bool {
   809  	return oelr.NextLink != nil && len(*oelr.NextLink) != 0
   810  }
   811  
   812  // operationEntityListResultPreparer prepares a request to retrieve the next set of results.
   813  // It returns nil if no more results exist.
   814  func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) {
   815  	if !oelr.hasNextLink() {
   816  		return nil, nil
   817  	}
   818  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   819  		autorest.AsJSON(),
   820  		autorest.AsGet(),
   821  		autorest.WithBaseURL(to.String(oelr.NextLink)))
   822  }
   823  
   824  // OperationEntityListResultPage contains a page of OperationEntity values.
   825  type OperationEntityListResultPage struct {
   826  	fn   func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)
   827  	oelr OperationEntityListResult
   828  }
   829  
   830  // NextWithContext advances to the next page of values.  If there was an error making
   831  // the request the page does not advance and the error is returned.
   832  func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) {
   833  	if tracing.IsEnabled() {
   834  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext")
   835  		defer func() {
   836  			sc := -1
   837  			if page.Response().Response.Response != nil {
   838  				sc = page.Response().Response.Response.StatusCode
   839  			}
   840  			tracing.EndSpan(ctx, sc, err)
   841  		}()
   842  	}
   843  	for {
   844  		next, err := page.fn(ctx, page.oelr)
   845  		if err != nil {
   846  			return err
   847  		}
   848  		page.oelr = next
   849  		if !next.hasNextLink() || !next.IsEmpty() {
   850  			break
   851  		}
   852  	}
   853  	return nil
   854  }
   855  
   856  // Next advances to the next page of values.  If there was an error making
   857  // the request the page does not advance and the error is returned.
   858  // Deprecated: Use NextWithContext() instead.
   859  func (page *OperationEntityListResultPage) Next() error {
   860  	return page.NextWithContext(context.Background())
   861  }
   862  
   863  // NotDone returns true if the page enumeration should be started or is not yet complete.
   864  func (page OperationEntityListResultPage) NotDone() bool {
   865  	return !page.oelr.IsEmpty()
   866  }
   867  
   868  // Response returns the raw server response from the last page request.
   869  func (page OperationEntityListResultPage) Response() OperationEntityListResult {
   870  	return page.oelr
   871  }
   872  
   873  // Values returns the slice of values for the current page or nil if there are no values.
   874  func (page OperationEntityListResultPage) Values() []OperationEntity {
   875  	if page.oelr.IsEmpty() {
   876  		return nil
   877  	}
   878  	return *page.oelr.Value
   879  }
   880  
   881  // Creates a new instance of the OperationEntityListResultPage type.
   882  func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage {
   883  	return OperationEntityListResultPage{
   884  		fn:   getNextPage,
   885  		oelr: cur,
   886  	}
   887  }
   888  
   889  // OuContainer resource for OuContainer.
   890  type OuContainer struct {
   891  	autorest.Response `json:"-"`
   892  	// OuContainerProperties - OuContainer properties
   893  	*OuContainerProperties `json:"properties,omitempty"`
   894  	// ID - READ-ONLY; Resource Id
   895  	ID *string `json:"id,omitempty"`
   896  	// Name - READ-ONLY; Resource name
   897  	Name *string `json:"name,omitempty"`
   898  	// Type - READ-ONLY; Resource type
   899  	Type *string `json:"type,omitempty"`
   900  	// Location - Resource location
   901  	Location *string `json:"location,omitempty"`
   902  	// Tags - Resource tags
   903  	Tags map[string]*string `json:"tags"`
   904  	// Etag - Resource etag
   905  	Etag *string `json:"etag,omitempty"`
   906  }
   907  
   908  // MarshalJSON is the custom marshaler for OuContainer.
   909  func (oc OuContainer) MarshalJSON() ([]byte, error) {
   910  	objectMap := make(map[string]interface{})
   911  	if oc.OuContainerProperties != nil {
   912  		objectMap["properties"] = oc.OuContainerProperties
   913  	}
   914  	if oc.Location != nil {
   915  		objectMap["location"] = oc.Location
   916  	}
   917  	if oc.Tags != nil {
   918  		objectMap["tags"] = oc.Tags
   919  	}
   920  	if oc.Etag != nil {
   921  		objectMap["etag"] = oc.Etag
   922  	}
   923  	return json.Marshal(objectMap)
   924  }
   925  
   926  // UnmarshalJSON is the custom unmarshaler for OuContainer struct.
   927  func (oc *OuContainer) UnmarshalJSON(body []byte) error {
   928  	var m map[string]*json.RawMessage
   929  	err := json.Unmarshal(body, &m)
   930  	if err != nil {
   931  		return err
   932  	}
   933  	for k, v := range m {
   934  		switch k {
   935  		case "properties":
   936  			if v != nil {
   937  				var ouContainerProperties OuContainerProperties
   938  				err = json.Unmarshal(*v, &ouContainerProperties)
   939  				if err != nil {
   940  					return err
   941  				}
   942  				oc.OuContainerProperties = &ouContainerProperties
   943  			}
   944  		case "id":
   945  			if v != nil {
   946  				var ID string
   947  				err = json.Unmarshal(*v, &ID)
   948  				if err != nil {
   949  					return err
   950  				}
   951  				oc.ID = &ID
   952  			}
   953  		case "name":
   954  			if v != nil {
   955  				var name string
   956  				err = json.Unmarshal(*v, &name)
   957  				if err != nil {
   958  					return err
   959  				}
   960  				oc.Name = &name
   961  			}
   962  		case "type":
   963  			if v != nil {
   964  				var typeVar string
   965  				err = json.Unmarshal(*v, &typeVar)
   966  				if err != nil {
   967  					return err
   968  				}
   969  				oc.Type = &typeVar
   970  			}
   971  		case "location":
   972  			if v != nil {
   973  				var location string
   974  				err = json.Unmarshal(*v, &location)
   975  				if err != nil {
   976  					return err
   977  				}
   978  				oc.Location = &location
   979  			}
   980  		case "tags":
   981  			if v != nil {
   982  				var tags map[string]*string
   983  				err = json.Unmarshal(*v, &tags)
   984  				if err != nil {
   985  					return err
   986  				}
   987  				oc.Tags = tags
   988  			}
   989  		case "etag":
   990  			if v != nil {
   991  				var etag string
   992  				err = json.Unmarshal(*v, &etag)
   993  				if err != nil {
   994  					return err
   995  				}
   996  				oc.Etag = &etag
   997  			}
   998  		}
   999  	}
  1000  
  1001  	return nil
  1002  }
  1003  
  1004  // OuContainerCreateFuture an abstraction for monitoring and retrieving the results of a long-running
  1005  // operation.
  1006  type OuContainerCreateFuture struct {
  1007  	azure.FutureAPI
  1008  	// Result returns the result of the asynchronous operation.
  1009  	// If the operation has not completed it will return an error.
  1010  	Result func(OuContainerClient) (OuContainer, error)
  1011  }
  1012  
  1013  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1014  func (future *OuContainerCreateFuture) UnmarshalJSON(body []byte) error {
  1015  	var azFuture azure.Future
  1016  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1017  		return err
  1018  	}
  1019  	future.FutureAPI = &azFuture
  1020  	future.Result = future.result
  1021  	return nil
  1022  }
  1023  
  1024  // result is the default implementation for OuContainerCreateFuture.Result.
  1025  func (future *OuContainerCreateFuture) result(client OuContainerClient) (oc OuContainer, err error) {
  1026  	var done bool
  1027  	done, err = future.DoneWithContext(context.Background(), client)
  1028  	if err != nil {
  1029  		err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", future.Response(), "Polling failure")
  1030  		return
  1031  	}
  1032  	if !done {
  1033  		oc.Response.Response = future.Response()
  1034  		err = azure.NewAsyncOpIncompleteError("aad.OuContainerCreateFuture")
  1035  		return
  1036  	}
  1037  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1038  	if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent {
  1039  		oc, err = client.CreateResponder(oc.Response.Response)
  1040  		if err != nil {
  1041  			err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", oc.Response.Response, "Failure responding to request")
  1042  		}
  1043  	}
  1044  	return
  1045  }
  1046  
  1047  // OuContainerDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1048  // operation.
  1049  type OuContainerDeleteFuture struct {
  1050  	azure.FutureAPI
  1051  	// Result returns the result of the asynchronous operation.
  1052  	// If the operation has not completed it will return an error.
  1053  	Result func(OuContainerClient) (autorest.Response, error)
  1054  }
  1055  
  1056  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1057  func (future *OuContainerDeleteFuture) UnmarshalJSON(body []byte) error {
  1058  	var azFuture azure.Future
  1059  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1060  		return err
  1061  	}
  1062  	future.FutureAPI = &azFuture
  1063  	future.Result = future.result
  1064  	return nil
  1065  }
  1066  
  1067  // result is the default implementation for OuContainerDeleteFuture.Result.
  1068  func (future *OuContainerDeleteFuture) result(client OuContainerClient) (ar autorest.Response, err error) {
  1069  	var done bool
  1070  	done, err = future.DoneWithContext(context.Background(), client)
  1071  	if err != nil {
  1072  		err = autorest.NewErrorWithError(err, "aad.OuContainerDeleteFuture", "Result", future.Response(), "Polling failure")
  1073  		return
  1074  	}
  1075  	if !done {
  1076  		ar.Response = future.Response()
  1077  		err = azure.NewAsyncOpIncompleteError("aad.OuContainerDeleteFuture")
  1078  		return
  1079  	}
  1080  	ar.Response = future.Response()
  1081  	return
  1082  }
  1083  
  1084  // OuContainerListResult the response from the List OuContainer operation.
  1085  type OuContainerListResult struct {
  1086  	autorest.Response `json:"-"`
  1087  	// Value - The list of OuContainer.
  1088  	Value *[]OuContainer `json:"value,omitempty"`
  1089  	// NextLink - READ-ONLY; The continuation token for the next page of results.
  1090  	NextLink *string `json:"nextLink,omitempty"`
  1091  }
  1092  
  1093  // MarshalJSON is the custom marshaler for OuContainerListResult.
  1094  func (oclr OuContainerListResult) MarshalJSON() ([]byte, error) {
  1095  	objectMap := make(map[string]interface{})
  1096  	if oclr.Value != nil {
  1097  		objectMap["value"] = oclr.Value
  1098  	}
  1099  	return json.Marshal(objectMap)
  1100  }
  1101  
  1102  // OuContainerListResultIterator provides access to a complete listing of OuContainer values.
  1103  type OuContainerListResultIterator struct {
  1104  	i    int
  1105  	page OuContainerListResultPage
  1106  }
  1107  
  1108  // NextWithContext advances to the next value.  If there was an error making
  1109  // the request the iterator does not advance and the error is returned.
  1110  func (iter *OuContainerListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1111  	if tracing.IsEnabled() {
  1112  		ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultIterator.NextWithContext")
  1113  		defer func() {
  1114  			sc := -1
  1115  			if iter.Response().Response.Response != nil {
  1116  				sc = iter.Response().Response.Response.StatusCode
  1117  			}
  1118  			tracing.EndSpan(ctx, sc, err)
  1119  		}()
  1120  	}
  1121  	iter.i++
  1122  	if iter.i < len(iter.page.Values()) {
  1123  		return nil
  1124  	}
  1125  	err = iter.page.NextWithContext(ctx)
  1126  	if err != nil {
  1127  		iter.i--
  1128  		return err
  1129  	}
  1130  	iter.i = 0
  1131  	return nil
  1132  }
  1133  
  1134  // Next advances to the next value.  If there was an error making
  1135  // the request the iterator does not advance and the error is returned.
  1136  // Deprecated: Use NextWithContext() instead.
  1137  func (iter *OuContainerListResultIterator) Next() error {
  1138  	return iter.NextWithContext(context.Background())
  1139  }
  1140  
  1141  // NotDone returns true if the enumeration should be started or is not yet complete.
  1142  func (iter OuContainerListResultIterator) NotDone() bool {
  1143  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1144  }
  1145  
  1146  // Response returns the raw server response from the last page request.
  1147  func (iter OuContainerListResultIterator) Response() OuContainerListResult {
  1148  	return iter.page.Response()
  1149  }
  1150  
  1151  // Value returns the current value or a zero-initialized value if the
  1152  // iterator has advanced beyond the end of the collection.
  1153  func (iter OuContainerListResultIterator) Value() OuContainer {
  1154  	if !iter.page.NotDone() {
  1155  		return OuContainer{}
  1156  	}
  1157  	return iter.page.Values()[iter.i]
  1158  }
  1159  
  1160  // Creates a new instance of the OuContainerListResultIterator type.
  1161  func NewOuContainerListResultIterator(page OuContainerListResultPage) OuContainerListResultIterator {
  1162  	return OuContainerListResultIterator{page: page}
  1163  }
  1164  
  1165  // IsEmpty returns true if the ListResult contains no values.
  1166  func (oclr OuContainerListResult) IsEmpty() bool {
  1167  	return oclr.Value == nil || len(*oclr.Value) == 0
  1168  }
  1169  
  1170  // hasNextLink returns true if the NextLink is not empty.
  1171  func (oclr OuContainerListResult) hasNextLink() bool {
  1172  	return oclr.NextLink != nil && len(*oclr.NextLink) != 0
  1173  }
  1174  
  1175  // ouContainerListResultPreparer prepares a request to retrieve the next set of results.
  1176  // It returns nil if no more results exist.
  1177  func (oclr OuContainerListResult) ouContainerListResultPreparer(ctx context.Context) (*http.Request, error) {
  1178  	if !oclr.hasNextLink() {
  1179  		return nil, nil
  1180  	}
  1181  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1182  		autorest.AsJSON(),
  1183  		autorest.AsGet(),
  1184  		autorest.WithBaseURL(to.String(oclr.NextLink)))
  1185  }
  1186  
  1187  // OuContainerListResultPage contains a page of OuContainer values.
  1188  type OuContainerListResultPage struct {
  1189  	fn   func(context.Context, OuContainerListResult) (OuContainerListResult, error)
  1190  	oclr OuContainerListResult
  1191  }
  1192  
  1193  // NextWithContext advances to the next page of values.  If there was an error making
  1194  // the request the page does not advance and the error is returned.
  1195  func (page *OuContainerListResultPage) NextWithContext(ctx context.Context) (err error) {
  1196  	if tracing.IsEnabled() {
  1197  		ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultPage.NextWithContext")
  1198  		defer func() {
  1199  			sc := -1
  1200  			if page.Response().Response.Response != nil {
  1201  				sc = page.Response().Response.Response.StatusCode
  1202  			}
  1203  			tracing.EndSpan(ctx, sc, err)
  1204  		}()
  1205  	}
  1206  	for {
  1207  		next, err := page.fn(ctx, page.oclr)
  1208  		if err != nil {
  1209  			return err
  1210  		}
  1211  		page.oclr = next
  1212  		if !next.hasNextLink() || !next.IsEmpty() {
  1213  			break
  1214  		}
  1215  	}
  1216  	return nil
  1217  }
  1218  
  1219  // Next advances to the next page of values.  If there was an error making
  1220  // the request the page does not advance and the error is returned.
  1221  // Deprecated: Use NextWithContext() instead.
  1222  func (page *OuContainerListResultPage) Next() error {
  1223  	return page.NextWithContext(context.Background())
  1224  }
  1225  
  1226  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1227  func (page OuContainerListResultPage) NotDone() bool {
  1228  	return !page.oclr.IsEmpty()
  1229  }
  1230  
  1231  // Response returns the raw server response from the last page request.
  1232  func (page OuContainerListResultPage) Response() OuContainerListResult {
  1233  	return page.oclr
  1234  }
  1235  
  1236  // Values returns the slice of values for the current page or nil if there are no values.
  1237  func (page OuContainerListResultPage) Values() []OuContainer {
  1238  	if page.oclr.IsEmpty() {
  1239  		return nil
  1240  	}
  1241  	return *page.oclr.Value
  1242  }
  1243  
  1244  // Creates a new instance of the OuContainerListResultPage type.
  1245  func NewOuContainerListResultPage(cur OuContainerListResult, getNextPage func(context.Context, OuContainerListResult) (OuContainerListResult, error)) OuContainerListResultPage {
  1246  	return OuContainerListResultPage{
  1247  		fn:   getNextPage,
  1248  		oclr: cur,
  1249  	}
  1250  }
  1251  
  1252  // OuContainerProperties properties of the OuContainer.
  1253  type OuContainerProperties struct {
  1254  	// TenantID - READ-ONLY; Azure Active Directory tenant id
  1255  	TenantID *string `json:"tenantId,omitempty"`
  1256  	// DomainName - READ-ONLY; The domain name of Domain Services.
  1257  	DomainName *string `json:"domainName,omitempty"`
  1258  	// DeploymentID - READ-ONLY; The Deployment id
  1259  	DeploymentID *string `json:"deploymentId,omitempty"`
  1260  	// ContainerID - READ-ONLY; The OuContainer name
  1261  	ContainerID *string `json:"containerId,omitempty"`
  1262  	// Accounts - The list of container accounts
  1263  	Accounts *[]ContainerAccount `json:"accounts,omitempty"`
  1264  	// ServiceStatus - READ-ONLY; Status of OuContainer instance
  1265  	ServiceStatus *string `json:"serviceStatus,omitempty"`
  1266  	// DistinguishedName - READ-ONLY; Distinguished Name of OuContainer instance
  1267  	DistinguishedName *string `json:"distinguishedName,omitempty"`
  1268  	// ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response.
  1269  	ProvisioningState *string `json:"provisioningState,omitempty"`
  1270  }
  1271  
  1272  // MarshalJSON is the custom marshaler for OuContainerProperties.
  1273  func (ocp OuContainerProperties) MarshalJSON() ([]byte, error) {
  1274  	objectMap := make(map[string]interface{})
  1275  	if ocp.Accounts != nil {
  1276  		objectMap["accounts"] = ocp.Accounts
  1277  	}
  1278  	return json.Marshal(objectMap)
  1279  }
  1280  
  1281  // OuContainerUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1282  // operation.
  1283  type OuContainerUpdateFuture struct {
  1284  	azure.FutureAPI
  1285  	// Result returns the result of the asynchronous operation.
  1286  	// If the operation has not completed it will return an error.
  1287  	Result func(OuContainerClient) (OuContainer, error)
  1288  }
  1289  
  1290  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1291  func (future *OuContainerUpdateFuture) UnmarshalJSON(body []byte) error {
  1292  	var azFuture azure.Future
  1293  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1294  		return err
  1295  	}
  1296  	future.FutureAPI = &azFuture
  1297  	future.Result = future.result
  1298  	return nil
  1299  }
  1300  
  1301  // result is the default implementation for OuContainerUpdateFuture.Result.
  1302  func (future *OuContainerUpdateFuture) result(client OuContainerClient) (oc OuContainer, err error) {
  1303  	var done bool
  1304  	done, err = future.DoneWithContext(context.Background(), client)
  1305  	if err != nil {
  1306  		err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", future.Response(), "Polling failure")
  1307  		return
  1308  	}
  1309  	if !done {
  1310  		oc.Response.Response = future.Response()
  1311  		err = azure.NewAsyncOpIncompleteError("aad.OuContainerUpdateFuture")
  1312  		return
  1313  	}
  1314  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1315  	if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent {
  1316  		oc, err = client.UpdateResponder(oc.Response.Response)
  1317  		if err != nil {
  1318  			err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", oc.Response.Response, "Failure responding to request")
  1319  		}
  1320  	}
  1321  	return
  1322  }
  1323  
  1324  // Resource the Resource model definition.
  1325  type Resource struct {
  1326  	// ID - READ-ONLY; Resource Id
  1327  	ID *string `json:"id,omitempty"`
  1328  	// Name - READ-ONLY; Resource name
  1329  	Name *string `json:"name,omitempty"`
  1330  	// Type - READ-ONLY; Resource type
  1331  	Type *string `json:"type,omitempty"`
  1332  	// Location - Resource location
  1333  	Location *string `json:"location,omitempty"`
  1334  	// Tags - Resource tags
  1335  	Tags map[string]*string `json:"tags"`
  1336  	// Etag - Resource etag
  1337  	Etag *string `json:"etag,omitempty"`
  1338  }
  1339  
  1340  // MarshalJSON is the custom marshaler for Resource.
  1341  func (r Resource) MarshalJSON() ([]byte, error) {
  1342  	objectMap := make(map[string]interface{})
  1343  	if r.Location != nil {
  1344  		objectMap["location"] = r.Location
  1345  	}
  1346  	if r.Tags != nil {
  1347  		objectMap["tags"] = r.Tags
  1348  	}
  1349  	if r.Etag != nil {
  1350  		objectMap["etag"] = r.Etag
  1351  	}
  1352  	return json.Marshal(objectMap)
  1353  }
  1354  
  1355  // ResourceForestSettings settings for Resource Forest
  1356  type ResourceForestSettings struct {
  1357  	// Settings - List of settings for Resource Forest
  1358  	Settings *[]ForestTrust `json:"settings,omitempty"`
  1359  	// ResourceForest - Resource Forest
  1360  	ResourceForest *string `json:"resourceForest,omitempty"`
  1361  }
  1362  

View as plain text