...

Source file src/github.com/Azure/azure-sdk-for-go/services/provisioningservices/mgmt/2022-02-05/iothub/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/provisioningservices/mgmt/2022-02-05/iothub

     1  package iothub
     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/provisioningservices/mgmt/2022-02-05/iothub"
    22  
    23  // AsyncOperationResult result of a long running operation.
    24  type AsyncOperationResult struct {
    25  	autorest.Response `json:"-"`
    26  	// Status - current status of a long running operation.
    27  	Status *string `json:"status,omitempty"`
    28  	// Error - Error message containing code, description and details
    29  	Error *ErrorMessage `json:"error,omitempty"`
    30  }
    31  
    32  // CertificateBodyDescription the JSON-serialized X509 Certificate.
    33  type CertificateBodyDescription struct {
    34  	// Certificate - Base-64 representation of the X509 leaf certificate .cer file or just .pem file content.
    35  	Certificate *string `json:"certificate,omitempty"`
    36  	// IsVerified - True indicates that the certificate will be created in verified state and proof of possession will not be required.
    37  	IsVerified *bool `json:"isVerified,omitempty"`
    38  }
    39  
    40  // CertificateListDescription the JSON-serialized array of Certificate objects.
    41  type CertificateListDescription struct {
    42  	autorest.Response `json:"-"`
    43  	// Value - The array of Certificate objects.
    44  	Value *[]CertificateResponse `json:"value,omitempty"`
    45  }
    46  
    47  // CertificateProperties the description of an X509 CA Certificate.
    48  type CertificateProperties struct {
    49  	// Subject - READ-ONLY; The certificate's subject name.
    50  	Subject *string `json:"subject,omitempty"`
    51  	// Expiry - READ-ONLY; The certificate's expiration date and time.
    52  	Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
    53  	// Thumbprint - READ-ONLY; The certificate's thumbprint.
    54  	Thumbprint *string `json:"thumbprint,omitempty"`
    55  	// IsVerified - Determines whether certificate has been verified.
    56  	IsVerified *bool `json:"isVerified,omitempty"`
    57  	// Certificate - base-64 representation of X509 certificate .cer file or just .pem file content.
    58  	Certificate *[]byte `json:"certificate,omitempty"`
    59  	// Created - READ-ONLY; The certificate's creation date and time.
    60  	Created *date.TimeRFC1123 `json:"created,omitempty"`
    61  	// Updated - READ-ONLY; The certificate's last update date and time.
    62  	Updated *date.TimeRFC1123 `json:"updated,omitempty"`
    63  }
    64  
    65  // MarshalJSON is the custom marshaler for CertificateProperties.
    66  func (cp CertificateProperties) MarshalJSON() ([]byte, error) {
    67  	objectMap := make(map[string]interface{})
    68  	if cp.IsVerified != nil {
    69  		objectMap["isVerified"] = cp.IsVerified
    70  	}
    71  	if cp.Certificate != nil {
    72  		objectMap["certificate"] = cp.Certificate
    73  	}
    74  	return json.Marshal(objectMap)
    75  }
    76  
    77  // CertificateResponse the X509 Certificate.
    78  type CertificateResponse struct {
    79  	autorest.Response `json:"-"`
    80  	// Properties - properties of a certificate
    81  	Properties *CertificateProperties `json:"properties,omitempty"`
    82  	// ID - READ-ONLY; The resource identifier.
    83  	ID *string `json:"id,omitempty"`
    84  	// Name - READ-ONLY; The name of the certificate.
    85  	Name *string `json:"name,omitempty"`
    86  	// Etag - READ-ONLY; The entity tag.
    87  	Etag *string `json:"etag,omitempty"`
    88  	// Type - READ-ONLY; The resource type.
    89  	Type *string `json:"type,omitempty"`
    90  	// SystemData - READ-ONLY
    91  	SystemData *SystemData `json:"systemData,omitempty"`
    92  }
    93  
    94  // MarshalJSON is the custom marshaler for CertificateResponse.
    95  func (cr CertificateResponse) MarshalJSON() ([]byte, error) {
    96  	objectMap := make(map[string]interface{})
    97  	if cr.Properties != nil {
    98  		objectMap["properties"] = cr.Properties
    99  	}
   100  	return json.Marshal(objectMap)
   101  }
   102  
   103  // DefinitionDescription description of the IoT hub.
   104  type DefinitionDescription struct {
   105  	// ApplyAllocationPolicy - flag for applying allocationPolicy or not for a given iot hub.
   106  	ApplyAllocationPolicy *bool `json:"applyAllocationPolicy,omitempty"`
   107  	// AllocationWeight - weight to apply for a given iot h.
   108  	AllocationWeight *int32 `json:"allocationWeight,omitempty"`
   109  	// Name - READ-ONLY; Host name of the IoT hub.
   110  	Name *string `json:"name,omitempty"`
   111  	// ConnectionString - Connection string of the IoT hub.
   112  	ConnectionString *string `json:"connectionString,omitempty"`
   113  	// Location - ARM region of the IoT hub.
   114  	Location *string `json:"location,omitempty"`
   115  }
   116  
   117  // MarshalJSON is the custom marshaler for DefinitionDescription.
   118  func (dd DefinitionDescription) MarshalJSON() ([]byte, error) {
   119  	objectMap := make(map[string]interface{})
   120  	if dd.ApplyAllocationPolicy != nil {
   121  		objectMap["applyAllocationPolicy"] = dd.ApplyAllocationPolicy
   122  	}
   123  	if dd.AllocationWeight != nil {
   124  		objectMap["allocationWeight"] = dd.AllocationWeight
   125  	}
   126  	if dd.ConnectionString != nil {
   127  		objectMap["connectionString"] = dd.ConnectionString
   128  	}
   129  	if dd.Location != nil {
   130  		objectMap["location"] = dd.Location
   131  	}
   132  	return json.Marshal(objectMap)
   133  }
   134  
   135  // ErrorDetails error details.
   136  type ErrorDetails struct {
   137  	// Code - READ-ONLY; The error code.
   138  	Code *string `json:"code,omitempty"`
   139  	// HTTPStatusCode - READ-ONLY; The HTTP status code.
   140  	HTTPStatusCode *string `json:"httpStatusCode,omitempty"`
   141  	// Message - READ-ONLY; The error message.
   142  	Message *string `json:"message,omitempty"`
   143  	// Details - READ-ONLY; The error details.
   144  	Details *string `json:"details,omitempty"`
   145  }
   146  
   147  // MarshalJSON is the custom marshaler for ErrorDetails.
   148  func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
   149  	objectMap := make(map[string]interface{})
   150  	return json.Marshal(objectMap)
   151  }
   152  
   153  // ErrorMessage error response containing message and code.
   154  type ErrorMessage struct {
   155  	// Code - standard error code
   156  	Code *string `json:"code,omitempty"`
   157  	// Message - standard error description
   158  	Message *string `json:"message,omitempty"`
   159  	// Details - detailed summary of error
   160  	Details *string `json:"details,omitempty"`
   161  }
   162  
   163  // GroupIDInformation the group information for creating a private endpoint on a provisioning service
   164  type GroupIDInformation struct {
   165  	autorest.Response `json:"-"`
   166  	// ID - READ-ONLY; The resource identifier.
   167  	ID *string `json:"id,omitempty"`
   168  	// Name - READ-ONLY; The resource name.
   169  	Name *string `json:"name,omitempty"`
   170  	// Type - READ-ONLY; The resource type.
   171  	Type *string `json:"type,omitempty"`
   172  	// Properties - The properties for a group information object
   173  	Properties *GroupIDInformationProperties `json:"properties,omitempty"`
   174  }
   175  
   176  // MarshalJSON is the custom marshaler for GroupIDInformation.
   177  func (gii GroupIDInformation) MarshalJSON() ([]byte, error) {
   178  	objectMap := make(map[string]interface{})
   179  	if gii.Properties != nil {
   180  		objectMap["properties"] = gii.Properties
   181  	}
   182  	return json.Marshal(objectMap)
   183  }
   184  
   185  // GroupIDInformationProperties the properties for a group information object
   186  type GroupIDInformationProperties struct {
   187  	// GroupID - The group id
   188  	GroupID *string `json:"groupId,omitempty"`
   189  	// RequiredMembers - The required members for a specific group id
   190  	RequiredMembers *[]string `json:"requiredMembers,omitempty"`
   191  	// RequiredZoneNames - The required DNS zones for a specific group id
   192  	RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"`
   193  }
   194  
   195  // IotDpsPropertiesDescription the service specific properties of a provisioning service, including keys,
   196  // linked iot hubs, current state, and system generated properties such as hostname and idScope
   197  type IotDpsPropertiesDescription struct {
   198  	// State - Current state of the provisioning service. Possible values include: 'StateActivating', 'StateActive', 'StateDeleting', 'StateDeleted', 'StateActivationFailed', 'StateDeletionFailed', 'StateTransitioning', 'StateSuspending', 'StateSuspended', 'StateResuming', 'StateFailingOver', 'StateFailoverFailed'
   199  	State State `json:"state,omitempty"`
   200  	// PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled'
   201  	PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`
   202  	// IPFilterRules - The IP filter rules.
   203  	IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
   204  	// PrivateEndpointConnections - Private endpoint connections created on this IotHub
   205  	PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
   206  	// ProvisioningState - The ARM provisioning state of the provisioning service.
   207  	ProvisioningState *string `json:"provisioningState,omitempty"`
   208  	// IotHubs - List of IoT hubs associated with this provisioning service.
   209  	IotHubs *[]DefinitionDescription `json:"iotHubs,omitempty"`
   210  	// AllocationPolicy - Allocation policy to be used by this provisioning service. Possible values include: 'AllocationPolicyHashed', 'AllocationPolicyGeoLatency', 'AllocationPolicyStatic'
   211  	AllocationPolicy AllocationPolicy `json:"allocationPolicy,omitempty"`
   212  	// ServiceOperationsHostName - READ-ONLY; Service endpoint for provisioning service.
   213  	ServiceOperationsHostName *string `json:"serviceOperationsHostName,omitempty"`
   214  	// DeviceProvisioningHostName - READ-ONLY; Device endpoint for this provisioning service.
   215  	DeviceProvisioningHostName *string `json:"deviceProvisioningHostName,omitempty"`
   216  	// IDScope - READ-ONLY; Unique identifier of this provisioning service.
   217  	IDScope *string `json:"idScope,omitempty"`
   218  	// AuthorizationPolicies - List of authorization keys for a provisioning service.
   219  	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"authorizationPolicies,omitempty"`
   220  	// EnableDataResidency - Optional.
   221  	// Indicates if the DPS instance has Data Residency enabled, removing the cross geo-pair disaster recovery.
   222  	EnableDataResidency *bool `json:"enableDataResidency,omitempty"`
   223  }
   224  
   225  // MarshalJSON is the custom marshaler for IotDpsPropertiesDescription.
   226  func (idpd IotDpsPropertiesDescription) MarshalJSON() ([]byte, error) {
   227  	objectMap := make(map[string]interface{})
   228  	if idpd.State != "" {
   229  		objectMap["state"] = idpd.State
   230  	}
   231  	if idpd.PublicNetworkAccess != "" {
   232  		objectMap["publicNetworkAccess"] = idpd.PublicNetworkAccess
   233  	}
   234  	if idpd.IPFilterRules != nil {
   235  		objectMap["ipFilterRules"] = idpd.IPFilterRules
   236  	}
   237  	if idpd.PrivateEndpointConnections != nil {
   238  		objectMap["privateEndpointConnections"] = idpd.PrivateEndpointConnections
   239  	}
   240  	if idpd.ProvisioningState != nil {
   241  		objectMap["provisioningState"] = idpd.ProvisioningState
   242  	}
   243  	if idpd.IotHubs != nil {
   244  		objectMap["iotHubs"] = idpd.IotHubs
   245  	}
   246  	if idpd.AllocationPolicy != "" {
   247  		objectMap["allocationPolicy"] = idpd.AllocationPolicy
   248  	}
   249  	if idpd.AuthorizationPolicies != nil {
   250  		objectMap["authorizationPolicies"] = idpd.AuthorizationPolicies
   251  	}
   252  	if idpd.EnableDataResidency != nil {
   253  		objectMap["enableDataResidency"] = idpd.EnableDataResidency
   254  	}
   255  	return json.Marshal(objectMap)
   256  }
   257  
   258  // IotDpsResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   259  // long-running operation.
   260  type IotDpsResourceCreateOrUpdateFuture struct {
   261  	azure.FutureAPI
   262  	// Result returns the result of the asynchronous operation.
   263  	// If the operation has not completed it will return an error.
   264  	Result func(IotDpsResourceClient) (ProvisioningServiceDescription, error)
   265  }
   266  
   267  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   268  func (future *IotDpsResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   269  	var azFuture azure.Future
   270  	if err := json.Unmarshal(body, &azFuture); err != nil {
   271  		return err
   272  	}
   273  	future.FutureAPI = &azFuture
   274  	future.Result = future.result
   275  	return nil
   276  }
   277  
   278  // result is the default implementation for IotDpsResourceCreateOrUpdateFuture.Result.
   279  func (future *IotDpsResourceCreateOrUpdateFuture) result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
   280  	var done bool
   281  	done, err = future.DoneWithContext(context.Background(), client)
   282  	if err != nil {
   283  		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   284  		return
   285  	}
   286  	if !done {
   287  		psd.Response.Response = future.Response()
   288  		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceCreateOrUpdateFuture")
   289  		return
   290  	}
   291  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   292  	if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
   293  		psd, err = client.CreateOrUpdateResponder(psd.Response.Response)
   294  		if err != nil {
   295  			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
   296  		}
   297  	}
   298  	return
   299  }
   300  
   301  // IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving
   302  // the results of a long-running operation.
   303  type IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture struct {
   304  	azure.FutureAPI
   305  	// Result returns the result of the asynchronous operation.
   306  	// If the operation has not completed it will return an error.
   307  	Result func(IotDpsResourceClient) (PrivateEndpointConnection, error)
   308  }
   309  
   310  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   311  func (future *IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error {
   312  	var azFuture azure.Future
   313  	if err := json.Unmarshal(body, &azFuture); err != nil {
   314  		return err
   315  	}
   316  	future.FutureAPI = &azFuture
   317  	future.Result = future.result
   318  	return nil
   319  }
   320  
   321  // result is the default implementation for IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture.Result.
   322  func (future *IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture) result(client IotDpsResourceClient) (pec PrivateEndpointConnection, err error) {
   323  	var done bool
   324  	done, err = future.DoneWithContext(context.Background(), client)
   325  	if err != nil {
   326  		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure")
   327  		return
   328  	}
   329  	if !done {
   330  		pec.Response.Response = future.Response()
   331  		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture")
   332  		return
   333  	}
   334  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   335  	if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
   336  		pec, err = client.CreateOrUpdatePrivateEndpointConnectionResponder(pec.Response.Response)
   337  		if err != nil {
   338  			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdatePrivateEndpointConnectionFuture", "Result", pec.Response.Response, "Failure responding to request")
   339  		}
   340  	}
   341  	return
   342  }
   343  
   344  // IotDpsResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   345  // operation.
   346  type IotDpsResourceDeleteFuture struct {
   347  	azure.FutureAPI
   348  	// Result returns the result of the asynchronous operation.
   349  	// If the operation has not completed it will return an error.
   350  	Result func(IotDpsResourceClient) (autorest.Response, error)
   351  }
   352  
   353  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   354  func (future *IotDpsResourceDeleteFuture) UnmarshalJSON(body []byte) error {
   355  	var azFuture azure.Future
   356  	if err := json.Unmarshal(body, &azFuture); err != nil {
   357  		return err
   358  	}
   359  	future.FutureAPI = &azFuture
   360  	future.Result = future.result
   361  	return nil
   362  }
   363  
   364  // result is the default implementation for IotDpsResourceDeleteFuture.Result.
   365  func (future *IotDpsResourceDeleteFuture) result(client IotDpsResourceClient) (ar autorest.Response, err error) {
   366  	var done bool
   367  	done, err = future.DoneWithContext(context.Background(), client)
   368  	if err != nil {
   369  		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceDeleteFuture", "Result", future.Response(), "Polling failure")
   370  		return
   371  	}
   372  	if !done {
   373  		ar.Response = future.Response()
   374  		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceDeleteFuture")
   375  		return
   376  	}
   377  	ar.Response = future.Response()
   378  	return
   379  }
   380  
   381  // IotDpsResourceDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving the
   382  // results of a long-running operation.
   383  type IotDpsResourceDeletePrivateEndpointConnectionFuture struct {
   384  	azure.FutureAPI
   385  	// Result returns the result of the asynchronous operation.
   386  	// If the operation has not completed it will return an error.
   387  	Result func(IotDpsResourceClient) (PrivateEndpointConnection, error)
   388  }
   389  
   390  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   391  func (future *IotDpsResourceDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error {
   392  	var azFuture azure.Future
   393  	if err := json.Unmarshal(body, &azFuture); err != nil {
   394  		return err
   395  	}
   396  	future.FutureAPI = &azFuture
   397  	future.Result = future.result
   398  	return nil
   399  }
   400  
   401  // result is the default implementation for IotDpsResourceDeletePrivateEndpointConnectionFuture.Result.
   402  func (future *IotDpsResourceDeletePrivateEndpointConnectionFuture) result(client IotDpsResourceClient) (pec PrivateEndpointConnection, err error) {
   403  	var done bool
   404  	done, err = future.DoneWithContext(context.Background(), client)
   405  	if err != nil {
   406  		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure")
   407  		return
   408  	}
   409  	if !done {
   410  		pec.Response.Response = future.Response()
   411  		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceDeletePrivateEndpointConnectionFuture")
   412  		return
   413  	}
   414  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   415  	if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
   416  		pec, err = client.DeletePrivateEndpointConnectionResponder(pec.Response.Response)
   417  		if err != nil {
   418  			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceDeletePrivateEndpointConnectionFuture", "Result", pec.Response.Response, "Failure responding to request")
   419  		}
   420  	}
   421  	return
   422  }
   423  
   424  // IotDpsResourceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   425  // operation.
   426  type IotDpsResourceUpdateFuture struct {
   427  	azure.FutureAPI
   428  	// Result returns the result of the asynchronous operation.
   429  	// If the operation has not completed it will return an error.
   430  	Result func(IotDpsResourceClient) (ProvisioningServiceDescription, error)
   431  }
   432  
   433  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   434  func (future *IotDpsResourceUpdateFuture) UnmarshalJSON(body []byte) error {
   435  	var azFuture azure.Future
   436  	if err := json.Unmarshal(body, &azFuture); err != nil {
   437  		return err
   438  	}
   439  	future.FutureAPI = &azFuture
   440  	future.Result = future.result
   441  	return nil
   442  }
   443  
   444  // result is the default implementation for IotDpsResourceUpdateFuture.Result.
   445  func (future *IotDpsResourceUpdateFuture) result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
   446  	var done bool
   447  	done, err = future.DoneWithContext(context.Background(), client)
   448  	if err != nil {
   449  		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", future.Response(), "Polling failure")
   450  		return
   451  	}
   452  	if !done {
   453  		psd.Response.Response = future.Response()
   454  		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceUpdateFuture")
   455  		return
   456  	}
   457  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   458  	if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
   459  		psd, err = client.UpdateResponder(psd.Response.Response)
   460  		if err != nil {
   461  			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
   462  		}
   463  	}
   464  	return
   465  }
   466  
   467  // IotDpsSkuDefinition available SKUs of tier and units.
   468  type IotDpsSkuDefinition struct {
   469  	// Name - Sku name. Possible values include: 'IotDpsSkuS1'
   470  	Name IotDpsSku `json:"name,omitempty"`
   471  }
   472  
   473  // IotDpsSkuDefinitionListResult list of available SKUs.
   474  type IotDpsSkuDefinitionListResult struct {
   475  	autorest.Response `json:"-"`
   476  	// Value - The list of SKUs
   477  	Value *[]IotDpsSkuDefinition `json:"value,omitempty"`
   478  	// NextLink - READ-ONLY; The next link.
   479  	NextLink *string `json:"nextLink,omitempty"`
   480  }
   481  
   482  // MarshalJSON is the custom marshaler for IotDpsSkuDefinitionListResult.
   483  func (idsdlr IotDpsSkuDefinitionListResult) MarshalJSON() ([]byte, error) {
   484  	objectMap := make(map[string]interface{})
   485  	if idsdlr.Value != nil {
   486  		objectMap["value"] = idsdlr.Value
   487  	}
   488  	return json.Marshal(objectMap)
   489  }
   490  
   491  // IotDpsSkuDefinitionListResultIterator provides access to a complete listing of IotDpsSkuDefinition
   492  // values.
   493  type IotDpsSkuDefinitionListResultIterator struct {
   494  	i    int
   495  	page IotDpsSkuDefinitionListResultPage
   496  }
   497  
   498  // NextWithContext advances to the next value.  If there was an error making
   499  // the request the iterator does not advance and the error is returned.
   500  func (iter *IotDpsSkuDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   501  	if tracing.IsEnabled() {
   502  		ctx = tracing.StartSpan(ctx, fqdn+"/IotDpsSkuDefinitionListResultIterator.NextWithContext")
   503  		defer func() {
   504  			sc := -1
   505  			if iter.Response().Response.Response != nil {
   506  				sc = iter.Response().Response.Response.StatusCode
   507  			}
   508  			tracing.EndSpan(ctx, sc, err)
   509  		}()
   510  	}
   511  	iter.i++
   512  	if iter.i < len(iter.page.Values()) {
   513  		return nil
   514  	}
   515  	err = iter.page.NextWithContext(ctx)
   516  	if err != nil {
   517  		iter.i--
   518  		return err
   519  	}
   520  	iter.i = 0
   521  	return nil
   522  }
   523  
   524  // Next advances to the next value.  If there was an error making
   525  // the request the iterator does not advance and the error is returned.
   526  // Deprecated: Use NextWithContext() instead.
   527  func (iter *IotDpsSkuDefinitionListResultIterator) Next() error {
   528  	return iter.NextWithContext(context.Background())
   529  }
   530  
   531  // NotDone returns true if the enumeration should be started or is not yet complete.
   532  func (iter IotDpsSkuDefinitionListResultIterator) NotDone() bool {
   533  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   534  }
   535  
   536  // Response returns the raw server response from the last page request.
   537  func (iter IotDpsSkuDefinitionListResultIterator) Response() IotDpsSkuDefinitionListResult {
   538  	return iter.page.Response()
   539  }
   540  
   541  // Value returns the current value or a zero-initialized value if the
   542  // iterator has advanced beyond the end of the collection.
   543  func (iter IotDpsSkuDefinitionListResultIterator) Value() IotDpsSkuDefinition {
   544  	if !iter.page.NotDone() {
   545  		return IotDpsSkuDefinition{}
   546  	}
   547  	return iter.page.Values()[iter.i]
   548  }
   549  
   550  // Creates a new instance of the IotDpsSkuDefinitionListResultIterator type.
   551  func NewIotDpsSkuDefinitionListResultIterator(page IotDpsSkuDefinitionListResultPage) IotDpsSkuDefinitionListResultIterator {
   552  	return IotDpsSkuDefinitionListResultIterator{page: page}
   553  }
   554  
   555  // IsEmpty returns true if the ListResult contains no values.
   556  func (idsdlr IotDpsSkuDefinitionListResult) IsEmpty() bool {
   557  	return idsdlr.Value == nil || len(*idsdlr.Value) == 0
   558  }
   559  
   560  // hasNextLink returns true if the NextLink is not empty.
   561  func (idsdlr IotDpsSkuDefinitionListResult) hasNextLink() bool {
   562  	return idsdlr.NextLink != nil && len(*idsdlr.NextLink) != 0
   563  }
   564  
   565  // iotDpsSkuDefinitionListResultPreparer prepares a request to retrieve the next set of results.
   566  // It returns nil if no more results exist.
   567  func (idsdlr IotDpsSkuDefinitionListResult) iotDpsSkuDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
   568  	if !idsdlr.hasNextLink() {
   569  		return nil, nil
   570  	}
   571  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   572  		autorest.AsJSON(),
   573  		autorest.AsGet(),
   574  		autorest.WithBaseURL(to.String(idsdlr.NextLink)))
   575  }
   576  
   577  // IotDpsSkuDefinitionListResultPage contains a page of IotDpsSkuDefinition values.
   578  type IotDpsSkuDefinitionListResultPage struct {
   579  	fn     func(context.Context, IotDpsSkuDefinitionListResult) (IotDpsSkuDefinitionListResult, error)
   580  	idsdlr IotDpsSkuDefinitionListResult
   581  }
   582  
   583  // NextWithContext advances to the next page of values.  If there was an error making
   584  // the request the page does not advance and the error is returned.
   585  func (page *IotDpsSkuDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
   586  	if tracing.IsEnabled() {
   587  		ctx = tracing.StartSpan(ctx, fqdn+"/IotDpsSkuDefinitionListResultPage.NextWithContext")
   588  		defer func() {
   589  			sc := -1
   590  			if page.Response().Response.Response != nil {
   591  				sc = page.Response().Response.Response.StatusCode
   592  			}
   593  			tracing.EndSpan(ctx, sc, err)
   594  		}()
   595  	}
   596  	for {
   597  		next, err := page.fn(ctx, page.idsdlr)
   598  		if err != nil {
   599  			return err
   600  		}
   601  		page.idsdlr = next
   602  		if !next.hasNextLink() || !next.IsEmpty() {
   603  			break
   604  		}
   605  	}
   606  	return nil
   607  }
   608  
   609  // Next advances to the next page of values.  If there was an error making
   610  // the request the page does not advance and the error is returned.
   611  // Deprecated: Use NextWithContext() instead.
   612  func (page *IotDpsSkuDefinitionListResultPage) Next() error {
   613  	return page.NextWithContext(context.Background())
   614  }
   615  
   616  // NotDone returns true if the page enumeration should be started or is not yet complete.
   617  func (page IotDpsSkuDefinitionListResultPage) NotDone() bool {
   618  	return !page.idsdlr.IsEmpty()
   619  }
   620  
   621  // Response returns the raw server response from the last page request.
   622  func (page IotDpsSkuDefinitionListResultPage) Response() IotDpsSkuDefinitionListResult {
   623  	return page.idsdlr
   624  }
   625  
   626  // Values returns the slice of values for the current page or nil if there are no values.
   627  func (page IotDpsSkuDefinitionListResultPage) Values() []IotDpsSkuDefinition {
   628  	if page.idsdlr.IsEmpty() {
   629  		return nil
   630  	}
   631  	return *page.idsdlr.Value
   632  }
   633  
   634  // Creates a new instance of the IotDpsSkuDefinitionListResultPage type.
   635  func NewIotDpsSkuDefinitionListResultPage(cur IotDpsSkuDefinitionListResult, getNextPage func(context.Context, IotDpsSkuDefinitionListResult) (IotDpsSkuDefinitionListResult, error)) IotDpsSkuDefinitionListResultPage {
   636  	return IotDpsSkuDefinitionListResultPage{
   637  		fn:     getNextPage,
   638  		idsdlr: cur,
   639  	}
   640  }
   641  
   642  // IotDpsSkuInfo list of possible provisioning service SKUs.
   643  type IotDpsSkuInfo struct {
   644  	// Name - Sku name. Possible values include: 'IotDpsSkuS1'
   645  	Name IotDpsSku `json:"name,omitempty"`
   646  	// Tier - READ-ONLY; Pricing tier name of the provisioning service.
   647  	Tier *string `json:"tier,omitempty"`
   648  	// Capacity - The number of units to provision
   649  	Capacity *int64 `json:"capacity,omitempty"`
   650  }
   651  
   652  // MarshalJSON is the custom marshaler for IotDpsSkuInfo.
   653  func (idsi IotDpsSkuInfo) MarshalJSON() ([]byte, error) {
   654  	objectMap := make(map[string]interface{})
   655  	if idsi.Name != "" {
   656  		objectMap["name"] = idsi.Name
   657  	}
   658  	if idsi.Capacity != nil {
   659  		objectMap["capacity"] = idsi.Capacity
   660  	}
   661  	return json.Marshal(objectMap)
   662  }
   663  
   664  // IPFilterRule the IP filter rules for a provisioning Service.
   665  type IPFilterRule struct {
   666  	// FilterName - The name of the IP filter rule.
   667  	FilterName *string `json:"filterName,omitempty"`
   668  	// Action - The desired action for requests captured by this rule. Possible values include: 'IPFilterActionTypeAccept', 'IPFilterActionTypeReject'
   669  	Action IPFilterActionType `json:"action,omitempty"`
   670  	// IPMask - A string that contains the IP address range in CIDR notation for the rule.
   671  	IPMask *string `json:"ipMask,omitempty"`
   672  	// Target - Target for requests captured by this rule. Possible values include: 'IPFilterTargetTypeAll', 'IPFilterTargetTypeServiceAPI', 'IPFilterTargetTypeDeviceAPI'
   673  	Target IPFilterTargetType `json:"target,omitempty"`
   674  }
   675  
   676  // ListPrivateEndpointConnection ...
   677  type ListPrivateEndpointConnection struct {
   678  	autorest.Response `json:"-"`
   679  	Value             *[]PrivateEndpointConnection `json:"value,omitempty"`
   680  }
   681  
   682  // NameAvailabilityInfo description of name availability.
   683  type NameAvailabilityInfo struct {
   684  	autorest.Response `json:"-"`
   685  	// NameAvailable - specifies if a name is available or not
   686  	NameAvailable *bool `json:"nameAvailable,omitempty"`
   687  	// Reason - specifies the reason a name is unavailable. Possible values include: 'NameUnavailabilityReasonInvalid', 'NameUnavailabilityReasonAlreadyExists'
   688  	Reason NameUnavailabilityReason `json:"reason,omitempty"`
   689  	// Message - message containing a detailed reason name is unavailable
   690  	Message *string `json:"message,omitempty"`
   691  }
   692  
   693  // Operation provisioning Service REST API operation.
   694  type Operation struct {
   695  	// Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete}
   696  	Name *string `json:"name,omitempty"`
   697  	// Display - The object that represents the operation.
   698  	Display *OperationDisplay `json:"display,omitempty"`
   699  }
   700  
   701  // MarshalJSON is the custom marshaler for Operation.
   702  func (o Operation) MarshalJSON() ([]byte, error) {
   703  	objectMap := make(map[string]interface{})
   704  	if o.Display != nil {
   705  		objectMap["display"] = o.Display
   706  	}
   707  	return json.Marshal(objectMap)
   708  }
   709  
   710  // OperationDisplay the object that represents the operation.
   711  type OperationDisplay struct {
   712  	// Provider - READ-ONLY; Service provider: Microsoft Devices.
   713  	Provider *string `json:"provider,omitempty"`
   714  	// Resource - READ-ONLY; Resource Type: ProvisioningServices.
   715  	Resource *string `json:"resource,omitempty"`
   716  	// Operation - READ-ONLY; Name of the operation.
   717  	Operation *string `json:"operation,omitempty"`
   718  }
   719  
   720  // MarshalJSON is the custom marshaler for OperationDisplay.
   721  func (o OperationDisplay) MarshalJSON() ([]byte, error) {
   722  	objectMap := make(map[string]interface{})
   723  	return json.Marshal(objectMap)
   724  }
   725  
   726  // OperationInputs input values for operation results call.
   727  type OperationInputs struct {
   728  	// Name - The name of the Provisioning Service to check.
   729  	Name *string `json:"name,omitempty"`
   730  }
   731  
   732  // OperationListResult result of the request to list provisioning service operations. It contains a list of
   733  // operations and a URL link to get the next set of results.
   734  type OperationListResult struct {
   735  	autorest.Response `json:"-"`
   736  	// Value - READ-ONLY; Provisioning service operations supported by the Microsoft.Devices resource provider.
   737  	Value *[]Operation `json:"value,omitempty"`
   738  	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
   739  	NextLink *string `json:"nextLink,omitempty"`
   740  }
   741  
   742  // MarshalJSON is the custom marshaler for OperationListResult.
   743  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
   744  	objectMap := make(map[string]interface{})
   745  	return json.Marshal(objectMap)
   746  }
   747  
   748  // OperationListResultIterator provides access to a complete listing of Operation values.
   749  type OperationListResultIterator struct {
   750  	i    int
   751  	page OperationListResultPage
   752  }
   753  
   754  // NextWithContext advances to the next value.  If there was an error making
   755  // the request the iterator does not advance and the error is returned.
   756  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   757  	if tracing.IsEnabled() {
   758  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
   759  		defer func() {
   760  			sc := -1
   761  			if iter.Response().Response.Response != nil {
   762  				sc = iter.Response().Response.Response.StatusCode
   763  			}
   764  			tracing.EndSpan(ctx, sc, err)
   765  		}()
   766  	}
   767  	iter.i++
   768  	if iter.i < len(iter.page.Values()) {
   769  		return nil
   770  	}
   771  	err = iter.page.NextWithContext(ctx)
   772  	if err != nil {
   773  		iter.i--
   774  		return err
   775  	}
   776  	iter.i = 0
   777  	return nil
   778  }
   779  
   780  // Next advances to the next value.  If there was an error making
   781  // the request the iterator does not advance and the error is returned.
   782  // Deprecated: Use NextWithContext() instead.
   783  func (iter *OperationListResultIterator) Next() error {
   784  	return iter.NextWithContext(context.Background())
   785  }
   786  
   787  // NotDone returns true if the enumeration should be started or is not yet complete.
   788  func (iter OperationListResultIterator) NotDone() bool {
   789  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   790  }
   791  
   792  // Response returns the raw server response from the last page request.
   793  func (iter OperationListResultIterator) Response() OperationListResult {
   794  	return iter.page.Response()
   795  }
   796  
   797  // Value returns the current value or a zero-initialized value if the
   798  // iterator has advanced beyond the end of the collection.
   799  func (iter OperationListResultIterator) Value() Operation {
   800  	if !iter.page.NotDone() {
   801  		return Operation{}
   802  	}
   803  	return iter.page.Values()[iter.i]
   804  }
   805  
   806  // Creates a new instance of the OperationListResultIterator type.
   807  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
   808  	return OperationListResultIterator{page: page}
   809  }
   810  
   811  // IsEmpty returns true if the ListResult contains no values.
   812  func (olr OperationListResult) IsEmpty() bool {
   813  	return olr.Value == nil || len(*olr.Value) == 0
   814  }
   815  
   816  // hasNextLink returns true if the NextLink is not empty.
   817  func (olr OperationListResult) hasNextLink() bool {
   818  	return olr.NextLink != nil && len(*olr.NextLink) != 0
   819  }
   820  
   821  // operationListResultPreparer prepares a request to retrieve the next set of results.
   822  // It returns nil if no more results exist.
   823  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
   824  	if !olr.hasNextLink() {
   825  		return nil, nil
   826  	}
   827  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   828  		autorest.AsJSON(),
   829  		autorest.AsGet(),
   830  		autorest.WithBaseURL(to.String(olr.NextLink)))
   831  }
   832  
   833  // OperationListResultPage contains a page of Operation values.
   834  type OperationListResultPage struct {
   835  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
   836  	olr OperationListResult
   837  }
   838  
   839  // NextWithContext advances to the next page of values.  If there was an error making
   840  // the request the page does not advance and the error is returned.
   841  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
   842  	if tracing.IsEnabled() {
   843  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
   844  		defer func() {
   845  			sc := -1
   846  			if page.Response().Response.Response != nil {
   847  				sc = page.Response().Response.Response.StatusCode
   848  			}
   849  			tracing.EndSpan(ctx, sc, err)
   850  		}()
   851  	}
   852  	for {
   853  		next, err := page.fn(ctx, page.olr)
   854  		if err != nil {
   855  			return err
   856  		}
   857  		page.olr = next
   858  		if !next.hasNextLink() || !next.IsEmpty() {
   859  			break
   860  		}
   861  	}
   862  	return nil
   863  }
   864  
   865  // Next advances to the next page of values.  If there was an error making
   866  // the request the page does not advance and the error is returned.
   867  // Deprecated: Use NextWithContext() instead.
   868  func (page *OperationListResultPage) Next() error {
   869  	return page.NextWithContext(context.Background())
   870  }
   871  
   872  // NotDone returns true if the page enumeration should be started or is not yet complete.
   873  func (page OperationListResultPage) NotDone() bool {
   874  	return !page.olr.IsEmpty()
   875  }
   876  
   877  // Response returns the raw server response from the last page request.
   878  func (page OperationListResultPage) Response() OperationListResult {
   879  	return page.olr
   880  }
   881  
   882  // Values returns the slice of values for the current page or nil if there are no values.
   883  func (page OperationListResultPage) Values() []Operation {
   884  	if page.olr.IsEmpty() {
   885  		return nil
   886  	}
   887  	return *page.olr.Value
   888  }
   889  
   890  // Creates a new instance of the OperationListResultPage type.
   891  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
   892  	return OperationListResultPage{
   893  		fn:  getNextPage,
   894  		olr: cur,
   895  	}
   896  }
   897  
   898  // PrivateEndpoint the private endpoint property of a private endpoint connection
   899  type PrivateEndpoint struct {
   900  	// ID - READ-ONLY; The resource identifier.
   901  	ID *string `json:"id,omitempty"`
   902  }
   903  
   904  // MarshalJSON is the custom marshaler for PrivateEndpoint.
   905  func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) {
   906  	objectMap := make(map[string]interface{})
   907  	return json.Marshal(objectMap)
   908  }
   909  
   910  // PrivateEndpointConnection the private endpoint connection of a provisioning service
   911  type PrivateEndpointConnection struct {
   912  	autorest.Response `json:"-"`
   913  	// ID - READ-ONLY; The resource identifier.
   914  	ID *string `json:"id,omitempty"`
   915  	// Name - READ-ONLY; The resource name.
   916  	Name *string `json:"name,omitempty"`
   917  	// Type - READ-ONLY; The resource type.
   918  	Type *string `json:"type,omitempty"`
   919  	// Properties - The properties of a private endpoint connection
   920  	Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"`
   921  	// SystemData - READ-ONLY
   922  	SystemData *SystemData `json:"systemData,omitempty"`
   923  }
   924  
   925  // MarshalJSON is the custom marshaler for PrivateEndpointConnection.
   926  func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
   927  	objectMap := make(map[string]interface{})
   928  	if pec.Properties != nil {
   929  		objectMap["properties"] = pec.Properties
   930  	}
   931  	return json.Marshal(objectMap)
   932  }
   933  
   934  // PrivateEndpointConnectionProperties the properties of a private endpoint connection
   935  type PrivateEndpointConnectionProperties struct {
   936  	// PrivateEndpoint - The private endpoint property of a private endpoint connection
   937  	PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"`
   938  	// PrivateLinkServiceConnectionState - The current state of a private endpoint connection
   939  	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"`
   940  }
   941  
   942  // PrivateLinkResources the available private link resources for a provisioning service
   943  type PrivateLinkResources struct {
   944  	autorest.Response `json:"-"`
   945  	// Value - The list of available private link resources for a provisioning service
   946  	Value *[]GroupIDInformation `json:"value,omitempty"`
   947  }
   948  
   949  // PrivateLinkServiceConnectionState the current state of a private endpoint connection
   950  type PrivateLinkServiceConnectionState struct {
   951  	// Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected'
   952  	Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"`
   953  	// Description - The description for the current state of a private endpoint connection
   954  	Description *string `json:"description,omitempty"`
   955  	// ActionsRequired - Actions required for a private endpoint connection
   956  	ActionsRequired *string `json:"actionsRequired,omitempty"`
   957  }
   958  
   959  // ProvisioningServiceDescription the description of the provisioning service.
   960  type ProvisioningServiceDescription struct {
   961  	autorest.Response `json:"-"`
   962  	// Etag - The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
   963  	Etag *string `json:"etag,omitempty"`
   964  	// Properties - Service specific properties for a provisioning service
   965  	Properties *IotDpsPropertiesDescription `json:"properties,omitempty"`
   966  	// Sku - Sku info for a provisioning Service.
   967  	Sku *IotDpsSkuInfo `json:"sku,omitempty"`
   968  	// SystemData - READ-ONLY
   969  	SystemData *SystemData `json:"systemData,omitempty"`
   970  	// ID - READ-ONLY; The resource identifier.
   971  	ID *string `json:"id,omitempty"`
   972  	// Name - READ-ONLY; The resource name.
   973  	Name *string `json:"name,omitempty"`
   974  	// Type - READ-ONLY; The resource type.
   975  	Type *string `json:"type,omitempty"`
   976  	// Location - The resource location.
   977  	Location *string `json:"location,omitempty"`
   978  	// Tags - The resource tags.
   979  	Tags map[string]*string `json:"tags"`
   980  }
   981  
   982  // MarshalJSON is the custom marshaler for ProvisioningServiceDescription.
   983  func (psd ProvisioningServiceDescription) MarshalJSON() ([]byte, error) {
   984  	objectMap := make(map[string]interface{})
   985  	if psd.Etag != nil {
   986  		objectMap["etag"] = psd.Etag
   987  	}
   988  	if psd.Properties != nil {
   989  		objectMap["properties"] = psd.Properties
   990  	}
   991  	if psd.Sku != nil {
   992  		objectMap["sku"] = psd.Sku
   993  	}
   994  	if psd.Location != nil {
   995  		objectMap["location"] = psd.Location
   996  	}
   997  	if psd.Tags != nil {
   998  		objectMap["tags"] = psd.Tags
   999  	}
  1000  	return json.Marshal(objectMap)
  1001  }
  1002  
  1003  // ProvisioningServiceDescriptionListResult list of provisioning service descriptions.
  1004  type ProvisioningServiceDescriptionListResult struct {
  1005  	autorest.Response `json:"-"`
  1006  	// Value - List of provisioning service descriptions.
  1007  	Value *[]ProvisioningServiceDescription `json:"value,omitempty"`
  1008  	// NextLink - READ-ONLY; the next link
  1009  	NextLink *string `json:"nextLink,omitempty"`
  1010  }
  1011  
  1012  // MarshalJSON is the custom marshaler for ProvisioningServiceDescriptionListResult.
  1013  func (psdlr ProvisioningServiceDescriptionListResult) MarshalJSON() ([]byte, error) {
  1014  	objectMap := make(map[string]interface{})
  1015  	if psdlr.Value != nil {
  1016  		objectMap["value"] = psdlr.Value
  1017  	}
  1018  	return json.Marshal(objectMap)
  1019  }
  1020  
  1021  // ProvisioningServiceDescriptionListResultIterator provides access to a complete listing of
  1022  // ProvisioningServiceDescription values.
  1023  type ProvisioningServiceDescriptionListResultIterator struct {
  1024  	i    int
  1025  	page ProvisioningServiceDescriptionListResultPage
  1026  }
  1027  
  1028  // NextWithContext advances to the next value.  If there was an error making
  1029  // the request the iterator does not advance and the error is returned.
  1030  func (iter *ProvisioningServiceDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1031  	if tracing.IsEnabled() {
  1032  		ctx = tracing.StartSpan(ctx, fqdn+"/ProvisioningServiceDescriptionListResultIterator.NextWithContext")
  1033  		defer func() {
  1034  			sc := -1
  1035  			if iter.Response().Response.Response != nil {
  1036  				sc = iter.Response().Response.Response.StatusCode
  1037  			}
  1038  			tracing.EndSpan(ctx, sc, err)
  1039  		}()
  1040  	}
  1041  	iter.i++
  1042  	if iter.i < len(iter.page.Values()) {
  1043  		return nil
  1044  	}
  1045  	err = iter.page.NextWithContext(ctx)
  1046  	if err != nil {
  1047  		iter.i--
  1048  		return err
  1049  	}
  1050  	iter.i = 0
  1051  	return nil
  1052  }
  1053  
  1054  // Next advances to the next value.  If there was an error making
  1055  // the request the iterator does not advance and the error is returned.
  1056  // Deprecated: Use NextWithContext() instead.
  1057  func (iter *ProvisioningServiceDescriptionListResultIterator) Next() error {
  1058  	return iter.NextWithContext(context.Background())
  1059  }
  1060  
  1061  // NotDone returns true if the enumeration should be started or is not yet complete.
  1062  func (iter ProvisioningServiceDescriptionListResultIterator) NotDone() bool {
  1063  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1064  }
  1065  
  1066  // Response returns the raw server response from the last page request.
  1067  func (iter ProvisioningServiceDescriptionListResultIterator) Response() ProvisioningServiceDescriptionListResult {
  1068  	return iter.page.Response()
  1069  }
  1070  
  1071  // Value returns the current value or a zero-initialized value if the
  1072  // iterator has advanced beyond the end of the collection.
  1073  func (iter ProvisioningServiceDescriptionListResultIterator) Value() ProvisioningServiceDescription {
  1074  	if !iter.page.NotDone() {
  1075  		return ProvisioningServiceDescription{}
  1076  	}
  1077  	return iter.page.Values()[iter.i]
  1078  }
  1079  
  1080  // Creates a new instance of the ProvisioningServiceDescriptionListResultIterator type.
  1081  func NewProvisioningServiceDescriptionListResultIterator(page ProvisioningServiceDescriptionListResultPage) ProvisioningServiceDescriptionListResultIterator {
  1082  	return ProvisioningServiceDescriptionListResultIterator{page: page}
  1083  }
  1084  
  1085  // IsEmpty returns true if the ListResult contains no values.
  1086  func (psdlr ProvisioningServiceDescriptionListResult) IsEmpty() bool {
  1087  	return psdlr.Value == nil || len(*psdlr.Value) == 0
  1088  }
  1089  
  1090  // hasNextLink returns true if the NextLink is not empty.
  1091  func (psdlr ProvisioningServiceDescriptionListResult) hasNextLink() bool {
  1092  	return psdlr.NextLink != nil && len(*psdlr.NextLink) != 0
  1093  }
  1094  
  1095  // provisioningServiceDescriptionListResultPreparer prepares a request to retrieve the next set of results.
  1096  // It returns nil if no more results exist.
  1097  func (psdlr ProvisioningServiceDescriptionListResult) provisioningServiceDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1098  	if !psdlr.hasNextLink() {
  1099  		return nil, nil
  1100  	}
  1101  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1102  		autorest.AsJSON(),
  1103  		autorest.AsGet(),
  1104  		autorest.WithBaseURL(to.String(psdlr.NextLink)))
  1105  }
  1106  
  1107  // ProvisioningServiceDescriptionListResultPage contains a page of ProvisioningServiceDescription values.
  1108  type ProvisioningServiceDescriptionListResultPage struct {
  1109  	fn    func(context.Context, ProvisioningServiceDescriptionListResult) (ProvisioningServiceDescriptionListResult, error)
  1110  	psdlr ProvisioningServiceDescriptionListResult
  1111  }
  1112  
  1113  // NextWithContext advances to the next page of values.  If there was an error making
  1114  // the request the page does not advance and the error is returned.
  1115  func (page *ProvisioningServiceDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1116  	if tracing.IsEnabled() {
  1117  		ctx = tracing.StartSpan(ctx, fqdn+"/ProvisioningServiceDescriptionListResultPage.NextWithContext")
  1118  		defer func() {
  1119  			sc := -1
  1120  			if page.Response().Response.Response != nil {
  1121  				sc = page.Response().Response.Response.StatusCode
  1122  			}
  1123  			tracing.EndSpan(ctx, sc, err)
  1124  		}()
  1125  	}
  1126  	for {
  1127  		next, err := page.fn(ctx, page.psdlr)
  1128  		if err != nil {
  1129  			return err
  1130  		}
  1131  		page.psdlr = next
  1132  		if !next.hasNextLink() || !next.IsEmpty() {
  1133  			break
  1134  		}
  1135  	}
  1136  	return nil
  1137  }
  1138  
  1139  // Next advances to the next page of values.  If there was an error making
  1140  // the request the page does not advance and the error is returned.
  1141  // Deprecated: Use NextWithContext() instead.
  1142  func (page *ProvisioningServiceDescriptionListResultPage) Next() error {
  1143  	return page.NextWithContext(context.Background())
  1144  }
  1145  
  1146  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1147  func (page ProvisioningServiceDescriptionListResultPage) NotDone() bool {
  1148  	return !page.psdlr.IsEmpty()
  1149  }
  1150  
  1151  // Response returns the raw server response from the last page request.
  1152  func (page ProvisioningServiceDescriptionListResultPage) Response() ProvisioningServiceDescriptionListResult {
  1153  	return page.psdlr
  1154  }
  1155  
  1156  // Values returns the slice of values for the current page or nil if there are no values.
  1157  func (page ProvisioningServiceDescriptionListResultPage) Values() []ProvisioningServiceDescription {
  1158  	if page.psdlr.IsEmpty() {
  1159  		return nil
  1160  	}
  1161  	return *page.psdlr.Value
  1162  }
  1163  
  1164  // Creates a new instance of the ProvisioningServiceDescriptionListResultPage type.
  1165  func NewProvisioningServiceDescriptionListResultPage(cur ProvisioningServiceDescriptionListResult, getNextPage func(context.Context, ProvisioningServiceDescriptionListResult) (ProvisioningServiceDescriptionListResult, error)) ProvisioningServiceDescriptionListResultPage {
  1166  	return ProvisioningServiceDescriptionListResultPage{
  1167  		fn:    getNextPage,
  1168  		psdlr: cur,
  1169  	}
  1170  }
  1171  
  1172  // Resource the common properties of an Azure resource.
  1173  type Resource struct {
  1174  	// ID - READ-ONLY; The resource identifier.
  1175  	ID *string `json:"id,omitempty"`
  1176  	// Name - READ-ONLY; The resource name.
  1177  	Name *string `json:"name,omitempty"`
  1178  	// Type - READ-ONLY; The resource type.
  1179  	Type *string `json:"type,omitempty"`
  1180  	// Location - The resource location.
  1181  	Location *string `json:"location,omitempty"`
  1182  	// Tags - The resource tags.
  1183  	Tags map[string]*string `json:"tags"`
  1184  }
  1185  
  1186  // MarshalJSON is the custom marshaler for Resource.
  1187  func (r Resource) MarshalJSON() ([]byte, error) {
  1188  	objectMap := make(map[string]interface{})
  1189  	if r.Location != nil {
  1190  		objectMap["location"] = r.Location
  1191  	}
  1192  	if r.Tags != nil {
  1193  		objectMap["tags"] = r.Tags
  1194  	}
  1195  	return json.Marshal(objectMap)
  1196  }
  1197  
  1198  // SharedAccessSignatureAuthorizationRuleAccessRightsDescription description of the shared access key.
  1199  type SharedAccessSignatureAuthorizationRuleAccessRightsDescription struct {
  1200  	autorest.Response `json:"-"`
  1201  	// KeyName - Name of the key.
  1202  	KeyName *string `json:"keyName,omitempty"`
  1203  	// PrimaryKey - Primary SAS key value.
  1204  	PrimaryKey *string `json:"primaryKey,omitempty"`
  1205  	// SecondaryKey - Secondary SAS key value.
  1206  	SecondaryKey *string `json:"secondaryKey,omitempty"`
  1207  	// Rights - Rights that this key has. Possible values include: 'AccessRightsDescriptionServiceConfig', 'AccessRightsDescriptionEnrollmentRead', 'AccessRightsDescriptionEnrollmentWrite', 'AccessRightsDescriptionDeviceConnect', 'AccessRightsDescriptionRegistrationStatusRead', 'AccessRightsDescriptionRegistrationStatusWrite'
  1208  	Rights AccessRightsDescription `json:"rights,omitempty"`
  1209  }
  1210  
  1211  // SharedAccessSignatureAuthorizationRuleListResult list of shared access keys.
  1212  type SharedAccessSignatureAuthorizationRuleListResult struct {
  1213  	autorest.Response `json:"-"`
  1214  	// Value - The list of shared access policies.
  1215  	Value *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"value,omitempty"`
  1216  	// NextLink - READ-ONLY; The next link.
  1217  	NextLink *string `json:"nextLink,omitempty"`
  1218  }
  1219  
  1220  // MarshalJSON is the custom marshaler for SharedAccessSignatureAuthorizationRuleListResult.
  1221  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
  1222  	objectMap := make(map[string]interface{})
  1223  	if sasarlr.Value != nil {
  1224  		objectMap["value"] = sasarlr.Value
  1225  	}
  1226  	return json.Marshal(objectMap)
  1227  }
  1228  
  1229  // SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
  1230  // SharedAccessSignatureAuthorizationRuleAccessRightsDescription values.
  1231  type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
  1232  	i    int
  1233  	page SharedAccessSignatureAuthorizationRuleListResultPage
  1234  }
  1235  
  1236  // NextWithContext advances to the next value.  If there was an error making
  1237  // the request the iterator does not advance and the error is returned.
  1238  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1239  	if tracing.IsEnabled() {
  1240  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
  1241  		defer func() {
  1242  			sc := -1
  1243  			if iter.Response().Response.Response != nil {
  1244  				sc = iter.Response().Response.Response.StatusCode
  1245  			}
  1246  			tracing.EndSpan(ctx, sc, err)
  1247  		}()
  1248  	}
  1249  	iter.i++
  1250  	if iter.i < len(iter.page.Values()) {
  1251  		return nil
  1252  	}
  1253  	err = iter.page.NextWithContext(ctx)
  1254  	if err != nil {
  1255  		iter.i--
  1256  		return err
  1257  	}
  1258  	iter.i = 0
  1259  	return nil
  1260  }
  1261  
  1262  // Next advances to the next value.  If there was an error making
  1263  // the request the iterator does not advance and the error is returned.
  1264  // Deprecated: Use NextWithContext() instead.
  1265  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
  1266  	return iter.NextWithContext(context.Background())
  1267  }
  1268  
  1269  // NotDone returns true if the enumeration should be started or is not yet complete.
  1270  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
  1271  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1272  }
  1273  
  1274  // Response returns the raw server response from the last page request.
  1275  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1276  	return iter.page.Response()
  1277  }
  1278  
  1279  // Value returns the current value or a zero-initialized value if the
  1280  // iterator has advanced beyond the end of the collection.
  1281  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
  1282  	if !iter.page.NotDone() {
  1283  		return SharedAccessSignatureAuthorizationRuleAccessRightsDescription{}
  1284  	}
  1285  	return iter.page.Values()[iter.i]
  1286  }
  1287  
  1288  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type.
  1289  func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
  1290  	return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
  1291  }
  1292  
  1293  // IsEmpty returns true if the ListResult contains no values.
  1294  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
  1295  	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
  1296  }
  1297  
  1298  // hasNextLink returns true if the NextLink is not empty.
  1299  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
  1300  	return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
  1301  }
  1302  
  1303  // sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
  1304  // It returns nil if no more results exist.
  1305  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  1306  	if !sasarlr.hasNextLink() {
  1307  		return nil, nil
  1308  	}
  1309  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1310  		autorest.AsJSON(),
  1311  		autorest.AsGet(),
  1312  		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
  1313  }
  1314  
  1315  // SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
  1316  // SharedAccessSignatureAuthorizationRuleAccessRightsDescription values.
  1317  type SharedAccessSignatureAuthorizationRuleListResultPage struct {
  1318  	fn      func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
  1319  	sasarlr SharedAccessSignatureAuthorizationRuleListResult
  1320  }
  1321  
  1322  // NextWithContext advances to the next page of values.  If there was an error making
  1323  // the request the page does not advance and the error is returned.
  1324  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  1325  	if tracing.IsEnabled() {
  1326  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
  1327  		defer func() {
  1328  			sc := -1
  1329  			if page.Response().Response.Response != nil {
  1330  				sc = page.Response().Response.Response.StatusCode
  1331  			}
  1332  			tracing.EndSpan(ctx, sc, err)
  1333  		}()
  1334  	}
  1335  	for {
  1336  		next, err := page.fn(ctx, page.sasarlr)
  1337  		if err != nil {
  1338  			return err
  1339  		}
  1340  		page.sasarlr = next
  1341  		if !next.hasNextLink() || !next.IsEmpty() {
  1342  			break
  1343  		}
  1344  	}
  1345  	return nil
  1346  }
  1347  
  1348  // Next advances to the next page of values.  If there was an error making
  1349  // the request the page does not advance and the error is returned.
  1350  // Deprecated: Use NextWithContext() instead.
  1351  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
  1352  	return page.NextWithContext(context.Background())
  1353  }
  1354  
  1355  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1356  func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
  1357  	return !page.sasarlr.IsEmpty()
  1358  }
  1359  
  1360  // Response returns the raw server response from the last page request.
  1361  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1362  	return page.sasarlr
  1363  }
  1364  
  1365  // Values returns the slice of values for the current page or nil if there are no values.
  1366  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
  1367  	if page.sasarlr.IsEmpty() {
  1368  		return nil
  1369  	}
  1370  	return *page.sasarlr.Value
  1371  }
  1372  
  1373  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type.
  1374  func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
  1375  	return SharedAccessSignatureAuthorizationRuleListResultPage{
  1376  		fn:      getNextPage,
  1377  		sasarlr: cur,
  1378  	}
  1379  }
  1380  
  1381  // SystemData metadata pertaining to creation and last modification of the resource.
  1382  type SystemData struct {
  1383  	// CreatedBy - The identity that created the resource.
  1384  	CreatedBy *string `json:"createdBy,omitempty"`
  1385  	// CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  1386  	CreatedByType CreatedByType `json:"createdByType,omitempty"`
  1387  	// CreatedAt - The timestamp of resource creation (UTC).
  1388  	CreatedAt *date.Time `json:"createdAt,omitempty"`
  1389  	// LastModifiedBy - The identity that last modified the resource.
  1390  	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
  1391  	// LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  1392  	LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
  1393  	// LastModifiedAt - The timestamp of resource last modification (UTC)
  1394  	LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
  1395  }
  1396  
  1397  // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a
  1398  // Provisioning Service instance.
  1399  type TagsResource struct {
  1400  	// Tags - Resource tags
  1401  	Tags map[string]*string `json:"tags"`
  1402  }
  1403  
  1404  // MarshalJSON is the custom marshaler for TagsResource.
  1405  func (tr TagsResource) MarshalJSON() ([]byte, error) {
  1406  	objectMap := make(map[string]interface{})
  1407  	if tr.Tags != nil {
  1408  		objectMap["tags"] = tr.Tags
  1409  	}
  1410  	return json.Marshal(objectMap)
  1411  }
  1412  
  1413  // VerificationCodeRequest the JSON-serialized leaf certificate
  1414  type VerificationCodeRequest struct {
  1415  	// Certificate - base-64 representation of X509 certificate .cer file or just .pem file content.
  1416  	Certificate *string `json:"certificate,omitempty"`
  1417  }
  1418  
  1419  // VerificationCodeResponse description of the response of the verification code.
  1420  type VerificationCodeResponse struct {
  1421  	autorest.Response `json:"-"`
  1422  	// Name - READ-ONLY; Name of certificate.
  1423  	Name *string `json:"name,omitempty"`
  1424  	// Etag - READ-ONLY; Request etag.
  1425  	Etag *string `json:"etag,omitempty"`
  1426  	// ID - READ-ONLY; The resource identifier.
  1427  	ID *string `json:"id,omitempty"`
  1428  	// Type - READ-ONLY; The resource type.
  1429  	Type       *string                             `json:"type,omitempty"`
  1430  	Properties *VerificationCodeResponseProperties `json:"properties,omitempty"`
  1431  }
  1432  
  1433  // MarshalJSON is the custom marshaler for VerificationCodeResponse.
  1434  func (vcr VerificationCodeResponse) MarshalJSON() ([]byte, error) {
  1435  	objectMap := make(map[string]interface{})
  1436  	if vcr.Properties != nil {
  1437  		objectMap["properties"] = vcr.Properties
  1438  	}
  1439  	return json.Marshal(objectMap)
  1440  }
  1441  
  1442  // VerificationCodeResponseProperties ...
  1443  type VerificationCodeResponseProperties struct {
  1444  	// VerificationCode - Verification code.
  1445  	VerificationCode *string `json:"verificationCode,omitempty"`
  1446  	// Subject - Certificate subject.
  1447  	Subject *string `json:"subject,omitempty"`
  1448  	// Expiry - Code expiry.
  1449  	Expiry *string `json:"expiry,omitempty"`
  1450  	// Thumbprint - Certificate thumbprint.
  1451  	Thumbprint *string `json:"thumbprint,omitempty"`
  1452  	// IsVerified - Indicate if the certificate is verified by owner of private key.
  1453  	IsVerified *bool `json:"isVerified,omitempty"`
  1454  	// Certificate - base-64 representation of X509 certificate .cer file or just .pem file content.
  1455  	Certificate *[]byte `json:"certificate,omitempty"`
  1456  	// Created - Certificate created time.
  1457  	Created *string `json:"created,omitempty"`
  1458  	// Updated - Certificate updated time.
  1459  	Updated *string `json:"updated,omitempty"`
  1460  }
  1461  

View as plain text