1package devices 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-01-22/devices" 33 34// AccessRights enumerates the values for access rights. 35type AccessRights string 36 37const ( 38 // DeviceConnect ... 39 DeviceConnect AccessRights = "DeviceConnect" 40 // RegistryRead ... 41 RegistryRead AccessRights = "RegistryRead" 42 // RegistryReadDeviceConnect ... 43 RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" 44 // RegistryReadRegistryWrite ... 45 RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" 46 // RegistryReadRegistryWriteDeviceConnect ... 47 RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" 48 // RegistryReadRegistryWriteServiceConnect ... 49 RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" 50 // RegistryReadRegistryWriteServiceConnectDeviceConnect ... 51 RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" 52 // RegistryReadServiceConnect ... 53 RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" 54 // RegistryReadServiceConnectDeviceConnect ... 55 RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" 56 // RegistryWrite ... 57 RegistryWrite AccessRights = "RegistryWrite" 58 // RegistryWriteDeviceConnect ... 59 RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" 60 // RegistryWriteServiceConnect ... 61 RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" 62 // RegistryWriteServiceConnectDeviceConnect ... 63 RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" 64 // ServiceConnect ... 65 ServiceConnect AccessRights = "ServiceConnect" 66 // ServiceConnectDeviceConnect ... 67 ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" 68) 69 70// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. 71func PossibleAccessRightsValues() []AccessRights { 72 return []AccessRights{DeviceConnect, RegistryRead, RegistryReadDeviceConnect, RegistryReadRegistryWrite, RegistryReadRegistryWriteDeviceConnect, RegistryReadRegistryWriteServiceConnect, RegistryReadRegistryWriteServiceConnectDeviceConnect, RegistryReadServiceConnect, RegistryReadServiceConnectDeviceConnect, RegistryWrite, RegistryWriteDeviceConnect, RegistryWriteServiceConnect, RegistryWriteServiceConnectDeviceConnect, ServiceConnect, ServiceConnectDeviceConnect} 73} 74 75// Capabilities enumerates the values for capabilities. 76type Capabilities string 77 78const ( 79 // DeviceManagement ... 80 DeviceManagement Capabilities = "DeviceManagement" 81 // None ... 82 None Capabilities = "None" 83) 84 85// PossibleCapabilitiesValues returns an array of possible values for the Capabilities const type. 86func PossibleCapabilitiesValues() []Capabilities { 87 return []Capabilities{DeviceManagement, None} 88} 89 90// IotHubNameUnavailabilityReason enumerates the values for iot hub name unavailability reason. 91type IotHubNameUnavailabilityReason string 92 93const ( 94 // AlreadyExists ... 95 AlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists" 96 // Invalid ... 97 Invalid IotHubNameUnavailabilityReason = "Invalid" 98) 99 100// PossibleIotHubNameUnavailabilityReasonValues returns an array of possible values for the IotHubNameUnavailabilityReason const type. 101func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason { 102 return []IotHubNameUnavailabilityReason{AlreadyExists, Invalid} 103} 104 105// IotHubScaleType enumerates the values for iot hub scale type. 106type IotHubScaleType string 107 108const ( 109 // IotHubScaleTypeAutomatic ... 110 IotHubScaleTypeAutomatic IotHubScaleType = "Automatic" 111 // IotHubScaleTypeManual ... 112 IotHubScaleTypeManual IotHubScaleType = "Manual" 113 // IotHubScaleTypeNone ... 114 IotHubScaleTypeNone IotHubScaleType = "None" 115) 116 117// PossibleIotHubScaleTypeValues returns an array of possible values for the IotHubScaleType const type. 118func PossibleIotHubScaleTypeValues() []IotHubScaleType { 119 return []IotHubScaleType{IotHubScaleTypeAutomatic, IotHubScaleTypeManual, IotHubScaleTypeNone} 120} 121 122// IotHubSku enumerates the values for iot hub sku. 123type IotHubSku string 124 125const ( 126 // F1 ... 127 F1 IotHubSku = "F1" 128 // S1 ... 129 S1 IotHubSku = "S1" 130 // S2 ... 131 S2 IotHubSku = "S2" 132 // S3 ... 133 S3 IotHubSku = "S3" 134) 135 136// PossibleIotHubSkuValues returns an array of possible values for the IotHubSku const type. 137func PossibleIotHubSkuValues() []IotHubSku { 138 return []IotHubSku{F1, S1, S2, S3} 139} 140 141// IotHubSkuTier enumerates the values for iot hub sku tier. 142type IotHubSkuTier string 143 144const ( 145 // Free ... 146 Free IotHubSkuTier = "Free" 147 // Standard ... 148 Standard IotHubSkuTier = "Standard" 149) 150 151// PossibleIotHubSkuTierValues returns an array of possible values for the IotHubSkuTier const type. 152func PossibleIotHubSkuTierValues() []IotHubSkuTier { 153 return []IotHubSkuTier{Free, Standard} 154} 155 156// IPFilterActionType enumerates the values for ip filter action type. 157type IPFilterActionType string 158 159const ( 160 // Accept ... 161 Accept IPFilterActionType = "Accept" 162 // Reject ... 163 Reject IPFilterActionType = "Reject" 164) 165 166// PossibleIPFilterActionTypeValues returns an array of possible values for the IPFilterActionType const type. 167func PossibleIPFilterActionTypeValues() []IPFilterActionType { 168 return []IPFilterActionType{Accept, Reject} 169} 170 171// JobStatus enumerates the values for job status. 172type JobStatus string 173 174const ( 175 // Cancelled ... 176 Cancelled JobStatus = "cancelled" 177 // Completed ... 178 Completed JobStatus = "completed" 179 // Enqueued ... 180 Enqueued JobStatus = "enqueued" 181 // Failed ... 182 Failed JobStatus = "failed" 183 // Running ... 184 Running JobStatus = "running" 185 // Unknown ... 186 Unknown JobStatus = "unknown" 187) 188 189// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. 190func PossibleJobStatusValues() []JobStatus { 191 return []JobStatus{Cancelled, Completed, Enqueued, Failed, Running, Unknown} 192} 193 194// JobType enumerates the values for job type. 195type JobType string 196 197const ( 198 // JobTypeBackup ... 199 JobTypeBackup JobType = "backup" 200 // JobTypeExport ... 201 JobTypeExport JobType = "export" 202 // JobTypeFactoryResetDevice ... 203 JobTypeFactoryResetDevice JobType = "factoryResetDevice" 204 // JobTypeFirmwareUpdate ... 205 JobTypeFirmwareUpdate JobType = "firmwareUpdate" 206 // JobTypeImport ... 207 JobTypeImport JobType = "import" 208 // JobTypeReadDeviceProperties ... 209 JobTypeReadDeviceProperties JobType = "readDeviceProperties" 210 // JobTypeRebootDevice ... 211 JobTypeRebootDevice JobType = "rebootDevice" 212 // JobTypeUnknown ... 213 JobTypeUnknown JobType = "unknown" 214 // JobTypeUpdateDeviceConfiguration ... 215 JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" 216 // JobTypeWriteDeviceProperties ... 217 JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" 218) 219 220// PossibleJobTypeValues returns an array of possible values for the JobType const type. 221func PossibleJobTypeValues() []JobType { 222 return []JobType{JobTypeBackup, JobTypeExport, JobTypeFactoryResetDevice, JobTypeFirmwareUpdate, JobTypeImport, JobTypeReadDeviceProperties, JobTypeRebootDevice, JobTypeUnknown, JobTypeUpdateDeviceConfiguration, JobTypeWriteDeviceProperties} 223} 224 225// OperationMonitoringLevel enumerates the values for operation monitoring level. 226type OperationMonitoringLevel string 227 228const ( 229 // OperationMonitoringLevelError ... 230 OperationMonitoringLevelError OperationMonitoringLevel = "Error" 231 // OperationMonitoringLevelErrorInformation ... 232 OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information" 233 // OperationMonitoringLevelInformation ... 234 OperationMonitoringLevelInformation OperationMonitoringLevel = "Information" 235 // OperationMonitoringLevelNone ... 236 OperationMonitoringLevelNone OperationMonitoringLevel = "None" 237) 238 239// PossibleOperationMonitoringLevelValues returns an array of possible values for the OperationMonitoringLevel const type. 240func PossibleOperationMonitoringLevelValues() []OperationMonitoringLevel { 241 return []OperationMonitoringLevel{OperationMonitoringLevelError, OperationMonitoringLevelErrorInformation, OperationMonitoringLevelInformation, OperationMonitoringLevelNone} 242} 243 244// RoutingSource enumerates the values for routing source. 245type RoutingSource string 246 247const ( 248 // DeviceJobLifecycleEvents ... 249 DeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" 250 // DeviceLifecycleEvents ... 251 DeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" 252 // DeviceMessages ... 253 DeviceMessages RoutingSource = "DeviceMessages" 254 // TwinChangeEvents ... 255 TwinChangeEvents RoutingSource = "TwinChangeEvents" 256) 257 258// PossibleRoutingSourceValues returns an array of possible values for the RoutingSource const type. 259func PossibleRoutingSourceValues() []RoutingSource { 260 return []RoutingSource{DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, TwinChangeEvents} 261} 262 263// CertificateBodyDescription the JSON-serialized X509 Certificate. 264type CertificateBodyDescription struct { 265 // Certificate - base-64 representation of the X509 leaf certificate .cer file or just .pem file content. 266 Certificate *string `json:"certificate,omitempty"` 267} 268 269// CertificateDescription the X509 Certificate. 270type CertificateDescription struct { 271 autorest.Response `json:"-"` 272 Properties *CertificateProperties `json:"properties,omitempty"` 273 // ID - READ-ONLY; The resource identifier. 274 ID *string `json:"id,omitempty"` 275 // Name - READ-ONLY; The name of the certificate. 276 Name *string `json:"name,omitempty"` 277 // Etag - READ-ONLY; The entity tag. 278 Etag *string `json:"etag,omitempty"` 279 // Type - READ-ONLY; The resource type. 280 Type *string `json:"type,omitempty"` 281} 282 283// CertificateListDescription the JSON-serialized array of Certificate objects. 284type CertificateListDescription struct { 285 autorest.Response `json:"-"` 286 // Value - The array of Certificate objects. 287 Value *[]CertificateDescription `json:"value,omitempty"` 288} 289 290// CertificateProperties the description of an X509 CA Certificate. 291type CertificateProperties struct { 292 // Subject - READ-ONLY; The certificate's subject name. 293 Subject *string `json:"subject,omitempty"` 294 // Expiry - READ-ONLY; The certificate's expiration date and time. 295 Expiry *date.TimeRFC1123 `json:"expiry,omitempty"` 296 // Thumbprint - READ-ONLY; The certificate's thumbprint. 297 Thumbprint *string `json:"thumbprint,omitempty"` 298 // IsVerified - READ-ONLY; Determines whether certificate has been verified. 299 IsVerified *bool `json:"isVerified,omitempty"` 300 // Created - READ-ONLY; The certificate's create date and time. 301 Created *date.TimeRFC1123 `json:"created,omitempty"` 302 // Updated - READ-ONLY; The certificate's last update date and time. 303 Updated *date.TimeRFC1123 `json:"updated,omitempty"` 304} 305 306// CertificatePropertiesWithNonce the description of an X509 CA Certificate including the challenge nonce 307// issued for the Proof-Of-Possession flow. 308type CertificatePropertiesWithNonce struct { 309 // Subject - READ-ONLY; The certificate's subject name. 310 Subject *string `json:"subject,omitempty"` 311 // Expiry - READ-ONLY; The certificate's expiration date and time. 312 Expiry *date.TimeRFC1123 `json:"expiry,omitempty"` 313 // Thumbprint - READ-ONLY; The certificate's thumbprint. 314 Thumbprint *string `json:"thumbprint,omitempty"` 315 // IsVerified - READ-ONLY; Determines whether certificate has been verified. 316 IsVerified *bool `json:"isVerified,omitempty"` 317 // Created - READ-ONLY; The certificate's create date and time. 318 Created *date.TimeRFC1123 `json:"created,omitempty"` 319 // Updated - READ-ONLY; The certificate's last update date and time. 320 Updated *date.TimeRFC1123 `json:"updated,omitempty"` 321 // VerificationCode - READ-ONLY; The certificate's verification code that will be used for proof of possession. 322 VerificationCode *string `json:"verificationCode,omitempty"` 323} 324 325// CertificateVerificationDescription the JSON-serialized leaf certificate 326type CertificateVerificationDescription struct { 327 // Certificate - base-64 representation of X509 certificate .cer file or just .pem file content. 328 Certificate *string `json:"certificate,omitempty"` 329} 330 331// CertificateWithNonceDescription the X509 Certificate. 332type CertificateWithNonceDescription struct { 333 autorest.Response `json:"-"` 334 Properties *CertificatePropertiesWithNonce `json:"properties,omitempty"` 335 // ID - READ-ONLY; The resource identifier. 336 ID *string `json:"id,omitempty"` 337 // Name - READ-ONLY; The name of the certificate. 338 Name *string `json:"name,omitempty"` 339 // Etag - READ-ONLY; The entity tag. 340 Etag *string `json:"etag,omitempty"` 341 // Type - READ-ONLY; The resource type. 342 Type *string `json:"type,omitempty"` 343} 344 345// CloudToDeviceProperties the IoT hub cloud-to-device messaging properties. 346type CloudToDeviceProperties struct { 347 // 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. 348 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` 349 // 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. 350 DefaultTTLAsIso8601 *string `json:"defaultTtlAsIso8601,omitempty"` 351 Feedback *FeedbackProperties `json:"feedback,omitempty"` 352} 353 354// ErrorDetails error details. 355type ErrorDetails struct { 356 // Code - READ-ONLY; The error code. 357 Code *string `json:"code,omitempty"` 358 // HTTPStatusCode - READ-ONLY; The HTTP status code. 359 HTTPStatusCode *string `json:"httpStatusCode,omitempty"` 360 // Message - READ-ONLY; The error message. 361 Message *string `json:"message,omitempty"` 362 // Details - READ-ONLY; The error details. 363 Details *string `json:"details,omitempty"` 364} 365 366// EventHubConsumerGroupInfo the properties of the EventHubConsumerGroupInfo object. 367type EventHubConsumerGroupInfo struct { 368 autorest.Response `json:"-"` 369 // Properties - The tags. 370 Properties map[string]*string `json:"properties"` 371 // ID - READ-ONLY; The Event Hub-compatible consumer group identifier. 372 ID *string `json:"id,omitempty"` 373 // Name - READ-ONLY; The Event Hub-compatible consumer group name. 374 Name *string `json:"name,omitempty"` 375 // Type - READ-ONLY; the resource type. 376 Type *string `json:"type,omitempty"` 377 // Etag - READ-ONLY; The etag. 378 Etag *string `json:"etag,omitempty"` 379} 380 381// MarshalJSON is the custom marshaler for EventHubConsumerGroupInfo. 382func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) { 383 objectMap := make(map[string]interface{}) 384 if ehcgi.Properties != nil { 385 objectMap["properties"] = ehcgi.Properties 386 } 387 return json.Marshal(objectMap) 388} 389 390// EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names 391// with a next link. 392type EventHubConsumerGroupsListResult struct { 393 autorest.Response `json:"-"` 394 // Value - List of consumer groups objects 395 Value *[]EventHubConsumerGroupInfo `json:"value,omitempty"` 396 // NextLink - READ-ONLY; The next link. 397 NextLink *string `json:"nextLink,omitempty"` 398} 399 400// EventHubConsumerGroupsListResultIterator provides access to a complete listing of 401// EventHubConsumerGroupInfo values. 402type EventHubConsumerGroupsListResultIterator struct { 403 i int 404 page EventHubConsumerGroupsListResultPage 405} 406 407// NextWithContext advances to the next value. If there was an error making 408// the request the iterator does not advance and the error is returned. 409func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { 410 if tracing.IsEnabled() { 411 ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext") 412 defer func() { 413 sc := -1 414 if iter.Response().Response.Response != nil { 415 sc = iter.Response().Response.Response.StatusCode 416 } 417 tracing.EndSpan(ctx, sc, err) 418 }() 419 } 420 iter.i++ 421 if iter.i < len(iter.page.Values()) { 422 return nil 423 } 424 err = iter.page.NextWithContext(ctx) 425 if err != nil { 426 iter.i-- 427 return err 428 } 429 iter.i = 0 430 return nil 431} 432 433// Next advances to the next value. If there was an error making 434// the request the iterator does not advance and the error is returned. 435// Deprecated: Use NextWithContext() instead. 436func (iter *EventHubConsumerGroupsListResultIterator) Next() error { 437 return iter.NextWithContext(context.Background()) 438} 439 440// NotDone returns true if the enumeration should be started or is not yet complete. 441func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool { 442 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 443} 444 445// Response returns the raw server response from the last page request. 446func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult { 447 return iter.page.Response() 448} 449 450// Value returns the current value or a zero-initialized value if the 451// iterator has advanced beyond the end of the collection. 452func (iter EventHubConsumerGroupsListResultIterator) Value() EventHubConsumerGroupInfo { 453 if !iter.page.NotDone() { 454 return EventHubConsumerGroupInfo{} 455 } 456 return iter.page.Values()[iter.i] 457} 458 459// Creates a new instance of the EventHubConsumerGroupsListResultIterator type. 460func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator { 461 return EventHubConsumerGroupsListResultIterator{page: page} 462} 463 464// IsEmpty returns true if the ListResult contains no values. 465func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool { 466 return ehcglr.Value == nil || len(*ehcglr.Value) == 0 467} 468 469// eventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results. 470// It returns nil if no more results exist. 471func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { 472 if ehcglr.NextLink == nil || len(to.String(ehcglr.NextLink)) < 1 { 473 return nil, nil 474 } 475 return autorest.Prepare((&http.Request{}).WithContext(ctx), 476 autorest.AsJSON(), 477 autorest.AsGet(), 478 autorest.WithBaseURL(to.String(ehcglr.NextLink))) 479} 480 481// EventHubConsumerGroupsListResultPage contains a page of EventHubConsumerGroupInfo values. 482type EventHubConsumerGroupsListResultPage struct { 483 fn func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error) 484 ehcglr EventHubConsumerGroupsListResult 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. 489func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { 490 if tracing.IsEnabled() { 491 ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.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 next, err := page.fn(ctx, page.ehcglr) 501 if err != nil { 502 return err 503 } 504 page.ehcglr = next 505 return nil 506} 507 508// Next advances to the next page of values. If there was an error making 509// the request the page does not advance and the error is returned. 510// Deprecated: Use NextWithContext() instead. 511func (page *EventHubConsumerGroupsListResultPage) Next() error { 512 return page.NextWithContext(context.Background()) 513} 514 515// NotDone returns true if the page enumeration should be started or is not yet complete. 516func (page EventHubConsumerGroupsListResultPage) NotDone() bool { 517 return !page.ehcglr.IsEmpty() 518} 519 520// Response returns the raw server response from the last page request. 521func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult { 522 return page.ehcglr 523} 524 525// Values returns the slice of values for the current page or nil if there are no values. 526func (page EventHubConsumerGroupsListResultPage) Values() []EventHubConsumerGroupInfo { 527 if page.ehcglr.IsEmpty() { 528 return nil 529 } 530 return *page.ehcglr.Value 531} 532 533// Creates a new instance of the EventHubConsumerGroupsListResultPage type. 534func NewEventHubConsumerGroupsListResultPage(getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage { 535 return EventHubConsumerGroupsListResultPage{fn: getNextPage} 536} 537 538// EventHubProperties the properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. 539type EventHubProperties struct { 540 // 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 541 RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"` 542 // 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. 543 PartitionCount *int32 `json:"partitionCount,omitempty"` 544 // PartitionIds - READ-ONLY; The partition ids in the Event Hub-compatible endpoint. 545 PartitionIds *[]string `json:"partitionIds,omitempty"` 546 // Path - READ-ONLY; The Event Hub-compatible name. 547 Path *string `json:"path,omitempty"` 548 // Endpoint - READ-ONLY; The Event Hub-compatible endpoint. 549 Endpoint *string `json:"endpoint,omitempty"` 550} 551 552// ExportDevicesRequest use to provide parameters when requesting an export of all devices in the IoT hub. 553type ExportDevicesRequest struct { 554 // ExportBlobContainerURI - The export blob container URI. 555 ExportBlobContainerURI *string `json:"exportBlobContainerUri,omitempty"` 556 // ExcludeKeys - The value indicating whether keys should be excluded during export. 557 ExcludeKeys *bool `json:"excludeKeys,omitempty"` 558} 559 560// FallbackRouteProperties the properties of the fallback route. IoT Hub uses these properties when it 561// routes messages to the fallback endpoint. 562type FallbackRouteProperties struct { 563 // 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. 564 Name *string `json:"name,omitempty"` 565 // Source - The source to which the routing rule is to be applied to. For example, DeviceMessages 566 Source *string `json:"source,omitempty"` 567 // 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 568 Condition *string `json:"condition,omitempty"` 569 // EndpointNames - The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. 570 EndpointNames *[]string `json:"endpointNames,omitempty"` 571 // IsEnabled - Used to specify whether the fallback route is enabled. 572 IsEnabled *bool `json:"isEnabled,omitempty"` 573} 574 575// FeedbackProperties the properties of the feedback queue for cloud-to-device messages. 576type FeedbackProperties struct { 577 // LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. 578 LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` 579 // 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. 580 TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` 581 // 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. 582 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` 583} 584 585// ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub. 586type ImportDevicesRequest struct { 587 // InputBlobContainerURI - The input blob container URI. 588 InputBlobContainerURI *string `json:"inputBlobContainerUri,omitempty"` 589 // OutputBlobContainerURI - The output blob container URI. 590 OutputBlobContainerURI *string `json:"outputBlobContainerUri,omitempty"` 591} 592 593// IotHubCapacity ioT Hub capacity information. 594type IotHubCapacity struct { 595 // Minimum - READ-ONLY; The minimum number of units. 596 Minimum *int64 `json:"minimum,omitempty"` 597 // Maximum - READ-ONLY; The maximum number of units. 598 Maximum *int64 `json:"maximum,omitempty"` 599 // Default - READ-ONLY; The default number of units. 600 Default *int64 `json:"default,omitempty"` 601 // ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone' 602 ScaleType IotHubScaleType `json:"scaleType,omitempty"` 603} 604 605// IotHubDescription the description of the IoT hub. 606type IotHubDescription struct { 607 autorest.Response `json:"-"` 608 // 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. 609 Etag *string `json:"etag,omitempty"` 610 Properties *IotHubProperties `json:"properties,omitempty"` 611 Sku *IotHubSkuInfo `json:"sku,omitempty"` 612 // ID - READ-ONLY; The resource identifier. 613 ID *string `json:"id,omitempty"` 614 // Name - READ-ONLY; The resource name. 615 Name *string `json:"name,omitempty"` 616 // Type - READ-ONLY; The resource type. 617 Type *string `json:"type,omitempty"` 618 // Location - The resource location. 619 Location *string `json:"location,omitempty"` 620 // Tags - The resource tags. 621 Tags map[string]*string `json:"tags"` 622} 623 624// MarshalJSON is the custom marshaler for IotHubDescription. 625func (ihd IotHubDescription) MarshalJSON() ([]byte, error) { 626 objectMap := make(map[string]interface{}) 627 if ihd.Etag != nil { 628 objectMap["etag"] = ihd.Etag 629 } 630 if ihd.Properties != nil { 631 objectMap["properties"] = ihd.Properties 632 } 633 if ihd.Sku != nil { 634 objectMap["sku"] = ihd.Sku 635 } 636 if ihd.Location != nil { 637 objectMap["location"] = ihd.Location 638 } 639 if ihd.Tags != nil { 640 objectMap["tags"] = ihd.Tags 641 } 642 return json.Marshal(objectMap) 643} 644 645// IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link. 646type IotHubDescriptionListResult struct { 647 autorest.Response `json:"-"` 648 // Value - The array of IotHubDescription objects. 649 Value *[]IotHubDescription `json:"value,omitempty"` 650 // NextLink - READ-ONLY; The next link. 651 NextLink *string `json:"nextLink,omitempty"` 652} 653 654// IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values. 655type IotHubDescriptionListResultIterator struct { 656 i int 657 page IotHubDescriptionListResultPage 658} 659 660// NextWithContext advances to the next value. If there was an error making 661// the request the iterator does not advance and the error is returned. 662func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { 663 if tracing.IsEnabled() { 664 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext") 665 defer func() { 666 sc := -1 667 if iter.Response().Response.Response != nil { 668 sc = iter.Response().Response.Response.StatusCode 669 } 670 tracing.EndSpan(ctx, sc, err) 671 }() 672 } 673 iter.i++ 674 if iter.i < len(iter.page.Values()) { 675 return nil 676 } 677 err = iter.page.NextWithContext(ctx) 678 if err != nil { 679 iter.i-- 680 return err 681 } 682 iter.i = 0 683 return nil 684} 685 686// Next advances to the next value. If there was an error making 687// the request the iterator does not advance and the error is returned. 688// Deprecated: Use NextWithContext() instead. 689func (iter *IotHubDescriptionListResultIterator) Next() error { 690 return iter.NextWithContext(context.Background()) 691} 692 693// NotDone returns true if the enumeration should be started or is not yet complete. 694func (iter IotHubDescriptionListResultIterator) NotDone() bool { 695 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 696} 697 698// Response returns the raw server response from the last page request. 699func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult { 700 return iter.page.Response() 701} 702 703// Value returns the current value or a zero-initialized value if the 704// iterator has advanced beyond the end of the collection. 705func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription { 706 if !iter.page.NotDone() { 707 return IotHubDescription{} 708 } 709 return iter.page.Values()[iter.i] 710} 711 712// Creates a new instance of the IotHubDescriptionListResultIterator type. 713func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator { 714 return IotHubDescriptionListResultIterator{page: page} 715} 716 717// IsEmpty returns true if the ListResult contains no values. 718func (ihdlr IotHubDescriptionListResult) IsEmpty() bool { 719 return ihdlr.Value == nil || len(*ihdlr.Value) == 0 720} 721 722// iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results. 723// It returns nil if no more results exist. 724func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) { 725 if ihdlr.NextLink == nil || len(to.String(ihdlr.NextLink)) < 1 { 726 return nil, nil 727 } 728 return autorest.Prepare((&http.Request{}).WithContext(ctx), 729 autorest.AsJSON(), 730 autorest.AsGet(), 731 autorest.WithBaseURL(to.String(ihdlr.NextLink))) 732} 733 734// IotHubDescriptionListResultPage contains a page of IotHubDescription values. 735type IotHubDescriptionListResultPage struct { 736 fn func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error) 737 ihdlr IotHubDescriptionListResult 738} 739 740// NextWithContext advances to the next page of values. If there was an error making 741// the request the page does not advance and the error is returned. 742func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { 743 if tracing.IsEnabled() { 744 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext") 745 defer func() { 746 sc := -1 747 if page.Response().Response.Response != nil { 748 sc = page.Response().Response.Response.StatusCode 749 } 750 tracing.EndSpan(ctx, sc, err) 751 }() 752 } 753 next, err := page.fn(ctx, page.ihdlr) 754 if err != nil { 755 return err 756 } 757 page.ihdlr = next 758 return nil 759} 760 761// Next advances to the next page of values. If there was an error making 762// the request the page does not advance and the error is returned. 763// Deprecated: Use NextWithContext() instead. 764func (page *IotHubDescriptionListResultPage) Next() error { 765 return page.NextWithContext(context.Background()) 766} 767 768// NotDone returns true if the page enumeration should be started or is not yet complete. 769func (page IotHubDescriptionListResultPage) NotDone() bool { 770 return !page.ihdlr.IsEmpty() 771} 772 773// Response returns the raw server response from the last page request. 774func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult { 775 return page.ihdlr 776} 777 778// Values returns the slice of values for the current page or nil if there are no values. 779func (page IotHubDescriptionListResultPage) Values() []IotHubDescription { 780 if page.ihdlr.IsEmpty() { 781 return nil 782 } 783 return *page.ihdlr.Value 784} 785 786// Creates a new instance of the IotHubDescriptionListResultPage type. 787func NewIotHubDescriptionListResultPage(getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage { 788 return IotHubDescriptionListResultPage{fn: getNextPage} 789} 790 791// IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available. 792type IotHubNameAvailabilityInfo struct { 793 autorest.Response `json:"-"` 794 // NameAvailable - READ-ONLY; The value which indicates whether the provided name is available. 795 NameAvailable *bool `json:"nameAvailable,omitempty"` 796 // Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists' 797 Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"` 798 // Message - The detailed reason message. 799 Message *string `json:"message,omitempty"` 800} 801 802// IotHubProperties the properties of an IoT hub. 803type IotHubProperties struct { 804 // AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub. 805 AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"` 806 // IPFilterRules - The IP filter rules. 807 IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"` 808 // ProvisioningState - READ-ONLY; The provisioning state. 809 ProvisioningState *string `json:"provisioningState,omitempty"` 810 // State - READ-ONLY; The hub state. 811 State *string `json:"state,omitempty"` 812 // HostName - READ-ONLY; The name of the host. 813 HostName *string `json:"hostName,omitempty"` 814 // 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. 815 EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"` 816 Routing *RoutingProperties `json:"routing,omitempty"` 817 // 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. 818 StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"` 819 // MessagingEndpoints - The messaging endpoint properties for the file upload notification queue. 820 MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"` 821 // EnableFileUploadNotifications - If True, file upload notifications are enabled. 822 EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"` 823 CloudToDevice *CloudToDeviceProperties `json:"cloudToDevice,omitempty"` 824 // Comments - IoT hub comments. 825 Comments *string `json:"comments,omitempty"` 826 OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"` 827 // Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement' 828 Features Capabilities `json:"features,omitempty"` 829} 830 831// MarshalJSON is the custom marshaler for IotHubProperties. 832func (ihp IotHubProperties) MarshalJSON() ([]byte, error) { 833 objectMap := make(map[string]interface{}) 834 if ihp.AuthorizationPolicies != nil { 835 objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies 836 } 837 if ihp.IPFilterRules != nil { 838 objectMap["ipFilterRules"] = ihp.IPFilterRules 839 } 840 if ihp.EventHubEndpoints != nil { 841 objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints 842 } 843 if ihp.Routing != nil { 844 objectMap["routing"] = ihp.Routing 845 } 846 if ihp.StorageEndpoints != nil { 847 objectMap["storageEndpoints"] = ihp.StorageEndpoints 848 } 849 if ihp.MessagingEndpoints != nil { 850 objectMap["messagingEndpoints"] = ihp.MessagingEndpoints 851 } 852 if ihp.EnableFileUploadNotifications != nil { 853 objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications 854 } 855 if ihp.CloudToDevice != nil { 856 objectMap["cloudToDevice"] = ihp.CloudToDevice 857 } 858 if ihp.Comments != nil { 859 objectMap["comments"] = ihp.Comments 860 } 861 if ihp.OperationsMonitoringProperties != nil { 862 objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties 863 } 864 if ihp.Features != "" { 865 objectMap["features"] = ihp.Features 866 } 867 return json.Marshal(objectMap) 868} 869 870// IotHubQuotaMetricInfo quota metrics properties. 871type IotHubQuotaMetricInfo struct { 872 // Name - READ-ONLY; The name of the quota metric. 873 Name *string `json:"name,omitempty"` 874 // CurrentValue - READ-ONLY; The current value for the quota metric. 875 CurrentValue *int64 `json:"currentValue,omitempty"` 876 // MaxValue - READ-ONLY; The maximum value of the quota metric. 877 MaxValue *int64 `json:"maxValue,omitempty"` 878} 879 880// IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next 881// link. 882type IotHubQuotaMetricInfoListResult struct { 883 autorest.Response `json:"-"` 884 // Value - The array of quota metrics objects. 885 Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"` 886 // NextLink - READ-ONLY; The next link. 887 NextLink *string `json:"nextLink,omitempty"` 888} 889 890// IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo 891// values. 892type IotHubQuotaMetricInfoListResultIterator struct { 893 i int 894 page IotHubQuotaMetricInfoListResultPage 895} 896 897// NextWithContext advances to the next value. If there was an error making 898// the request the iterator does not advance and the error is returned. 899func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { 900 if tracing.IsEnabled() { 901 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext") 902 defer func() { 903 sc := -1 904 if iter.Response().Response.Response != nil { 905 sc = iter.Response().Response.Response.StatusCode 906 } 907 tracing.EndSpan(ctx, sc, err) 908 }() 909 } 910 iter.i++ 911 if iter.i < len(iter.page.Values()) { 912 return nil 913 } 914 err = iter.page.NextWithContext(ctx) 915 if err != nil { 916 iter.i-- 917 return err 918 } 919 iter.i = 0 920 return nil 921} 922 923// Next advances to the next value. If there was an error making 924// the request the iterator does not advance and the error is returned. 925// Deprecated: Use NextWithContext() instead. 926func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error { 927 return iter.NextWithContext(context.Background()) 928} 929 930// NotDone returns true if the enumeration should be started or is not yet complete. 931func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool { 932 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 933} 934 935// Response returns the raw server response from the last page request. 936func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult { 937 return iter.page.Response() 938} 939 940// Value returns the current value or a zero-initialized value if the 941// iterator has advanced beyond the end of the collection. 942func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo { 943 if !iter.page.NotDone() { 944 return IotHubQuotaMetricInfo{} 945 } 946 return iter.page.Values()[iter.i] 947} 948 949// Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type. 950func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator { 951 return IotHubQuotaMetricInfoListResultIterator{page: page} 952} 953 954// IsEmpty returns true if the ListResult contains no values. 955func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool { 956 return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0 957} 958 959// iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results. 960// It returns nil if no more results exist. 961func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) { 962 if ihqmilr.NextLink == nil || len(to.String(ihqmilr.NextLink)) < 1 { 963 return nil, nil 964 } 965 return autorest.Prepare((&http.Request{}).WithContext(ctx), 966 autorest.AsJSON(), 967 autorest.AsGet(), 968 autorest.WithBaseURL(to.String(ihqmilr.NextLink))) 969} 970 971// IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values. 972type IotHubQuotaMetricInfoListResultPage struct { 973 fn func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error) 974 ihqmilr IotHubQuotaMetricInfoListResult 975} 976 977// NextWithContext advances to the next page of values. If there was an error making 978// the request the page does not advance and the error is returned. 979func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) { 980 if tracing.IsEnabled() { 981 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext") 982 defer func() { 983 sc := -1 984 if page.Response().Response.Response != nil { 985 sc = page.Response().Response.Response.StatusCode 986 } 987 tracing.EndSpan(ctx, sc, err) 988 }() 989 } 990 next, err := page.fn(ctx, page.ihqmilr) 991 if err != nil { 992 return err 993 } 994 page.ihqmilr = next 995 return nil 996} 997 998// Next advances to the next page of values. If there was an error making 999// the request the page does not advance and the error is returned. 1000// Deprecated: Use NextWithContext() instead. 1001func (page *IotHubQuotaMetricInfoListResultPage) Next() error { 1002 return page.NextWithContext(context.Background()) 1003} 1004 1005// NotDone returns true if the page enumeration should be started or is not yet complete. 1006func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool { 1007 return !page.ihqmilr.IsEmpty() 1008} 1009 1010// Response returns the raw server response from the last page request. 1011func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult { 1012 return page.ihqmilr 1013} 1014 1015// Values returns the slice of values for the current page or nil if there are no values. 1016func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo { 1017 if page.ihqmilr.IsEmpty() { 1018 return nil 1019 } 1020 return *page.ihqmilr.Value 1021} 1022 1023// Creates a new instance of the IotHubQuotaMetricInfoListResultPage type. 1024func NewIotHubQuotaMetricInfoListResultPage(getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage { 1025 return IotHubQuotaMetricInfoListResultPage{fn: getNextPage} 1026} 1027 1028// IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1029// long-running operation. 1030type IotHubResourceCreateOrUpdateFuture struct { 1031 azure.Future 1032} 1033 1034// Result returns the result of the asynchronous operation. 1035// If the operation has not completed it will return an error. 1036func (future *IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceClient) (ihd IotHubDescription, err error) { 1037 var done bool 1038 done, err = future.DoneWithContext(context.Background(), client) 1039 if err != nil { 1040 err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1041 return 1042 } 1043 if !done { 1044 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture") 1045 return 1046 } 1047 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1048 if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent { 1049 ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response) 1050 if err != nil { 1051 err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request") 1052 } 1053 } 1054 return 1055} 1056 1057// IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1058// operation. 1059type IotHubResourceDeleteFuture struct { 1060 azure.Future 1061} 1062 1063// Result returns the result of the asynchronous operation. 1064// If the operation has not completed it will return an error. 1065func (future *IotHubResourceDeleteFuture) Result(client IotHubResourceClient) (so SetObject, err error) { 1066 var done bool 1067 done, err = future.DoneWithContext(context.Background(), client) 1068 if err != nil { 1069 err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure") 1070 return 1071 } 1072 if !done { 1073 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture") 1074 return 1075 } 1076 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1077 if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { 1078 so, err = client.DeleteResponder(so.Response.Response) 1079 if err != nil { 1080 err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request") 1081 } 1082 } 1083 return 1084} 1085 1086// IotHubResourceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1087// operation. 1088type IotHubResourceUpdateFuture struct { 1089 azure.Future 1090} 1091 1092// Result returns the result of the asynchronous operation. 1093// If the operation has not completed it will return an error. 1094func (future *IotHubResourceUpdateFuture) Result(client IotHubResourceClient) (ihd IotHubDescription, err error) { 1095 var done bool 1096 done, err = future.DoneWithContext(context.Background(), client) 1097 if err != nil { 1098 err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", future.Response(), "Polling failure") 1099 return 1100 } 1101 if !done { 1102 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceUpdateFuture") 1103 return 1104 } 1105 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1106 if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent { 1107 ihd, err = client.UpdateResponder(ihd.Response.Response) 1108 if err != nil { 1109 err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request") 1110 } 1111 } 1112 return 1113} 1114 1115// IotHubSkuDescription SKU properties. 1116type IotHubSkuDescription struct { 1117 // ResourceType - READ-ONLY; The type of the resource. 1118 ResourceType *string `json:"resourceType,omitempty"` 1119 // Sku - The type of the resource. 1120 Sku *IotHubSkuInfo `json:"sku,omitempty"` 1121 Capacity *IotHubCapacity `json:"capacity,omitempty"` 1122} 1123 1124// IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next 1125// link. 1126type IotHubSkuDescriptionListResult struct { 1127 autorest.Response `json:"-"` 1128 // Value - The array of IotHubSkuDescription. 1129 Value *[]IotHubSkuDescription `json:"value,omitempty"` 1130 // NextLink - READ-ONLY; The next link. 1131 NextLink *string `json:"nextLink,omitempty"` 1132} 1133 1134// IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription 1135// values. 1136type IotHubSkuDescriptionListResultIterator struct { 1137 i int 1138 page IotHubSkuDescriptionListResultPage 1139} 1140 1141// NextWithContext advances to the next value. If there was an error making 1142// the request the iterator does not advance and the error is returned. 1143func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { 1144 if tracing.IsEnabled() { 1145 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext") 1146 defer func() { 1147 sc := -1 1148 if iter.Response().Response.Response != nil { 1149 sc = iter.Response().Response.Response.StatusCode 1150 } 1151 tracing.EndSpan(ctx, sc, err) 1152 }() 1153 } 1154 iter.i++ 1155 if iter.i < len(iter.page.Values()) { 1156 return nil 1157 } 1158 err = iter.page.NextWithContext(ctx) 1159 if err != nil { 1160 iter.i-- 1161 return err 1162 } 1163 iter.i = 0 1164 return nil 1165} 1166 1167// Next advances to the next value. If there was an error making 1168// the request the iterator does not advance and the error is returned. 1169// Deprecated: Use NextWithContext() instead. 1170func (iter *IotHubSkuDescriptionListResultIterator) Next() error { 1171 return iter.NextWithContext(context.Background()) 1172} 1173 1174// NotDone returns true if the enumeration should be started or is not yet complete. 1175func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool { 1176 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1177} 1178 1179// Response returns the raw server response from the last page request. 1180func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult { 1181 return iter.page.Response() 1182} 1183 1184// Value returns the current value or a zero-initialized value if the 1185// iterator has advanced beyond the end of the collection. 1186func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription { 1187 if !iter.page.NotDone() { 1188 return IotHubSkuDescription{} 1189 } 1190 return iter.page.Values()[iter.i] 1191} 1192 1193// Creates a new instance of the IotHubSkuDescriptionListResultIterator type. 1194func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator { 1195 return IotHubSkuDescriptionListResultIterator{page: page} 1196} 1197 1198// IsEmpty returns true if the ListResult contains no values. 1199func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool { 1200 return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0 1201} 1202 1203// iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results. 1204// It returns nil if no more results exist. 1205func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) { 1206 if ihsdlr.NextLink == nil || len(to.String(ihsdlr.NextLink)) < 1 { 1207 return nil, nil 1208 } 1209 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1210 autorest.AsJSON(), 1211 autorest.AsGet(), 1212 autorest.WithBaseURL(to.String(ihsdlr.NextLink))) 1213} 1214 1215// IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values. 1216type IotHubSkuDescriptionListResultPage struct { 1217 fn func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error) 1218 ihsdlr IotHubSkuDescriptionListResult 1219} 1220 1221// NextWithContext advances to the next page of values. If there was an error making 1222// the request the page does not advance and the error is returned. 1223func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { 1224 if tracing.IsEnabled() { 1225 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext") 1226 defer func() { 1227 sc := -1 1228 if page.Response().Response.Response != nil { 1229 sc = page.Response().Response.Response.StatusCode 1230 } 1231 tracing.EndSpan(ctx, sc, err) 1232 }() 1233 } 1234 next, err := page.fn(ctx, page.ihsdlr) 1235 if err != nil { 1236 return err 1237 } 1238 page.ihsdlr = next 1239 return nil 1240} 1241 1242// Next advances to the next page of values. If there was an error making 1243// the request the page does not advance and the error is returned. 1244// Deprecated: Use NextWithContext() instead. 1245func (page *IotHubSkuDescriptionListResultPage) Next() error { 1246 return page.NextWithContext(context.Background()) 1247} 1248 1249// NotDone returns true if the page enumeration should be started or is not yet complete. 1250func (page IotHubSkuDescriptionListResultPage) NotDone() bool { 1251 return !page.ihsdlr.IsEmpty() 1252} 1253 1254// Response returns the raw server response from the last page request. 1255func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult { 1256 return page.ihsdlr 1257} 1258 1259// Values returns the slice of values for the current page or nil if there are no values. 1260func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription { 1261 if page.ihsdlr.IsEmpty() { 1262 return nil 1263 } 1264 return *page.ihsdlr.Value 1265} 1266 1267// Creates a new instance of the IotHubSkuDescriptionListResultPage type. 1268func NewIotHubSkuDescriptionListResultPage(getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage { 1269 return IotHubSkuDescriptionListResultPage{fn: getNextPage} 1270} 1271 1272// IotHubSkuInfo information about the SKU of the IoT hub. 1273type IotHubSkuInfo struct { 1274 // Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3' 1275 Name IotHubSku `json:"name,omitempty"` 1276 // Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard' 1277 Tier IotHubSkuTier `json:"tier,omitempty"` 1278 // Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. 1279 Capacity *int64 `json:"capacity,omitempty"` 1280} 1281 1282// IPFilterRule the IP filter rules for the IoT hub. 1283type IPFilterRule struct { 1284 // FilterName - The name of the IP filter rule. 1285 FilterName *string `json:"filterName,omitempty"` 1286 // Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject' 1287 Action IPFilterActionType `json:"action,omitempty"` 1288 // IPMask - A string that contains the IP address range in CIDR notation for the rule. 1289 IPMask *string `json:"ipMask,omitempty"` 1290} 1291 1292// JobResponse the properties of the Job Response object. 1293type JobResponse struct { 1294 autorest.Response `json:"-"` 1295 // JobID - READ-ONLY; The job identifier. 1296 JobID *string `json:"jobId,omitempty"` 1297 // StartTimeUtc - READ-ONLY; The start time of the job. 1298 StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"` 1299 // EndTimeUtc - READ-ONLY; The time the job stopped processing. 1300 EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"` 1301 // Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate' 1302 Type JobType `json:"type,omitempty"` 1303 // Status - READ-ONLY; The status of the job. Possible values include: 'Unknown', 'Enqueued', 'Running', 'Completed', 'Failed', 'Cancelled' 1304 Status JobStatus `json:"status,omitempty"` 1305 // FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure. 1306 FailureReason *string `json:"failureReason,omitempty"` 1307 // StatusMessage - READ-ONLY; The status message for the job. 1308 StatusMessage *string `json:"statusMessage,omitempty"` 1309 // ParentJobID - READ-ONLY; The job identifier of the parent job, if any. 1310 ParentJobID *string `json:"parentJobId,omitempty"` 1311} 1312 1313// JobResponseListResult the JSON-serialized array of JobResponse objects with a next link. 1314type JobResponseListResult struct { 1315 autorest.Response `json:"-"` 1316 // Value - The array of JobResponse objects. 1317 Value *[]JobResponse `json:"value,omitempty"` 1318 // NextLink - READ-ONLY; The next link. 1319 NextLink *string `json:"nextLink,omitempty"` 1320} 1321 1322// JobResponseListResultIterator provides access to a complete listing of JobResponse values. 1323type JobResponseListResultIterator struct { 1324 i int 1325 page JobResponseListResultPage 1326} 1327 1328// NextWithContext advances to the next value. If there was an error making 1329// the request the iterator does not advance and the error is returned. 1330func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) { 1331 if tracing.IsEnabled() { 1332 ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext") 1333 defer func() { 1334 sc := -1 1335 if iter.Response().Response.Response != nil { 1336 sc = iter.Response().Response.Response.StatusCode 1337 } 1338 tracing.EndSpan(ctx, sc, err) 1339 }() 1340 } 1341 iter.i++ 1342 if iter.i < len(iter.page.Values()) { 1343 return nil 1344 } 1345 err = iter.page.NextWithContext(ctx) 1346 if err != nil { 1347 iter.i-- 1348 return err 1349 } 1350 iter.i = 0 1351 return nil 1352} 1353 1354// Next advances to the next value. If there was an error making 1355// the request the iterator does not advance and the error is returned. 1356// Deprecated: Use NextWithContext() instead. 1357func (iter *JobResponseListResultIterator) Next() error { 1358 return iter.NextWithContext(context.Background()) 1359} 1360 1361// NotDone returns true if the enumeration should be started or is not yet complete. 1362func (iter JobResponseListResultIterator) NotDone() bool { 1363 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1364} 1365 1366// Response returns the raw server response from the last page request. 1367func (iter JobResponseListResultIterator) Response() JobResponseListResult { 1368 return iter.page.Response() 1369} 1370 1371// Value returns the current value or a zero-initialized value if the 1372// iterator has advanced beyond the end of the collection. 1373func (iter JobResponseListResultIterator) Value() JobResponse { 1374 if !iter.page.NotDone() { 1375 return JobResponse{} 1376 } 1377 return iter.page.Values()[iter.i] 1378} 1379 1380// Creates a new instance of the JobResponseListResultIterator type. 1381func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator { 1382 return JobResponseListResultIterator{page: page} 1383} 1384 1385// IsEmpty returns true if the ListResult contains no values. 1386func (jrlr JobResponseListResult) IsEmpty() bool { 1387 return jrlr.Value == nil || len(*jrlr.Value) == 0 1388} 1389 1390// jobResponseListResultPreparer prepares a request to retrieve the next set of results. 1391// It returns nil if no more results exist. 1392func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) { 1393 if jrlr.NextLink == nil || len(to.String(jrlr.NextLink)) < 1 { 1394 return nil, nil 1395 } 1396 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1397 autorest.AsJSON(), 1398 autorest.AsGet(), 1399 autorest.WithBaseURL(to.String(jrlr.NextLink))) 1400} 1401 1402// JobResponseListResultPage contains a page of JobResponse values. 1403type JobResponseListResultPage struct { 1404 fn func(context.Context, JobResponseListResult) (JobResponseListResult, error) 1405 jrlr JobResponseListResult 1406} 1407 1408// NextWithContext advances to the next page of values. If there was an error making 1409// the request the page does not advance and the error is returned. 1410func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) { 1411 if tracing.IsEnabled() { 1412 ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext") 1413 defer func() { 1414 sc := -1 1415 if page.Response().Response.Response != nil { 1416 sc = page.Response().Response.Response.StatusCode 1417 } 1418 tracing.EndSpan(ctx, sc, err) 1419 }() 1420 } 1421 next, err := page.fn(ctx, page.jrlr) 1422 if err != nil { 1423 return err 1424 } 1425 page.jrlr = next 1426 return nil 1427} 1428 1429// Next advances to the next page of values. If there was an error making 1430// the request the page does not advance and the error is returned. 1431// Deprecated: Use NextWithContext() instead. 1432func (page *JobResponseListResultPage) Next() error { 1433 return page.NextWithContext(context.Background()) 1434} 1435 1436// NotDone returns true if the page enumeration should be started or is not yet complete. 1437func (page JobResponseListResultPage) NotDone() bool { 1438 return !page.jrlr.IsEmpty() 1439} 1440 1441// Response returns the raw server response from the last page request. 1442func (page JobResponseListResultPage) Response() JobResponseListResult { 1443 return page.jrlr 1444} 1445 1446// Values returns the slice of values for the current page or nil if there are no values. 1447func (page JobResponseListResultPage) Values() []JobResponse { 1448 if page.jrlr.IsEmpty() { 1449 return nil 1450 } 1451 return *page.jrlr.Value 1452} 1453 1454// Creates a new instance of the JobResponseListResultPage type. 1455func NewJobResponseListResultPage(getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage { 1456 return JobResponseListResultPage{fn: getNextPage} 1457} 1458 1459// MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub. 1460type MessagingEndpointProperties struct { 1461 // LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. 1462 LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` 1463 // 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. 1464 TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` 1465 // 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. 1466 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` 1467} 1468 1469// Operation ioT Hub REST API operation 1470type Operation struct { 1471 // Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} 1472 Name *string `json:"name,omitempty"` 1473 // Display - The object that represents the operation. 1474 Display *OperationDisplay `json:"display,omitempty"` 1475} 1476 1477// OperationDisplay the object that represents the operation. 1478type OperationDisplay struct { 1479 // Provider - READ-ONLY; Service provider: Microsoft Devices 1480 Provider *string `json:"provider,omitempty"` 1481 // Resource - READ-ONLY; Resource Type: IotHubs 1482 Resource *string `json:"resource,omitempty"` 1483 // Operation - READ-ONLY; Name of the operation 1484 Operation *string `json:"operation,omitempty"` 1485} 1486 1487// OperationInputs input values. 1488type OperationInputs struct { 1489 // Name - The name of the IoT hub to check. 1490 Name *string `json:"name,omitempty"` 1491} 1492 1493// OperationListResult result of the request to list IoT Hub operations. It contains a list of operations 1494// and a URL link to get the next set of results. 1495type OperationListResult struct { 1496 autorest.Response `json:"-"` 1497 // Value - READ-ONLY; List of IoT Hub operations supported by the Microsoft.Devices resource provider. 1498 Value *[]Operation `json:"value,omitempty"` 1499 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 1500 NextLink *string `json:"nextLink,omitempty"` 1501} 1502 1503// OperationListResultIterator provides access to a complete listing of Operation values. 1504type OperationListResultIterator struct { 1505 i int 1506 page OperationListResultPage 1507} 1508 1509// NextWithContext advances to the next value. If there was an error making 1510// the request the iterator does not advance and the error is returned. 1511func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1512 if tracing.IsEnabled() { 1513 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1514 defer func() { 1515 sc := -1 1516 if iter.Response().Response.Response != nil { 1517 sc = iter.Response().Response.Response.StatusCode 1518 } 1519 tracing.EndSpan(ctx, sc, err) 1520 }() 1521 } 1522 iter.i++ 1523 if iter.i < len(iter.page.Values()) { 1524 return nil 1525 } 1526 err = iter.page.NextWithContext(ctx) 1527 if err != nil { 1528 iter.i-- 1529 return err 1530 } 1531 iter.i = 0 1532 return nil 1533} 1534 1535// Next advances to the next value. If there was an error making 1536// the request the iterator does not advance and the error is returned. 1537// Deprecated: Use NextWithContext() instead. 1538func (iter *OperationListResultIterator) Next() error { 1539 return iter.NextWithContext(context.Background()) 1540} 1541 1542// NotDone returns true if the enumeration should be started or is not yet complete. 1543func (iter OperationListResultIterator) NotDone() bool { 1544 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1545} 1546 1547// Response returns the raw server response from the last page request. 1548func (iter OperationListResultIterator) Response() OperationListResult { 1549 return iter.page.Response() 1550} 1551 1552// Value returns the current value or a zero-initialized value if the 1553// iterator has advanced beyond the end of the collection. 1554func (iter OperationListResultIterator) Value() Operation { 1555 if !iter.page.NotDone() { 1556 return Operation{} 1557 } 1558 return iter.page.Values()[iter.i] 1559} 1560 1561// Creates a new instance of the OperationListResultIterator type. 1562func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1563 return OperationListResultIterator{page: page} 1564} 1565 1566// IsEmpty returns true if the ListResult contains no values. 1567func (olr OperationListResult) IsEmpty() bool { 1568 return olr.Value == nil || len(*olr.Value) == 0 1569} 1570 1571// operationListResultPreparer prepares a request to retrieve the next set of results. 1572// It returns nil if no more results exist. 1573func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1574 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1575 return nil, nil 1576 } 1577 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1578 autorest.AsJSON(), 1579 autorest.AsGet(), 1580 autorest.WithBaseURL(to.String(olr.NextLink))) 1581} 1582 1583// OperationListResultPage contains a page of Operation values. 1584type OperationListResultPage struct { 1585 fn func(context.Context, OperationListResult) (OperationListResult, error) 1586 olr OperationListResult 1587} 1588 1589// NextWithContext advances to the next page of values. If there was an error making 1590// the request the page does not advance and the error is returned. 1591func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1592 if tracing.IsEnabled() { 1593 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1594 defer func() { 1595 sc := -1 1596 if page.Response().Response.Response != nil { 1597 sc = page.Response().Response.Response.StatusCode 1598 } 1599 tracing.EndSpan(ctx, sc, err) 1600 }() 1601 } 1602 next, err := page.fn(ctx, page.olr) 1603 if err != nil { 1604 return err 1605 } 1606 page.olr = next 1607 return nil 1608} 1609 1610// Next advances to the next page of values. If there was an error making 1611// the request the page does not advance and the error is returned. 1612// Deprecated: Use NextWithContext() instead. 1613func (page *OperationListResultPage) Next() error { 1614 return page.NextWithContext(context.Background()) 1615} 1616 1617// NotDone returns true if the page enumeration should be started or is not yet complete. 1618func (page OperationListResultPage) NotDone() bool { 1619 return !page.olr.IsEmpty() 1620} 1621 1622// Response returns the raw server response from the last page request. 1623func (page OperationListResultPage) Response() OperationListResult { 1624 return page.olr 1625} 1626 1627// Values returns the slice of values for the current page or nil if there are no values. 1628func (page OperationListResultPage) Values() []Operation { 1629 if page.olr.IsEmpty() { 1630 return nil 1631 } 1632 return *page.olr.Value 1633} 1634 1635// Creates a new instance of the OperationListResultPage type. 1636func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1637 return OperationListResultPage{fn: getNextPage} 1638} 1639 1640// OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys 1641// to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, 1642// FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, 1643// DirectMethods. 1644type OperationsMonitoringProperties struct { 1645 Events map[string]*OperationMonitoringLevel `json:"events"` 1646} 1647 1648// MarshalJSON is the custom marshaler for OperationsMonitoringProperties. 1649func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) { 1650 objectMap := make(map[string]interface{}) 1651 if omp.Events != nil { 1652 objectMap["events"] = omp.Events 1653 } 1654 return json.Marshal(objectMap) 1655} 1656 1657// RegistryStatistics identity registry statistics. 1658type RegistryStatistics struct { 1659 autorest.Response `json:"-"` 1660 // TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry. 1661 TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"` 1662 // EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry. 1663 EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"` 1664 // DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry. 1665 DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"` 1666} 1667 1668// Resource the common properties of an Azure resource. 1669type Resource struct { 1670 // ID - READ-ONLY; The resource identifier. 1671 ID *string `json:"id,omitempty"` 1672 // Name - READ-ONLY; The resource name. 1673 Name *string `json:"name,omitempty"` 1674 // Type - READ-ONLY; The resource type. 1675 Type *string `json:"type,omitempty"` 1676 // Location - The resource location. 1677 Location *string `json:"location,omitempty"` 1678 // Tags - The resource tags. 1679 Tags map[string]*string `json:"tags"` 1680} 1681 1682// MarshalJSON is the custom marshaler for Resource. 1683func (r Resource) MarshalJSON() ([]byte, error) { 1684 objectMap := make(map[string]interface{}) 1685 if r.Location != nil { 1686 objectMap["location"] = r.Location 1687 } 1688 if r.Tags != nil { 1689 objectMap["tags"] = r.Tags 1690 } 1691 return json.Marshal(objectMap) 1692} 1693 1694// RouteProperties the properties of a routing rule that your IoT hub uses to route messages to endpoints. 1695type RouteProperties struct { 1696 // 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. 1697 Name *string `json:"name,omitempty"` 1698 // Source - The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: 'DeviceMessages', 'TwinChangeEvents', 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents' 1699 Source RoutingSource `json:"source,omitempty"` 1700 // 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 1701 Condition *string `json:"condition,omitempty"` 1702 // EndpointNames - The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed. 1703 EndpointNames *[]string `json:"endpointNames,omitempty"` 1704 // IsEnabled - Used to specify whether a route is enabled. 1705 IsEnabled *bool `json:"isEnabled,omitempty"` 1706} 1707 1708// RoutingEndpoints the properties related to the custom endpoints to which your IoT hub routes messages 1709// based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for 1710// paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. 1711type RoutingEndpoints struct { 1712 // ServiceBusQueues - The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. 1713 ServiceBusQueues *[]RoutingServiceBusQueueEndpointProperties `json:"serviceBusQueues,omitempty"` 1714 // ServiceBusTopics - The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. 1715 ServiceBusTopics *[]RoutingServiceBusTopicEndpointProperties `json:"serviceBusTopics,omitempty"` 1716 // 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. 1717 EventHubs *[]RoutingEventHubProperties `json:"eventHubs,omitempty"` 1718 // StorageContainers - The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. 1719 StorageContainers *[]RoutingStorageContainerProperties `json:"storageContainers,omitempty"` 1720} 1721 1722// RoutingEventHubProperties the properties related to an event hub endpoint. 1723type RoutingEventHubProperties struct { 1724 // ConnectionString - The connection string of the event hub endpoint. 1725 ConnectionString *string `json:"connectionString,omitempty"` 1726 // Name - The name that identifies this 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. 1727 Name *string `json:"name,omitempty"` 1728 // SubscriptionID - The subscription identifier of the event hub endpoint. 1729 SubscriptionID *string `json:"subscriptionId,omitempty"` 1730 // ResourceGroup - The name of the resource group of the event hub endpoint. 1731 ResourceGroup *string `json:"resourceGroup,omitempty"` 1732} 1733 1734// RoutingProperties the routing related properties of the IoT hub. See: 1735// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging 1736type RoutingProperties struct { 1737 Endpoints *RoutingEndpoints `json:"endpoints,omitempty"` 1738 // 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. 1739 Routes *[]RouteProperties `json:"routes,omitempty"` 1740 // 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. 1741 FallbackRoute *FallbackRouteProperties `json:"fallbackRoute,omitempty"` 1742} 1743 1744// RoutingServiceBusQueueEndpointProperties the properties related to service bus queue endpoint types. 1745type RoutingServiceBusQueueEndpointProperties struct { 1746 // ConnectionString - The connection string of the service bus queue endpoint. 1747 ConnectionString *string `json:"connectionString,omitempty"` 1748 // Name - The name that identifies this 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. 1749 Name *string `json:"name,omitempty"` 1750 // SubscriptionID - The subscription identifier of the service bus queue endpoint. 1751 SubscriptionID *string `json:"subscriptionId,omitempty"` 1752 // ResourceGroup - The name of the resource group of the service bus queue endpoint. 1753 ResourceGroup *string `json:"resourceGroup,omitempty"` 1754} 1755 1756// RoutingServiceBusTopicEndpointProperties the properties related to service bus topic endpoint types. 1757type RoutingServiceBusTopicEndpointProperties struct { 1758 // ConnectionString - The connection string of the service bus topic endpoint. 1759 ConnectionString *string `json:"connectionString,omitempty"` 1760 // Name - The name that identifies this 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. 1761 Name *string `json:"name,omitempty"` 1762 // SubscriptionID - The subscription identifier of the service bus topic endpoint. 1763 SubscriptionID *string `json:"subscriptionId,omitempty"` 1764 // ResourceGroup - The name of the resource group of the service bus topic endpoint. 1765 ResourceGroup *string `json:"resourceGroup,omitempty"` 1766} 1767 1768// RoutingStorageContainerProperties the properties related to a storage container endpoint. 1769type RoutingStorageContainerProperties struct { 1770 // ConnectionString - The connection string of the storage account. 1771 ConnectionString *string `json:"connectionString,omitempty"` 1772 // Name - The name that identifies this 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. 1773 Name *string `json:"name,omitempty"` 1774 // SubscriptionID - The subscription identifier of the storage account. 1775 SubscriptionID *string `json:"subscriptionId,omitempty"` 1776 // ResourceGroup - The name of the resource group of the storage account. 1777 ResourceGroup *string `json:"resourceGroup,omitempty"` 1778 // ContainerName - The name of storage container in the storage account. 1779 ContainerName *string `json:"containerName,omitempty"` 1780 // FileNameFormat - File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered. 1781 FileNameFormat *string `json:"fileNameFormat,omitempty"` 1782 // BatchFrequencyInSeconds - Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds. 1783 BatchFrequencyInSeconds *int32 `json:"batchFrequencyInSeconds,omitempty"` 1784 // MaxChunkSizeInBytes - Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). 1785 MaxChunkSizeInBytes *int32 `json:"maxChunkSizeInBytes,omitempty"` 1786 // Encoding - Encoding that is used to serialize messages to blobs. Supported values are 'avro' and 'avroDeflate'. Default value is 'avro'. 1787 Encoding *string `json:"encoding,omitempty"` 1788} 1789 1790// SetObject ... 1791type SetObject struct { 1792 autorest.Response `json:"-"` 1793 Value interface{} `json:"value,omitempty"` 1794} 1795 1796// SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy. 1797type SharedAccessSignatureAuthorizationRule struct { 1798 autorest.Response `json:"-"` 1799 // KeyName - The name of the shared access policy. 1800 KeyName *string `json:"keyName,omitempty"` 1801 // PrimaryKey - The primary key. 1802 PrimaryKey *string `json:"primaryKey,omitempty"` 1803 // SecondaryKey - The secondary key. 1804 SecondaryKey *string `json:"secondaryKey,omitempty"` 1805 // 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' 1806 Rights AccessRights `json:"rights,omitempty"` 1807} 1808 1809// SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link. 1810type SharedAccessSignatureAuthorizationRuleListResult struct { 1811 autorest.Response `json:"-"` 1812 // Value - The list of shared access policies. 1813 Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"` 1814 // NextLink - READ-ONLY; The next link. 1815 NextLink *string `json:"nextLink,omitempty"` 1816} 1817 1818// SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of 1819// SharedAccessSignatureAuthorizationRule values. 1820type SharedAccessSignatureAuthorizationRuleListResultIterator struct { 1821 i int 1822 page SharedAccessSignatureAuthorizationRuleListResultPage 1823} 1824 1825// NextWithContext advances to the next value. If there was an error making 1826// the request the iterator does not advance and the error is returned. 1827func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 1828 if tracing.IsEnabled() { 1829 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext") 1830 defer func() { 1831 sc := -1 1832 if iter.Response().Response.Response != nil { 1833 sc = iter.Response().Response.Response.StatusCode 1834 } 1835 tracing.EndSpan(ctx, sc, err) 1836 }() 1837 } 1838 iter.i++ 1839 if iter.i < len(iter.page.Values()) { 1840 return nil 1841 } 1842 err = iter.page.NextWithContext(ctx) 1843 if err != nil { 1844 iter.i-- 1845 return err 1846 } 1847 iter.i = 0 1848 return nil 1849} 1850 1851// Next advances to the next value. If there was an error making 1852// the request the iterator does not advance and the error is returned. 1853// Deprecated: Use NextWithContext() instead. 1854func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error { 1855 return iter.NextWithContext(context.Background()) 1856} 1857 1858// NotDone returns true if the enumeration should be started or is not yet complete. 1859func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool { 1860 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1861} 1862 1863// Response returns the raw server response from the last page request. 1864func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult { 1865 return iter.page.Response() 1866} 1867 1868// Value returns the current value or a zero-initialized value if the 1869// iterator has advanced beyond the end of the collection. 1870func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule { 1871 if !iter.page.NotDone() { 1872 return SharedAccessSignatureAuthorizationRule{} 1873 } 1874 return iter.page.Values()[iter.i] 1875} 1876 1877// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type. 1878func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator { 1879 return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page} 1880} 1881 1882// IsEmpty returns true if the ListResult contains no values. 1883func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool { 1884 return sasarlr.Value == nil || len(*sasarlr.Value) == 0 1885} 1886 1887// sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. 1888// It returns nil if no more results exist. 1889func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 1890 if sasarlr.NextLink == nil || len(to.String(sasarlr.NextLink)) < 1 { 1891 return nil, nil 1892 } 1893 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1894 autorest.AsJSON(), 1895 autorest.AsGet(), 1896 autorest.WithBaseURL(to.String(sasarlr.NextLink))) 1897} 1898 1899// SharedAccessSignatureAuthorizationRuleListResultPage contains a page of 1900// SharedAccessSignatureAuthorizationRule values. 1901type SharedAccessSignatureAuthorizationRuleListResultPage struct { 1902 fn func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error) 1903 sasarlr SharedAccessSignatureAuthorizationRuleListResult 1904} 1905 1906// NextWithContext advances to the next page of values. If there was an error making 1907// the request the page does not advance and the error is returned. 1908func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 1909 if tracing.IsEnabled() { 1910 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext") 1911 defer func() { 1912 sc := -1 1913 if page.Response().Response.Response != nil { 1914 sc = page.Response().Response.Response.StatusCode 1915 } 1916 tracing.EndSpan(ctx, sc, err) 1917 }() 1918 } 1919 next, err := page.fn(ctx, page.sasarlr) 1920 if err != nil { 1921 return err 1922 } 1923 page.sasarlr = next 1924 return nil 1925} 1926 1927// Next advances to the next page of values. If there was an error making 1928// the request the page does not advance and the error is returned. 1929// Deprecated: Use NextWithContext() instead. 1930func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error { 1931 return page.NextWithContext(context.Background()) 1932} 1933 1934// NotDone returns true if the page enumeration should be started or is not yet complete. 1935func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool { 1936 return !page.sasarlr.IsEmpty() 1937} 1938 1939// Response returns the raw server response from the last page request. 1940func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult { 1941 return page.sasarlr 1942} 1943 1944// Values returns the slice of values for the current page or nil if there are no values. 1945func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule { 1946 if page.sasarlr.IsEmpty() { 1947 return nil 1948 } 1949 return *page.sasarlr.Value 1950} 1951 1952// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type. 1953func NewSharedAccessSignatureAuthorizationRuleListResultPage(getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage { 1954 return SharedAccessSignatureAuthorizationRuleListResultPage{fn: getNextPage} 1955} 1956 1957// StorageEndpointProperties the properties of the Azure Storage endpoint for file upload. 1958type StorageEndpointProperties struct { 1959 // 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. 1960 SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"` 1961 // ConnectionString - The connection string for the Azure Storage account to which files are uploaded. 1962 ConnectionString *string `json:"connectionString,omitempty"` 1963 // ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. 1964 ContainerName *string `json:"containerName,omitempty"` 1965} 1966 1967// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on 1968// an IoT Hub instance. 1969type TagsResource struct { 1970 // Tags - Resource tags 1971 Tags map[string]*string `json:"tags"` 1972} 1973 1974// MarshalJSON is the custom marshaler for TagsResource. 1975func (tr TagsResource) MarshalJSON() ([]byte, error) { 1976 objectMap := make(map[string]interface{}) 1977 if tr.Tags != nil { 1978 objectMap["tags"] = tr.Tags 1979 } 1980 return json.Marshal(objectMap) 1981} 1982