diff --git a/services/iothub/mgmt/2018-01-22/devices/certificates.go b/services/iothub/mgmt/2018-01-22/devices/certificates.go index e44901ffba9e..b5402f653782 100644 --- a/services/iothub/mgmt/2018-01-22/devices/certificates.go +++ b/services/iothub/mgmt/2018-01-22/devices/certificates.go @@ -127,7 +127,6 @@ func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http. func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -213,7 +212,6 @@ func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp @@ -299,7 +297,6 @@ func (client CertificatesClient) GenerateVerificationCodeSender(req *http.Reques func (client CertificatesClient) GenerateVerificationCodeResponder(resp *http.Response) (result CertificateWithNonceDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -383,7 +380,6 @@ func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, e func (client CertificatesClient) GetResponder(resp *http.Response) (result CertificateDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -459,7 +455,6 @@ func (client CertificatesClient) ListByIotHubSender(req *http.Request) (*http.Re func (client CertificatesClient) ListByIotHubResponder(resp *http.Response) (result CertificateListDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -549,7 +544,6 @@ func (client CertificatesClient) VerifySender(req *http.Request) (*http.Response func (client CertificatesClient) VerifyResponder(resp *http.Response) (result CertificateDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/iothub/mgmt/2018-01-22/devices/enums.go b/services/iothub/mgmt/2018-01-22/devices/enums.go new file mode 100644 index 000000000000..564d7a5e37f4 --- /dev/null +++ b/services/iothub/mgmt/2018-01-22/devices/enums.go @@ -0,0 +1,247 @@ +package devices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // DeviceConnect ... + DeviceConnect AccessRights = "DeviceConnect" + // RegistryRead ... + RegistryRead AccessRights = "RegistryRead" + // RegistryReadDeviceConnect ... + RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" + // RegistryReadRegistryWrite ... + RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" + // RegistryReadRegistryWriteDeviceConnect ... + RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" + // RegistryReadRegistryWriteServiceConnect ... + RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" + // RegistryReadRegistryWriteServiceConnectDeviceConnect ... + RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + // RegistryReadServiceConnect ... + RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" + // RegistryReadServiceConnectDeviceConnect ... + RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" + // RegistryWrite ... + RegistryWrite AccessRights = "RegistryWrite" + // RegistryWriteDeviceConnect ... + RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" + // RegistryWriteServiceConnect ... + RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" + // RegistryWriteServiceConnectDeviceConnect ... + RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" + // ServiceConnect ... + ServiceConnect AccessRights = "ServiceConnect" + // ServiceConnectDeviceConnect ... + ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" +) + +// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. +func PossibleAccessRightsValues() []AccessRights { + return []AccessRights{DeviceConnect, RegistryRead, RegistryReadDeviceConnect, RegistryReadRegistryWrite, RegistryReadRegistryWriteDeviceConnect, RegistryReadRegistryWriteServiceConnect, RegistryReadRegistryWriteServiceConnectDeviceConnect, RegistryReadServiceConnect, RegistryReadServiceConnectDeviceConnect, RegistryWrite, RegistryWriteDeviceConnect, RegistryWriteServiceConnect, RegistryWriteServiceConnectDeviceConnect, ServiceConnect, ServiceConnectDeviceConnect} +} + +// Capabilities enumerates the values for capabilities. +type Capabilities string + +const ( + // DeviceManagement ... + DeviceManagement Capabilities = "DeviceManagement" + // None ... + None Capabilities = "None" +) + +// PossibleCapabilitiesValues returns an array of possible values for the Capabilities const type. +func PossibleCapabilitiesValues() []Capabilities { + return []Capabilities{DeviceManagement, None} +} + +// IotHubNameUnavailabilityReason enumerates the values for iot hub name unavailability reason. +type IotHubNameUnavailabilityReason string + +const ( + // AlreadyExists ... + AlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists" + // Invalid ... + Invalid IotHubNameUnavailabilityReason = "Invalid" +) + +// PossibleIotHubNameUnavailabilityReasonValues returns an array of possible values for the IotHubNameUnavailabilityReason const type. +func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason { + return []IotHubNameUnavailabilityReason{AlreadyExists, Invalid} +} + +// IotHubScaleType enumerates the values for iot hub scale type. +type IotHubScaleType string + +const ( + // IotHubScaleTypeAutomatic ... + IotHubScaleTypeAutomatic IotHubScaleType = "Automatic" + // IotHubScaleTypeManual ... + IotHubScaleTypeManual IotHubScaleType = "Manual" + // IotHubScaleTypeNone ... + IotHubScaleTypeNone IotHubScaleType = "None" +) + +// PossibleIotHubScaleTypeValues returns an array of possible values for the IotHubScaleType const type. +func PossibleIotHubScaleTypeValues() []IotHubScaleType { + return []IotHubScaleType{IotHubScaleTypeAutomatic, IotHubScaleTypeManual, IotHubScaleTypeNone} +} + +// IotHubSku enumerates the values for iot hub sku. +type IotHubSku string + +const ( + // F1 ... + F1 IotHubSku = "F1" + // S1 ... + S1 IotHubSku = "S1" + // S2 ... + S2 IotHubSku = "S2" + // S3 ... + S3 IotHubSku = "S3" +) + +// PossibleIotHubSkuValues returns an array of possible values for the IotHubSku const type. +func PossibleIotHubSkuValues() []IotHubSku { + return []IotHubSku{F1, S1, S2, S3} +} + +// IotHubSkuTier enumerates the values for iot hub sku tier. +type IotHubSkuTier string + +const ( + // Free ... + Free IotHubSkuTier = "Free" + // Standard ... + Standard IotHubSkuTier = "Standard" +) + +// PossibleIotHubSkuTierValues returns an array of possible values for the IotHubSkuTier const type. +func PossibleIotHubSkuTierValues() []IotHubSkuTier { + return []IotHubSkuTier{Free, Standard} +} + +// IPFilterActionType enumerates the values for ip filter action type. +type IPFilterActionType string + +const ( + // Accept ... + Accept IPFilterActionType = "Accept" + // Reject ... + Reject IPFilterActionType = "Reject" +) + +// PossibleIPFilterActionTypeValues returns an array of possible values for the IPFilterActionType const type. +func PossibleIPFilterActionTypeValues() []IPFilterActionType { + return []IPFilterActionType{Accept, Reject} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // Cancelled ... + Cancelled JobStatus = "cancelled" + // Completed ... + Completed JobStatus = "completed" + // Enqueued ... + Enqueued JobStatus = "enqueued" + // Failed ... + Failed JobStatus = "failed" + // Running ... + Running JobStatus = "running" + // Unknown ... + Unknown JobStatus = "unknown" +) + +// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{Cancelled, Completed, Enqueued, Failed, Running, Unknown} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeBackup ... + JobTypeBackup JobType = "backup" + // JobTypeExport ... + JobTypeExport JobType = "export" + // JobTypeFactoryResetDevice ... + JobTypeFactoryResetDevice JobType = "factoryResetDevice" + // JobTypeFirmwareUpdate ... + JobTypeFirmwareUpdate JobType = "firmwareUpdate" + // JobTypeImport ... + JobTypeImport JobType = "import" + // JobTypeReadDeviceProperties ... + JobTypeReadDeviceProperties JobType = "readDeviceProperties" + // JobTypeRebootDevice ... + JobTypeRebootDevice JobType = "rebootDevice" + // JobTypeUnknown ... + JobTypeUnknown JobType = "unknown" + // JobTypeUpdateDeviceConfiguration ... + JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" + // JobTypeWriteDeviceProperties ... + JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeBackup, JobTypeExport, JobTypeFactoryResetDevice, JobTypeFirmwareUpdate, JobTypeImport, JobTypeReadDeviceProperties, JobTypeRebootDevice, JobTypeUnknown, JobTypeUpdateDeviceConfiguration, JobTypeWriteDeviceProperties} +} + +// OperationMonitoringLevel enumerates the values for operation monitoring level. +type OperationMonitoringLevel string + +const ( + // OperationMonitoringLevelError ... + OperationMonitoringLevelError OperationMonitoringLevel = "Error" + // OperationMonitoringLevelErrorInformation ... + OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information" + // OperationMonitoringLevelInformation ... + OperationMonitoringLevelInformation OperationMonitoringLevel = "Information" + // OperationMonitoringLevelNone ... + OperationMonitoringLevelNone OperationMonitoringLevel = "None" +) + +// PossibleOperationMonitoringLevelValues returns an array of possible values for the OperationMonitoringLevel const type. +func PossibleOperationMonitoringLevelValues() []OperationMonitoringLevel { + return []OperationMonitoringLevel{OperationMonitoringLevelError, OperationMonitoringLevelErrorInformation, OperationMonitoringLevelInformation, OperationMonitoringLevelNone} +} + +// RoutingSource enumerates the values for routing source. +type RoutingSource string + +const ( + // DeviceJobLifecycleEvents ... + DeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" + // DeviceLifecycleEvents ... + DeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" + // DeviceMessages ... + DeviceMessages RoutingSource = "DeviceMessages" + // TwinChangeEvents ... + TwinChangeEvents RoutingSource = "TwinChangeEvents" +) + +// PossibleRoutingSourceValues returns an array of possible values for the RoutingSource const type. +func PossibleRoutingSourceValues() []RoutingSource { + return []RoutingSource{DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, TwinChangeEvents} +} diff --git a/services/iothub/mgmt/2018-01-22/devices/iothubresource.go b/services/iothub/mgmt/2018-01-22/devices/iothubresource.go index 4289d05cdf89..d25b13aa3259 100644 --- a/services/iothub/mgmt/2018-01-22/devices/iothubresource.go +++ b/services/iothub/mgmt/2018-01-22/devices/iothubresource.go @@ -116,7 +116,6 @@ func (client IotHubResourceClient) CheckNameAvailabilitySender(req *http.Request func (client IotHubResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result IotHubNameAvailabilityInfo, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -196,7 +195,6 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupSender(req *http.R func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -313,7 +311,6 @@ func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (futu func (client IotHubResourceClient) CreateOrUpdateResponder(resp *http.Response) (result IotHubDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -389,7 +386,6 @@ func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHu func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -469,7 +465,6 @@ func (client IotHubResourceClient) DeleteEventHubConsumerGroupSender(req *http.R func (client IotHubResourceClient) DeleteEventHubConsumerGroupResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp @@ -556,7 +551,6 @@ func (client IotHubResourceClient) ExportDevicesSender(req *http.Request) (*http func (client IotHubResourceClient) ExportDevicesResponder(resp *http.Response) (result JobResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -632,7 +626,6 @@ func (client IotHubResourceClient) GetSender(req *http.Request) (*http.Response, func (client IotHubResourceClient) GetResponder(resp *http.Response) (result IotHubDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -712,7 +705,6 @@ func (client IotHubResourceClient) GetEventHubConsumerGroupSender(req *http.Requ func (client IotHubResourceClient) GetEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -791,7 +783,6 @@ func (client IotHubResourceClient) GetJobSender(req *http.Request) (*http.Respon func (client IotHubResourceClient) GetJobResponder(resp *http.Response) (result JobResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -870,7 +861,6 @@ func (client IotHubResourceClient) GetKeysForKeyNameSender(req *http.Request) (* func (client IotHubResourceClient) GetKeysForKeyNameResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRule, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -911,6 +901,9 @@ func (client IotHubResourceClient) GetQuotaMetrics(ctx context.Context, resource if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetQuotaMetrics", resp, "Failure responding to request") } + if result.ihqmilr.hasNextLink() && result.ihqmilr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -947,7 +940,6 @@ func (client IotHubResourceClient) GetQuotaMetricsSender(req *http.Request) (*ht func (client IotHubResourceClient) GetQuotaMetricsResponder(resp *http.Response) (result IotHubQuotaMetricInfoListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1060,7 +1052,6 @@ func (client IotHubResourceClient) GetStatsSender(req *http.Request) (*http.Resp func (client IotHubResourceClient) GetStatsResponder(resp *http.Response) (result RegistryStatistics, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1101,6 +1092,9 @@ func (client IotHubResourceClient) GetValidSkus(ctx context.Context, resourceGro if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetValidSkus", resp, "Failure responding to request") } + if result.ihsdlr.hasNextLink() && result.ihsdlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1137,7 +1131,6 @@ func (client IotHubResourceClient) GetValidSkusSender(req *http.Request) (*http. func (client IotHubResourceClient) GetValidSkusResponder(resp *http.Response) (result IotHubSkuDescriptionListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1262,7 +1255,6 @@ func (client IotHubResourceClient) ImportDevicesSender(req *http.Request) (*http func (client IotHubResourceClient) ImportDevicesResponder(resp *http.Response) (result JobResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1302,6 +1294,9 @@ func (client IotHubResourceClient) ListByResourceGroup(ctx context.Context, reso if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListByResourceGroup", resp, "Failure responding to request") } + if result.ihdlr.hasNextLink() && result.ihdlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1337,7 +1332,6 @@ func (client IotHubResourceClient) ListByResourceGroupSender(req *http.Request) func (client IotHubResourceClient) ListByResourceGroupResponder(resp *http.Response) (result IotHubDescriptionListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1412,6 +1406,9 @@ func (client IotHubResourceClient) ListBySubscription(ctx context.Context) (resu if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListBySubscription", resp, "Failure responding to request") } + if result.ihdlr.hasNextLink() && result.ihdlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1446,7 +1443,6 @@ func (client IotHubResourceClient) ListBySubscriptionSender(req *http.Request) ( func (client IotHubResourceClient) ListBySubscriptionResponder(resp *http.Response) (result IotHubDescriptionListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1526,6 +1522,9 @@ func (client IotHubResourceClient) ListEventHubConsumerGroups(ctx context.Contex if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to request") } + if result.ehcglr.hasNextLink() && result.ehcglr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1563,7 +1562,6 @@ func (client IotHubResourceClient) ListEventHubConsumerGroupsSender(req *http.Re func (client IotHubResourceClient) ListEventHubConsumerGroupsResponder(resp *http.Response) (result EventHubConsumerGroupsListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1642,6 +1640,9 @@ func (client IotHubResourceClient) ListJobs(ctx context.Context, resourceGroupNa if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListJobs", resp, "Failure responding to request") } + if result.jrlr.hasNextLink() && result.jrlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1678,7 +1679,6 @@ func (client IotHubResourceClient) ListJobsSender(req *http.Request) (*http.Resp func (client IotHubResourceClient) ListJobsResponder(resp *http.Response) (result JobResponseListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1757,6 +1757,9 @@ func (client IotHubResourceClient) ListKeys(ctx context.Context, resourceGroupNa if err != nil { err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListKeys", resp, "Failure responding to request") } + if result.sasarlr.hasNextLink() && result.sasarlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1793,7 +1796,6 @@ func (client IotHubResourceClient) ListKeysSender(req *http.Request) (*http.Resp func (client IotHubResourceClient) ListKeysResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -1909,7 +1911,6 @@ func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHu func (client IotHubResourceClient) UpdateResponder(resp *http.Response) (result IotHubDescription, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/iothub/mgmt/2018-01-22/devices/models.go b/services/iothub/mgmt/2018-01-22/devices/models.go index 9a093b7c54c7..cc3a20507a75 100644 --- a/services/iothub/mgmt/2018-01-22/devices/models.go +++ b/services/iothub/mgmt/2018-01-22/devices/models.go @@ -31,235 +31,6 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-01-22/devices" -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // DeviceConnect ... - DeviceConnect AccessRights = "DeviceConnect" - // RegistryRead ... - RegistryRead AccessRights = "RegistryRead" - // RegistryReadDeviceConnect ... - RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" - // RegistryReadRegistryWrite ... - RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" - // RegistryReadRegistryWriteDeviceConnect ... - RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" - // RegistryReadRegistryWriteServiceConnect ... - RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" - // RegistryReadRegistryWriteServiceConnectDeviceConnect ... - RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" - // RegistryReadServiceConnect ... - RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" - // RegistryReadServiceConnectDeviceConnect ... - RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" - // RegistryWrite ... - RegistryWrite AccessRights = "RegistryWrite" - // RegistryWriteDeviceConnect ... - RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" - // RegistryWriteServiceConnect ... - RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" - // RegistryWriteServiceConnectDeviceConnect ... - RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" - // ServiceConnect ... - ServiceConnect AccessRights = "ServiceConnect" - // ServiceConnectDeviceConnect ... - ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" -) - -// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. -func PossibleAccessRightsValues() []AccessRights { - return []AccessRights{DeviceConnect, RegistryRead, RegistryReadDeviceConnect, RegistryReadRegistryWrite, RegistryReadRegistryWriteDeviceConnect, RegistryReadRegistryWriteServiceConnect, RegistryReadRegistryWriteServiceConnectDeviceConnect, RegistryReadServiceConnect, RegistryReadServiceConnectDeviceConnect, RegistryWrite, RegistryWriteDeviceConnect, RegistryWriteServiceConnect, RegistryWriteServiceConnectDeviceConnect, ServiceConnect, ServiceConnectDeviceConnect} -} - -// Capabilities enumerates the values for capabilities. -type Capabilities string - -const ( - // DeviceManagement ... - DeviceManagement Capabilities = "DeviceManagement" - // None ... - None Capabilities = "None" -) - -// PossibleCapabilitiesValues returns an array of possible values for the Capabilities const type. -func PossibleCapabilitiesValues() []Capabilities { - return []Capabilities{DeviceManagement, None} -} - -// IotHubNameUnavailabilityReason enumerates the values for iot hub name unavailability reason. -type IotHubNameUnavailabilityReason string - -const ( - // AlreadyExists ... - AlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists" - // Invalid ... - Invalid IotHubNameUnavailabilityReason = "Invalid" -) - -// PossibleIotHubNameUnavailabilityReasonValues returns an array of possible values for the IotHubNameUnavailabilityReason const type. -func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason { - return []IotHubNameUnavailabilityReason{AlreadyExists, Invalid} -} - -// IotHubScaleType enumerates the values for iot hub scale type. -type IotHubScaleType string - -const ( - // IotHubScaleTypeAutomatic ... - IotHubScaleTypeAutomatic IotHubScaleType = "Automatic" - // IotHubScaleTypeManual ... - IotHubScaleTypeManual IotHubScaleType = "Manual" - // IotHubScaleTypeNone ... - IotHubScaleTypeNone IotHubScaleType = "None" -) - -// PossibleIotHubScaleTypeValues returns an array of possible values for the IotHubScaleType const type. -func PossibleIotHubScaleTypeValues() []IotHubScaleType { - return []IotHubScaleType{IotHubScaleTypeAutomatic, IotHubScaleTypeManual, IotHubScaleTypeNone} -} - -// IotHubSku enumerates the values for iot hub sku. -type IotHubSku string - -const ( - // F1 ... - F1 IotHubSku = "F1" - // S1 ... - S1 IotHubSku = "S1" - // S2 ... - S2 IotHubSku = "S2" - // S3 ... - S3 IotHubSku = "S3" -) - -// PossibleIotHubSkuValues returns an array of possible values for the IotHubSku const type. -func PossibleIotHubSkuValues() []IotHubSku { - return []IotHubSku{F1, S1, S2, S3} -} - -// IotHubSkuTier enumerates the values for iot hub sku tier. -type IotHubSkuTier string - -const ( - // Free ... - Free IotHubSkuTier = "Free" - // Standard ... - Standard IotHubSkuTier = "Standard" -) - -// PossibleIotHubSkuTierValues returns an array of possible values for the IotHubSkuTier const type. -func PossibleIotHubSkuTierValues() []IotHubSkuTier { - return []IotHubSkuTier{Free, Standard} -} - -// IPFilterActionType enumerates the values for ip filter action type. -type IPFilterActionType string - -const ( - // Accept ... - Accept IPFilterActionType = "Accept" - // Reject ... - Reject IPFilterActionType = "Reject" -) - -// PossibleIPFilterActionTypeValues returns an array of possible values for the IPFilterActionType const type. -func PossibleIPFilterActionTypeValues() []IPFilterActionType { - return []IPFilterActionType{Accept, Reject} -} - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // Cancelled ... - Cancelled JobStatus = "cancelled" - // Completed ... - Completed JobStatus = "completed" - // Enqueued ... - Enqueued JobStatus = "enqueued" - // Failed ... - Failed JobStatus = "failed" - // Running ... - Running JobStatus = "running" - // Unknown ... - Unknown JobStatus = "unknown" -) - -// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. -func PossibleJobStatusValues() []JobStatus { - return []JobStatus{Cancelled, Completed, Enqueued, Failed, Running, Unknown} -} - -// JobType enumerates the values for job type. -type JobType string - -const ( - // JobTypeBackup ... - JobTypeBackup JobType = "backup" - // JobTypeExport ... - JobTypeExport JobType = "export" - // JobTypeFactoryResetDevice ... - JobTypeFactoryResetDevice JobType = "factoryResetDevice" - // JobTypeFirmwareUpdate ... - JobTypeFirmwareUpdate JobType = "firmwareUpdate" - // JobTypeImport ... - JobTypeImport JobType = "import" - // JobTypeReadDeviceProperties ... - JobTypeReadDeviceProperties JobType = "readDeviceProperties" - // JobTypeRebootDevice ... - JobTypeRebootDevice JobType = "rebootDevice" - // JobTypeUnknown ... - JobTypeUnknown JobType = "unknown" - // JobTypeUpdateDeviceConfiguration ... - JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" - // JobTypeWriteDeviceProperties ... - JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" -) - -// PossibleJobTypeValues returns an array of possible values for the JobType const type. -func PossibleJobTypeValues() []JobType { - return []JobType{JobTypeBackup, JobTypeExport, JobTypeFactoryResetDevice, JobTypeFirmwareUpdate, JobTypeImport, JobTypeReadDeviceProperties, JobTypeRebootDevice, JobTypeUnknown, JobTypeUpdateDeviceConfiguration, JobTypeWriteDeviceProperties} -} - -// OperationMonitoringLevel enumerates the values for operation monitoring level. -type OperationMonitoringLevel string - -const ( - // OperationMonitoringLevelError ... - OperationMonitoringLevelError OperationMonitoringLevel = "Error" - // OperationMonitoringLevelErrorInformation ... - OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information" - // OperationMonitoringLevelInformation ... - OperationMonitoringLevelInformation OperationMonitoringLevel = "Information" - // OperationMonitoringLevelNone ... - OperationMonitoringLevelNone OperationMonitoringLevel = "None" -) - -// PossibleOperationMonitoringLevelValues returns an array of possible values for the OperationMonitoringLevel const type. -func PossibleOperationMonitoringLevelValues() []OperationMonitoringLevel { - return []OperationMonitoringLevel{OperationMonitoringLevelError, OperationMonitoringLevelErrorInformation, OperationMonitoringLevelInformation, OperationMonitoringLevelNone} -} - -// RoutingSource enumerates the values for routing source. -type RoutingSource string - -const ( - // DeviceJobLifecycleEvents ... - DeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" - // DeviceLifecycleEvents ... - DeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" - // DeviceMessages ... - DeviceMessages RoutingSource = "DeviceMessages" - // TwinChangeEvents ... - TwinChangeEvents RoutingSource = "TwinChangeEvents" -) - -// PossibleRoutingSourceValues returns an array of possible values for the RoutingSource const type. -func PossibleRoutingSourceValues() []RoutingSource { - return []RoutingSource{DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, TwinChangeEvents} -} - // CertificateBodyDescription the JSON-serialized X509 Certificate. type CertificateBodyDescription struct { // Certificate - base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -280,6 +51,15 @@ type CertificateDescription struct { Type *string `json:"type,omitempty"` } +// MarshalJSON is the custom marshaler for CertificateDescription. +func (cd CertificateDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cd.Properties != nil { + objectMap["properties"] = cd.Properties + } + return json.Marshal(objectMap) +} + // CertificateListDescription the JSON-serialized array of Certificate objects. type CertificateListDescription struct { autorest.Response `json:"-"` @@ -342,6 +122,15 @@ type CertificateWithNonceDescription struct { Type *string `json:"type,omitempty"` } +// MarshalJSON is the custom marshaler for CertificateWithNonceDescription. +func (cwnd CertificateWithNonceDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cwnd.Properties != nil { + objectMap["properties"] = cwnd.Properties + } + return json.Marshal(objectMap) +} + // CloudToDeviceProperties the IoT hub cloud-to-device messaging properties. type CloudToDeviceProperties struct { // 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. @@ -387,8 +176,8 @@ func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names -// with a next link. +// EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names with +// a next link. type EventHubConsumerGroupsListResult struct { autorest.Response `json:"-"` // Value - List of consumer groups objects @@ -397,8 +186,17 @@ type EventHubConsumerGroupsListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// EventHubConsumerGroupsListResultIterator provides access to a complete listing of -// EventHubConsumerGroupInfo values. +// MarshalJSON is the custom marshaler for EventHubConsumerGroupsListResult. +func (ehcglr EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehcglr.Value != nil { + objectMap["value"] = ehcglr.Value + } + return json.Marshal(objectMap) +} + +// EventHubConsumerGroupsListResultIterator provides access to a complete listing of EventHubConsumerGroupInfo +// values. type EventHubConsumerGroupsListResultIterator struct { i int page EventHubConsumerGroupsListResultPage @@ -466,10 +264,15 @@ func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool { return ehcglr.Value == nil || len(*ehcglr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ehcglr EventHubConsumerGroupsListResult) hasNextLink() bool { + return ehcglr.NextLink != nil && len(*ehcglr.NextLink) != 0 +} + // eventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { - if ehcglr.NextLink == nil || len(to.String(ehcglr.NextLink)) < 1 { + if !ehcglr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -497,11 +300,16 @@ func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Co tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ehcglr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ehcglr) + if err != nil { + return err + } + page.ehcglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ehcglr = next return nil } @@ -549,6 +357,18 @@ type EventHubProperties struct { Endpoint *string `json:"endpoint,omitempty"` } +// MarshalJSON is the custom marshaler for EventHubProperties. +func (ehp EventHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehp.RetentionTimeInDays != nil { + objectMap["retentionTimeInDays"] = ehp.RetentionTimeInDays + } + if ehp.PartitionCount != nil { + objectMap["partitionCount"] = ehp.PartitionCount + } + return json.Marshal(objectMap) +} + // ExportDevicesRequest use to provide parameters when requesting an export of all devices in the IoT hub. type ExportDevicesRequest struct { // ExportBlobContainerURI - The export blob container URI. @@ -557,8 +377,8 @@ type ExportDevicesRequest struct { ExcludeKeys *bool `json:"excludeKeys,omitempty"` } -// FallbackRouteProperties the properties of the fallback route. IoT Hub uses these properties when it -// routes messages to the fallback endpoint. +// FallbackRouteProperties the properties of the fallback route. IoT Hub uses these properties when it routes +// messages to the fallback endpoint. type FallbackRouteProperties struct { // 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. Name *string `json:"name,omitempty"` @@ -651,6 +471,15 @@ type IotHubDescriptionListResult struct { NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for IotHubDescriptionListResult. +func (ihdlr IotHubDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihdlr.Value != nil { + objectMap["value"] = ihdlr.Value + } + return json.Marshal(objectMap) +} + // IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values. type IotHubDescriptionListResultIterator struct { i int @@ -719,10 +548,15 @@ func (ihdlr IotHubDescriptionListResult) IsEmpty() bool { return ihdlr.Value == nil || len(*ihdlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ihdlr IotHubDescriptionListResult) hasNextLink() bool { + return ihdlr.NextLink != nil && len(*ihdlr.NextLink) != 0 +} + // iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if ihdlr.NextLink == nil || len(to.String(ihdlr.NextLink)) < 1 { + if !ihdlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -750,11 +584,16 @@ func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ihdlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ihdlr) + if err != nil { + return err + } + page.ihdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ihdlr = next return nil } @@ -799,6 +638,15 @@ type IotHubNameAvailabilityInfo struct { Message *string `json:"message,omitempty"` } +// MarshalJSON is the custom marshaler for IotHubNameAvailabilityInfo. +func (ihnai IotHubNameAvailabilityInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihnai.Message != nil { + objectMap["message"] = ihnai.Message + } + return json.Marshal(objectMap) +} + // IotHubProperties the properties of an IoT hub. type IotHubProperties struct { // AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub. @@ -877,8 +725,7 @@ type IotHubQuotaMetricInfo struct { MaxValue *int64 `json:"maxValue,omitempty"` } -// IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next -// link. +// IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. type IotHubQuotaMetricInfoListResult struct { autorest.Response `json:"-"` // Value - The array of quota metrics objects. @@ -887,6 +734,15 @@ type IotHubQuotaMetricInfoListResult struct { NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for IotHubQuotaMetricInfoListResult. +func (ihqmilr IotHubQuotaMetricInfoListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihqmilr.Value != nil { + objectMap["value"] = ihqmilr.Value + } + return json.Marshal(objectMap) +} + // IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo // values. type IotHubQuotaMetricInfoListResultIterator struct { @@ -956,10 +812,15 @@ func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool { return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ihqmilr IotHubQuotaMetricInfoListResult) hasNextLink() bool { + return ihqmilr.NextLink != nil && len(*ihqmilr.NextLink) != 0 +} + // iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if ihqmilr.NextLink == nil || len(to.String(ihqmilr.NextLink)) < 1 { + if !ihqmilr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -987,11 +848,16 @@ func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Con tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ihqmilr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ihqmilr) + if err != nil { + return err + } + page.ihqmilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ihqmilr = next return nil } @@ -1121,8 +987,19 @@ type IotHubSkuDescription struct { Capacity *IotHubCapacity `json:"capacity,omitempty"` } -// IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next -// link. +// MarshalJSON is the custom marshaler for IotHubSkuDescription. +func (ihsd IotHubSkuDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihsd.Sku != nil { + objectMap["sku"] = ihsd.Sku + } + if ihsd.Capacity != nil { + objectMap["capacity"] = ihsd.Capacity + } + return json.Marshal(objectMap) +} + +// IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next link. type IotHubSkuDescriptionListResult struct { autorest.Response `json:"-"` // Value - The array of IotHubSkuDescription. @@ -1131,8 +1008,16 @@ type IotHubSkuDescriptionListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription -// values. +// MarshalJSON is the custom marshaler for IotHubSkuDescriptionListResult. +func (ihsdlr IotHubSkuDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihsdlr.Value != nil { + objectMap["value"] = ihsdlr.Value + } + return json.Marshal(objectMap) +} + +// IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription values. type IotHubSkuDescriptionListResultIterator struct { i int page IotHubSkuDescriptionListResultPage @@ -1200,10 +1085,15 @@ func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool { return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ihsdlr IotHubSkuDescriptionListResult) hasNextLink() bool { + return ihsdlr.NextLink != nil && len(*ihsdlr.NextLink) != 0 +} + // iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if ihsdlr.NextLink == nil || len(to.String(ihsdlr.NextLink)) < 1 { + if !ihsdlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1231,11 +1121,16 @@ func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Cont tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ihsdlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ihsdlr) + if err != nil { + return err + } + page.ihsdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ihsdlr = next return nil } @@ -1279,6 +1174,18 @@ type IotHubSkuInfo struct { Capacity *int64 `json:"capacity,omitempty"` } +// MarshalJSON is the custom marshaler for IotHubSkuInfo. +func (ihsi IotHubSkuInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihsi.Name != "" { + objectMap["name"] = ihsi.Name + } + if ihsi.Capacity != nil { + objectMap["capacity"] = ihsi.Capacity + } + return json.Marshal(objectMap) +} + // IPFilterRule the IP filter rules for the IoT hub. type IPFilterRule struct { // FilterName - The name of the IP filter rule. @@ -1319,6 +1226,15 @@ type JobResponseListResult struct { NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for JobResponseListResult. +func (jrlr JobResponseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jrlr.Value != nil { + objectMap["value"] = jrlr.Value + } + return json.Marshal(objectMap) +} + // JobResponseListResultIterator provides access to a complete listing of JobResponse values. type JobResponseListResultIterator struct { i int @@ -1387,10 +1303,15 @@ func (jrlr JobResponseListResult) IsEmpty() bool { return jrlr.Value == nil || len(*jrlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (jrlr JobResponseListResult) hasNextLink() bool { + return jrlr.NextLink != nil && len(*jrlr.NextLink) != 0 +} + // jobResponseListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) { - if jrlr.NextLink == nil || len(to.String(jrlr.NextLink)) < 1 { + if !jrlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1418,11 +1339,16 @@ func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.jrlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.jrlr) + if err != nil { + return err + } + page.jrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.jrlr = next return nil } @@ -1474,6 +1400,15 @@ type Operation struct { Display *OperationDisplay `json:"display,omitempty"` } +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + // OperationDisplay the object that represents the operation. type OperationDisplay struct { // Provider - READ-ONLY; Service provider: Microsoft Devices @@ -1490,8 +1425,8 @@ type OperationInputs struct { Name *string `json:"name,omitempty"` } -// OperationListResult result of the request to list IoT Hub operations. It contains a list of operations -// and a URL link to get the next set of results. +// OperationListResult result of the request to list IoT Hub operations. It contains a list of operations and a +// URL link to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; List of IoT Hub operations supported by the Microsoft.Devices resource provider. @@ -1568,10 +1503,15 @@ func (olr OperationListResult) IsEmpty() bool { return olr.Value == nil || len(*olr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + // operationListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + if !olr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1599,11 +1539,16 @@ func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err e tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.olr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.olr = next return nil } @@ -1637,8 +1582,8 @@ func NewOperationListResultPage(getNextPage func(context.Context, OperationListR return OperationListResultPage{fn: getNextPage} } -// OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys -// to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, +// OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys to +// the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, // FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, // DirectMethods. type OperationsMonitoringProperties struct { @@ -1705,9 +1650,9 @@ type RouteProperties struct { IsEnabled *bool `json:"isEnabled,omitempty"` } -// RoutingEndpoints the properties related to the custom endpoints to which your IoT hub routes messages -// based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for -// paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. +// RoutingEndpoints the properties related to the custom endpoints to which your IoT hub routes messages based +// on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs +// and only 1 custom endpoint is allowed across all endpoint types for free hubs. type RoutingEndpoints struct { // ServiceBusQueues - The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. ServiceBusQueues *[]RoutingServiceBusQueueEndpointProperties `json:"serviceBusQueues,omitempty"` @@ -1815,6 +1760,15 @@ type SharedAccessSignatureAuthorizationRuleListResult struct { NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for SharedAccessSignatureAuthorizationRuleListResult. +func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sasarlr.Value != nil { + objectMap["value"] = sasarlr.Value + } + return json.Marshal(objectMap) +} + // SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of // SharedAccessSignatureAuthorizationRule values. type SharedAccessSignatureAuthorizationRuleListResultIterator struct { @@ -1884,10 +1838,15 @@ func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool { return sasarlr.Value == nil || len(*sasarlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool { + return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0 +} + // sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if sasarlr.NextLink == nil || len(to.String(sasarlr.NextLink)) < 1 { + if !sasarlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1916,11 +1875,16 @@ func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContex tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sasarlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.sasarlr) + if err != nil { + return err + } + page.sasarlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.sasarlr = next return nil } @@ -1964,8 +1928,8 @@ type StorageEndpointProperties struct { ContainerName *string `json:"containerName,omitempty"` } -// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on -// an IoT Hub instance. +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on an +// IoT Hub instance. type TagsResource struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` diff --git a/services/iothub/mgmt/2018-01-22/devices/operations.go b/services/iothub/mgmt/2018-01-22/devices/operations.go index 584cff9364d5..18f5f91bbc19 100644 --- a/services/iothub/mgmt/2018-01-22/devices/operations.go +++ b/services/iothub/mgmt/2018-01-22/devices/operations.go @@ -71,6 +71,9 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe if err != nil { err = autorest.NewErrorWithError(err, "devices.OperationsClient", "List", resp, "Failure responding to request") } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -101,7 +104,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/iothub/mgmt/2018-01-22/devices/version.go b/services/iothub/mgmt/2018-01-22/devices/version.go index c4a6fe40a9f8..9486037c420c 100644 --- a/services/iothub/mgmt/2018-01-22/devices/version.go +++ b/services/iothub/mgmt/2018-01-22/devices/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " devices/2018-01-22" + return "Azure-SDK-For-Go/" + Version() + " devices/2018-01-22" } // Version returns the semantic version (see http://semver.org) of the client.