...

Source file src/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-01-19/devices/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-01-19/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/2017-01-19/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  // FallbackRouteProperties the properties related to the fallback route based on which the IoT hub routes
   280  // messages to the fallback endpoint.
   281  type FallbackRouteProperties struct {
   282  	// Source - The source to which the routing rule is to be applied to. e.g. DeviceMessages
   283  	Source *string `json:"source,omitempty"`
   284  	// Condition - The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language
   285  	Condition *string `json:"condition,omitempty"`
   286  	// EndpointNames - The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed.
   287  	EndpointNames *[]string `json:"endpointNames,omitempty"`
   288  	// IsEnabled - Used to specify whether the fallback route is enabled or not.
   289  	IsEnabled *bool `json:"isEnabled,omitempty"`
   290  }
   291  
   292  // FeedbackProperties the properties of the feedback queue for cloud-to-device messages.
   293  type FeedbackProperties struct {
   294  	// LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
   295  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
   296  	// 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.
   297  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
   298  	// 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.
   299  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
   300  }
   301  
   302  // ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub.
   303  type ImportDevicesRequest struct {
   304  	// InputBlobContainerURI - The input blob container URI.
   305  	InputBlobContainerURI *string `json:"InputBlobContainerUri,omitempty"`
   306  	// OutputBlobContainerURI - The output blob container URI.
   307  	OutputBlobContainerURI *string `json:"OutputBlobContainerUri,omitempty"`
   308  }
   309  
   310  // IotHubCapacity ioT Hub capacity information.
   311  type IotHubCapacity struct {
   312  	// Minimum - READ-ONLY; The minimum number of units.
   313  	Minimum *int64 `json:"minimum,omitempty"`
   314  	// Maximum - READ-ONLY; The maximum number of units.
   315  	Maximum *int64 `json:"maximum,omitempty"`
   316  	// Default - READ-ONLY; The default number of units.
   317  	Default *int64 `json:"default,omitempty"`
   318  	// ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone'
   319  	ScaleType IotHubScaleType `json:"scaleType,omitempty"`
   320  }
   321  
   322  // MarshalJSON is the custom marshaler for IotHubCapacity.
   323  func (ihc IotHubCapacity) MarshalJSON() ([]byte, error) {
   324  	objectMap := make(map[string]interface{})
   325  	return json.Marshal(objectMap)
   326  }
   327  
   328  // IotHubDescription the description of the IoT hub.
   329  type IotHubDescription struct {
   330  	autorest.Response `json:"-"`
   331  	// Subscriptionid - The subscription identifier.
   332  	Subscriptionid *string `json:"subscriptionid,omitempty"`
   333  	// Resourcegroup - The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription.
   334  	Resourcegroup *string `json:"resourcegroup,omitempty"`
   335  	// 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.
   336  	Etag       *string           `json:"etag,omitempty"`
   337  	Properties *IotHubProperties `json:"properties,omitempty"`
   338  	Sku        *IotHubSkuInfo    `json:"sku,omitempty"`
   339  	// ID - READ-ONLY; The resource identifier.
   340  	ID *string `json:"id,omitempty"`
   341  	// Name - READ-ONLY; The resource name.
   342  	Name *string `json:"name,omitempty"`
   343  	// Type - READ-ONLY; The resource type.
   344  	Type *string `json:"type,omitempty"`
   345  	// Location - The resource location.
   346  	Location *string `json:"location,omitempty"`
   347  	// Tags - The resource tags.
   348  	Tags map[string]*string `json:"tags"`
   349  }
   350  
   351  // MarshalJSON is the custom marshaler for IotHubDescription.
   352  func (ihd IotHubDescription) MarshalJSON() ([]byte, error) {
   353  	objectMap := make(map[string]interface{})
   354  	if ihd.Subscriptionid != nil {
   355  		objectMap["subscriptionid"] = ihd.Subscriptionid
   356  	}
   357  	if ihd.Resourcegroup != nil {
   358  		objectMap["resourcegroup"] = ihd.Resourcegroup
   359  	}
   360  	if ihd.Etag != nil {
   361  		objectMap["etag"] = ihd.Etag
   362  	}
   363  	if ihd.Properties != nil {
   364  		objectMap["properties"] = ihd.Properties
   365  	}
   366  	if ihd.Sku != nil {
   367  		objectMap["sku"] = ihd.Sku
   368  	}
   369  	if ihd.Location != nil {
   370  		objectMap["location"] = ihd.Location
   371  	}
   372  	if ihd.Tags != nil {
   373  		objectMap["tags"] = ihd.Tags
   374  	}
   375  	return json.Marshal(objectMap)
   376  }
   377  
   378  // IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link.
   379  type IotHubDescriptionListResult struct {
   380  	autorest.Response `json:"-"`
   381  	// Value - The array of IotHubDescription objects.
   382  	Value *[]IotHubDescription `json:"value,omitempty"`
   383  	// NextLink - READ-ONLY; The next link.
   384  	NextLink *string `json:"nextLink,omitempty"`
   385  }
   386  
   387  // MarshalJSON is the custom marshaler for IotHubDescriptionListResult.
   388  func (ihdlr IotHubDescriptionListResult) MarshalJSON() ([]byte, error) {
   389  	objectMap := make(map[string]interface{})
   390  	if ihdlr.Value != nil {
   391  		objectMap["value"] = ihdlr.Value
   392  	}
   393  	return json.Marshal(objectMap)
   394  }
   395  
   396  // IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values.
   397  type IotHubDescriptionListResultIterator struct {
   398  	i    int
   399  	page IotHubDescriptionListResultPage
   400  }
   401  
   402  // NextWithContext advances to the next value.  If there was an error making
   403  // the request the iterator does not advance and the error is returned.
   404  func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   405  	if tracing.IsEnabled() {
   406  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext")
   407  		defer func() {
   408  			sc := -1
   409  			if iter.Response().Response.Response != nil {
   410  				sc = iter.Response().Response.Response.StatusCode
   411  			}
   412  			tracing.EndSpan(ctx, sc, err)
   413  		}()
   414  	}
   415  	iter.i++
   416  	if iter.i < len(iter.page.Values()) {
   417  		return nil
   418  	}
   419  	err = iter.page.NextWithContext(ctx)
   420  	if err != nil {
   421  		iter.i--
   422  		return err
   423  	}
   424  	iter.i = 0
   425  	return nil
   426  }
   427  
   428  // Next advances to the next value.  If there was an error making
   429  // the request the iterator does not advance and the error is returned.
   430  // Deprecated: Use NextWithContext() instead.
   431  func (iter *IotHubDescriptionListResultIterator) Next() error {
   432  	return iter.NextWithContext(context.Background())
   433  }
   434  
   435  // NotDone returns true if the enumeration should be started or is not yet complete.
   436  func (iter IotHubDescriptionListResultIterator) NotDone() bool {
   437  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   438  }
   439  
   440  // Response returns the raw server response from the last page request.
   441  func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult {
   442  	return iter.page.Response()
   443  }
   444  
   445  // Value returns the current value or a zero-initialized value if the
   446  // iterator has advanced beyond the end of the collection.
   447  func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription {
   448  	if !iter.page.NotDone() {
   449  		return IotHubDescription{}
   450  	}
   451  	return iter.page.Values()[iter.i]
   452  }
   453  
   454  // Creates a new instance of the IotHubDescriptionListResultIterator type.
   455  func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator {
   456  	return IotHubDescriptionListResultIterator{page: page}
   457  }
   458  
   459  // IsEmpty returns true if the ListResult contains no values.
   460  func (ihdlr IotHubDescriptionListResult) IsEmpty() bool {
   461  	return ihdlr.Value == nil || len(*ihdlr.Value) == 0
   462  }
   463  
   464  // hasNextLink returns true if the NextLink is not empty.
   465  func (ihdlr IotHubDescriptionListResult) hasNextLink() bool {
   466  	return ihdlr.NextLink != nil && len(*ihdlr.NextLink) != 0
   467  }
   468  
   469  // iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results.
   470  // It returns nil if no more results exist.
   471  func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
   472  	if !ihdlr.hasNextLink() {
   473  		return nil, nil
   474  	}
   475  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   476  		autorest.AsJSON(),
   477  		autorest.AsGet(),
   478  		autorest.WithBaseURL(to.String(ihdlr.NextLink)))
   479  }
   480  
   481  // IotHubDescriptionListResultPage contains a page of IotHubDescription values.
   482  type IotHubDescriptionListResultPage struct {
   483  	fn    func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)
   484  	ihdlr IotHubDescriptionListResult
   485  }
   486  
   487  // NextWithContext advances to the next page of values.  If there was an error making
   488  // the request the page does not advance and the error is returned.
   489  func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
   490  	if tracing.IsEnabled() {
   491  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext")
   492  		defer func() {
   493  			sc := -1
   494  			if page.Response().Response.Response != nil {
   495  				sc = page.Response().Response.Response.StatusCode
   496  			}
   497  			tracing.EndSpan(ctx, sc, err)
   498  		}()
   499  	}
   500  	for {
   501  		next, err := page.fn(ctx, page.ihdlr)
   502  		if err != nil {
   503  			return err
   504  		}
   505  		page.ihdlr = next
   506  		if !next.hasNextLink() || !next.IsEmpty() {
   507  			break
   508  		}
   509  	}
   510  	return nil
   511  }
   512  
   513  // Next advances to the next page of values.  If there was an error making
   514  // the request the page does not advance and the error is returned.
   515  // Deprecated: Use NextWithContext() instead.
   516  func (page *IotHubDescriptionListResultPage) Next() error {
   517  	return page.NextWithContext(context.Background())
   518  }
   519  
   520  // NotDone returns true if the page enumeration should be started or is not yet complete.
   521  func (page IotHubDescriptionListResultPage) NotDone() bool {
   522  	return !page.ihdlr.IsEmpty()
   523  }
   524  
   525  // Response returns the raw server response from the last page request.
   526  func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult {
   527  	return page.ihdlr
   528  }
   529  
   530  // Values returns the slice of values for the current page or nil if there are no values.
   531  func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {
   532  	if page.ihdlr.IsEmpty() {
   533  		return nil
   534  	}
   535  	return *page.ihdlr.Value
   536  }
   537  
   538  // Creates a new instance of the IotHubDescriptionListResultPage type.
   539  func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {
   540  	return IotHubDescriptionListResultPage{
   541  		fn:    getNextPage,
   542  		ihdlr: cur,
   543  	}
   544  }
   545  
   546  // IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available.
   547  type IotHubNameAvailabilityInfo struct {
   548  	autorest.Response `json:"-"`
   549  	// NameAvailable - READ-ONLY; The value which indicates whether the provided name is available.
   550  	NameAvailable *bool `json:"nameAvailable,omitempty"`
   551  	// Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists'
   552  	Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"`
   553  	// Message - The detailed reason message.
   554  	Message *string `json:"message,omitempty"`
   555  }
   556  
   557  // MarshalJSON is the custom marshaler for IotHubNameAvailabilityInfo.
   558  func (ihnai IotHubNameAvailabilityInfo) MarshalJSON() ([]byte, error) {
   559  	objectMap := make(map[string]interface{})
   560  	if ihnai.Message != nil {
   561  		objectMap["message"] = ihnai.Message
   562  	}
   563  	return json.Marshal(objectMap)
   564  }
   565  
   566  // IotHubProperties the properties of an IoT hub.
   567  type IotHubProperties struct {
   568  	// AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub.
   569  	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"`
   570  	// IPFilterRules - The IP filter rules.
   571  	IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
   572  	// ProvisioningState - READ-ONLY; The provisioning state.
   573  	ProvisioningState *string `json:"provisioningState,omitempty"`
   574  	// HostName - READ-ONLY; The name of the host.
   575  	HostName *string `json:"hostName,omitempty"`
   576  	// 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.
   577  	EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"`
   578  	Routing           *RoutingProperties             `json:"routing,omitempty"`
   579  	// 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.
   580  	StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"`
   581  	// MessagingEndpoints - The messaging endpoint properties for the file upload notification queue.
   582  	MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"`
   583  	// EnableFileUploadNotifications - If True, file upload notifications are enabled.
   584  	EnableFileUploadNotifications *bool                    `json:"enableFileUploadNotifications,omitempty"`
   585  	CloudToDevice                 *CloudToDeviceProperties `json:"cloudToDevice,omitempty"`
   586  	// Comments - Comments.
   587  	Comments                       *string                         `json:"comments,omitempty"`
   588  	OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"`
   589  	// Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement'
   590  	Features Capabilities `json:"features,omitempty"`
   591  }
   592  
   593  // MarshalJSON is the custom marshaler for IotHubProperties.
   594  func (ihp IotHubProperties) MarshalJSON() ([]byte, error) {
   595  	objectMap := make(map[string]interface{})
   596  	if ihp.AuthorizationPolicies != nil {
   597  		objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies
   598  	}
   599  	if ihp.IPFilterRules != nil {
   600  		objectMap["ipFilterRules"] = ihp.IPFilterRules
   601  	}
   602  	if ihp.EventHubEndpoints != nil {
   603  		objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints
   604  	}
   605  	if ihp.Routing != nil {
   606  		objectMap["routing"] = ihp.Routing
   607  	}
   608  	if ihp.StorageEndpoints != nil {
   609  		objectMap["storageEndpoints"] = ihp.StorageEndpoints
   610  	}
   611  	if ihp.MessagingEndpoints != nil {
   612  		objectMap["messagingEndpoints"] = ihp.MessagingEndpoints
   613  	}
   614  	if ihp.EnableFileUploadNotifications != nil {
   615  		objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications
   616  	}
   617  	if ihp.CloudToDevice != nil {
   618  		objectMap["cloudToDevice"] = ihp.CloudToDevice
   619  	}
   620  	if ihp.Comments != nil {
   621  		objectMap["comments"] = ihp.Comments
   622  	}
   623  	if ihp.OperationsMonitoringProperties != nil {
   624  		objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties
   625  	}
   626  	if ihp.Features != "" {
   627  		objectMap["features"] = ihp.Features
   628  	}
   629  	return json.Marshal(objectMap)
   630  }
   631  
   632  // IotHubQuotaMetricInfo quota metrics properties.
   633  type IotHubQuotaMetricInfo struct {
   634  	// Name - READ-ONLY; The name of the quota metric.
   635  	Name *string `json:"Name,omitempty"`
   636  	// CurrentValue - READ-ONLY; The current value for the quota metric.
   637  	CurrentValue *int64 `json:"CurrentValue,omitempty"`
   638  	// MaxValue - READ-ONLY; The maximum value of the quota metric.
   639  	MaxValue *int64 `json:"MaxValue,omitempty"`
   640  }
   641  
   642  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfo.
   643  func (ihqmi IotHubQuotaMetricInfo) MarshalJSON() ([]byte, error) {
   644  	objectMap := make(map[string]interface{})
   645  	return json.Marshal(objectMap)
   646  }
   647  
   648  // IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next
   649  // link.
   650  type IotHubQuotaMetricInfoListResult struct {
   651  	autorest.Response `json:"-"`
   652  	// Value - The array of quota metrics objects.
   653  	Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"`
   654  	// NextLink - READ-ONLY; The next link.
   655  	NextLink *string `json:"nextLink,omitempty"`
   656  }
   657  
   658  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfoListResult.
   659  func (ihqmilr IotHubQuotaMetricInfoListResult) MarshalJSON() ([]byte, error) {
   660  	objectMap := make(map[string]interface{})
   661  	if ihqmilr.Value != nil {
   662  		objectMap["value"] = ihqmilr.Value
   663  	}
   664  	return json.Marshal(objectMap)
   665  }
   666  
   667  // IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo
   668  // values.
   669  type IotHubQuotaMetricInfoListResultIterator struct {
   670  	i    int
   671  	page IotHubQuotaMetricInfoListResultPage
   672  }
   673  
   674  // NextWithContext advances to the next value.  If there was an error making
   675  // the request the iterator does not advance and the error is returned.
   676  func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
   677  	if tracing.IsEnabled() {
   678  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext")
   679  		defer func() {
   680  			sc := -1
   681  			if iter.Response().Response.Response != nil {
   682  				sc = iter.Response().Response.Response.StatusCode
   683  			}
   684  			tracing.EndSpan(ctx, sc, err)
   685  		}()
   686  	}
   687  	iter.i++
   688  	if iter.i < len(iter.page.Values()) {
   689  		return nil
   690  	}
   691  	err = iter.page.NextWithContext(ctx)
   692  	if err != nil {
   693  		iter.i--
   694  		return err
   695  	}
   696  	iter.i = 0
   697  	return nil
   698  }
   699  
   700  // Next advances to the next value.  If there was an error making
   701  // the request the iterator does not advance and the error is returned.
   702  // Deprecated: Use NextWithContext() instead.
   703  func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error {
   704  	return iter.NextWithContext(context.Background())
   705  }
   706  
   707  // NotDone returns true if the enumeration should be started or is not yet complete.
   708  func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool {
   709  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   710  }
   711  
   712  // Response returns the raw server response from the last page request.
   713  func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult {
   714  	return iter.page.Response()
   715  }
   716  
   717  // Value returns the current value or a zero-initialized value if the
   718  // iterator has advanced beyond the end of the collection.
   719  func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {
   720  	if !iter.page.NotDone() {
   721  		return IotHubQuotaMetricInfo{}
   722  	}
   723  	return iter.page.Values()[iter.i]
   724  }
   725  
   726  // Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type.
   727  func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator {
   728  	return IotHubQuotaMetricInfoListResultIterator{page: page}
   729  }
   730  
   731  // IsEmpty returns true if the ListResult contains no values.
   732  func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {
   733  	return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0
   734  }
   735  
   736  // hasNextLink returns true if the NextLink is not empty.
   737  func (ihqmilr IotHubQuotaMetricInfoListResult) hasNextLink() bool {
   738  	return ihqmilr.NextLink != nil && len(*ihqmilr.NextLink) != 0
   739  }
   740  
   741  // iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results.
   742  // It returns nil if no more results exist.
   743  func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {
   744  	if !ihqmilr.hasNextLink() {
   745  		return nil, nil
   746  	}
   747  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   748  		autorest.AsJSON(),
   749  		autorest.AsGet(),
   750  		autorest.WithBaseURL(to.String(ihqmilr.NextLink)))
   751  }
   752  
   753  // IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values.
   754  type IotHubQuotaMetricInfoListResultPage struct {
   755  	fn      func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)
   756  	ihqmilr IotHubQuotaMetricInfoListResult
   757  }
   758  
   759  // NextWithContext advances to the next page of values.  If there was an error making
   760  // the request the page does not advance and the error is returned.
   761  func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) {
   762  	if tracing.IsEnabled() {
   763  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext")
   764  		defer func() {
   765  			sc := -1
   766  			if page.Response().Response.Response != nil {
   767  				sc = page.Response().Response.Response.StatusCode
   768  			}
   769  			tracing.EndSpan(ctx, sc, err)
   770  		}()
   771  	}
   772  	for {
   773  		next, err := page.fn(ctx, page.ihqmilr)
   774  		if err != nil {
   775  			return err
   776  		}
   777  		page.ihqmilr = next
   778  		if !next.hasNextLink() || !next.IsEmpty() {
   779  			break
   780  		}
   781  	}
   782  	return nil
   783  }
   784  
   785  // Next advances to the next page of values.  If there was an error making
   786  // the request the page does not advance and the error is returned.
   787  // Deprecated: Use NextWithContext() instead.
   788  func (page *IotHubQuotaMetricInfoListResultPage) Next() error {
   789  	return page.NextWithContext(context.Background())
   790  }
   791  
   792  // NotDone returns true if the page enumeration should be started or is not yet complete.
   793  func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {
   794  	return !page.ihqmilr.IsEmpty()
   795  }
   796  
   797  // Response returns the raw server response from the last page request.
   798  func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult {
   799  	return page.ihqmilr
   800  }
   801  
   802  // Values returns the slice of values for the current page or nil if there are no values.
   803  func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {
   804  	if page.ihqmilr.IsEmpty() {
   805  		return nil
   806  	}
   807  	return *page.ihqmilr.Value
   808  }
   809  
   810  // Creates a new instance of the IotHubQuotaMetricInfoListResultPage type.
   811  func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {
   812  	return IotHubQuotaMetricInfoListResultPage{
   813  		fn:      getNextPage,
   814  		ihqmilr: cur,
   815  	}
   816  }
   817  
   818  // IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
   819  // long-running operation.
   820  type IotHubResourceCreateOrUpdateFuture struct {
   821  	azure.FutureAPI
   822  	// Result returns the result of the asynchronous operation.
   823  	// If the operation has not completed it will return an error.
   824  	Result func(IotHubResourceClient) (IotHubDescription, error)
   825  }
   826  
   827  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   828  func (future *IotHubResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   829  	var azFuture azure.Future
   830  	if err := json.Unmarshal(body, &azFuture); err != nil {
   831  		return err
   832  	}
   833  	future.FutureAPI = &azFuture
   834  	future.Result = future.result
   835  	return nil
   836  }
   837  
   838  // result is the default implementation for IotHubResourceCreateOrUpdateFuture.Result.
   839  func (future *IotHubResourceCreateOrUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
   840  	var done bool
   841  	done, err = future.DoneWithContext(context.Background(), client)
   842  	if err != nil {
   843  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   844  		return
   845  	}
   846  	if !done {
   847  		ihd.Response.Response = future.Response()
   848  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture")
   849  		return
   850  	}
   851  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   852  	if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
   853  		ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response)
   854  		if err != nil {
   855  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
   856  		}
   857  	}
   858  	return
   859  }
   860  
   861  // IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   862  // operation.
   863  type IotHubResourceDeleteFuture struct {
   864  	azure.FutureAPI
   865  	// Result returns the result of the asynchronous operation.
   866  	// If the operation has not completed it will return an error.
   867  	Result func(IotHubResourceClient) (SetObject, error)
   868  }
   869  
   870  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   871  func (future *IotHubResourceDeleteFuture) UnmarshalJSON(body []byte) error {
   872  	var azFuture azure.Future
   873  	if err := json.Unmarshal(body, &azFuture); err != nil {
   874  		return err
   875  	}
   876  	future.FutureAPI = &azFuture
   877  	future.Result = future.result
   878  	return nil
   879  }
   880  
   881  // result is the default implementation for IotHubResourceDeleteFuture.Result.
   882  func (future *IotHubResourceDeleteFuture) result(client IotHubResourceClient) (so SetObject, err error) {
   883  	var done bool
   884  	done, err = future.DoneWithContext(context.Background(), client)
   885  	if err != nil {
   886  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure")
   887  		return
   888  	}
   889  	if !done {
   890  		so.Response.Response = future.Response()
   891  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture")
   892  		return
   893  	}
   894  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   895  	if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
   896  		so, err = client.DeleteResponder(so.Response.Response)
   897  		if err != nil {
   898  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request")
   899  		}
   900  	}
   901  	return
   902  }
   903  
   904  // IotHubSkuDescription SKU properties.
   905  type IotHubSkuDescription struct {
   906  	// ResourceType - READ-ONLY; The type of the resource.
   907  	ResourceType *string         `json:"resourceType,omitempty"`
   908  	Sku          *IotHubSkuInfo  `json:"sku,omitempty"`
   909  	Capacity     *IotHubCapacity `json:"capacity,omitempty"`
   910  }
   911  
   912  // MarshalJSON is the custom marshaler for IotHubSkuDescription.
   913  func (ihsd IotHubSkuDescription) MarshalJSON() ([]byte, error) {
   914  	objectMap := make(map[string]interface{})
   915  	if ihsd.Sku != nil {
   916  		objectMap["sku"] = ihsd.Sku
   917  	}
   918  	if ihsd.Capacity != nil {
   919  		objectMap["capacity"] = ihsd.Capacity
   920  	}
   921  	return json.Marshal(objectMap)
   922  }
   923  
   924  // IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next
   925  // link.
   926  type IotHubSkuDescriptionListResult struct {
   927  	autorest.Response `json:"-"`
   928  	// Value - The array of IotHubSkuDescription.
   929  	Value *[]IotHubSkuDescription `json:"value,omitempty"`
   930  	// NextLink - READ-ONLY; The next link.
   931  	NextLink *string `json:"nextLink,omitempty"`
   932  }
   933  
   934  // MarshalJSON is the custom marshaler for IotHubSkuDescriptionListResult.
   935  func (ihsdlr IotHubSkuDescriptionListResult) MarshalJSON() ([]byte, error) {
   936  	objectMap := make(map[string]interface{})
   937  	if ihsdlr.Value != nil {
   938  		objectMap["value"] = ihsdlr.Value
   939  	}
   940  	return json.Marshal(objectMap)
   941  }
   942  
   943  // IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription
   944  // values.
   945  type IotHubSkuDescriptionListResultIterator struct {
   946  	i    int
   947  	page IotHubSkuDescriptionListResultPage
   948  }
   949  
   950  // NextWithContext advances to the next value.  If there was an error making
   951  // the request the iterator does not advance and the error is returned.
   952  func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   953  	if tracing.IsEnabled() {
   954  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext")
   955  		defer func() {
   956  			sc := -1
   957  			if iter.Response().Response.Response != nil {
   958  				sc = iter.Response().Response.Response.StatusCode
   959  			}
   960  			tracing.EndSpan(ctx, sc, err)
   961  		}()
   962  	}
   963  	iter.i++
   964  	if iter.i < len(iter.page.Values()) {
   965  		return nil
   966  	}
   967  	err = iter.page.NextWithContext(ctx)
   968  	if err != nil {
   969  		iter.i--
   970  		return err
   971  	}
   972  	iter.i = 0
   973  	return nil
   974  }
   975  
   976  // Next advances to the next value.  If there was an error making
   977  // the request the iterator does not advance and the error is returned.
   978  // Deprecated: Use NextWithContext() instead.
   979  func (iter *IotHubSkuDescriptionListResultIterator) Next() error {
   980  	return iter.NextWithContext(context.Background())
   981  }
   982  
   983  // NotDone returns true if the enumeration should be started or is not yet complete.
   984  func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool {
   985  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   986  }
   987  
   988  // Response returns the raw server response from the last page request.
   989  func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult {
   990  	return iter.page.Response()
   991  }
   992  
   993  // Value returns the current value or a zero-initialized value if the
   994  // iterator has advanced beyond the end of the collection.
   995  func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription {
   996  	if !iter.page.NotDone() {
   997  		return IotHubSkuDescription{}
   998  	}
   999  	return iter.page.Values()[iter.i]
  1000  }
  1001  
  1002  // Creates a new instance of the IotHubSkuDescriptionListResultIterator type.
  1003  func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator {
  1004  	return IotHubSkuDescriptionListResultIterator{page: page}
  1005  }
  1006  
  1007  // IsEmpty returns true if the ListResult contains no values.
  1008  func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {
  1009  	return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0
  1010  }
  1011  
  1012  // hasNextLink returns true if the NextLink is not empty.
  1013  func (ihsdlr IotHubSkuDescriptionListResult) hasNextLink() bool {
  1014  	return ihsdlr.NextLink != nil && len(*ihsdlr.NextLink) != 0
  1015  }
  1016  
  1017  // iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results.
  1018  // It returns nil if no more results exist.
  1019  func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1020  	if !ihsdlr.hasNextLink() {
  1021  		return nil, nil
  1022  	}
  1023  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1024  		autorest.AsJSON(),
  1025  		autorest.AsGet(),
  1026  		autorest.WithBaseURL(to.String(ihsdlr.NextLink)))
  1027  }
  1028  
  1029  // IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values.
  1030  type IotHubSkuDescriptionListResultPage struct {
  1031  	fn     func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)
  1032  	ihsdlr IotHubSkuDescriptionListResult
  1033  }
  1034  
  1035  // NextWithContext advances to the next page of values.  If there was an error making
  1036  // the request the page does not advance and the error is returned.
  1037  func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1038  	if tracing.IsEnabled() {
  1039  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext")
  1040  		defer func() {
  1041  			sc := -1
  1042  			if page.Response().Response.Response != nil {
  1043  				sc = page.Response().Response.Response.StatusCode
  1044  			}
  1045  			tracing.EndSpan(ctx, sc, err)
  1046  		}()
  1047  	}
  1048  	for {
  1049  		next, err := page.fn(ctx, page.ihsdlr)
  1050  		if err != nil {
  1051  			return err
  1052  		}
  1053  		page.ihsdlr = next
  1054  		if !next.hasNextLink() || !next.IsEmpty() {
  1055  			break
  1056  		}
  1057  	}
  1058  	return nil
  1059  }
  1060  
  1061  // Next advances to the next page of values.  If there was an error making
  1062  // the request the page does not advance and the error is returned.
  1063  // Deprecated: Use NextWithContext() instead.
  1064  func (page *IotHubSkuDescriptionListResultPage) Next() error {
  1065  	return page.NextWithContext(context.Background())
  1066  }
  1067  
  1068  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1069  func (page IotHubSkuDescriptionListResultPage) NotDone() bool {
  1070  	return !page.ihsdlr.IsEmpty()
  1071  }
  1072  
  1073  // Response returns the raw server response from the last page request.
  1074  func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult {
  1075  	return page.ihsdlr
  1076  }
  1077  
  1078  // Values returns the slice of values for the current page or nil if there are no values.
  1079  func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {
  1080  	if page.ihsdlr.IsEmpty() {
  1081  		return nil
  1082  	}
  1083  	return *page.ihsdlr.Value
  1084  }
  1085  
  1086  // Creates a new instance of the IotHubSkuDescriptionListResultPage type.
  1087  func NewIotHubSkuDescriptionListResultPage(cur IotHubSkuDescriptionListResult, getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage {
  1088  	return IotHubSkuDescriptionListResultPage{
  1089  		fn:     getNextPage,
  1090  		ihsdlr: cur,
  1091  	}
  1092  }
  1093  
  1094  // IotHubSkuInfo information about the SKU of the IoT hub.
  1095  type IotHubSkuInfo struct {
  1096  	// Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3'
  1097  	Name IotHubSku `json:"name,omitempty"`
  1098  	// Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard'
  1099  	Tier IotHubSkuTier `json:"tier,omitempty"`
  1100  	// Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits.
  1101  	Capacity *int64 `json:"capacity,omitempty"`
  1102  }
  1103  
  1104  // MarshalJSON is the custom marshaler for IotHubSkuInfo.
  1105  func (ihsi IotHubSkuInfo) MarshalJSON() ([]byte, error) {
  1106  	objectMap := make(map[string]interface{})
  1107  	if ihsi.Name != "" {
  1108  		objectMap["name"] = ihsi.Name
  1109  	}
  1110  	if ihsi.Capacity != nil {
  1111  		objectMap["capacity"] = ihsi.Capacity
  1112  	}
  1113  	return json.Marshal(objectMap)
  1114  }
  1115  
  1116  // IPFilterRule the IP filter rules for the IoT hub.
  1117  type IPFilterRule struct {
  1118  	// FilterName - The name of the IP filter rule.
  1119  	FilterName *string `json:"filterName,omitempty"`
  1120  	// Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject'
  1121  	Action IPFilterActionType `json:"action,omitempty"`
  1122  	// IPMask - A string that contains the IP address range in CIDR notation for the rule.
  1123  	IPMask *string `json:"ipMask,omitempty"`
  1124  }
  1125  
  1126  // JobResponse the properties of the Job Response object.
  1127  type JobResponse struct {
  1128  	autorest.Response `json:"-"`
  1129  	// JobID - READ-ONLY; The job identifier.
  1130  	JobID *string `json:"jobId,omitempty"`
  1131  	// StartTimeUtc - READ-ONLY; The start time of the job.
  1132  	StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"`
  1133  	// EndTimeUtc - READ-ONLY; The time the job stopped processing.
  1134  	EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"`
  1135  	// Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate'
  1136  	Type JobType `json:"type,omitempty"`
  1137  	// Status - READ-ONLY; The status of the job. Possible values include: 'Unknown', 'Enqueued', 'Running', 'Completed', 'Failed', 'Cancelled'
  1138  	Status JobStatus `json:"status,omitempty"`
  1139  	// FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure.
  1140  	FailureReason *string `json:"failureReason,omitempty"`
  1141  	// StatusMessage - READ-ONLY; The status message for the job.
  1142  	StatusMessage *string `json:"statusMessage,omitempty"`
  1143  	// ParentJobID - READ-ONLY; The job identifier of the parent job, if any.
  1144  	ParentJobID *string `json:"parentJobId,omitempty"`
  1145  }
  1146  
  1147  // MarshalJSON is the custom marshaler for JobResponse.
  1148  func (jr JobResponse) MarshalJSON() ([]byte, error) {
  1149  	objectMap := make(map[string]interface{})
  1150  	return json.Marshal(objectMap)
  1151  }
  1152  
  1153  // JobResponseListResult the JSON-serialized array of JobResponse objects with a next link.
  1154  type JobResponseListResult struct {
  1155  	autorest.Response `json:"-"`
  1156  	// Value - The array of JobResponse objects.
  1157  	Value *[]JobResponse `json:"value,omitempty"`
  1158  	// NextLink - READ-ONLY; The next link.
  1159  	NextLink *string `json:"nextLink,omitempty"`
  1160  }
  1161  
  1162  // MarshalJSON is the custom marshaler for JobResponseListResult.
  1163  func (jrlr JobResponseListResult) MarshalJSON() ([]byte, error) {
  1164  	objectMap := make(map[string]interface{})
  1165  	if jrlr.Value != nil {
  1166  		objectMap["value"] = jrlr.Value
  1167  	}
  1168  	return json.Marshal(objectMap)
  1169  }
  1170  
  1171  // JobResponseListResultIterator provides access to a complete listing of JobResponse values.
  1172  type JobResponseListResultIterator struct {
  1173  	i    int
  1174  	page JobResponseListResultPage
  1175  }
  1176  
  1177  // NextWithContext advances to the next value.  If there was an error making
  1178  // the request the iterator does not advance and the error is returned.
  1179  func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1180  	if tracing.IsEnabled() {
  1181  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext")
  1182  		defer func() {
  1183  			sc := -1
  1184  			if iter.Response().Response.Response != nil {
  1185  				sc = iter.Response().Response.Response.StatusCode
  1186  			}
  1187  			tracing.EndSpan(ctx, sc, err)
  1188  		}()
  1189  	}
  1190  	iter.i++
  1191  	if iter.i < len(iter.page.Values()) {
  1192  		return nil
  1193  	}
  1194  	err = iter.page.NextWithContext(ctx)
  1195  	if err != nil {
  1196  		iter.i--
  1197  		return err
  1198  	}
  1199  	iter.i = 0
  1200  	return nil
  1201  }
  1202  
  1203  // Next advances to the next value.  If there was an error making
  1204  // the request the iterator does not advance and the error is returned.
  1205  // Deprecated: Use NextWithContext() instead.
  1206  func (iter *JobResponseListResultIterator) Next() error {
  1207  	return iter.NextWithContext(context.Background())
  1208  }
  1209  
  1210  // NotDone returns true if the enumeration should be started or is not yet complete.
  1211  func (iter JobResponseListResultIterator) NotDone() bool {
  1212  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1213  }
  1214  
  1215  // Response returns the raw server response from the last page request.
  1216  func (iter JobResponseListResultIterator) Response() JobResponseListResult {
  1217  	return iter.page.Response()
  1218  }
  1219  
  1220  // Value returns the current value or a zero-initialized value if the
  1221  // iterator has advanced beyond the end of the collection.
  1222  func (iter JobResponseListResultIterator) Value() JobResponse {
  1223  	if !iter.page.NotDone() {
  1224  		return JobResponse{}
  1225  	}
  1226  	return iter.page.Values()[iter.i]
  1227  }
  1228  
  1229  // Creates a new instance of the JobResponseListResultIterator type.
  1230  func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator {
  1231  	return JobResponseListResultIterator{page: page}
  1232  }
  1233  
  1234  // IsEmpty returns true if the ListResult contains no values.
  1235  func (jrlr JobResponseListResult) IsEmpty() bool {
  1236  	return jrlr.Value == nil || len(*jrlr.Value) == 0
  1237  }
  1238  
  1239  // hasNextLink returns true if the NextLink is not empty.
  1240  func (jrlr JobResponseListResult) hasNextLink() bool {
  1241  	return jrlr.NextLink != nil && len(*jrlr.NextLink) != 0
  1242  }
  1243  
  1244  // jobResponseListResultPreparer prepares a request to retrieve the next set of results.
  1245  // It returns nil if no more results exist.
  1246  func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) {
  1247  	if !jrlr.hasNextLink() {
  1248  		return nil, nil
  1249  	}
  1250  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1251  		autorest.AsJSON(),
  1252  		autorest.AsGet(),
  1253  		autorest.WithBaseURL(to.String(jrlr.NextLink)))
  1254  }
  1255  
  1256  // JobResponseListResultPage contains a page of JobResponse values.
  1257  type JobResponseListResultPage struct {
  1258  	fn   func(context.Context, JobResponseListResult) (JobResponseListResult, error)
  1259  	jrlr JobResponseListResult
  1260  }
  1261  
  1262  // NextWithContext advances to the next page of values.  If there was an error making
  1263  // the request the page does not advance and the error is returned.
  1264  func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {
  1265  	if tracing.IsEnabled() {
  1266  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext")
  1267  		defer func() {
  1268  			sc := -1
  1269  			if page.Response().Response.Response != nil {
  1270  				sc = page.Response().Response.Response.StatusCode
  1271  			}
  1272  			tracing.EndSpan(ctx, sc, err)
  1273  		}()
  1274  	}
  1275  	for {
  1276  		next, err := page.fn(ctx, page.jrlr)
  1277  		if err != nil {
  1278  			return err
  1279  		}
  1280  		page.jrlr = next
  1281  		if !next.hasNextLink() || !next.IsEmpty() {
  1282  			break
  1283  		}
  1284  	}
  1285  	return nil
  1286  }
  1287  
  1288  // Next advances to the next page of values.  If there was an error making
  1289  // the request the page does not advance and the error is returned.
  1290  // Deprecated: Use NextWithContext() instead.
  1291  func (page *JobResponseListResultPage) Next() error {
  1292  	return page.NextWithContext(context.Background())
  1293  }
  1294  
  1295  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1296  func (page JobResponseListResultPage) NotDone() bool {
  1297  	return !page.jrlr.IsEmpty()
  1298  }
  1299  
  1300  // Response returns the raw server response from the last page request.
  1301  func (page JobResponseListResultPage) Response() JobResponseListResult {
  1302  	return page.jrlr
  1303  }
  1304  
  1305  // Values returns the slice of values for the current page or nil if there are no values.
  1306  func (page JobResponseListResultPage) Values() []JobResponse {
  1307  	if page.jrlr.IsEmpty() {
  1308  		return nil
  1309  	}
  1310  	return *page.jrlr.Value
  1311  }
  1312  
  1313  // Creates a new instance of the JobResponseListResultPage type.
  1314  func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {
  1315  	return JobResponseListResultPage{
  1316  		fn:   getNextPage,
  1317  		jrlr: cur,
  1318  	}
  1319  }
  1320  
  1321  // MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub.
  1322  type MessagingEndpointProperties struct {
  1323  	// LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.
  1324  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
  1325  	// 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-file-upload.
  1326  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
  1327  	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.
  1328  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
  1329  }
  1330  
  1331  // OperationInputs input values.
  1332  type OperationInputs struct {
  1333  	// Name - The name of the IoT hub to check.
  1334  	Name *string `json:"Name,omitempty"`
  1335  }
  1336  
  1337  // OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys
  1338  // to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations,
  1339  // FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations,
  1340  // DirectMethods.
  1341  type OperationsMonitoringProperties struct {
  1342  	Events map[string]*OperationMonitoringLevel `json:"events"`
  1343  }
  1344  
  1345  // MarshalJSON is the custom marshaler for OperationsMonitoringProperties.
  1346  func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) {
  1347  	objectMap := make(map[string]interface{})
  1348  	if omp.Events != nil {
  1349  		objectMap["events"] = omp.Events
  1350  	}
  1351  	return json.Marshal(objectMap)
  1352  }
  1353  
  1354  // RegistryStatistics identity registry statistics.
  1355  type RegistryStatistics struct {
  1356  	autorest.Response `json:"-"`
  1357  	// TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry.
  1358  	TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"`
  1359  	// EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry.
  1360  	EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"`
  1361  	// DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry.
  1362  	DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"`
  1363  }
  1364  
  1365  // MarshalJSON is the custom marshaler for RegistryStatistics.
  1366  func (rs RegistryStatistics) MarshalJSON() ([]byte, error) {
  1367  	objectMap := make(map[string]interface{})
  1368  	return json.Marshal(objectMap)
  1369  }
  1370  
  1371  // Resource the common properties of an Azure resource.
  1372  type Resource struct {
  1373  	// ID - READ-ONLY; The resource identifier.
  1374  	ID *string `json:"id,omitempty"`
  1375  	// Name - READ-ONLY; The resource name.
  1376  	Name *string `json:"name,omitempty"`
  1377  	// Type - READ-ONLY; The resource type.
  1378  	Type *string `json:"type,omitempty"`
  1379  	// Location - The resource location.
  1380  	Location *string `json:"location,omitempty"`
  1381  	// Tags - The resource tags.
  1382  	Tags map[string]*string `json:"tags"`
  1383  }
  1384  
  1385  // MarshalJSON is the custom marshaler for Resource.
  1386  func (r Resource) MarshalJSON() ([]byte, error) {
  1387  	objectMap := make(map[string]interface{})
  1388  	if r.Location != nil {
  1389  		objectMap["location"] = r.Location
  1390  	}
  1391  	if r.Tags != nil {
  1392  		objectMap["tags"] = r.Tags
  1393  	}
  1394  	return json.Marshal(objectMap)
  1395  }
  1396  
  1397  // RouteProperties the properties of a routing rule that your IoT hub uses to route messages to endpoints.
  1398  type RouteProperties struct {
  1399  	// Name - The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters,  and must be unique.
  1400  	Name *string `json:"name,omitempty"`
  1401  	// Source - The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: 'DeviceMessages', 'TwinChangeEvents', 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents'
  1402  	Source RoutingSource `json:"source,omitempty"`
  1403  	// Condition - The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language
  1404  	Condition *string `json:"condition,omitempty"`
  1405  	// EndpointNames - The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.
  1406  	EndpointNames *[]string `json:"endpointNames,omitempty"`
  1407  	// IsEnabled - Used to specify whether a route is enabled.
  1408  	IsEnabled *bool `json:"isEnabled,omitempty"`
  1409  }
  1410  
  1411  // RoutingEndpoints the properties related to the custom endpoints to which your IoT hub routes messages
  1412  // based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for
  1413  // paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs.
  1414  type RoutingEndpoints struct {
  1415  	// ServiceBusQueues - The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules.
  1416  	ServiceBusQueues *[]RoutingServiceBusQueueEndpointProperties `json:"serviceBusQueues,omitempty"`
  1417  	// ServiceBusTopics - The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules.
  1418  	ServiceBusTopics *[]RoutingServiceBusTopicEndpointProperties `json:"serviceBusTopics,omitempty"`
  1419  	// EventHubs - The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint.
  1420  	EventHubs *[]RoutingEventHubProperties `json:"eventHubs,omitempty"`
  1421  }
  1422  
  1423  // RoutingEventHubProperties the properties related to an event hub endpoint.
  1424  type RoutingEventHubProperties struct {
  1425  	// ConnectionString - The connection string of the event hub endpoint.
  1426  	ConnectionString *string `json:"connectionString,omitempty"`
  1427  	// Name - The name of the event hub endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved;  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.
  1428  	Name *string `json:"name,omitempty"`
  1429  	// SubscriptionID - The subscription identifier of the event hub endpoint.
  1430  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  1431  	// ResourceGroup - The name of the resource group of the event hub endpoint.
  1432  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  1433  }
  1434  
  1435  // RoutingProperties the routing related properties of the IoT hub. See:
  1436  // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging
  1437  type RoutingProperties struct {
  1438  	Endpoints *RoutingEndpoints `json:"endpoints,omitempty"`
  1439  	// Routes - The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs.
  1440  	Routes *[]RouteProperties `json:"routes,omitempty"`
  1441  	// FallbackRoute - The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint.
  1442  	FallbackRoute *FallbackRouteProperties `json:"fallbackRoute,omitempty"`
  1443  }
  1444  
  1445  // RoutingServiceBusQueueEndpointProperties the properties related to service bus queue endpoint types.
  1446  type RoutingServiceBusQueueEndpointProperties struct {
  1447  	// ConnectionString - The connection string of the service bus queue endpoint.
  1448  	ConnectionString *string `json:"connectionString,omitempty"`
  1449  	// Name - The name of the service bus queue endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved;  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name.
  1450  	Name *string `json:"name,omitempty"`
  1451  	// SubscriptionID - The subscription identifier of the service bus queue endpoint.
  1452  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  1453  	// ResourceGroup - The name of the resource group of the service bus queue endpoint.
  1454  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  1455  }
  1456  
  1457  // RoutingServiceBusTopicEndpointProperties the properties related to service bus topic endpoint types.
  1458  type RoutingServiceBusTopicEndpointProperties struct {
  1459  	// ConnectionString - The connection string of the service bus topic endpoint.
  1460  	ConnectionString *string `json:"connectionString,omitempty"`
  1461  	// Name - The name of the service bus topic endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved;  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.  The name need not be the same as the actual topic name.
  1462  	Name *string `json:"name,omitempty"`
  1463  	// SubscriptionID - The subscription identifier of the service bus topic endpoint.
  1464  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  1465  	// ResourceGroup - The name of the resource group of the service bus topic endpoint.
  1466  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  1467  }
  1468  
  1469  // SetObject ...
  1470  type SetObject struct {
  1471  	autorest.Response `json:"-"`
  1472  	Value             interface{} `json:"value,omitempty"`
  1473  }
  1474  
  1475  // SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy.
  1476  type SharedAccessSignatureAuthorizationRule struct {
  1477  	autorest.Response `json:"-"`
  1478  	// KeyName - The name of the shared access policy.
  1479  	KeyName *string `json:"keyName,omitempty"`
  1480  	// PrimaryKey - The primary key.
  1481  	PrimaryKey *string `json:"primaryKey,omitempty"`
  1482  	// SecondaryKey - The secondary key.
  1483  	SecondaryKey *string `json:"secondaryKey,omitempty"`
  1484  	// 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'
  1485  	Rights AccessRights `json:"rights,omitempty"`
  1486  }
  1487  
  1488  // SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link.
  1489  type SharedAccessSignatureAuthorizationRuleListResult struct {
  1490  	autorest.Response `json:"-"`
  1491  	// Value - The list of shared access policies.
  1492  	Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"`
  1493  	// NextLink - READ-ONLY; The next link.
  1494  	NextLink *string `json:"nextLink,omitempty"`
  1495  }
  1496  
  1497  // MarshalJSON is the custom marshaler for SharedAccessSignatureAuthorizationRuleListResult.
  1498  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
  1499  	objectMap := make(map[string]interface{})
  1500  	if sasarlr.Value != nil {
  1501  		objectMap["value"] = sasarlr.Value
  1502  	}
  1503  	return json.Marshal(objectMap)
  1504  }
  1505  
  1506  // SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
  1507  // SharedAccessSignatureAuthorizationRule values.
  1508  type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
  1509  	i    int
  1510  	page SharedAccessSignatureAuthorizationRuleListResultPage
  1511  }
  1512  
  1513  // NextWithContext advances to the next value.  If there was an error making
  1514  // the request the iterator does not advance and the error is returned.
  1515  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1516  	if tracing.IsEnabled() {
  1517  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
  1518  		defer func() {
  1519  			sc := -1
  1520  			if iter.Response().Response.Response != nil {
  1521  				sc = iter.Response().Response.Response.StatusCode
  1522  			}
  1523  			tracing.EndSpan(ctx, sc, err)
  1524  		}()
  1525  	}
  1526  	iter.i++
  1527  	if iter.i < len(iter.page.Values()) {
  1528  		return nil
  1529  	}
  1530  	err = iter.page.NextWithContext(ctx)
  1531  	if err != nil {
  1532  		iter.i--
  1533  		return err
  1534  	}
  1535  	iter.i = 0
  1536  	return nil
  1537  }
  1538  
  1539  // Next advances to the next value.  If there was an error making
  1540  // the request the iterator does not advance and the error is returned.
  1541  // Deprecated: Use NextWithContext() instead.
  1542  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
  1543  	return iter.NextWithContext(context.Background())
  1544  }
  1545  
  1546  // NotDone returns true if the enumeration should be started or is not yet complete.
  1547  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
  1548  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1549  }
  1550  
  1551  // Response returns the raw server response from the last page request.
  1552  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1553  	return iter.page.Response()
  1554  }
  1555  
  1556  // Value returns the current value or a zero-initialized value if the
  1557  // iterator has advanced beyond the end of the collection.
  1558  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule {
  1559  	if !iter.page.NotDone() {
  1560  		return SharedAccessSignatureAuthorizationRule{}
  1561  	}
  1562  	return iter.page.Values()[iter.i]
  1563  }
  1564  
  1565  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type.
  1566  func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
  1567  	return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
  1568  }
  1569  
  1570  // IsEmpty returns true if the ListResult contains no values.
  1571  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
  1572  	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
  1573  }
  1574  
  1575  // hasNextLink returns true if the NextLink is not empty.
  1576  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
  1577  	return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
  1578  }
  1579  
  1580  // sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
  1581  // It returns nil if no more results exist.
  1582  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  1583  	if !sasarlr.hasNextLink() {
  1584  		return nil, nil
  1585  	}
  1586  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1587  		autorest.AsJSON(),
  1588  		autorest.AsGet(),
  1589  		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
  1590  }
  1591  
  1592  // SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
  1593  // SharedAccessSignatureAuthorizationRule values.
  1594  type SharedAccessSignatureAuthorizationRuleListResultPage struct {
  1595  	fn      func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
  1596  	sasarlr SharedAccessSignatureAuthorizationRuleListResult
  1597  }
  1598  
  1599  // NextWithContext advances to the next page of values.  If there was an error making
  1600  // the request the page does not advance and the error is returned.
  1601  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  1602  	if tracing.IsEnabled() {
  1603  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
  1604  		defer func() {
  1605  			sc := -1
  1606  			if page.Response().Response.Response != nil {
  1607  				sc = page.Response().Response.Response.StatusCode
  1608  			}
  1609  			tracing.EndSpan(ctx, sc, err)
  1610  		}()
  1611  	}
  1612  	for {
  1613  		next, err := page.fn(ctx, page.sasarlr)
  1614  		if err != nil {
  1615  			return err
  1616  		}
  1617  		page.sasarlr = next
  1618  		if !next.hasNextLink() || !next.IsEmpty() {
  1619  			break
  1620  		}
  1621  	}
  1622  	return nil
  1623  }
  1624  
  1625  // Next advances to the next page of values.  If there was an error making
  1626  // the request the page does not advance and the error is returned.
  1627  // Deprecated: Use NextWithContext() instead.
  1628  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
  1629  	return page.NextWithContext(context.Background())
  1630  }
  1631  
  1632  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1633  func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
  1634  	return !page.sasarlr.IsEmpty()
  1635  }
  1636  
  1637  // Response returns the raw server response from the last page request.
  1638  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
  1639  	return page.sasarlr
  1640  }
  1641  
  1642  // Values returns the slice of values for the current page or nil if there are no values.
  1643  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule {
  1644  	if page.sasarlr.IsEmpty() {
  1645  		return nil
  1646  	}
  1647  	return *page.sasarlr.Value
  1648  }
  1649  
  1650  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type.
  1651  func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
  1652  	return SharedAccessSignatureAuthorizationRuleListResultPage{
  1653  		fn:      getNextPage,
  1654  		sasarlr: cur,
  1655  	}
  1656  }
  1657  
  1658  // StorageEndpointProperties the properties of the Azure Storage endpoint for file upload.
  1659  type StorageEndpointProperties struct {
  1660  	// 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.
  1661  	SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"`
  1662  	// ConnectionString - The connection string for the Azure Storage account to which files are uploaded.
  1663  	ConnectionString *string `json:"connectionString,omitempty"`
  1664  	// ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.
  1665  	ContainerName *string `json:"containerName,omitempty"`
  1666  }
  1667  

View as plain text