...

Source file src/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2016-02-03/devices/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2016-02-03/devices

     1  package devices
     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/iothub/mgmt/2016-02-03/devices"
    22  
    23  // CloudToDeviceProperties the IoT hub cloud-to-device messaging properties.
    24  type CloudToDeviceProperties struct {
    25  	// MaxDeliveryCount - The max delivery count for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
    26  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
    27  	// DefaultTTLAsIso8601 - The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
    28  	DefaultTTLAsIso8601 *string             `json:"defaultTtlAsIso8601,omitempty"`
    29  	Feedback            *FeedbackProperties `json:"feedback,omitempty"`
    30  }
    31  
    32  // ErrorDetails error details.
    33  type ErrorDetails struct {
    34  	// Code - READ-ONLY; The error code.
    35  	Code *string `json:"Code,omitempty"`
    36  	// HTTPStatusCode - READ-ONLY; The HTTP status code.
    37  	HTTPStatusCode *string `json:"HttpStatusCode,omitempty"`
    38  	// Message - READ-ONLY; The error message.
    39  	Message *string `json:"Message,omitempty"`
    40  	// Details - READ-ONLY; The error details.
    41  	Details *string `json:"Details,omitempty"`
    42  }
    43  
    44  // MarshalJSON is the custom marshaler for ErrorDetails.
    45  func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
    46  	objectMap := make(map[string]interface{})
    47  	return json.Marshal(objectMap)
    48  }
    49  
    50  // EventHubConsumerGroupInfo the properties of the EventHubConsumerGroupInfo object.
    51  type EventHubConsumerGroupInfo struct {
    52  	autorest.Response `json:"-"`
    53  	// Tags - The tags.
    54  	Tags map[string]*string `json:"tags"`
    55  	// ID - The Event Hub-compatible consumer group identifier.
    56  	ID *string `json:"id,omitempty"`
    57  	// Name - The Event Hub-compatible consumer group name.
    58  	Name *string `json:"name,omitempty"`
    59  }
    60  
    61  // MarshalJSON is the custom marshaler for EventHubConsumerGroupInfo.
    62  func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) {
    63  	objectMap := make(map[string]interface{})
    64  	if ehcgi.Tags != nil {
    65  		objectMap["tags"] = ehcgi.Tags
    66  	}
    67  	if ehcgi.ID != nil {
    68  		objectMap["id"] = ehcgi.ID
    69  	}
    70  	if ehcgi.Name != nil {
    71  		objectMap["name"] = ehcgi.Name
    72  	}
    73  	return json.Marshal(objectMap)
    74  }
    75  
    76  // EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names
    77  // with a next link.
    78  type EventHubConsumerGroupsListResult struct {
    79  	autorest.Response `json:"-"`
    80  	// Value - The array of Event Hub-compatible consumer group names.
    81  	Value *[]string `json:"value,omitempty"`
    82  	// NextLink - READ-ONLY; The next link.
    83  	NextLink *string `json:"nextLink,omitempty"`
    84  }
    85  
    86  // MarshalJSON is the custom marshaler for EventHubConsumerGroupsListResult.
    87  func (ehcglr EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) {
    88  	objectMap := make(map[string]interface{})
    89  	if ehcglr.Value != nil {
    90  		objectMap["value"] = ehcglr.Value
    91  	}
    92  	return json.Marshal(objectMap)
    93  }
    94  
    95  // EventHubConsumerGroupsListResultIterator provides access to a complete listing of string values.
    96  type EventHubConsumerGroupsListResultIterator struct {
    97  	i    int
    98  	page EventHubConsumerGroupsListResultPage
    99  }
   100  
   101  // NextWithContext advances to the next value.  If there was an error making
   102  // the request the iterator does not advance and the error is returned.
   103  func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) {
   104  	if tracing.IsEnabled() {
   105  		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext")
   106  		defer func() {
   107  			sc := -1
   108  			if iter.Response().Response.Response != nil {
   109  				sc = iter.Response().Response.Response.StatusCode
   110  			}
   111  			tracing.EndSpan(ctx, sc, err)
   112  		}()
   113  	}
   114  	iter.i++
   115  	if iter.i < len(iter.page.Values()) {
   116  		return nil
   117  	}
   118  	err = iter.page.NextWithContext(ctx)
   119  	if err != nil {
   120  		iter.i--
   121  		return err
   122  	}
   123  	iter.i = 0
   124  	return nil
   125  }
   126  
   127  // Next advances to the next value.  If there was an error making
   128  // the request the iterator does not advance and the error is returned.
   129  // Deprecated: Use NextWithContext() instead.
   130  func (iter *EventHubConsumerGroupsListResultIterator) Next() error {
   131  	return iter.NextWithContext(context.Background())
   132  }
   133  
   134  // NotDone returns true if the enumeration should be started or is not yet complete.
   135  func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool {
   136  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   137  }
   138  
   139  // Response returns the raw server response from the last page request.
   140  func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult {
   141  	return iter.page.Response()
   142  }
   143  
   144  // Value returns the current value or a zero-initialized value if the
   145  // iterator has advanced beyond the end of the collection.
   146  func (iter EventHubConsumerGroupsListResultIterator) Value() string {
   147  	if !iter.page.NotDone() {
   148  		return ""
   149  	}
   150  	return iter.page.Values()[iter.i]
   151  }
   152  
   153  // Creates a new instance of the EventHubConsumerGroupsListResultIterator type.
   154  func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator {
   155  	return EventHubConsumerGroupsListResultIterator{page: page}
   156  }
   157  
   158  // IsEmpty returns true if the ListResult contains no values.
   159  func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool {
   160  	return ehcglr.Value == nil || len(*ehcglr.Value) == 0
   161  }
   162  
   163  // hasNextLink returns true if the NextLink is not empty.
   164  func (ehcglr EventHubConsumerGroupsListResult) hasNextLink() bool {
   165  	return ehcglr.NextLink != nil && len(*ehcglr.NextLink) != 0
   166  }
   167  
   168  // eventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results.
   169  // It returns nil if no more results exist.
   170  func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) {
   171  	if !ehcglr.hasNextLink() {
   172  		return nil, nil
   173  	}
   174  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   175  		autorest.AsJSON(),
   176  		autorest.AsGet(),
   177  		autorest.WithBaseURL(to.String(ehcglr.NextLink)))
   178  }
   179  
   180  // EventHubConsumerGroupsListResultPage contains a page of string values.
   181  type EventHubConsumerGroupsListResultPage struct {
   182  	fn     func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)
   183  	ehcglr EventHubConsumerGroupsListResult
   184  }
   185  
   186  // NextWithContext advances to the next page of values.  If there was an error making
   187  // the request the page does not advance and the error is returned.
   188  func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) {
   189  	if tracing.IsEnabled() {
   190  		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.NextWithContext")
   191  		defer func() {
   192  			sc := -1
   193  			if page.Response().Response.Response != nil {
   194  				sc = page.Response().Response.Response.StatusCode
   195  			}
   196  			tracing.EndSpan(ctx, sc, err)
   197  		}()
   198  	}
   199  	for {
   200  		next, err := page.fn(ctx, page.ehcglr)
   201  		if err != nil {
   202  			return err
   203  		}
   204  		page.ehcglr = next
   205  		if !next.hasNextLink() || !next.IsEmpty() {
   206  			break
   207  		}
   208  	}
   209  	return nil
   210  }
   211  
   212  // Next advances to the next page of values.  If there was an error making
   213  // the request the page does not advance and the error is returned.
   214  // Deprecated: Use NextWithContext() instead.
   215  func (page *EventHubConsumerGroupsListResultPage) Next() error {
   216  	return page.NextWithContext(context.Background())
   217  }
   218  
   219  // NotDone returns true if the page enumeration should be started or is not yet complete.
   220  func (page EventHubConsumerGroupsListResultPage) NotDone() bool {
   221  	return !page.ehcglr.IsEmpty()
   222  }
   223  
   224  // Response returns the raw server response from the last page request.
   225  func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult {
   226  	return page.ehcglr
   227  }
   228  
   229  // Values returns the slice of values for the current page or nil if there are no values.
   230  func (page EventHubConsumerGroupsListResultPage) Values() []string {
   231  	if page.ehcglr.IsEmpty() {
   232  		return nil
   233  	}
   234  	return *page.ehcglr.Value
   235  }
   236  
   237  // Creates a new instance of the EventHubConsumerGroupsListResultPage type.
   238  func NewEventHubConsumerGroupsListResultPage(cur EventHubConsumerGroupsListResult, getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage {
   239  	return EventHubConsumerGroupsListResultPage{
   240  		fn:     getNextPage,
   241  		ehcglr: cur,
   242  	}
   243  }
   244  
   245  // EventHubProperties the properties of the provisioned Event Hub-compatible endpoint used by the IoT hub.
   246  type EventHubProperties struct {
   247  	// RetentionTimeInDays - The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages
   248  	RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"`
   249  	// PartitionCount - The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages.
   250  	PartitionCount *int32 `json:"partitionCount,omitempty"`
   251  	// PartitionIds - READ-ONLY; The partition ids in the Event Hub-compatible endpoint.
   252  	PartitionIds *[]string `json:"partitionIds,omitempty"`
   253  	// Path - READ-ONLY; The Event Hub-compatible name.
   254  	Path *string `json:"path,omitempty"`
   255  	// Endpoint - READ-ONLY; The Event Hub-compatible endpoint.
   256  	Endpoint *string `json:"endpoint,omitempty"`
   257  }
   258  
   259  // MarshalJSON is the custom marshaler for EventHubProperties.
   260  func (ehp EventHubProperties) MarshalJSON() ([]byte, error) {
   261  	objectMap := make(map[string]interface{})
   262  	if ehp.RetentionTimeInDays != nil {
   263  		objectMap["retentionTimeInDays"] = ehp.RetentionTimeInDays
   264  	}
   265  	if ehp.PartitionCount != nil {
   266  		objectMap["partitionCount"] = ehp.PartitionCount
   267  	}
   268  	return json.Marshal(objectMap)
   269  }
   270  
   271  // ExportDevicesRequest use to provide parameters when requesting an export of all devices in the IoT hub.
   272  type ExportDevicesRequest struct {
   273  	// ExportBlobContainerURI - The export blob container URI.
   274  	ExportBlobContainerURI *string `json:"ExportBlobContainerUri,omitempty"`
   275  	// ExcludeKeys - The value indicating whether keys should be excluded during export.
   276  	ExcludeKeys *bool `json:"ExcludeKeys,omitempty"`
   277  }
   278  
   279  // FeedbackProperties the properties of the feedback queue for cloud-to-device messages.
   280  type FeedbackProperties struct {
   281  	// LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
   282  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
   283  	// TTLAsIso8601 - The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
   284  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
   285  	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
   286  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
   287  }
   288  
   289  // ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub.
   290  type ImportDevicesRequest struct {
   291  	// InputBlobContainerURI - The input blob container URI.
   292  	InputBlobContainerURI *string `json:"InputBlobContainerUri,omitempty"`
   293  	// OutputBlobContainerURI - The output blob container URI.
   294  	OutputBlobContainerURI *string `json:"OutputBlobContainerUri,omitempty"`
   295  }
   296  
   297  // IotHubCapacity ioT Hub capacity information.
   298  type IotHubCapacity struct {
   299  	// Minimum - READ-ONLY; The minimum number of units.
   300  	Minimum *int64 `json:"minimum,omitempty"`
   301  	// Maximum - READ-ONLY; The maximum number of units.
   302  	Maximum *int64 `json:"maximum,omitempty"`
   303  	// Default - READ-ONLY; The default number of units.
   304  	Default *int64 `json:"default,omitempty"`
   305  	// ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone'
   306  	ScaleType IotHubScaleType `json:"scaleType,omitempty"`
   307  }
   308  
   309  // MarshalJSON is the custom marshaler for IotHubCapacity.
   310  func (ihc IotHubCapacity) MarshalJSON() ([]byte, error) {
   311  	objectMap := make(map[string]interface{})
   312  	return json.Marshal(objectMap)
   313  }
   314  
   315  // IotHubDescription the description of the IoT hub.
   316  type IotHubDescription struct {
   317  	autorest.Response `json:"-"`
   318  	// Subscriptionid - The subscription identifier.
   319  	Subscriptionid *string `json:"subscriptionid,omitempty"`
   320  	// Resourcegroup - The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription.
   321  	Resourcegroup *string `json:"resourcegroup,omitempty"`
   322  	// 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.
   323  	Etag       *string           `json:"etag,omitempty"`
   324  	Properties *IotHubProperties `json:"properties,omitempty"`
   325  	Sku        *IotHubSkuInfo    `json:"sku,omitempty"`
   326  	// ID - READ-ONLY; The resource identifier.
   327  	ID *string `json:"id,omitempty"`
   328  	// Name - READ-ONLY; The resource name.
   329  	Name *string `json:"name,omitempty"`
   330  	// Type - READ-ONLY; The resource type.
   331  	Type *string `json:"type,omitempty"`
   332  	// Location - The resource location.
   333  	Location *string `json:"location,omitempty"`
   334  	// Tags - The resource tags.
   335  	Tags map[string]*string `json:"tags"`
   336  }
   337  
   338  // MarshalJSON is the custom marshaler for IotHubDescription.
   339  func (ihd IotHubDescription) MarshalJSON() ([]byte, error) {
   340  	objectMap := make(map[string]interface{})
   341  	if ihd.Subscriptionid != nil {
   342  		objectMap["subscriptionid"] = ihd.Subscriptionid
   343  	}
   344  	if ihd.Resourcegroup != nil {
   345  		objectMap["resourcegroup"] = ihd.Resourcegroup
   346  	}
   347  	if ihd.Etag != nil {
   348  		objectMap["etag"] = ihd.Etag
   349  	}
   350  	if ihd.Properties != nil {
   351  		objectMap["properties"] = ihd.Properties
   352  	}
   353  	if ihd.Sku != nil {
   354  		objectMap["sku"] = ihd.Sku
   355  	}
   356  	if ihd.Location != nil {
   357  		objectMap["location"] = ihd.Location
   358  	}
   359  	if ihd.Tags != nil {
   360  		objectMap["tags"] = ihd.Tags
   361  	}
   362  	return json.Marshal(objectMap)
   363  }
   364  
   365  // IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link.
   366  type IotHubDescriptionListResult struct {
   367  	autorest.Response `json:"-"`
   368  	// Value - The array of IotHubDescription objects.
   369  	Value *[]IotHubDescription `json:"value,omitempty"`
   370  	// NextLink - READ-ONLY; The next link.
   371  	NextLink *string `json:"nextLink,omitempty"`
   372  }
   373  
   374  // MarshalJSON is the custom marshaler for IotHubDescriptionListResult.
   375  func (ihdlr IotHubDescriptionListResult) MarshalJSON() ([]byte, error) {
   376  	objectMap := make(map[string]interface{})
   377  	if ihdlr.Value != nil {
   378  		objectMap["value"] = ihdlr.Value
   379  	}
   380  	return json.Marshal(objectMap)
   381  }
   382  
   383  // IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values.
   384  type IotHubDescriptionListResultIterator struct {
   385  	i    int
   386  	page IotHubDescriptionListResultPage
   387  }
   388  
   389  // NextWithContext advances to the next value.  If there was an error making
   390  // the request the iterator does not advance and the error is returned.
   391  func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   392  	if tracing.IsEnabled() {
   393  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext")
   394  		defer func() {
   395  			sc := -1
   396  			if iter.Response().Response.Response != nil {
   397  				sc = iter.Response().Response.Response.StatusCode
   398  			}
   399  			tracing.EndSpan(ctx, sc, err)
   400  		}()
   401  	}
   402  	iter.i++
   403  	if iter.i < len(iter.page.Values()) {
   404  		return nil
   405  	}
   406  	err = iter.page.NextWithContext(ctx)
   407  	if err != nil {
   408  		iter.i--
   409  		return err
   410  	}
   411  	iter.i = 0
   412  	return nil
   413  }
   414  
   415  // Next advances to the next value.  If there was an error making
   416  // the request the iterator does not advance and the error is returned.
   417  // Deprecated: Use NextWithContext() instead.
   418  func (iter *IotHubDescriptionListResultIterator) Next() error {
   419  	return iter.NextWithContext(context.Background())
   420  }
   421  
   422  // NotDone returns true if the enumeration should be started or is not yet complete.
   423  func (iter IotHubDescriptionListResultIterator) NotDone() bool {
   424  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   425  }
   426  
   427  // Response returns the raw server response from the last page request.
   428  func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult {
   429  	return iter.page.Response()
   430  }
   431  
   432  // Value returns the current value or a zero-initialized value if the
   433  // iterator has advanced beyond the end of the collection.
   434  func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription {
   435  	if !iter.page.NotDone() {
   436  		return IotHubDescription{}
   437  	}
   438  	return iter.page.Values()[iter.i]
   439  }
   440  
   441  // Creates a new instance of the IotHubDescriptionListResultIterator type.
   442  func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator {
   443  	return IotHubDescriptionListResultIterator{page: page}
   444  }
   445  
   446  // IsEmpty returns true if the ListResult contains no values.
   447  func (ihdlr IotHubDescriptionListResult) IsEmpty() bool {
   448  	return ihdlr.Value == nil || len(*ihdlr.Value) == 0
   449  }
   450  
   451  // hasNextLink returns true if the NextLink is not empty.
   452  func (ihdlr IotHubDescriptionListResult) hasNextLink() bool {
   453  	return ihdlr.NextLink != nil && len(*ihdlr.NextLink) != 0
   454  }
   455  
   456  // iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results.
   457  // It returns nil if no more results exist.
   458  func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
   459  	if !ihdlr.hasNextLink() {
   460  		return nil, nil
   461  	}
   462  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   463  		autorest.AsJSON(),
   464  		autorest.AsGet(),
   465  		autorest.WithBaseURL(to.String(ihdlr.NextLink)))
   466  }
   467  
   468  // IotHubDescriptionListResultPage contains a page of IotHubDescription values.
   469  type IotHubDescriptionListResultPage struct {
   470  	fn    func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)
   471  	ihdlr IotHubDescriptionListResult
   472  }
   473  
   474  // NextWithContext advances to the next page of values.  If there was an error making
   475  // the request the page does not advance and the error is returned.
   476  func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
   477  	if tracing.IsEnabled() {
   478  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext")
   479  		defer func() {
   480  			sc := -1
   481  			if page.Response().Response.Response != nil {
   482  				sc = page.Response().Response.Response.StatusCode
   483  			}
   484  			tracing.EndSpan(ctx, sc, err)
   485  		}()
   486  	}
   487  	for {
   488  		next, err := page.fn(ctx, page.ihdlr)
   489  		if err != nil {
   490  			return err
   491  		}
   492  		page.ihdlr = next
   493  		if !next.hasNextLink() || !next.IsEmpty() {
   494  			break
   495  		}
   496  	}
   497  	return nil
   498  }
   499  
   500  // Next advances to the next page of values.  If there was an error making
   501  // the request the page does not advance and the error is returned.
   502  // Deprecated: Use NextWithContext() instead.
   503  func (page *IotHubDescriptionListResultPage) Next() error {
   504  	return page.NextWithContext(context.Background())
   505  }
   506  
   507  // NotDone returns true if the page enumeration should be started or is not yet complete.
   508  func (page IotHubDescriptionListResultPage) NotDone() bool {
   509  	return !page.ihdlr.IsEmpty()
   510  }
   511  
   512  // Response returns the raw server response from the last page request.
   513  func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult {
   514  	return page.ihdlr
   515  }
   516  
   517  // Values returns the slice of values for the current page or nil if there are no values.
   518  func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {
   519  	if page.ihdlr.IsEmpty() {
   520  		return nil
   521  	}
   522  	return *page.ihdlr.Value
   523  }
   524  
   525  // Creates a new instance of the IotHubDescriptionListResultPage type.
   526  func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {
   527  	return IotHubDescriptionListResultPage{
   528  		fn:    getNextPage,
   529  		ihdlr: cur,
   530  	}
   531  }
   532  
   533  // IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available.
   534  type IotHubNameAvailabilityInfo struct {
   535  	autorest.Response `json:"-"`
   536  	// NameAvailable - READ-ONLY; The value which indicates whether the provided name is available.
   537  	NameAvailable *bool `json:"nameAvailable,omitempty"`
   538  	// Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists'
   539  	Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"`
   540  	// Message - The detailed reason message.
   541  	Message *string `json:"message,omitempty"`
   542  }
   543  
   544  // MarshalJSON is the custom marshaler for IotHubNameAvailabilityInfo.
   545  func (ihnai IotHubNameAvailabilityInfo) MarshalJSON() ([]byte, error) {
   546  	objectMap := make(map[string]interface{})
   547  	if ihnai.Message != nil {
   548  		objectMap["message"] = ihnai.Message
   549  	}
   550  	return json.Marshal(objectMap)
   551  }
   552  
   553  // IotHubProperties the properties of an IoT hub.
   554  type IotHubProperties struct {
   555  	// AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub.
   556  	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"`
   557  	// IPFilterRules - The IP filter rules.
   558  	IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
   559  	// ProvisioningState - READ-ONLY; The provisioning state.
   560  	ProvisioningState *string `json:"provisioningState,omitempty"`
   561  	// HostName - READ-ONLY; The name of the host.
   562  	HostName *string `json:"hostName,omitempty"`
   563  	// EventHubEndpoints - The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub.
   564  	EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"`
   565  	// StorageEndpoints - The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown.
   566  	StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"`
   567  	// MessagingEndpoints - The messaging endpoint properties for the file upload notification queue.
   568  	MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"`
   569  	// EnableFileUploadNotifications - If True, file upload notifications are enabled.
   570  	EnableFileUploadNotifications *bool                    `json:"enableFileUploadNotifications,omitempty"`
   571  	CloudToDevice                 *CloudToDeviceProperties `json:"cloudToDevice,omitempty"`
   572  	// Comments - Comments.
   573  	Comments                       *string                         `json:"comments,omitempty"`
   574  	OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"`
   575  	// Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement'
   576  	Features Capabilities `json:"features,omitempty"`
   577  }
   578  
   579  // MarshalJSON is the custom marshaler for IotHubProperties.
   580  func (ihp IotHubProperties) MarshalJSON() ([]byte, error) {
   581  	objectMap := make(map[string]interface{})
   582  	if ihp.AuthorizationPolicies != nil {
   583  		objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies
   584  	}
   585  	if ihp.IPFilterRules != nil {
   586  		objectMap["ipFilterRules"] = ihp.IPFilterRules
   587  	}
   588  	if ihp.EventHubEndpoints != nil {
   589  		objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints
   590  	}
   591  	if ihp.StorageEndpoints != nil {
   592  		objectMap["storageEndpoints"] = ihp.StorageEndpoints
   593  	}
   594  	if ihp.MessagingEndpoints != nil {
   595  		objectMap["messagingEndpoints"] = ihp.MessagingEndpoints
   596  	}
   597  	if ihp.EnableFileUploadNotifications != nil {
   598  		objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications
   599  	}
   600  	if ihp.CloudToDevice != nil {
   601  		objectMap["cloudToDevice"] = ihp.CloudToDevice
   602  	}
   603  	if ihp.Comments != nil {
   604  		objectMap["comments"] = ihp.Comments
   605  	}
   606  	if ihp.OperationsMonitoringProperties != nil {
   607  		objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties
   608  	}
   609  	if ihp.Features != "" {
   610  		objectMap["features"] = ihp.Features
   611  	}
   612  	return json.Marshal(objectMap)
   613  }
   614  
   615  // IotHubQuotaMetricInfo quota metrics properties.
   616  type IotHubQuotaMetricInfo struct {
   617  	// Name - READ-ONLY; The name of the quota metric.
   618  	Name *string `json:"Name,omitempty"`
   619  	// CurrentValue - READ-ONLY; The current value for the quota metric.
   620  	CurrentValue *int64 `json:"CurrentValue,omitempty"`
   621  	// MaxValue - READ-ONLY; The maximum value of the quota metric.
   622  	MaxValue *int64 `json:"MaxValue,omitempty"`
   623  }
   624  
   625  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfo.
   626  func (ihqmi IotHubQuotaMetricInfo) MarshalJSON() ([]byte, error) {
   627  	objectMap := make(map[string]interface{})
   628  	return json.Marshal(objectMap)
   629  }
   630  
   631  // IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next
   632  // link.
   633  type IotHubQuotaMetricInfoListResult struct {
   634  	autorest.Response `json:"-"`
   635  	// Value - The array of quota metrics objects.
   636  	Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"`
   637  	// NextLink - READ-ONLY; The next link.
   638  	NextLink *string `json:"nextLink,omitempty"`
   639  }
   640  
   641  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfoListResult.
   642  func (ihqmilr IotHubQuotaMetricInfoListResult) MarshalJSON() ([]byte, error) {
   643  	objectMap := make(map[string]interface{})
   644  	if ihqmilr.Value != nil {
   645  		objectMap["value"] = ihqmilr.Value
   646  	}
   647  	return json.Marshal(objectMap)
   648  }
   649  
   650  // IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo
   651  // values.
   652  type IotHubQuotaMetricInfoListResultIterator struct {
   653  	i    int
   654  	page IotHubQuotaMetricInfoListResultPage
   655  }
   656  
   657  // NextWithContext advances to the next value.  If there was an error making
   658  // the request the iterator does not advance and the error is returned.
   659  func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
   660  	if tracing.IsEnabled() {
   661  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext")
   662  		defer func() {
   663  			sc := -1
   664  			if iter.Response().Response.Response != nil {
   665  				sc = iter.Response().Response.Response.StatusCode
   666  			}
   667  			tracing.EndSpan(ctx, sc, err)
   668  		}()
   669  	}
   670  	iter.i++
   671  	if iter.i < len(iter.page.Values()) {
   672  		return nil
   673  	}
   674  	err = iter.page.NextWithContext(ctx)
   675  	if err != nil {
   676  		iter.i--
   677  		return err
   678  	}
   679  	iter.i = 0
   680  	return nil
   681  }
   682  
   683  // Next advances to the next value.  If there was an error making
   684  // the request the iterator does not advance and the error is returned.
   685  // Deprecated: Use NextWithContext() instead.
   686  func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error {
   687  	return iter.NextWithContext(context.Background())
   688  }
   689  
   690  // NotDone returns true if the enumeration should be started or is not yet complete.
   691  func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool {
   692  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   693  }
   694  
   695  // Response returns the raw server response from the last page request.
   696  func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult {
   697  	return iter.page.Response()
   698  }
   699  
   700  // Value returns the current value or a zero-initialized value if the
   701  // iterator has advanced beyond the end of the collection.
   702  func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {
   703  	if !iter.page.NotDone() {
   704  		return IotHubQuotaMetricInfo{}
   705  	}
   706  	return iter.page.Values()[iter.i]
   707  }
   708  
   709  // Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type.
   710  func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator {
   711  	return IotHubQuotaMetricInfoListResultIterator{page: page}
   712  }
   713  
   714  // IsEmpty returns true if the ListResult contains no values.
   715  func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {
   716  	return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0
   717  }
   718  
   719  // hasNextLink returns true if the NextLink is not empty.
   720  func (ihqmilr IotHubQuotaMetricInfoListResult) hasNextLink() bool {
   721  	return ihqmilr.NextLink != nil && len(*ihqmilr.NextLink) != 0
   722  }
   723  
   724  // iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results.
   725  // It returns nil if no more results exist.
   726  func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {
   727  	if !ihqmilr.hasNextLink() {
   728  		return nil, nil
   729  	}
   730  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   731  		autorest.AsJSON(),
   732  		autorest.AsGet(),
   733  		autorest.WithBaseURL(to.String(ihqmilr.NextLink)))
   734  }
   735  
   736  // IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values.
   737  type IotHubQuotaMetricInfoListResultPage struct {
   738  	fn      func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)
   739  	ihqmilr IotHubQuotaMetricInfoListResult
   740  }
   741  
   742  // NextWithContext advances to the next page of values.  If there was an error making
   743  // the request the page does not advance and the error is returned.
   744  func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) {
   745  	if tracing.IsEnabled() {
   746  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext")
   747  		defer func() {
   748  			sc := -1
   749  			if page.Response().Response.Response != nil {
   750  				sc = page.Response().Response.Response.StatusCode
   751  			}
   752  			tracing.EndSpan(ctx, sc, err)
   753  		}()
   754  	}
   755  	for {
   756  		next, err := page.fn(ctx, page.ihqmilr)
   757  		if err != nil {
   758  			return err
   759  		}
   760  		page.ihqmilr = next
   761  		if !next.hasNextLink() || !next.IsEmpty() {
   762  			break
   763  		}
   764  	}
   765  	return nil
   766  }
   767  
   768  // Next advances to the next page of values.  If there was an error making
   769  // the request the page does not advance and the error is returned.
   770  // Deprecated: Use NextWithContext() instead.
   771  func (page *IotHubQuotaMetricInfoListResultPage) Next() error {
   772  	return page.NextWithContext(context.Background())
   773  }
   774  
   775  // NotDone returns true if the page enumeration should be started or is not yet complete.
   776  func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {
   777  	return !page.ihqmilr.IsEmpty()
   778  }
   779  
   780  // Response returns the raw server response from the last page request.
   781  func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult {
   782  	return page.ihqmilr
   783  }
   784  
   785  // Values returns the slice of values for the current page or nil if there are no values.
   786  func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {
   787  	if page.ihqmilr.IsEmpty() {
   788  		return nil
   789  	}
   790  	return *page.ihqmilr.Value
   791  }
   792  
   793  // Creates a new instance of the IotHubQuotaMetricInfoListResultPage type.
   794  func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {
   795  	return IotHubQuotaMetricInfoListResultPage{
   796  		fn:      getNextPage,
   797  		ihqmilr: cur,
   798  	}
   799  }
   800  
   801  // IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   802  // long-running operation.
   803  type IotHubResourceCreateOrUpdateFuture struct {
   804  	azure.FutureAPI
   805  	// Result returns the result of the asynchronous operation.
   806  	// If the operation has not completed it will return an error.
   807  	Result func(IotHubResourceClient) (IotHubDescription, error)
   808  }
   809  
   810  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   811  func (future *IotHubResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   812  	var azFuture azure.Future
   813  	if err := json.Unmarshal(body, &azFuture); err != nil {
   814  		return err
   815  	}
   816  	future.FutureAPI = &azFuture
   817  	future.Result = future.result
   818  	return nil
   819  }
   820  
   821  // result is the default implementation for IotHubResourceCreateOrUpdateFuture.Result.
   822  func (future *IotHubResourceCreateOrUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
   823  	var done bool
   824  	done, err = future.DoneWithContext(context.Background(), client)
   825  	if err != nil {
   826  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   827  		return
   828  	}
   829  	if !done {
   830  		ihd.Response.Response = future.Response()
   831  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture")
   832  		return
   833  	}
   834  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   835  	if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
   836  		ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response)
   837  		if err != nil {
   838  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
   839  		}
   840  	}
   841  	return
   842  }
   843  
   844  // IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   845  // operation.
   846  type IotHubResourceDeleteFuture struct {
   847  	azure.FutureAPI
   848  	// Result returns the result of the asynchronous operation.
   849  	// If the operation has not completed it will return an error.
   850  	Result func(IotHubResourceClient) (SetObject, error)
   851  }
   852  
   853  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   854  func (future *IotHubResourceDeleteFuture) UnmarshalJSON(body []byte) error {
   855  	var azFuture azure.Future
   856  	if err := json.Unmarshal(body, &azFuture); err != nil {
   857  		return err
   858  	}
   859  	future.FutureAPI = &azFuture
   860  	future.Result = future.result
   861  	return nil
   862  }
   863  
   864  // result is the default implementation for IotHubResourceDeleteFuture.Result.
   865  func (future *IotHubResourceDeleteFuture) result(client IotHubResourceClient) (so SetObject, err error) {
   866  	var done bool
   867  	done, err = future.DoneWithContext(context.Background(), client)
   868  	if err != nil {
   869  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure")
   870  		return
   871  	}
   872  	if !done {
   873  		so.Response.Response = future.Response()
   874  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture")
   875  		return
   876  	}
   877  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   878  	if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
   879  		so, err = client.DeleteResponder(so.Response.Response)
   880  		if err != nil {
   881  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request")
   882  		}
   883  	}
   884  	return
   885  }
   886  
   887  // IotHubSkuDescription SKU properties.
   888  type IotHubSkuDescription struct {
   889  	// ResourceType - READ-ONLY; The type of the resource.
   890  	ResourceType *string         `json:"resourceType,omitempty"`
   891  	Sku          *IotHubSkuInfo  `json:"sku,omitempty"`
   892  	Capacity     *IotHubCapacity `json:"capacity,omitempty"`
   893  }
   894  
   895  // MarshalJSON is the custom marshaler for IotHubSkuDescription.
   896  func (ihsd IotHubSkuDescription) MarshalJSON() ([]byte, error) {
   897  	objectMap := make(map[string]interface{})
   898  	if ihsd.Sku != nil {
   899  		objectMap["sku"] = ihsd.Sku
   900  	}
   901  	if ihsd.Capacity != nil {
   902  		objectMap["capacity"] = ihsd.Capacity
   903  	}
   904  	return json.Marshal(objectMap)
   905  }
   906  
   907  // IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next
   908  // link.
   909  type IotHubSkuDescriptionListResult struct {
   910  	autorest.Response `json:"-"`
   911  	// Value - The array of IotHubSkuDescription.
   912  	Value *[]IotHubSkuDescription `json:"value,omitempty"`
   913  	// NextLink - READ-ONLY; The next link.
   914  	NextLink *string `json:"nextLink,omitempty"`
   915  }
   916  
   917  // MarshalJSON is the custom marshaler for IotHubSkuDescriptionListResult.
   918  func (ihsdlr IotHubSkuDescriptionListResult) MarshalJSON() ([]byte, error) {
   919  	objectMap := make(map[string]interface{})
   920  	if ihsdlr.Value != nil {
   921  		objectMap["value"] = ihsdlr.Value
   922  	}
   923  	return json.Marshal(objectMap)
   924  }
   925  
   926  // IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription
   927  // values.
   928  type IotHubSkuDescriptionListResultIterator struct {
   929  	i    int
   930  	page IotHubSkuDescriptionListResultPage
   931  }
   932  
   933  // NextWithContext advances to the next value.  If there was an error making
   934  // the request the iterator does not advance and the error is returned.
   935  func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   936  	if tracing.IsEnabled() {
   937  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext")
   938  		defer func() {
   939  			sc := -1
   940  			if iter.Response().Response.Response != nil {
   941  				sc = iter.Response().Response.Response.StatusCode
   942  			}
   943  			tracing.EndSpan(ctx, sc, err)
   944  		}()
   945  	}
   946  	iter.i++
   947  	if iter.i < len(iter.page.Values()) {
   948  		return nil
   949  	}
   950  	err = iter.page.NextWithContext(ctx)
   951  	if err != nil {
   952  		iter.i--
   953  		return err
   954  	}
   955  	iter.i = 0
   956  	return nil
   957  }
   958  
   959  // Next advances to the next value.  If there was an error making
   960  // the request the iterator does not advance and the error is returned.
   961  // Deprecated: Use NextWithContext() instead.
   962  func (iter *IotHubSkuDescriptionListResultIterator) Next() error {
   963  	return iter.NextWithContext(context.Background())
   964  }
   965  
   966  // NotDone returns true if the enumeration should be started or is not yet complete.
   967  func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool {
   968  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   969  }
   970  
   971  // Response returns the raw server response from the last page request.
   972  func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult {
   973  	return iter.page.Response()
   974  }
   975  
   976  // Value returns the current value or a zero-initialized value if the
   977  // iterator has advanced beyond the end of the collection.
   978  func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription {
   979  	if !iter.page.NotDone() {
   980  		return IotHubSkuDescription{}
   981  	}
   982  	return iter.page.Values()[iter.i]
   983  }
   984  
   985  // Creates a new instance of the IotHubSkuDescriptionListResultIterator type.
   986  func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator {
   987  	return IotHubSkuDescriptionListResultIterator{page: page}
   988  }
   989  
   990  // IsEmpty returns true if the ListResult contains no values.
   991  func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {
   992  	return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0
   993  }
   994  
   995  // hasNextLink returns true if the NextLink is not empty.
   996  func (ihsdlr IotHubSkuDescriptionListResult) hasNextLink() bool {
   997  	return ihsdlr.NextLink != nil && len(*ihsdlr.NextLink) != 0
   998  }
   999  
  1000  // iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results.
  1001  // It returns nil if no more results exist.
  1002  func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1003  	if !ihsdlr.hasNextLink() {
  1004  		return nil, nil
  1005  	}
  1006  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1007  		autorest.AsJSON(),
  1008  		autorest.AsGet(),
  1009  		autorest.WithBaseURL(to.String(ihsdlr.NextLink)))
  1010  }
  1011  
  1012  // IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values.
  1013  type IotHubSkuDescriptionListResultPage struct {
  1014  	fn     func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)
  1015  	ihsdlr IotHubSkuDescriptionListResult
  1016  }
  1017  
  1018  // NextWithContext advances to the next page of values.  If there was an error making
  1019  // the request the page does not advance and the error is returned.
  1020  func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1021  	if tracing.IsEnabled() {
  1022  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext")
  1023  		defer func() {
  1024  			sc := -1
  1025  			if page.Response().Response.Response != nil {
  1026  				sc = page.Response().Response.Response.StatusCode
  1027  			}
  1028  			tracing.EndSpan(ctx, sc, err)
  1029  		}()
  1030  	}
  1031  	for {
  1032  		next, err := page.fn(ctx, page.ihsdlr)
  1033  		if err != nil {
  1034  			return err
  1035  		}
  1036  		page.ihsdlr = next
  1037  		if !next.hasNextLink() || !next.IsEmpty() {
  1038  			break
  1039  		}
  1040  	}
  1041  	return nil
  1042  }
  1043  
  1044  // Next advances to the next page of values.  If there was an error making
  1045  // the request the page does not advance and the error is returned.
  1046  // Deprecated: Use NextWithContext() instead.
  1047  func (page *IotHubSkuDescriptionListResultPage) Next() error {
  1048  	return page.NextWithContext(context.Background())
  1049  }
  1050  
  1051  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1052  func (page IotHubSkuDescriptionListResultPage) NotDone() bool {
  1053  	return !page.ihsdlr.IsEmpty()
  1054  }
  1055  
  1056  // Response returns the raw server response from the last page request.
  1057  func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult {
  1058  	return page.ihsdlr
  1059  }
  1060  
  1061  // Values returns the slice of values for the current page or nil if there are no values.
  1062  func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {
  1063  	if page.ihsdlr.IsEmpty() {
  1064  		return nil
  1065  	}
  1066  	return *page.ihsdlr.Value
  1067  }
  1068  
  1069  // Creates a new instance of the IotHubSkuDescriptionListResultPage type.
  1070  func NewIotHubSkuDescriptionListResultPage(cur IotHubSkuDescriptionListResult, getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage {
  1071  	return IotHubSkuDescriptionListResultPage{
  1072  		fn:     getNextPage,
  1073  		ihsdlr: cur,
  1074  	}
  1075  }
  1076  
  1077  // IotHubSkuInfo information about the SKU of the IoT hub.
  1078  type IotHubSkuInfo struct {
  1079  	// Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3'
  1080  	Name IotHubSku `json:"name,omitempty"`
  1081  	// Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard'
  1082  	Tier IotHubSkuTier `json:"tier,omitempty"`
  1083  	// Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits.
  1084  	Capacity *int64 `json:"capacity,omitempty"`
  1085  }
  1086  
  1087  // MarshalJSON is the custom marshaler for IotHubSkuInfo.
  1088  func (ihsi IotHubSkuInfo) MarshalJSON() ([]byte, error) {
  1089  	objectMap := make(map[string]interface{})
  1090  	if ihsi.Name != "" {
  1091  		objectMap["name"] = ihsi.Name
  1092  	}
  1093  	if ihsi.Capacity != nil {
  1094  		objectMap["capacity"] = ihsi.Capacity
  1095  	}
  1096  	return json.Marshal(objectMap)
  1097  }
  1098  
  1099  // IPFilterRule the IP filter rules for the IoT hub.
  1100  type IPFilterRule struct {
  1101  	// FilterName - The name of the IP filter rule.
  1102  	FilterName *string `json:"filterName,omitempty"`
  1103  	// Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject'
  1104  	Action IPFilterActionType `json:"action,omitempty"`
  1105  	// IPMask - A string that contains the IP address range in CIDR notation for the rule.
  1106  	IPMask *string `json:"ipMask,omitempty"`
  1107  }
  1108  
  1109  // JobResponse the properties of the Job Response object.
  1110  type JobResponse struct {
  1111  	autorest.Response `json:"-"`
  1112  	// JobID - READ-ONLY; The job identifier.
  1113  	JobID *string `json:"jobId,omitempty"`
  1114  	// StartTimeUtc - READ-ONLY; The start time of the job.
  1115  	StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"`
  1116  	// EndTimeUtc - READ-ONLY; The time the job stopped processing.
  1117  	EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"`
  1118  	// Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate'
  1119  	Type JobType `json:"type,omitempty"`
  1120  	// Status - READ-ONLY; The status of the job. Possible values include: 'Unknown', 'Enqueued', 'Running', 'Completed', 'Failed', 'Cancelled'
  1121  	Status JobStatus `json:"status,omitempty"`
  1122  	// FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure.
  1123  	FailureReason *string `json:"failureReason,omitempty"`
  1124  	// StatusMessage - READ-ONLY; The status message for the job.
  1125  	StatusMessage *string `json:"statusMessage,omitempty"`
  1126  	// ParentJobID - READ-ONLY; The job identifier of the parent job, if any.
  1127  	ParentJobID *string `json:"parentJobId,omitempty"`
  1128  }
  1129  
  1130  // MarshalJSON is the custom marshaler for JobResponse.
  1131  func (jr JobResponse) MarshalJSON() ([]byte, error) {
  1132  	objectMap := make(map[string]interface{})
  1133  	return json.Marshal(objectMap)
  1134  }
  1135  
  1136  // JobResponseListResult the JSON-serialized array of JobResponse objects with a next link.
  1137  type JobResponseListResult struct {
  1138  	autorest.Response `json:"-"`
  1139  	// Value - The array of JobResponse objects.
  1140  	Value *[]JobResponse `json:"value,omitempty"`
  1141  	// NextLink - READ-ONLY; The next link.
  1142  	NextLink *string `json:"nextLink,omitempty"`
  1143  }
  1144  
  1145  // MarshalJSON is the custom marshaler for JobResponseListResult.
  1146  func (jrlr JobResponseListResult) MarshalJSON() ([]byte, error) {
  1147  	objectMap := make(map[string]interface{})
  1148  	if jrlr.Value != nil {
  1149  		objectMap["value"] = jrlr.Value
  1150  	}
  1151  	return json.Marshal(objectMap)
  1152  }
  1153  
  1154  // JobResponseListResultIterator provides access to a complete listing of JobResponse values.
  1155  type JobResponseListResultIterator struct {
  1156  	i    int
  1157  	page JobResponseListResultPage
  1158  }
  1159  
  1160  // NextWithContext advances to the next value.  If there was an error making
  1161  // the request the iterator does not advance and the error is returned.
  1162  func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1163  	if tracing.IsEnabled() {
  1164  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext")
  1165  		defer func() {
  1166  			sc := -1
  1167  			if iter.Response().Response.Response != nil {
  1168  				sc = iter.Response().Response.Response.StatusCode
  1169  			}
  1170  			tracing.EndSpan(ctx, sc, err)
  1171  		}()
  1172  	}
  1173  	iter.i++
  1174  	if iter.i < len(iter.page.Values()) {
  1175  		return nil
  1176  	}
  1177  	err = iter.page.NextWithContext(ctx)
  1178  	if err != nil {
  1179  		iter.i--
  1180  		return err
  1181  	}
  1182  	iter.i = 0
  1183  	return nil
  1184  }
  1185  
  1186  // Next advances to the next value.  If there was an error making
  1187  // the request the iterator does not advance and the error is returned.
  1188  // Deprecated: Use NextWithContext() instead.
  1189  func (iter *JobResponseListResultIterator) Next() error {
  1190  	return iter.NextWithContext(context.Background())
  1191  }
  1192  
  1193  // NotDone returns true if the enumeration should be started or is not yet complete.
  1194  func (iter JobResponseListResultIterator) NotDone() bool {
  1195  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1196  }
  1197  
  1198  // Response returns the raw server response from the last page request.
  1199  func (iter JobResponseListResultIterator) Response() JobResponseListResult {
  1200  	return iter.page.Response()
  1201  }
  1202  
  1203  // Value returns the current value or a zero-initialized value if the
  1204  // iterator has advanced beyond the end of the collection.
  1205  func (iter JobResponseListResultIterator) Value() JobResponse {
  1206  	if !iter.page.NotDone() {
  1207  		return JobResponse{}
  1208  	}
  1209  	return iter.page.Values()[iter.i]
  1210  }
  1211  
  1212  // Creates a new instance of the JobResponseListResultIterator type.
  1213  func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator {
  1214  	return JobResponseListResultIterator{page: page}
  1215  }
  1216  
  1217  // IsEmpty returns true if the ListResult contains no values.
  1218  func (jrlr JobResponseListResult) IsEmpty() bool {
  1219  	return jrlr.Value == nil || len(*jrlr.Value) == 0
  1220  }
  1221  
  1222  // hasNextLink returns true if the NextLink is not empty.
  1223  func (jrlr JobResponseListResult) hasNextLink() bool {
  1224  	return jrlr.NextLink != nil && len(*jrlr.NextLink) != 0
  1225  }
  1226  
  1227  // jobResponseListResultPreparer prepares a request to retrieve the next set of results.
  1228  // It returns nil if no more results exist.
  1229  func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) {
  1230  	if !jrlr.hasNextLink() {
  1231  		return nil, nil
  1232  	}
  1233  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1234  		autorest.AsJSON(),
  1235  		autorest.AsGet(),
  1236  		autorest.WithBaseURL(to.String(jrlr.NextLink)))
  1237  }
  1238  
  1239  // JobResponseListResultPage contains a page of JobResponse values.
  1240  type JobResponseListResultPage struct {
  1241  	fn   func(context.Context, JobResponseListResult) (JobResponseListResult, error)
  1242  	jrlr JobResponseListResult
  1243  }
  1244  
  1245  // NextWithContext advances to the next page of values.  If there was an error making
  1246  // the request the page does not advance and the error is returned.
  1247  func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {
  1248  	if tracing.IsEnabled() {
  1249  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext")
  1250  		defer func() {
  1251  			sc := -1
  1252  			if page.Response().Response.Response != nil {
  1253  				sc = page.Response().Response.Response.StatusCode
  1254  			}
  1255  			tracing.EndSpan(ctx, sc, err)
  1256  		}()
  1257  	}
  1258  	for {
  1259  		next, err := page.fn(ctx, page.jrlr)
  1260  		if err != nil {
  1261  			return err
  1262  		}
  1263  		page.jrlr = next
  1264  		if !next.hasNextLink() || !next.IsEmpty() {
  1265  			break
  1266  		}
  1267  	}
  1268  	return nil
  1269  }
  1270  
  1271  // Next advances to the next page of values.  If there was an error making
  1272  // the request the page does not advance and the error is returned.
  1273  // Deprecated: Use NextWithContext() instead.
  1274  func (page *JobResponseListResultPage) Next() error {
  1275  	return page.NextWithContext(context.Background())
  1276  }
  1277  
  1278  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1279  func (page JobResponseListResultPage) NotDone() bool {
  1280  	return !page.jrlr.IsEmpty()
  1281  }
  1282  
  1283  // Response returns the raw server response from the last page request.
  1284  func (page JobResponseListResultPage) Response() JobResponseListResult {
  1285  	return page.jrlr
  1286  }
  1287  
  1288  // Values returns the slice of values for the current page or nil if there are no values.
  1289  func (page JobResponseListResultPage) Values() []JobResponse {
  1290  	if page.jrlr.IsEmpty() {
  1291  		return nil
  1292  	}
  1293  	return *page.jrlr.Value
  1294  }
  1295  
  1296  // Creates a new instance of the JobResponseListResultPage type.
  1297  func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {
  1298  	return JobResponseListResultPage{
  1299  		fn:   getNextPage,
  1300  		jrlr: cur,
  1301  	}
  1302  }
  1303  
  1304  // MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub.
  1305  type MessagingEndpointProperties struct {
  1306  	// LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
  1307  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
  1308  	// TTLAsIso8601 - The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
  1309  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
  1310  	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
  1311  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
  1312  }
  1313  
  1314  // OperationInputs input values.
  1315  type OperationInputs struct {
  1316  	// Name - The name of the IoT hub to check.
  1317  	Name *string `json:"Name,omitempty"`
  1318  }
  1319  
  1320  // OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys
  1321  // to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations,
  1322  // FileUploadOperations.
  1323  type OperationsMonitoringProperties struct {
  1324  	Events map[string]*OperationMonitoringLevel `json:"events"`
  1325  }
  1326  
  1327  // MarshalJSON is the custom marshaler for OperationsMonitoringProperties.
  1328  func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) {
  1329  	objectMap := make(map[string]interface{})
  1330  	if omp.Events != nil {
  1331  		objectMap["events"] = omp.Events
  1332  	}
  1333  	return json.Marshal(objectMap)
  1334  }
  1335  
  1336  // RegistryStatistics identity registry statistics.
  1337  type RegistryStatistics struct {
  1338  	autorest.Response `json:"-"`
  1339  	// TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry.
  1340  	TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"`
  1341  	// EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry.
  1342  	EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"`
  1343  	// DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry.
  1344  	DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"`
  1345  }
  1346  
  1347  // MarshalJSON is the custom marshaler for RegistryStatistics.
  1348  func (rs RegistryStatistics) MarshalJSON() ([]byte, error) {
  1349  	objectMap := make(map[string]interface{})
  1350  	return json.Marshal(objectMap)
  1351  }
  1352  
  1353  // Resource the common properties of an Azure resource.
  1354  type Resource struct {
  1355  	// ID - READ-ONLY; The resource identifier.
  1356  	ID *string `json:"id,omitempty"`
  1357  	// Name - READ-ONLY; The resource name.
  1358  	Name *string `json:"name,omitempty"`
  1359  	// Type - READ-ONLY; The resource type.
  1360  	Type *string `json:"type,omitempty"`
  1361  	// Location - The resource location.
  1362  	Location *string `json:"location,omitempty"`
  1363  	// Tags - The resource tags.
  1364  	Tags map[string]*string `json:"tags"`
  1365  }
  1366  
  1367  // MarshalJSON is the custom marshaler for Resource.
  1368  func (r Resource) MarshalJSON() ([]byte, error) {
  1369  	objectMap := make(map[string]interface{})
  1370  	if r.Location != nil {
  1371  		objectMap["location"] = r.Location
  1372  	}
  1373  	if r.Tags != nil {
  1374  		objectMap["tags"] = r.Tags
  1375  	}
  1376  	return json.Marshal(objectMap)
  1377  }
  1378  
  1379  // SetObject ...
  1380  type SetObject struct {
  1381  	autorest.Response `json:"-"`
  1382  	Value             interface{} `json:"value,omitempty"`
  1383  }
  1384  
  1385  // SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy.
  1386  type SharedAccessSignatureAuthorizationRule struct {
  1387  	autorest.Response `json:"-"`
  1388  	// KeyName - The name of the shared access policy.
  1389  	KeyName *string `json:"keyName,omitempty"`
  1390  	// PrimaryKey - The primary key.
  1391  	PrimaryKey *string `json:"primaryKey,omitempty"`
  1392  	// SecondaryKey - The secondary key.
  1393  	SecondaryKey *string `json:"secondaryKey,omitempty"`
  1394  	// Rights - The permissions assigned to the shared access policy. Possible values include: 'RegistryRead', 'RegistryWrite', 'ServiceConnect', 'DeviceConnect', 'RegistryReadRegistryWrite', 'RegistryReadServiceConnect', 'RegistryReadDeviceConnect', 'RegistryWriteServiceConnect', 'RegistryWriteDeviceConnect', 'ServiceConnectDeviceConnect', 'RegistryReadRegistryWriteServiceConnect', 'RegistryReadRegistryWriteDeviceConnect', 'RegistryReadServiceConnectDeviceConnect', 'RegistryWriteServiceConnectDeviceConnect', 'RegistryReadRegistryWriteServiceConnectDeviceConnect'
  1395  	Rights AccessRights `json:"rights,omitempty"`
  1396  }
  1397  
  1398  // SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link.
  1399  type SharedAccessSignatureAuthorizationRuleListResult struct {
  1400  	autorest.Response `json:"-"`
  1401  	// Value - The list of shared access policies.
  1402  	Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"`
  1403  	// NextLink - READ-ONLY; The next link.
  1404  	NextLink *string `json:"nextLink,omitempty"`
  1405  }
  1406  
  1407  // MarshalJSON is the custom marshaler for SharedAccessSignatureAuthorizationRuleListResult.
  1408  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
  1409  	objectMap := make(map[string]interface{})
  1410  	if sasarlr.Value != nil {
  1411  		objectMap["value"] = sasarlr.Value
  1412  	}
  1413  	return json.Marshal(objectMap)
  1414  }
  1415  
  1416  // SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
  1417  // SharedAccessSignatureAuthorizationRule values.
  1418  type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
  1419  	i    int
  1420  	page SharedAccessSignatureAuthorizationRuleListResultPage
  1421  }
  1422  
  1423  // NextWithContext advances to the next value.  If there was an error making
  1424  // the request the iterator does not advance and the error is returned.
  1425  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1426  	if tracing.IsEnabled() {
  1427  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
  1428  		defer func() {
  1429  			sc := -1
  1430  			if iter.Response().Response.Response != nil {
  1431  				sc = iter.Response().Response.Response.StatusCode
  1432  			}
  1433  			tracing.EndSpan(ctx, sc, err)
  1434  		}()
  1435  	}
  1436  	iter.i++
  1437  	if iter.i < len(iter.page.Values()) {
  1438  		return nil
  1439  	}
  1440  	err = iter.page.NextWithContext(ctx)
  1441  	if err != nil {
  1442  		iter.i--
  1443  		return err
  1444  	}
  1445  	iter.i = 0
  1446  	return nil
  1447  }
  1448  
  1449  // Next advances to the next value.  If there was an error making
  1450  // the request the iterator does not advance and the error is returned.
  1451  // Deprecated: Use NextWithContext() instead.
  1452  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
  1453  	return iter.NextWithContext(context.Background())
  1454  }
  1455  
  1456  // NotDone returns true if the enumeration should be started or is not yet complete.
  1457  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
  1458  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1459  }
  1460  
  1461  // Response returns the raw server response from the last page request.
  1462  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1463  	return iter.page.Response()
  1464  }
  1465  
  1466  // Value returns the current value or a zero-initialized value if the
  1467  // iterator has advanced beyond the end of the collection.
  1468  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule {
  1469  	if !iter.page.NotDone() {
  1470  		return SharedAccessSignatureAuthorizationRule{}
  1471  	}
  1472  	return iter.page.Values()[iter.i]
  1473  }
  1474  
  1475  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type.
  1476  func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
  1477  	return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
  1478  }
  1479  
  1480  // IsEmpty returns true if the ListResult contains no values.
  1481  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
  1482  	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
  1483  }
  1484  
  1485  // hasNextLink returns true if the NextLink is not empty.
  1486  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
  1487  	return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
  1488  }
  1489  
  1490  // sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
  1491  // It returns nil if no more results exist.
  1492  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  1493  	if !sasarlr.hasNextLink() {
  1494  		return nil, nil
  1495  	}
  1496  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1497  		autorest.AsJSON(),
  1498  		autorest.AsGet(),
  1499  		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
  1500  }
  1501  
  1502  // SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
  1503  // SharedAccessSignatureAuthorizationRule values.
  1504  type SharedAccessSignatureAuthorizationRuleListResultPage struct {
  1505  	fn      func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
  1506  	sasarlr SharedAccessSignatureAuthorizationRuleListResult
  1507  }
  1508  
  1509  // NextWithContext advances to the next page of values.  If there was an error making
  1510  // the request the page does not advance and the error is returned.
  1511  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  1512  	if tracing.IsEnabled() {
  1513  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
  1514  		defer func() {
  1515  			sc := -1
  1516  			if page.Response().Response.Response != nil {
  1517  				sc = page.Response().Response.Response.StatusCode
  1518  			}
  1519  			tracing.EndSpan(ctx, sc, err)
  1520  		}()
  1521  	}
  1522  	for {
  1523  		next, err := page.fn(ctx, page.sasarlr)
  1524  		if err != nil {
  1525  			return err
  1526  		}
  1527  		page.sasarlr = next
  1528  		if !next.hasNextLink() || !next.IsEmpty() {
  1529  			break
  1530  		}
  1531  	}
  1532  	return nil
  1533  }
  1534  
  1535  // Next advances to the next page of values.  If there was an error making
  1536  // the request the page does not advance and the error is returned.
  1537  // Deprecated: Use NextWithContext() instead.
  1538  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
  1539  	return page.NextWithContext(context.Background())
  1540  }
  1541  
  1542  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1543  func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
  1544  	return !page.sasarlr.IsEmpty()
  1545  }
  1546  
  1547  // Response returns the raw server response from the last page request.
  1548  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1549  	return page.sasarlr
  1550  }
  1551  
  1552  // Values returns the slice of values for the current page or nil if there are no values.
  1553  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule {
  1554  	if page.sasarlr.IsEmpty() {
  1555  		return nil
  1556  	}
  1557  	return *page.sasarlr.Value
  1558  }
  1559  
  1560  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type.
  1561  func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
  1562  	return SharedAccessSignatureAuthorizationRuleListResultPage{
  1563  		fn:      getNextPage,
  1564  		sasarlr: cur,
  1565  	}
  1566  }
  1567  
  1568  // StorageEndpointProperties the properties of the Azure Storage endpoint for file upload.
  1569  type StorageEndpointProperties struct {
  1570  	// SasTTLAsIso8601 - The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options.
  1571  	SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"`
  1572  	// ConnectionString - The connection string for the Azure Storage account to which files are uploaded.
  1573  	ConnectionString *string `json:"connectionString,omitempty"`
  1574  	// ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.
  1575  	ContainerName *string `json:"containerName,omitempty"`
  1576  }
  1577  

View as plain text