diff --git a/services/containerinstance/mgmt/2018-04-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2018-04-01/containerinstance/CHANGELOG.md index 628be2d0ab96..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2018-04-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2018-04-01/containerinstance/CHANGELOG.md @@ -1,16 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerExecResponse.MarshalJSON() ([]byte, error) -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerState.MarshalJSON() ([]byte, error) -1. Event.MarshalJSON() ([]byte, error) -1. Logs.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2018-04-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2018-04-01/containerinstance/_meta.json index 7016c9152967..bec492eb4003 100644 --- a/services/containerinstance/mgmt/2018-04-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2018-04-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2018-04", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2018-04-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2018-04-01/containerinstance/containergroups.go index 389689fd0939..5125a6c58974 100644 --- a/services/containerinstance/mgmt/2018-04-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2018-04-01/containerinstance/containergroups.go @@ -67,7 +67,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -101,6 +101,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2018-06-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2018-06-01/containerinstance/CHANGELOG.md index 561c5545ab95..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2018-06-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2018-06-01/containerinstance/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2018-06-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2018-06-01/containerinstance/_meta.json index f395b516b294..7e13f256d570 100644 --- a/services/containerinstance/mgmt/2018-06-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2018-06-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2018-06", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2018-06-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2018-06-01/containerinstance/containergroups.go index 787a75831cdc..aa303cd4ace0 100644 --- a/services/containerinstance/mgmt/2018-06-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2018-06-01/containerinstance/containergroups.go @@ -73,7 +73,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -107,6 +107,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -542,7 +543,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -574,6 +575,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2018-09-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2018-09-01/containerinstance/CHANGELOG.md index 561c5545ab95..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2018-09-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2018-09-01/containerinstance/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2018-09-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2018-09-01/containerinstance/_meta.json index 5b9855a8b854..b7b7f735560c 100644 --- a/services/containerinstance/mgmt/2018-09-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2018-09-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2018-09", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2018-09-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2018-09-01/containerinstance/containergroups.go index e11d4cc0202d..9793ff5f4ca8 100644 --- a/services/containerinstance/mgmt/2018-09-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2018-09-01/containerinstance/containergroups.go @@ -73,7 +73,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -107,6 +107,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -542,7 +543,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -574,6 +575,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2018-10-01/containerinstance/CHANGELOG.md index e47e07f3ad75..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/CHANGELOG.md @@ -1,14 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. Capabilities.MarshalJSON() ([]byte, error) -1. CapabilitiesCapabilities.MarshalJSON() ([]byte, error) -1. ContainerGroupIdentityUserAssignedIdentitiesValue.MarshalJSON() ([]byte, error) -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2018-10-01/containerinstance/_meta.json index 2cf1e829be2e..7280832d676a 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2018-10", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2018-10-01/containerinstance/containergroups.go index 96bd83af3a1d..5b7bb6e4d797 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/containergroups.go @@ -75,7 +75,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -109,6 +109,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -544,7 +545,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -576,6 +577,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -621,7 +623,7 @@ func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName result, err = client.StartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") return } @@ -653,6 +655,7 @@ func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2019-12-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2019-12-01/containerinstance/CHANGELOG.md index 34c479bd4d34..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2019-12-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2019-12-01/containerinstance/CHANGELOG.md @@ -1,17 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. Capabilities.MarshalJSON() ([]byte, error) -1. CapabilitiesCapabilities.MarshalJSON() ([]byte, error) -1. ContainerGroupIdentityUserAssignedIdentitiesValue.MarshalJSON() ([]byte, error) -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerState.MarshalJSON() ([]byte, error) -1. Event.MarshalJSON() ([]byte, error) -1. InitContainerPropertiesDefinitionInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2019-12-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2019-12-01/containerinstance/_meta.json index a8f2c9cfbfcd..6c83cbd994d4 100644 --- a/services/containerinstance/mgmt/2019-12-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2019-12-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2019-12", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2019-12 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-12 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2019-12-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2019-12-01/containerinstance/containergroups.go index 97fea51f49c3..2da0a2cb944c 100644 --- a/services/containerinstance/mgmt/2019-12-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2019-12-01/containerinstance/containergroups.go @@ -80,7 +80,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -114,6 +114,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -161,7 +162,7 @@ func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupNam result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") return } @@ -193,6 +194,7 @@ func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resource // http.Response Body if it receives an error. func (client ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -551,7 +553,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -583,6 +585,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -628,7 +631,7 @@ func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName result, err = client.StartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") return } @@ -660,6 +663,7 @@ func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2020-11-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2020-11-01/containerinstance/CHANGELOG.md index 34c479bd4d34..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2020-11-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2020-11-01/containerinstance/CHANGELOG.md @@ -1,17 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. Capabilities.MarshalJSON() ([]byte, error) -1. CapabilitiesCapabilities.MarshalJSON() ([]byte, error) -1. ContainerGroupIdentityUserAssignedIdentitiesValue.MarshalJSON() ([]byte, error) -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerState.MarshalJSON() ([]byte, error) -1. Event.MarshalJSON() ([]byte, error) -1. InitContainerPropertiesDefinitionInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/containerinstance/mgmt/2020-11-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2020-11-01/containerinstance/_meta.json index 8756f8326ed0..4a878c5b7ee5 100644 --- a/services/containerinstance/mgmt/2020-11-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2020-11-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "92ab22b49bd085116af0c61fada2c6c360702e9e", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2020-11", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/containerinstance/mgmt/2020-11-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2020-11-01/containerinstance/containergroups.go index 2b0848c8e677..4582ef1c4177 100644 --- a/services/containerinstance/mgmt/2020-11-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2020-11-01/containerinstance/containergroups.go @@ -80,7 +80,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -114,6 +114,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -161,7 +162,7 @@ func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupNam result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") return } @@ -193,6 +194,7 @@ func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resource // http.Response Body if it receives an error. func (client ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -551,7 +553,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -583,6 +585,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -628,7 +631,7 @@ func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName result, err = client.StartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") return } @@ -660,6 +663,7 @@ func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md +++ b/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json index 08a93d9404fa..20c2e1639924 100644 --- a/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json +++ b/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "4e6cea592e12915061beb893134e1a70d7e5c495", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" } diff --git a/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go index 5d833203351f..24edd5e539a7 100644 --- a/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go +++ b/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go @@ -80,7 +80,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -114,6 +114,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -161,7 +162,7 @@ func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupNam result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") return } @@ -193,6 +194,7 @@ func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resource // http.Response Body if it receives an error. func (client ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -551,7 +553,7 @@ func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupNa result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") return } @@ -583,6 +585,7 @@ func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourc // http.Response Body if it receives an error. func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -628,7 +631,7 @@ func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName result, err = client.StartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") return } @@ -660,6 +663,7 @@ func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/CHANGELOG.md b/services/containerinstance/mgmt/2021-07-01/containerinstance/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/_meta.json b/services/containerinstance/mgmt/2021-07-01/containerinstance/_meta.json new file mode 100644 index 000000000000..d01ed2e69593 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", + "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "tag": "package-2021-07", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/client.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/client.go new file mode 100644 index 000000000000..29a75a5dd333 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/client.go @@ -0,0 +1,41 @@ +// Package containerinstance implements the Azure ARM Containerinstance service API version 2021-07-01. +// +// +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerinstance + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerinstance. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/containergroups.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/containergroups.go new file mode 100644 index 000000000000..3d98e5985ba2 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/containergroups.go @@ -0,0 +1,919 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ContainerGroupsClient is the client for the ContainerGroups methods of the Containerinstance service. +type ContainerGroupsClient struct { + BaseClient +} + +// NewContainerGroupsClient creates an instance of the ContainerGroupsClient client. +func NewContainerGroupsClient(subscriptionID string) ContainerGroupsClient { + return NewContainerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainerGroupsClientWithBaseURI creates an instance of the ContainerGroupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewContainerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ContainerGroupsClient { + return ContainerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update container groups with specified configurations. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +// containerGroup - the properties of the container group to be created or updated. +func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (result ContainerGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: containerGroup, + Constraints: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Containers", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "containerGroup.ContainerGroupProperties.IPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.IPAddress.Ports", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "containerGroup.ContainerGroupProperties.Diagnostics", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceKey", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "containerGroup.ContainerGroupProperties.DNSConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.DNSConfig.NameServers", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.VaultBaseURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerinstance.ContainerGroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerGroupName, containerGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), + autorest.WithJSON(containerGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified container group in the specified subscription and resource group. The operation does not +// delete other resources provided by the user, such as volumes. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) DeleteResponder(resp *http.Response) (result ContainerGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the properties of the specified container group in the specified subscription and resource group. The +// operation returns the properties of each container group including containers, image registry credentials, restart +// policy, IP address type, OS type, state, and volumes. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) Get(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ContainerGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) GetResponder(resp *http.Response) (result ContainerGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOutboundNetworkDependenciesEndpoints gets all the network dependencies for this container group to allow complete +// control of network setting and configuration. For container groups, this will always be an empty list. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) GetOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, containerGroupName string) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.GetOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "GetOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.GetOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "GetOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result, err = client.GetOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "GetOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + + return +} + +// GetOutboundNetworkDependenciesEndpointsPreparer prepares the GetOutboundNetworkDependenciesEndpoints request. +func (client ContainerGroupsClient) GetOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOutboundNetworkDependenciesEndpointsSender sends the GetOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) GetOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOutboundNetworkDependenciesEndpointsResponder handles the response to the GetOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) GetOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get a list of container groups in the specified subscription. This operation returns properties of each +// container group including containers, image registry credentials, restart policy, IP address type, OS type, state, +// and volumes. +func (client ContainerGroupsClient) List(ctx context.Context) (result ContainerGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") + defer func() { + sc := -1 + if result.cglr.Response.Response != nil { + sc = result.cglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure sending request") + return + } + + result.cglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.cglr.hasNextLink() && result.cglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ContainerGroupsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) ListResponder(resp *http.Response) (result ContainerGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ContainerGroupsClient) listNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { + req, err := lastResults.containerGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerGroupsClient) ListComplete(ctx context.Context) (result ContainerGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup get a list of container groups in a specified subscription and resource group. This operation +// returns properties of each container group including containers, image registry credentials, restart policy, IP +// address type, OS type, state, and volumes. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ContainerGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cglr.Response.Response != nil { + sc = result.cglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.cglr.hasNextLink() && result.cglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ContainerGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ContainerGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { + req, err := lastResults.containerGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Restart restarts all containers in a container group in place. If container image has updates, new image will be +// downloaded. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Restart") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts all containers in a container group. Compute resources will be allocated and billing will start. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops all containers in a container group. Compute resources will be deallocated and billing will stop. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +func (client ContainerGroupsClient) Stop(ctx context.Context, resourceGroupName string, containerGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Stop") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, containerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ContainerGroupsClient) StopPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates container group tags with specified values. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +// resource - the container group resource with just the tags to be updated. +func (client ContainerGroupsClient) Update(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (result ContainerGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, containerGroupName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ContainerGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + resource.ID = nil + resource.Name = nil + resource.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ContainerGroupsClient) UpdateResponder(resp *http.Response) (result ContainerGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/containerinstanceapi/interfaces.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/containerinstanceapi/interfaces.go new file mode 100644 index 000000000000..b4257281af26 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/containerinstanceapi/interfaces.go @@ -0,0 +1,59 @@ +package containerinstanceapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-07-01/containerinstance" + "github.com/Azure/go-autorest/autorest" +) + +// ContainerGroupsClientAPI contains the set of methods on the ContainerGroupsClient type. +type ContainerGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup containerinstance.ContainerGroup) (result containerinstance.ContainerGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, containerGroupName string) (result containerinstance.ContainerGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, containerGroupName string) (result containerinstance.ContainerGroup, err error) + GetOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, containerGroupName string) (result containerinstance.ListString, err error) + List(ctx context.Context) (result containerinstance.ContainerGroupListResultPage, err error) + ListComplete(ctx context.Context) (result containerinstance.ContainerGroupListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerinstance.ContainerGroupListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerinstance.ContainerGroupListResultIterator, err error) + Restart(ctx context.Context, resourceGroupName string, containerGroupName string) (result containerinstance.ContainerGroupsRestartFuture, err error) + Start(ctx context.Context, resourceGroupName string, containerGroupName string) (result containerinstance.ContainerGroupsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, containerGroupName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, containerGroupName string, resource containerinstance.Resource) (result containerinstance.ContainerGroup, err error) +} + +var _ ContainerGroupsClientAPI = (*containerinstance.ContainerGroupsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result containerinstance.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result containerinstance.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*containerinstance.OperationsClient)(nil) + +// LocationClientAPI contains the set of methods on the LocationClient type. +type LocationClientAPI interface { + ListCachedImages(ctx context.Context, location string) (result containerinstance.CachedImagesListResultPage, err error) + ListCachedImagesComplete(ctx context.Context, location string) (result containerinstance.CachedImagesListResultIterator, err error) + ListCapabilities(ctx context.Context, location string) (result containerinstance.CapabilitiesListResultPage, err error) + ListCapabilitiesComplete(ctx context.Context, location string) (result containerinstance.CapabilitiesListResultIterator, err error) + ListUsage(ctx context.Context, location string) (result containerinstance.UsageListResult, err error) +} + +var _ LocationClientAPI = (*containerinstance.LocationClient)(nil) + +// ContainersClientAPI contains the set of methods on the ContainersClient type. +type ContainersClientAPI interface { + Attach(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (result containerinstance.ContainerAttachResponse, err error) + ExecuteCommand(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest containerinstance.ContainerExecRequest) (result containerinstance.ContainerExecResponse, err error) + ListLogs(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (result containerinstance.Logs, err error) +} + +var _ ContainersClientAPI = (*containerinstance.ContainersClient)(nil) diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/containers.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/containers.go new file mode 100644 index 000000000000..d286d6eb1a19 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/containers.go @@ -0,0 +1,280 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ContainersClient is the client for the Containers methods of the Containerinstance service. +type ContainersClient struct { + BaseClient +} + +// NewContainersClient creates an instance of the ContainersClient client. +func NewContainersClient(subscriptionID string) ContainersClient { + return NewContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainersClientWithBaseURI creates an instance of the ContainersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewContainersClientWithBaseURI(baseURI string, subscriptionID string) ContainersClient { + return ContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Attach attach to the output stream of a specific container instance in a specified resource group and container +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +// containerName - the name of the container instance. +func (client ContainersClient) Attach(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (result ContainerAttachResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.Attach") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AttachPreparer(ctx, resourceGroupName, containerGroupName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", nil, "Failure preparing request") + return + } + + resp, err := client.AttachSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure sending request") + return + } + + result, err = client.AttachResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure responding to request") + return + } + + return +} + +// AttachPreparer prepares the Attach request. +func (client ContainersClient) AttachPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "containerName": autorest.Encode("path", containerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AttachSender sends the Attach request. The method will close the +// http.Response Body if it receives an error. +func (client ContainersClient) AttachSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AttachResponder handles the response to the Attach request. The method always +// closes the http.Response Body. +func (client ContainersClient) AttachResponder(resp *http.Response) (result ContainerAttachResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExecuteCommand executes a command for a specific container instance in a specified resource group and container +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +// containerName - the name of the container instance. +// containerExecRequest - the request for the exec command. +func (client ContainersClient) ExecuteCommand(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (result ContainerExecResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ExecuteCommand") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExecuteCommandPreparer(ctx, resourceGroupName, containerGroupName, containerName, containerExecRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteCommandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure sending request") + return + } + + result, err = client.ExecuteCommandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure responding to request") + return + } + + return +} + +// ExecuteCommandPreparer prepares the ExecuteCommand request. +func (client ContainersClient) ExecuteCommandPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "containerName": autorest.Encode("path", containerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec", pathParameters), + autorest.WithJSON(containerExecRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteCommandSender sends the ExecuteCommand request. The method will close the +// http.Response Body if it receives an error. +func (client ContainersClient) ExecuteCommandSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExecuteCommandResponder handles the response to the ExecuteCommand request. The method always +// closes the http.Response Body. +func (client ContainersClient) ExecuteCommandResponder(resp *http.Response) (result ContainerExecResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLogs get the logs for a specified container instance in a specified resource group and container group. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerGroupName - the name of the container group. +// containerName - the name of the container instance. +// tail - the number of lines to show from the tail of the container instance log. If not provided, all +// available logs are shown up to 4mb. +// timestamps - if true, adds a timestamp at the beginning of every line of log output. If not provided, +// defaults to false. +func (client ContainersClient) ListLogs(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (result Logs, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ListLogs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListLogsPreparer(ctx, resourceGroupName, containerGroupName, containerName, tail, timestamps) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", nil, "Failure preparing request") + return + } + + resp, err := client.ListLogsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure sending request") + return + } + + result, err = client.ListLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure responding to request") + return + } + + return +} + +// ListLogsPreparer prepares the ListLogs request. +func (client ContainersClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerGroupName": autorest.Encode("path", containerGroupName), + "containerName": autorest.Encode("path", containerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if tail != nil { + queryParameters["tail"] = autorest.Encode("query", *tail) + } + if timestamps != nil { + queryParameters["timestamps"] = autorest.Encode("query", *timestamps) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLogsSender sends the ListLogs request. The method will close the +// http.Response Body if it receives an error. +func (client ContainersClient) ListLogsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListLogsResponder handles the response to the ListLogs request. The method always +// closes the http.Response Body. +func (client ContainersClient) ListLogsResponder(resp *http.Response) (result Logs, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/enums.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/enums.go new file mode 100644 index 000000000000..db6cd07bd3d7 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/enums.go @@ -0,0 +1,180 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ContainerGroupIPAddressType enumerates the values for container group ip address type. +type ContainerGroupIPAddressType string + +const ( + // Private ... + Private ContainerGroupIPAddressType = "Private" + // Public ... + Public ContainerGroupIPAddressType = "Public" +) + +// PossibleContainerGroupIPAddressTypeValues returns an array of possible values for the ContainerGroupIPAddressType const type. +func PossibleContainerGroupIPAddressTypeValues() []ContainerGroupIPAddressType { + return []ContainerGroupIPAddressType{Private, Public} +} + +// ContainerGroupNetworkProtocol enumerates the values for container group network protocol. +type ContainerGroupNetworkProtocol string + +const ( + // TCP ... + TCP ContainerGroupNetworkProtocol = "TCP" + // UDP ... + UDP ContainerGroupNetworkProtocol = "UDP" +) + +// PossibleContainerGroupNetworkProtocolValues returns an array of possible values for the ContainerGroupNetworkProtocol const type. +func PossibleContainerGroupNetworkProtocolValues() []ContainerGroupNetworkProtocol { + return []ContainerGroupNetworkProtocol{TCP, UDP} +} + +// ContainerGroupRestartPolicy enumerates the values for container group restart policy. +type ContainerGroupRestartPolicy string + +const ( + // Always ... + Always ContainerGroupRestartPolicy = "Always" + // Never ... + Never ContainerGroupRestartPolicy = "Never" + // OnFailure ... + OnFailure ContainerGroupRestartPolicy = "OnFailure" +) + +// PossibleContainerGroupRestartPolicyValues returns an array of possible values for the ContainerGroupRestartPolicy const type. +func PossibleContainerGroupRestartPolicyValues() []ContainerGroupRestartPolicy { + return []ContainerGroupRestartPolicy{Always, Never, OnFailure} +} + +// ContainerGroupSku enumerates the values for container group sku. +type ContainerGroupSku string + +const ( + // Dedicated ... + Dedicated ContainerGroupSku = "Dedicated" + // Standard ... + Standard ContainerGroupSku = "Standard" +) + +// PossibleContainerGroupSkuValues returns an array of possible values for the ContainerGroupSku const type. +func PossibleContainerGroupSkuValues() []ContainerGroupSku { + return []ContainerGroupSku{Dedicated, Standard} +} + +// ContainerNetworkProtocol enumerates the values for container network protocol. +type ContainerNetworkProtocol string + +const ( + // ContainerNetworkProtocolTCP ... + ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" + // ContainerNetworkProtocolUDP ... + ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" +) + +// PossibleContainerNetworkProtocolValues returns an array of possible values for the ContainerNetworkProtocol const type. +func PossibleContainerNetworkProtocolValues() []ContainerNetworkProtocol { + return []ContainerNetworkProtocol{ContainerNetworkProtocolTCP, ContainerNetworkProtocolUDP} +} + +// GpuSku enumerates the values for gpu sku. +type GpuSku string + +const ( + // K80 ... + K80 GpuSku = "K80" + // P100 ... + P100 GpuSku = "P100" + // V100 ... + V100 GpuSku = "V100" +) + +// PossibleGpuSkuValues returns an array of possible values for the GpuSku const type. +func PossibleGpuSkuValues() []GpuSku { + return []GpuSku{K80, P100, V100} +} + +// LogAnalyticsLogType enumerates the values for log analytics log type. +type LogAnalyticsLogType string + +const ( + // ContainerInsights ... + ContainerInsights LogAnalyticsLogType = "ContainerInsights" + // ContainerInstanceLogs ... + ContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" +) + +// PossibleLogAnalyticsLogTypeValues returns an array of possible values for the LogAnalyticsLogType const type. +func PossibleLogAnalyticsLogTypeValues() []LogAnalyticsLogType { + return []LogAnalyticsLogType{ContainerInsights, ContainerInstanceLogs} +} + +// OperatingSystemTypes enumerates the values for operating system types. +type OperatingSystemTypes string + +const ( + // Linux ... + Linux OperatingSystemTypes = "Linux" + // Windows ... + Windows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{Linux, Windows} +} + +// OperationsOrigin enumerates the values for operations origin. +type OperationsOrigin string + +const ( + // System ... + System OperationsOrigin = "System" + // User ... + User OperationsOrigin = "User" +) + +// PossibleOperationsOriginValues returns an array of possible values for the OperationsOrigin const type. +func PossibleOperationsOriginValues() []OperationsOrigin { + return []OperationsOrigin{System, User} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // None ... + None ResourceIdentityType = "None" + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // UserAssigned ... + UserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// Scheme enumerates the values for scheme. +type Scheme string + +const ( + // HTTP ... + HTTP Scheme = "http" + // HTTPS ... + HTTPS Scheme = "https" +) + +// PossibleSchemeValues returns an array of possible values for the Scheme const type. +func PossibleSchemeValues() []Scheme { + return []Scheme{HTTP, HTTPS} +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/location.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/location.go new file mode 100644 index 000000000000..bda81a60275e --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/location.go @@ -0,0 +1,337 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LocationClient is the client for the Location methods of the Containerinstance service. +type LocationClient struct { + BaseClient +} + +// NewLocationClient creates an instance of the LocationClient client. +func NewLocationClient(subscriptionID string) LocationClient { + return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { + return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListCachedImages get the list of cached images on specific OS type for a subscription in a region. +// Parameters: +// location - the identifier for the physical azure location. +func (client LocationClient) ListCachedImages(ctx context.Context, location string) (result CachedImagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") + defer func() { + sc := -1 + if result.cilr.Response.Response != nil { + sc = result.cilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCachedImagesNextResults + req, err := client.ListCachedImagesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", nil, "Failure preparing request") + return + } + + resp, err := client.ListCachedImagesSender(req) + if err != nil { + result.cilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure sending request") + return + } + + result.cilr, err = client.ListCachedImagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure responding to request") + return + } + if result.cilr.hasNextLink() && result.cilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCachedImagesPreparer prepares the ListCachedImages request. +func (client LocationClient) ListCachedImagesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCachedImagesSender sends the ListCachedImages request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) ListCachedImagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCachedImagesResponder handles the response to the ListCachedImages request. The method always +// closes the http.Response Body. +func (client LocationClient) ListCachedImagesResponder(resp *http.Response) (result CachedImagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCachedImagesNextResults retrieves the next set of results, if any. +func (client LocationClient) listCachedImagesNextResults(ctx context.Context, lastResults CachedImagesListResult) (result CachedImagesListResult, err error) { + req, err := lastResults.cachedImagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCachedImagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCachedImagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCachedImagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationClient) ListCachedImagesComplete(ctx context.Context, location string) (result CachedImagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCachedImages(ctx, location) + return +} + +// ListCapabilities get the list of CPU/memory/GPU capabilities of a region. +// Parameters: +// location - the identifier for the physical azure location. +func (client LocationClient) ListCapabilities(ctx context.Context, location string) (result CapabilitiesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCapabilitiesNextResults + req, err := client.ListCapabilitiesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure sending request") + return + } + + result.clr, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCapabilitiesPreparer prepares the ListCapabilities request. +func (client LocationClient) ListCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCapabilitiesSender sends the ListCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always +// closes the http.Response Body. +func (client LocationClient) ListCapabilitiesResponder(resp *http.Response) (result CapabilitiesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCapabilitiesNextResults retrieves the next set of results, if any. +func (client LocationClient) listCapabilitiesNextResults(ctx context.Context, lastResults CapabilitiesListResult) (result CapabilitiesListResult, err error) { + req, err := lastResults.capabilitiesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCapabilitiesComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationClient) ListCapabilitiesComplete(ctx context.Context, location string) (result CapabilitiesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCapabilities(ctx, location) + return +} + +// ListUsage get the usage for a subscription +// Parameters: +// location - the identifier for the physical azure location. +func (client LocationClient) ListUsage(ctx context.Context, location string) (result UsageListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListUsage") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListUsagePreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure sending request") + return + } + + result, err = client.ListUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure responding to request") + return + } + + return +} + +// ListUsagePreparer prepares the ListUsage request. +func (client LocationClient) ListUsagePreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsageSender sends the ListUsage request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) ListUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsageResponder handles the response to the ListUsage request. The method always +// closes the http.Response Body. +func (client LocationClient) ListUsageResponder(resp *http.Response) (result UsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/models.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/models.go new file mode 100644 index 000000000000..d3ced3de3650 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/models.go @@ -0,0 +1,1825 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-07-01/containerinstance" + +// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. +type AzureFileVolume struct { + // ShareName - The name of the Azure File share to be mounted as a volume. + ShareName *string `json:"shareName,omitempty"` + // ReadOnly - The flag indicating whether the Azure File shared mounted as a volume is read-only. + ReadOnly *bool `json:"readOnly,omitempty"` + // StorageAccountName - The name of the storage account that contains the Azure File share. + StorageAccountName *string `json:"storageAccountName,omitempty"` + // StorageAccountKey - The storage account access key used to access the Azure File share. + StorageAccountKey *string `json:"storageAccountKey,omitempty"` +} + +// CachedImages the cached image and OS type. +type CachedImages struct { + // OsType - The OS type of the cached image. + OsType *string `json:"osType,omitempty"` + // Image - The cached image name. + Image *string `json:"image,omitempty"` +} + +// CachedImagesListResult the response containing cached images. +type CachedImagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of cached images. + Value *[]CachedImages `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of cached images. + NextLink *string `json:"nextLink,omitempty"` +} + +// CachedImagesListResultIterator provides access to a complete listing of CachedImages values. +type CachedImagesListResultIterator struct { + i int + page CachedImagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CachedImagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CachedImagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CachedImagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CachedImagesListResultIterator) Response() CachedImagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CachedImagesListResultIterator) Value() CachedImages { + if !iter.page.NotDone() { + return CachedImages{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CachedImagesListResultIterator type. +func NewCachedImagesListResultIterator(page CachedImagesListResultPage) CachedImagesListResultIterator { + return CachedImagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cilr CachedImagesListResult) IsEmpty() bool { + return cilr.Value == nil || len(*cilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cilr CachedImagesListResult) hasNextLink() bool { + return cilr.NextLink != nil && len(*cilr.NextLink) != 0 +} + +// cachedImagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cilr CachedImagesListResult) cachedImagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cilr.NextLink))) +} + +// CachedImagesListResultPage contains a page of CachedImages values. +type CachedImagesListResultPage struct { + fn func(context.Context, CachedImagesListResult) (CachedImagesListResult, error) + cilr CachedImagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CachedImagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cilr) + if err != nil { + return err + } + page.cilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CachedImagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CachedImagesListResultPage) NotDone() bool { + return !page.cilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CachedImagesListResultPage) Response() CachedImagesListResult { + return page.cilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CachedImagesListResultPage) Values() []CachedImages { + if page.cilr.IsEmpty() { + return nil + } + return *page.cilr.Value +} + +// Creates a new instance of the CachedImagesListResultPage type. +func NewCachedImagesListResultPage(cur CachedImagesListResult, getNextPage func(context.Context, CachedImagesListResult) (CachedImagesListResult, error)) CachedImagesListResultPage { + return CachedImagesListResultPage{ + fn: getNextPage, + cilr: cur, + } +} + +// Capabilities the regional capabilities. +type Capabilities struct { + // ResourceType - READ-ONLY; The resource type that this capability describes. + ResourceType *string `json:"resourceType,omitempty"` + // OsType - READ-ONLY; The OS type that this capability describes. + OsType *string `json:"osType,omitempty"` + // Location - READ-ONLY; The resource location. + Location *string `json:"location,omitempty"` + // IPAddressType - READ-ONLY; The ip address type that this capability describes. + IPAddressType *string `json:"ipAddressType,omitempty"` + // Gpu - READ-ONLY; The GPU sku that this capability describes. + Gpu *string `json:"gpu,omitempty"` + // Capabilities - READ-ONLY; The supported capabilities. + Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` +} + +// MarshalJSON is the custom marshaler for Capabilities. +func (c Capabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CapabilitiesCapabilities the supported capabilities. +type CapabilitiesCapabilities struct { + // MaxMemoryInGB - READ-ONLY; The maximum allowed memory request in GB. + MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` + // MaxCPU - READ-ONLY; The maximum allowed CPU request in cores. + MaxCPU *float64 `json:"maxCpu,omitempty"` + // MaxGpuCount - READ-ONLY; The maximum allowed GPU count. + MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapabilitiesCapabilities. +func (c CapabilitiesCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CapabilitiesListResult the response containing list of capabilities. +type CapabilitiesListResult struct { + autorest.Response `json:"-"` + // Value - The list of capabilities. + Value *[]Capabilities `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of capabilities. + NextLink *string `json:"nextLink,omitempty"` +} + +// CapabilitiesListResultIterator provides access to a complete listing of Capabilities values. +type CapabilitiesListResultIterator struct { + i int + page CapabilitiesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CapabilitiesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CapabilitiesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CapabilitiesListResultIterator) Value() Capabilities { + if !iter.page.NotDone() { + return Capabilities{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CapabilitiesListResultIterator type. +func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator { + return CapabilitiesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr CapabilitiesListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (clr CapabilitiesListResult) hasNextLink() bool { + return clr.NextLink != nil && len(*clr.NextLink) != 0 +} + +// capabilitiesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !clr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// CapabilitiesListResultPage contains a page of Capabilities values. +type CapabilitiesListResultPage struct { + fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error) + clr CapabilitiesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CapabilitiesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CapabilitiesListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CapabilitiesListResultPage) Response() CapabilitiesListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CapabilitiesListResultPage) Values() []Capabilities { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// Creates a new instance of the CapabilitiesListResultPage type. +func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage { + return CapabilitiesListResultPage{ + fn: getNextPage, + clr: cur, + } +} + +// CloudError an error response from the Container Instance service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Container Instance service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// Container a container instance. +type Container struct { + // Name - The user-provided name of the container instance. + Name *string `json:"name,omitempty"` + // ContainerProperties - The properties of the container instance. + *ContainerProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Name != nil { + objectMap["name"] = c.Name + } + if c.ContainerProperties != nil { + objectMap["properties"] = c.ContainerProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Container struct. +func (c *Container) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "properties": + if v != nil { + var containerProperties ContainerProperties + err = json.Unmarshal(*v, &containerProperties) + if err != nil { + return err + } + c.ContainerProperties = &containerProperties + } + } + } + + return nil +} + +// ContainerAttachResponse the information for the output stream from container attach. +type ContainerAttachResponse struct { + autorest.Response `json:"-"` + // WebSocketURI - The uri for the output stream from the attach. + WebSocketURI *string `json:"webSocketUri,omitempty"` + // Password - The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. + Password *string `json:"password,omitempty"` +} + +// ContainerExec the container execution command, for liveness or readiness probe +type ContainerExec struct { + // Command - The commands to execute within the container. + Command *[]string `json:"command,omitempty"` +} + +// ContainerExecRequest the container exec request. +type ContainerExecRequest struct { + // Command - The command to be executed. + Command *string `json:"command,omitempty"` + // TerminalSize - The size of the terminal. + TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` +} + +// ContainerExecRequestTerminalSize the size of the terminal. +type ContainerExecRequestTerminalSize struct { + // Rows - The row size of the terminal + Rows *int32 `json:"rows,omitempty"` + // Cols - The column size of the terminal + Cols *int32 `json:"cols,omitempty"` +} + +// ContainerExecResponse the information for the container exec command. +type ContainerExecResponse struct { + autorest.Response `json:"-"` + // WebSocketURI - The uri for the exec websocket. + WebSocketURI *string `json:"webSocketUri,omitempty"` + // Password - The password to start the exec command. + Password *string `json:"password,omitempty"` +} + +// ContainerGroup a container group. +type ContainerGroup struct { + autorest.Response `json:"-"` + // Identity - The identity of the container group, if configured. + Identity *ContainerGroupIdentity `json:"identity,omitempty"` + // ContainerGroupProperties - The container group properties + *ContainerGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ContainerGroup. +func (cg ContainerGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cg.Identity != nil { + objectMap["identity"] = cg.Identity + } + if cg.ContainerGroupProperties != nil { + objectMap["properties"] = cg.ContainerGroupProperties + } + if cg.Location != nil { + objectMap["location"] = cg.Location + } + if cg.Tags != nil { + objectMap["tags"] = cg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerGroup struct. +func (cg *ContainerGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity ContainerGroupIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + cg.Identity = &identity + } + case "properties": + if v != nil { + var containerGroupProperties ContainerGroupProperties + err = json.Unmarshal(*v, &containerGroupProperties) + if err != nil { + return err + } + cg.ContainerGroupProperties = &containerGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cg.Tags = tags + } + } + } + + return nil +} + +// ContainerGroupDiagnostics container group diagnostic information. +type ContainerGroupDiagnostics struct { + // LogAnalytics - Container group log analytics information. + LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` +} + +// ContainerGroupIdentity identity for the container group. +type ContainerGroupIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the container group identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the container group. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ContainerGroupIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ContainerGroupIdentity. +func (cgiVar ContainerGroupIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cgiVar.Type != "" { + objectMap["type"] = cgiVar.Type + } + if cgiVar.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = cgiVar.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ContainerGroupIdentityUserAssignedIdentitiesValue ... +type ContainerGroupIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerGroupIdentityUserAssignedIdentitiesValue. +func (cgiAiv ContainerGroupIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerGroupListResult the container group list response that contains the container group properties. +type ContainerGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of container groups. + Value *[]ContainerGroup `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of container groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// ContainerGroupListResultIterator provides access to a complete listing of ContainerGroup values. +type ContainerGroupListResultIterator struct { + i int + page ContainerGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ContainerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ContainerGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContainerGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ContainerGroupListResultIterator) Response() ContainerGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ContainerGroupListResultIterator) Value() ContainerGroup { + if !iter.page.NotDone() { + return ContainerGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContainerGroupListResultIterator type. +func NewContainerGroupListResultIterator(page ContainerGroupListResultPage) ContainerGroupListResultIterator { + return ContainerGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cglr ContainerGroupListResult) IsEmpty() bool { + return cglr.Value == nil || len(*cglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cglr ContainerGroupListResult) hasNextLink() bool { + return cglr.NextLink != nil && len(*cglr.NextLink) != 0 +} + +// containerGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cglr ContainerGroupListResult) containerGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cglr.NextLink))) +} + +// ContainerGroupListResultPage contains a page of ContainerGroup values. +type ContainerGroupListResultPage struct { + fn func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error) + cglr ContainerGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ContainerGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cglr) + if err != nil { + return err + } + page.cglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ContainerGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContainerGroupListResultPage) NotDone() bool { + return !page.cglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContainerGroupListResultPage) Response() ContainerGroupListResult { + return page.cglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContainerGroupListResultPage) Values() []ContainerGroup { + if page.cglr.IsEmpty() { + return nil + } + return *page.cglr.Value +} + +// Creates a new instance of the ContainerGroupListResultPage type. +func NewContainerGroupListResultPage(cur ContainerGroupListResult, getNextPage func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)) ContainerGroupListResultPage { + return ContainerGroupListResultPage{ + fn: getNextPage, + cglr: cur, + } +} + +// ContainerGroupProperties the container group properties +type ContainerGroupProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the container group. This only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Containers - The containers within the container group. + Containers *[]Container `json:"containers,omitempty"` + // ImageRegistryCredentials - The image registry credentials by which the container group is created from. + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + // RestartPolicy - Restart policy for all containers within the container group. + // - `Always` Always restart + // - `OnFailure` Restart on failure + // - `Never` Never restart + // . Possible values include: 'Always', 'OnFailure', 'Never' + RestartPolicy ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + // IPAddress - The IP address type of the container group. + IPAddress *IPAddress `json:"ipAddress,omitempty"` + // OsType - The operating system type required by the containers in the container group. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // Volumes - The list of volumes that can be mounted by containers in this container group. + Volumes *[]Volume `json:"volumes,omitempty"` + // InstanceView - READ-ONLY; The instance view of the container group. Only valid in response. + InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"` + // Diagnostics - The diagnostic information for a container group. + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + // SubnetIds - The subnet resource IDs for a container group. + SubnetIds *[]ContainerGroupSubnetID `json:"subnetIds,omitempty"` + // DNSConfig - The DNS config information for a container group. + DNSConfig *DNSConfiguration `json:"dnsConfig,omitempty"` + // Sku - The SKU for a container group. Possible values include: 'Standard', 'Dedicated' + Sku ContainerGroupSku `json:"sku,omitempty"` + // EncryptionProperties - The encryption properties for a container group. + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + // InitContainers - The init containers for a container group. + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerGroupProperties. +func (cg ContainerGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cg.Containers != nil { + objectMap["containers"] = cg.Containers + } + if cg.ImageRegistryCredentials != nil { + objectMap["imageRegistryCredentials"] = cg.ImageRegistryCredentials + } + if cg.RestartPolicy != "" { + objectMap["restartPolicy"] = cg.RestartPolicy + } + if cg.IPAddress != nil { + objectMap["ipAddress"] = cg.IPAddress + } + if cg.OsType != "" { + objectMap["osType"] = cg.OsType + } + if cg.Volumes != nil { + objectMap["volumes"] = cg.Volumes + } + if cg.Diagnostics != nil { + objectMap["diagnostics"] = cg.Diagnostics + } + if cg.SubnetIds != nil { + objectMap["subnetIds"] = cg.SubnetIds + } + if cg.DNSConfig != nil { + objectMap["dnsConfig"] = cg.DNSConfig + } + if cg.Sku != "" { + objectMap["sku"] = cg.Sku + } + if cg.EncryptionProperties != nil { + objectMap["encryptionProperties"] = cg.EncryptionProperties + } + if cg.InitContainers != nil { + objectMap["initContainers"] = cg.InitContainers + } + return json.Marshal(objectMap) +} + +// ContainerGroupPropertiesInstanceView the instance view of the container group. Only valid in response. +type ContainerGroupPropertiesInstanceView struct { + // Events - READ-ONLY; The events of this container group. + Events *[]Event `json:"events,omitempty"` + // State - READ-ONLY; The state of the container group. Only valid in response. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerGroupPropertiesInstanceView. +func (cgV ContainerGroupPropertiesInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ContainerGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerGroupsClient) (ContainerGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerGroupsCreateOrUpdateFuture.Result. +func (future *ContainerGroupsCreateOrUpdateFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { + cg, err = client.CreateOrUpdateResponder(cg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", cg.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainerGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerGroupsClient) (ContainerGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerGroupsDeleteFuture.Result. +func (future *ContainerGroupsDeleteFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { + cg, err = client.DeleteResponder(cg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", cg.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerGroupsRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainerGroupsRestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerGroupsRestartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerGroupsRestartFuture.Result. +func (future *ContainerGroupsRestartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// ContainerGroupsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainerGroupsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerGroupsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerGroupsStartFuture.Result. +func (future *ContainerGroupsStartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ContainerGroupSubnetID container group subnet information. +type ContainerGroupSubnetID struct { + // ID - Resource ID of virtual network and subnet. + ID *string `json:"id,omitempty"` + // Name - Friendly name for the subnet. + Name *string `json:"name,omitempty"` +} + +// ContainerHTTPGet the container Http Get settings, for liveness or readiness probe +type ContainerHTTPGet struct { + // Path - The path to probe. + Path *string `json:"path,omitempty"` + // Port - The port number to probe. + Port *int32 `json:"port,omitempty"` + // Scheme - The scheme. Possible values include: 'HTTP', 'HTTPS' + Scheme Scheme `json:"scheme,omitempty"` + // HTTPHeaders - The HTTP headers. + HTTPHeaders *[]HTTPHeader `json:"httpHeaders,omitempty"` +} + +// ContainerPort the port exposed on the container instance. +type ContainerPort struct { + // Protocol - The protocol associated with the port. Possible values include: 'ContainerNetworkProtocolTCP', 'ContainerNetworkProtocolUDP' + Protocol ContainerNetworkProtocol `json:"protocol,omitempty"` + // Port - The port number exposed within the container group. + Port *int32 `json:"port,omitempty"` +} + +// ContainerProbe the container probe, for liveness or readiness +type ContainerProbe struct { + // Exec - The execution command to probe + Exec *ContainerExec `json:"exec,omitempty"` + // HTTPGet - The Http Get settings to probe + HTTPGet *ContainerHTTPGet `json:"httpGet,omitempty"` + // InitialDelaySeconds - The initial delay seconds. + InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + // PeriodSeconds - The period seconds. + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + // FailureThreshold - The failure threshold. + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + // SuccessThreshold - The success threshold. + SuccessThreshold *int32 `json:"successThreshold,omitempty"` + // TimeoutSeconds - The timeout seconds. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` +} + +// ContainerProperties the container instance properties. +type ContainerProperties struct { + // Image - The name of the image used to create the container instance. + Image *string `json:"image,omitempty"` + // Command - The commands to execute within the container instance in exec form. + Command *[]string `json:"command,omitempty"` + // Ports - The exposed ports on the container instance. + Ports *[]ContainerPort `json:"ports,omitempty"` + // EnvironmentVariables - The environment variables to set in the container instance. + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + // InstanceView - READ-ONLY; The instance view of the container instance. Only valid in response. + InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` + // Resources - The resource requirements of the container instance. + Resources *ResourceRequirements `json:"resources,omitempty"` + // VolumeMounts - The volume mounts available to the container instance. + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` + // LivenessProbe - The liveness probe. + LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` + // ReadinessProbe - The readiness probe. + ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerProperties. +func (cp ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Image != nil { + objectMap["image"] = cp.Image + } + if cp.Command != nil { + objectMap["command"] = cp.Command + } + if cp.Ports != nil { + objectMap["ports"] = cp.Ports + } + if cp.EnvironmentVariables != nil { + objectMap["environmentVariables"] = cp.EnvironmentVariables + } + if cp.Resources != nil { + objectMap["resources"] = cp.Resources + } + if cp.VolumeMounts != nil { + objectMap["volumeMounts"] = cp.VolumeMounts + } + if cp.LivenessProbe != nil { + objectMap["livenessProbe"] = cp.LivenessProbe + } + if cp.ReadinessProbe != nil { + objectMap["readinessProbe"] = cp.ReadinessProbe + } + return json.Marshal(objectMap) +} + +// ContainerPropertiesInstanceView the instance view of the container instance. Only valid in response. +type ContainerPropertiesInstanceView struct { + // RestartCount - READ-ONLY; The number of times that the container instance has been restarted. + RestartCount *int32 `json:"restartCount,omitempty"` + // CurrentState - READ-ONLY; Current container instance state. + CurrentState *ContainerState `json:"currentState,omitempty"` + // PreviousState - READ-ONLY; Previous container instance state. + PreviousState *ContainerState `json:"previousState,omitempty"` + // Events - READ-ONLY; The events of the container instance. + Events *[]Event `json:"events,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerPropertiesInstanceView. +func (cpV ContainerPropertiesInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerState the container instance state. +type ContainerState struct { + // State - READ-ONLY; The state of the container instance. + State *string `json:"state,omitempty"` + // StartTime - READ-ONLY; The date-time when the container instance state started. + StartTime *date.Time `json:"startTime,omitempty"` + // ExitCode - READ-ONLY; The container instance exit codes correspond to those from the `docker run` command. + ExitCode *int32 `json:"exitCode,omitempty"` + // FinishTime - READ-ONLY; The date-time when the container instance state finished. + FinishTime *date.Time `json:"finishTime,omitempty"` + // DetailStatus - READ-ONLY; The human-readable status of the container instance state. + DetailStatus *string `json:"detailStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerState. +func (cs ContainerState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DNSConfiguration DNS configuration for the container group. +type DNSConfiguration struct { + // NameServers - The DNS servers for the container group. + NameServers *[]string `json:"nameServers,omitempty"` + // SearchDomains - The DNS search domains for hostname lookup in the container group. + SearchDomains *string `json:"searchDomains,omitempty"` + // Options - The DNS options for the container group. + Options *string `json:"options,omitempty"` +} + +// EncryptionProperties the container group encryption properties. +type EncryptionProperties struct { + // VaultBaseURL - The keyvault base url. + VaultBaseURL *string `json:"vaultBaseUrl,omitempty"` + // KeyName - The encryption key name. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The encryption key version. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// EnvironmentVariable the environment variable to set within the container instance. +type EnvironmentVariable struct { + // Name - The name of the environment variable. + Name *string `json:"name,omitempty"` + // Value - The value of the environment variable. + Value *string `json:"value,omitempty"` + // SecureValue - The value of the secure environment variable. + SecureValue *string `json:"secureValue,omitempty"` +} + +// Event a container group or container instance event. +type Event struct { + // Count - READ-ONLY; The count of the event. + Count *int32 `json:"count,omitempty"` + // FirstTimestamp - READ-ONLY; The date-time of the earliest logged event. + FirstTimestamp *date.Time `json:"firstTimestamp,omitempty"` + // LastTimestamp - READ-ONLY; The date-time of the latest logged event. + LastTimestamp *date.Time `json:"lastTimestamp,omitempty"` + // Name - READ-ONLY; The event name. + Name *string `json:"name,omitempty"` + // Message - READ-ONLY; The event message. + Message *string `json:"message,omitempty"` + // Type - READ-ONLY; The event type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Event. +func (e Event) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GitRepoVolume represents a volume that is populated with the contents of a git repository +type GitRepoVolume struct { + // Directory - Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. + Directory *string `json:"directory,omitempty"` + // Repository - Repository URL + Repository *string `json:"repository,omitempty"` + // Revision - Commit hash for the specified revision. + Revision *string `json:"revision,omitempty"` +} + +// GpuResource the GPU resource. +type GpuResource struct { + // Count - The count of the GPU resource. + Count *int32 `json:"count,omitempty"` + // Sku - The SKU of the GPU resource. Possible values include: 'K80', 'P100', 'V100' + Sku GpuSku `json:"sku,omitempty"` +} + +// HTTPHeader the HTTP header. +type HTTPHeader struct { + // Name - The header name. + Name *string `json:"name,omitempty"` + // Value - The header value. + Value *string `json:"value,omitempty"` +} + +// ImageRegistryCredential image registry credential. +type ImageRegistryCredential struct { + // Server - The Docker image registry server without a protocol such as "http" and "https". + Server *string `json:"server,omitempty"` + // Username - The username for the private registry. + Username *string `json:"username,omitempty"` + // Password - The password for the private registry. + Password *string `json:"password,omitempty"` + // Identity - The identity for the private registry. + Identity *string `json:"identity,omitempty"` + // IdentityURL - The identity URL for the private registry. + IdentityURL *string `json:"identityUrl,omitempty"` +} + +// InitContainerDefinition the init container definition. +type InitContainerDefinition struct { + // Name - The name for the init container. + Name *string `json:"name,omitempty"` + // InitContainerPropertiesDefinition - The properties for the init container. + *InitContainerPropertiesDefinition `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for InitContainerDefinition. +func (icd InitContainerDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icd.Name != nil { + objectMap["name"] = icd.Name + } + if icd.InitContainerPropertiesDefinition != nil { + objectMap["properties"] = icd.InitContainerPropertiesDefinition + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InitContainerDefinition struct. +func (icd *InitContainerDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + icd.Name = &name + } + case "properties": + if v != nil { + var initContainerPropertiesDefinition InitContainerPropertiesDefinition + err = json.Unmarshal(*v, &initContainerPropertiesDefinition) + if err != nil { + return err + } + icd.InitContainerPropertiesDefinition = &initContainerPropertiesDefinition + } + } + } + + return nil +} + +// InitContainerPropertiesDefinition the init container definition properties. +type InitContainerPropertiesDefinition struct { + // Image - The image of the init container. + Image *string `json:"image,omitempty"` + // Command - The command to execute within the init container in exec form. + Command *[]string `json:"command,omitempty"` + // EnvironmentVariables - The environment variables to set in the init container. + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + // InstanceView - READ-ONLY; The instance view of the init container. Only valid in response. + InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` + // VolumeMounts - The volume mounts available to the init container. + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} + +// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinition. +func (icpd InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icpd.Image != nil { + objectMap["image"] = icpd.Image + } + if icpd.Command != nil { + objectMap["command"] = icpd.Command + } + if icpd.EnvironmentVariables != nil { + objectMap["environmentVariables"] = icpd.EnvironmentVariables + } + if icpd.VolumeMounts != nil { + objectMap["volumeMounts"] = icpd.VolumeMounts + } + return json.Marshal(objectMap) +} + +// InitContainerPropertiesDefinitionInstanceView the instance view of the init container. Only valid in +// response. +type InitContainerPropertiesDefinitionInstanceView struct { + // RestartCount - READ-ONLY; The number of times that the init container has been restarted. + RestartCount *int32 `json:"restartCount,omitempty"` + // CurrentState - READ-ONLY; The current state of the init container. + CurrentState *ContainerState `json:"currentState,omitempty"` + // PreviousState - READ-ONLY; The previous state of the init container. + PreviousState *ContainerState `json:"previousState,omitempty"` + // Events - READ-ONLY; The events of the init container. + Events *[]Event `json:"events,omitempty"` +} + +// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinitionInstanceView. +func (icpdV InitContainerPropertiesDefinitionInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IPAddress IP address for the container group. +type IPAddress struct { + // Ports - The list of ports exposed on the container group. + Ports *[]Port `json:"ports,omitempty"` + // Type - Specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'Public', 'Private' + Type ContainerGroupIPAddressType `json:"type,omitempty"` + // IP - The IP exposed to the public internet. + IP *string `json:"ip,omitempty"` + // DNSNameLabel - The Dns name label for the IP. + DNSNameLabel *string `json:"dnsNameLabel,omitempty"` + // Fqdn - READ-ONLY; The FQDN for the IP. + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPAddress. +func (ia IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.Ports != nil { + objectMap["ports"] = ia.Ports + } + if ia.Type != "" { + objectMap["type"] = ia.Type + } + if ia.IP != nil { + objectMap["ip"] = ia.IP + } + if ia.DNSNameLabel != nil { + objectMap["dnsNameLabel"] = ia.DNSNameLabel + } + return json.Marshal(objectMap) +} + +// ListString ... +type ListString struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// LogAnalytics container group log analytics information. +type LogAnalytics struct { + // WorkspaceID - The workspace id for log analytics + WorkspaceID *string `json:"workspaceId,omitempty"` + // WorkspaceKey - The workspace key for log analytics + WorkspaceKey *string `json:"workspaceKey,omitempty"` + // LogType - The log type to be used. Possible values include: 'ContainerInsights', 'ContainerInstanceLogs' + LogType LogAnalyticsLogType `json:"logType,omitempty"` + // Metadata - Metadata for log analytics. + Metadata map[string]*string `json:"metadata"` + // WorkspaceResourceID - The workspace resource id for log analytics + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogAnalytics. +func (la LogAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if la.WorkspaceID != nil { + objectMap["workspaceId"] = la.WorkspaceID + } + if la.WorkspaceKey != nil { + objectMap["workspaceKey"] = la.WorkspaceKey + } + if la.LogType != "" { + objectMap["logType"] = la.LogType + } + if la.Metadata != nil { + objectMap["metadata"] = la.Metadata + } + if la.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = la.WorkspaceResourceID + } + return json.Marshal(objectMap) +} + +// Logs the logs. +type Logs struct { + autorest.Response `json:"-"` + // Content - The content of the log. + Content *string `json:"content,omitempty"` +} + +// Operation an operation for Azure Container Instance service. +type Operation struct { + // Name - The name of the operation. + Name *string `json:"name,omitempty"` + // Display - The display information of the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Properties - The additional properties. + Properties interface{} `json:"properties,omitempty"` + // Origin - The intended executor of the operation. Possible values include: 'User', 'System' + Origin OperationsOrigin `json:"origin,omitempty"` +} + +// OperationDisplay the display information of the operation. +type OperationDisplay struct { + // Provider - The name of the provider of the operation. + Provider *string `json:"provider,omitempty"` + // Resource - The name of the resource type of the operation. + Resource *string `json:"resource,omitempty"` + // Operation - The friendly name of the operation. + Operation *string `json:"operation,omitempty"` + // Description - The description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult the operation list response that contains all operations for Azure Container +// Instance service. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - The list of operations. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Port the port exposed on the container group. +type Port struct { + // Protocol - The protocol associated with the port. Possible values include: 'TCP', 'UDP' + Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"` + // Port - The port number. + Port *int32 `json:"port,omitempty"` +} + +// Resource the Resource model definition. +type Resource struct { + // ID - READ-ONLY; The resource id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceLimits the resource limits. +type ResourceLimits struct { + // MemoryInGB - The memory limit in GB of this container instance. + MemoryInGB *float64 `json:"memoryInGB,omitempty"` + // CPU - The CPU limit of this container instance. + CPU *float64 `json:"cpu,omitempty"` + // Gpu - The GPU limit of this container instance. + Gpu *GpuResource `json:"gpu,omitempty"` +} + +// ResourceRequests the resource requests. +type ResourceRequests struct { + // MemoryInGB - The memory request in GB of this container instance. + MemoryInGB *float64 `json:"memoryInGB,omitempty"` + // CPU - The CPU request of this container instance. + CPU *float64 `json:"cpu,omitempty"` + // Gpu - The GPU request of this container instance. + Gpu *GpuResource `json:"gpu,omitempty"` +} + +// ResourceRequirements the resource requirements. +type ResourceRequirements struct { + // Requests - The resource requests of this container instance. + Requests *ResourceRequests `json:"requests,omitempty"` + // Limits - The resource limits of this container instance. + Limits *ResourceLimits `json:"limits,omitempty"` +} + +// Usage a single usage result +type Usage struct { + // Unit - READ-ONLY; Unit of the usage result + Unit *string `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; The current usage of the resource + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; The maximum permitted usage of the resource. + Limit *int32 `json:"limit,omitempty"` + // Name - READ-ONLY; The name object of the resource + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UsageListResult the response containing the usage data +type UsageListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The usage data. + Value *[]Usage `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageListResult. +func (ulr UsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UsageName the name object of the resource +type UsageName struct { + // Value - READ-ONLY; The name of the resource + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; The localized name of the resource + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Volume the properties of the volume. +type Volume struct { + // Name - The name of the volume. + Name *string `json:"name,omitempty"` + // AzureFile - The Azure File volume. + AzureFile *AzureFileVolume `json:"azureFile,omitempty"` + // EmptyDir - The empty directory volume. + EmptyDir interface{} `json:"emptyDir,omitempty"` + // Secret - The secret volume. + Secret map[string]*string `json:"secret"` + // GitRepo - The git repo volume. + GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` +} + +// MarshalJSON is the custom marshaler for Volume. +func (vVar Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Name != nil { + objectMap["name"] = vVar.Name + } + if vVar.AzureFile != nil { + objectMap["azureFile"] = vVar.AzureFile + } + if vVar.EmptyDir != nil { + objectMap["emptyDir"] = vVar.EmptyDir + } + if vVar.Secret != nil { + objectMap["secret"] = vVar.Secret + } + if vVar.GitRepo != nil { + objectMap["gitRepo"] = vVar.GitRepo + } + return json.Marshal(objectMap) +} + +// VolumeMount the properties of the volume mount. +type VolumeMount struct { + // Name - The name of the volume mount. + Name *string `json:"name,omitempty"` + // MountPath - The path within the container where the volume should be mounted. Must not contain colon (:). + MountPath *string `json:"mountPath,omitempty"` + // ReadOnly - The flag indicating whether the volume mount is read-only. + ReadOnly *bool `json:"readOnly,omitempty"` +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/operations.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/operations.go new file mode 100644 index 000000000000..6e8e39354fb7 --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/operations.go @@ -0,0 +1,140 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the Containerinstance service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list the operations for Azure Container Instance service. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerInstance/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/containerinstance/mgmt/2021-07-01/containerinstance/version.go b/services/containerinstance/mgmt/2021-07-01/containerinstance/version.go new file mode 100644 index 000000000000..f4ac06aa7e5b --- /dev/null +++ b/services/containerinstance/mgmt/2021-07-01/containerinstance/version.go @@ -0,0 +1,19 @@ +package containerinstance + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " containerinstance/2021-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/iothub/mgmt/2016-02-03/devices/CHANGELOG.md b/services/iothub/mgmt/2016-02-03/devices/CHANGELOG.md index ef3e28ff55b3..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2016-02-03/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2016-02-03/devices/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2016-02-03/devices/_meta.json b/services/iothub/mgmt/2016-02-03/devices/_meta.json index d87435822221..34a4efd9920a 100644 --- a/services/iothub/mgmt/2016-02-03/devices/_meta.json +++ b/services/iothub/mgmt/2016-02-03/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2016-02", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2016-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2016-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2016-02-03/devices/iothubresource.go b/services/iothub/mgmt/2016-02-03/devices/iothubresource.go index a4fb76ae0ec2..b72906605f32 100644 --- a/services/iothub/mgmt/2016-02-03/devices/iothubresource.go +++ b/services/iothub/mgmt/2016-02-03/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub to create or update. @@ -242,7 +243,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -276,6 +277,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -322,7 +324,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -354,6 +356,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -371,7 +374,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return diff --git a/services/iothub/mgmt/2017-01-19/devices/CHANGELOG.md b/services/iothub/mgmt/2017-01-19/devices/CHANGELOG.md index ef3e28ff55b3..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2017-01-19/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2017-01-19/devices/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2017-01-19/devices/_meta.json b/services/iothub/mgmt/2017-01-19/devices/_meta.json index 60e1ca735be3..6838713e0f83 100644 --- a/services/iothub/mgmt/2017-01-19/devices/_meta.json +++ b/services/iothub/mgmt/2017-01-19/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2017-01", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2017-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2017-01-19/devices/iothubresource.go b/services/iothub/mgmt/2017-01-19/devices/iothubresource.go index f0d64387f476..9224ae0d117f 100644 --- a/services/iothub/mgmt/2017-01-19/devices/iothubresource.go +++ b/services/iothub/mgmt/2017-01-19/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub to create or update. @@ -252,7 +253,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -286,6 +287,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -332,7 +334,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -364,6 +366,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -381,7 +384,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return diff --git a/services/iothub/mgmt/2017-07-01/devices/CHANGELOG.md b/services/iothub/mgmt/2017-07-01/devices/CHANGELOG.md index 17a82c7c5246..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2017-07-01/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2017-07-01/devices/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificateProperties.MarshalJSON() ([]byte, error) -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2017-07-01/devices/_meta.json b/services/iothub/mgmt/2017-07-01/devices/_meta.json index ce76bce8ab10..068b5bd91050 100644 --- a/services/iothub/mgmt/2017-07-01/devices/_meta.json +++ b/services/iothub/mgmt/2017-07-01/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2017-07", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2017-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2017-07-01/devices/iothubresource.go b/services/iothub/mgmt/2017-07-01/devices/iothubresource.go index 865cf7260844..1e0e21647dc7 100644 --- a/services/iothub/mgmt/2017-07-01/devices/iothubresource.go +++ b/services/iothub/mgmt/2017-07-01/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -254,7 +255,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -292,6 +293,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -338,7 +340,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -370,6 +372,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -387,7 +390,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return diff --git a/services/iothub/mgmt/2018-01-22/devices/CHANGELOG.md b/services/iothub/mgmt/2018-01-22/devices/CHANGELOG.md index 17a82c7c5246..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2018-01-22/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2018-01-22/devices/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificateProperties.MarshalJSON() ([]byte, error) -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2018-01-22/devices/_meta.json b/services/iothub/mgmt/2018-01-22/devices/_meta.json index 2efdfcb1f792..8ea0ac76ce6f 100644 --- a/services/iothub/mgmt/2018-01-22/devices/_meta.json +++ b/services/iothub/mgmt/2018-01-22/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2018-01", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2018-01-22/devices/iothubresource.go b/services/iothub/mgmt/2018-01-22/devices/iothubresource.go index 2f569866adff..9496fee6d85e 100644 --- a/services/iothub/mgmt/2018-01-22/devices/iothubresource.go +++ b/services/iothub/mgmt/2018-01-22/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -1883,7 +1886,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -1917,6 +1920,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/iothub/mgmt/2018-04-01/devices/CHANGELOG.md b/services/iothub/mgmt/2018-04-01/devices/CHANGELOG.md index 1ef15e7e7f4e..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2018-04-01/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2018-04-01/devices/CHANGELOG.md @@ -1,14 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2018-04-01/devices/_meta.json b/services/iothub/mgmt/2018-04-01/devices/_meta.json index 308fc190f7b1..aee4dc3dd186 100644 --- a/services/iothub/mgmt/2018-04-01/devices/_meta.json +++ b/services/iothub/mgmt/2018-04-01/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2018-04", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2018-04-01/devices/iothubresource.go b/services/iothub/mgmt/2018-04-01/devices/iothubresource.go index 2248609384b0..2eaa0ba67939 100644 --- a/services/iothub/mgmt/2018-04-01/devices/iothubresource.go +++ b/services/iothub/mgmt/2018-04-01/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2170,7 +2173,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2204,6 +2207,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/iothub/mgmt/2020-03-01/devices/CHANGELOG.md b/services/iothub/mgmt/2020-03-01/devices/CHANGELOG.md index 354b026d5d2d..a1ecf841edb0 100644 --- a/services/iothub/mgmt/2020-03-01/devices/CHANGELOG.md +++ b/services/iothub/mgmt/2020-03-01/devices/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/iothub/mgmt/2020-03-01/devices/_meta.json b/services/iothub/mgmt/2020-03-01/devices/_meta.json index 79bca89e87f0..d29e137a6919 100644 --- a/services/iothub/mgmt/2020-03-01/devices/_meta.json +++ b/services/iothub/mgmt/2020-03-01/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2020-03", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/iothub/mgmt/2020-03-01/devices/iothub.go b/services/iothub/mgmt/2020-03-01/devices/iothub.go index 204da5fbf579..c1313db626b8 100644 --- a/services/iothub/mgmt/2020-03-01/devices/iothub.go +++ b/services/iothub/mgmt/2020-03-01/devices/iothub.go @@ -63,7 +63,7 @@ func (client IotHubClient) ManualFailover(ctx context.Context, iotHubName string result, err = client.ManualFailoverSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", result.Response(), "Failure sending request") return } @@ -97,6 +97,7 @@ func (client IotHubClient) ManualFailoverPreparer(ctx context.Context, iotHubNam // http.Response Body if it receives an error. func (client IotHubClient) ManualFailoverSender(req *http.Request) (future IotHubManualFailoverFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/iothub/mgmt/2020-03-01/devices/iothubresource.go b/services/iothub/mgmt/2020-03-01/devices/iothubresource.go index 5e86f16de46d..de8724fe75b6 100644 --- a/services/iothub/mgmt/2020-03-01/devices/iothubresource.go +++ b/services/iothub/mgmt/2020-03-01/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2170,7 +2173,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2204,6 +2207,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/iothub/mgmt/2020-03-01/devices/privateendpointconnections.go b/services/iothub/mgmt/2020-03-01/devices/privateendpointconnections.go index 28ffb17a7724..555ab7f61c65 100644 --- a/services/iothub/mgmt/2020-03-01/devices/privateendpointconnections.go +++ b/services/iothub/mgmt/2020-03-01/devices/privateendpointconnections.go @@ -56,7 +56,7 @@ func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resou result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") return } @@ -89,6 +89,7 @@ func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Contex // http.Response Body if it receives an error. func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -300,7 +301,7 @@ func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resou result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") return } @@ -338,6 +339,7 @@ func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Contex // http.Response Body if it receives an error. func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/iothub/mgmt/2021-03-31/devices/CHANGELOG.md b/services/iothub/mgmt/2021-03-31/devices/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/iothub/mgmt/2021-03-31/devices/_meta.json b/services/iothub/mgmt/2021-03-31/devices/_meta.json new file mode 100644 index 000000000000..4b6fa21e4938 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", + "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "tag": "package-2021-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/iothub/mgmt/2021-03-31/devices/certificates.go b/services/iothub/mgmt/2021-03-31/devices/certificates.go new file mode 100644 index 000000000000..1039996016e6 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/certificates.go @@ -0,0 +1,551 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificatesClient is the use this API to manage the IoT hubs in your Azure subscription. +type CertificatesClient struct { + BaseClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the CertificatesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate adds new or replaces existing certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// certificateName - the name of the certificate +// certificateDescription - the certificate body. +// ifMatch - eTag of the Certificate. Do not specify for creating a brand new certificate. Required to update +// an existing certificate. +func (client CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateDescription CertificateDescription, ifMatch string) (result CertificateDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.CertificatesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateDescription CertificateDescription, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + certificateDescription.ID = nil + certificateDescription.Name = nil + certificateDescription.Etag = nil + certificateDescription.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificateDescription), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing X509 certificate or does nothing if it does not exist. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// certificateName - the name of the certificate +// ifMatch - eTag of the Certificate. +func (client CertificatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.CertificatesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, certificateName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateVerificationCode generates verification code for proof of possession flow. The verification code will be +// used to generate a leaf certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// certificateName - the name of the certificate +// ifMatch - eTag of the Certificate. +func (client CertificatesClient) GenerateVerificationCode(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (result CertificateWithNonceDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.GenerateVerificationCode") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.CertificatesClient", "GenerateVerificationCode", err.Error()) + } + + req, err := client.GenerateVerificationCodePreparer(ctx, resourceGroupName, resourceName, certificateName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "GenerateVerificationCode", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateVerificationCodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "GenerateVerificationCode", resp, "Failure sending request") + return + } + + result, err = client.GenerateVerificationCodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "GenerateVerificationCode", resp, "Failure responding to request") + return + } + + return +} + +// GenerateVerificationCodePreparer prepares the GenerateVerificationCode request. +func (client CertificatesClient) GenerateVerificationCodePreparer(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateVerificationCodeSender sends the GenerateVerificationCode request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GenerateVerificationCodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateVerificationCodeResponder handles the response to the GenerateVerificationCode request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GenerateVerificationCodeResponder(resp *http.Response) (result CertificateWithNonceDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get returns the certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// certificateName - the name of the certificate +func (client CertificatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, certificateName string) (result CertificateDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.CertificatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result CertificateDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIotHub returns the list of certificates. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client CertificatesClient) ListByIotHub(ctx context.Context, resourceGroupName string, resourceName string) (result CertificateListDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.ListByIotHub") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByIotHubPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "ListByIotHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIotHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "ListByIotHub", resp, "Failure sending request") + return + } + + result, err = client.ListByIotHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "ListByIotHub", resp, "Failure responding to request") + return + } + + return +} + +// ListByIotHubPreparer prepares the ListByIotHub request. +func (client CertificatesClient) ListByIotHubPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByIotHubSender sends the ListByIotHub request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByIotHubSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByIotHubResponder handles the response to the ListByIotHub request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByIotHubResponder(resp *http.Response) (result CertificateListDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Verify verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre +// uploaded certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// certificateName - the name of the certificate +// certificateVerificationBody - the name of the certificate +// ifMatch - eTag of the Certificate. +func (client CertificatesClient) Verify(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateVerificationBody CertificateVerificationDescription, ifMatch string) (result CertificateDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Verify") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.CertificatesClient", "Verify", err.Error()) + } + + req, err := client.VerifyPreparer(ctx, resourceGroupName, resourceName, certificateName, certificateVerificationBody, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Verify", nil, "Failure preparing request") + return + } + + resp, err := client.VerifySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Verify", resp, "Failure sending request") + return + } + + result, err = client.VerifyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.CertificatesClient", "Verify", resp, "Failure responding to request") + return + } + + return +} + +// VerifyPreparer prepares the Verify request. +func (client CertificatesClient) VerifyPreparer(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateVerificationBody CertificateVerificationDescription, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify", pathParameters), + autorest.WithJSON(certificateVerificationBody), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VerifySender sends the Verify request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) VerifySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VerifyResponder handles the response to the Verify request. The method always +// closes the http.Response Body. +func (client CertificatesClient) VerifyResponder(resp *http.Response) (result CertificateDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/client.go b/services/iothub/mgmt/2021-03-31/devices/client.go new file mode 100644 index 000000000000..019001aa1cb4 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/client.go @@ -0,0 +1,41 @@ +// Package devices implements the Azure ARM Devices service API version 2021-03-31. +// +// Use this API to manage the IoT hubs in your Azure subscription. +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Devices + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Devices. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/iothub/mgmt/2021-03-31/devices/devicesapi/interfaces.go b/services/iothub/mgmt/2021-03-31/devices/devicesapi/interfaces.go new file mode 100644 index 000000000000..96636a4c34ba --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/devicesapi/interfaces.go @@ -0,0 +1,102 @@ +package devicesapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result devices.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result devices.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*devices.OperationsClient)(nil) + +// IotHubResourceClientAPI contains the set of methods on the IotHubResourceClient type. +type IotHubResourceClientAPI interface { + CheckNameAvailability(ctx context.Context, operationInputs devices.OperationInputs) (result devices.IotHubNameAvailabilityInfo, err error) + CreateEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, consumerGroupBody devices.EventHubConsumerGroupBodyDescription) (result devices.EventHubConsumerGroupInfo, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription devices.IotHubDescription, ifMatch string) (result devices.IotHubResourceCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubResourceDeleteFuture, err error) + DeleteEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result autorest.Response, err error) + ExportDevices(ctx context.Context, resourceGroupName string, resourceName string, exportDevicesParameters devices.ExportDevicesRequest) (result devices.JobResponse, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubDescription, err error) + GetEndpointHealth(ctx context.Context, resourceGroupName string, iotHubName string) (result devices.EndpointHealthDataListResultPage, err error) + GetEndpointHealthComplete(ctx context.Context, resourceGroupName string, iotHubName string) (result devices.EndpointHealthDataListResultIterator, err error) + GetEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result devices.EventHubConsumerGroupInfo, err error) + GetJob(ctx context.Context, resourceGroupName string, resourceName string, jobID string) (result devices.JobResponse, err error) + GetKeysForKeyName(ctx context.Context, resourceGroupName string, resourceName string, keyName string) (result devices.SharedAccessSignatureAuthorizationRule, err error) + GetQuotaMetrics(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubQuotaMetricInfoListResultPage, err error) + GetQuotaMetricsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubQuotaMetricInfoListResultIterator, err error) + GetStats(ctx context.Context, resourceGroupName string, resourceName string) (result devices.RegistryStatistics, err error) + GetValidSkus(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubSkuDescriptionListResultPage, err error) + GetValidSkusComplete(ctx context.Context, resourceGroupName string, resourceName string) (result devices.IotHubSkuDescriptionListResultIterator, err error) + ImportDevices(ctx context.Context, resourceGroupName string, resourceName string, importDevicesParameters devices.ImportDevicesRequest) (result devices.JobResponse, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result devices.IotHubDescriptionListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result devices.IotHubDescriptionListResultIterator, err error) + ListBySubscription(ctx context.Context) (result devices.IotHubDescriptionListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result devices.IotHubDescriptionListResultIterator, err error) + ListEventHubConsumerGroups(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string) (result devices.EventHubConsumerGroupsListResultPage, err error) + ListEventHubConsumerGroupsComplete(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string) (result devices.EventHubConsumerGroupsListResultIterator, err error) + ListJobs(ctx context.Context, resourceGroupName string, resourceName string) (result devices.JobResponseListResultPage, err error) + ListJobsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result devices.JobResponseListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result devices.SharedAccessSignatureAuthorizationRuleListResultPage, err error) + ListKeysComplete(ctx context.Context, resourceGroupName string, resourceName string) (result devices.SharedAccessSignatureAuthorizationRuleListResultIterator, err error) + TestAllRoutes(ctx context.Context, input devices.TestAllRoutesInput, iotHubName string, resourceGroupName string) (result devices.TestAllRoutesResult, err error) + TestRoute(ctx context.Context, input devices.TestRouteInput, iotHubName string, resourceGroupName string) (result devices.TestRouteResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags devices.TagsResource) (result devices.IotHubResourceUpdateFuture, err error) +} + +var _ IotHubResourceClientAPI = (*devices.IotHubResourceClient)(nil) + +// ResourceProviderCommonClientAPI contains the set of methods on the ResourceProviderCommonClient type. +type ResourceProviderCommonClientAPI interface { + GetSubscriptionQuota(ctx context.Context) (result devices.UserSubscriptionQuotaListResult, err error) +} + +var _ ResourceProviderCommonClientAPI = (*devices.ResourceProviderCommonClient)(nil) + +// CertificatesClientAPI contains the set of methods on the CertificatesClient type. +type CertificatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateDescription devices.CertificateDescription, ifMatch string) (result devices.CertificateDescription, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (result autorest.Response, err error) + GenerateVerificationCode(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string) (result devices.CertificateWithNonceDescription, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, certificateName string) (result devices.CertificateDescription, err error) + ListByIotHub(ctx context.Context, resourceGroupName string, resourceName string) (result devices.CertificateListDescription, err error) + Verify(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateVerificationBody devices.CertificateVerificationDescription, ifMatch string) (result devices.CertificateDescription, err error) +} + +var _ CertificatesClientAPI = (*devices.CertificatesClient)(nil) + +// IotHubClientAPI contains the set of methods on the IotHubClient type. +type IotHubClientAPI interface { + ManualFailover(ctx context.Context, iotHubName string, failoverInput devices.FailoverInput, resourceGroupName string) (result devices.IotHubManualFailoverFuture, err error) +} + +var _ IotHubClientAPI = (*devices.IotHubClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, groupID string) (result devices.GroupIDInformation, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result devices.PrivateLinkResources, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*devices.PrivateLinkResourcesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result devices.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result devices.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result devices.ListPrivateEndpointConnection, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection devices.PrivateEndpointConnection) (result devices.PrivateEndpointConnectionsUpdateFuture, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*devices.PrivateEndpointConnectionsClient)(nil) diff --git a/services/iothub/mgmt/2021-03-31/devices/enums.go b/services/iothub/mgmt/2021-03-31/devices/enums.go new file mode 100644 index 000000000000..0a5a24eae251 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/enums.go @@ -0,0 +1,410 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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} +} + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // IdentityBased ... + IdentityBased AuthenticationType = "identityBased" + // KeyBased ... + KeyBased AuthenticationType = "keyBased" +) + +// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{IdentityBased, KeyBased} +} + +// 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} +} + +// DefaultAction enumerates the values for default action. +type DefaultAction string + +const ( + // Allow ... + Allow DefaultAction = "Allow" + // Deny ... + Deny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{Allow, Deny} +} + +// Encoding enumerates the values for encoding. +type Encoding string + +const ( + // Avro ... + Avro Encoding = "Avro" + // AvroDeflate ... + AvroDeflate Encoding = "AvroDeflate" + // JSON ... + JSON Encoding = "JSON" +) + +// PossibleEncodingValues returns an array of possible values for the Encoding const type. +func PossibleEncodingValues() []Encoding { + return []Encoding{Avro, AvroDeflate, JSON} +} + +// EndpointHealthStatus enumerates the values for endpoint health status. +type EndpointHealthStatus string + +const ( + // Dead ... + Dead EndpointHealthStatus = "dead" + // Degraded ... + Degraded EndpointHealthStatus = "degraded" + // Healthy ... + Healthy EndpointHealthStatus = "healthy" + // Unhealthy ... + Unhealthy EndpointHealthStatus = "unhealthy" + // Unknown ... + Unknown EndpointHealthStatus = "unknown" +) + +// PossibleEndpointHealthStatusValues returns an array of possible values for the EndpointHealthStatus const type. +func PossibleEndpointHealthStatusValues() []EndpointHealthStatus { + return []EndpointHealthStatus{Dead, Degraded, Healthy, Unhealthy, Unknown} +} + +// 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} +} + +// IotHubReplicaRoleType enumerates the values for iot hub replica role type. +type IotHubReplicaRoleType string + +const ( + // Primary ... + Primary IotHubReplicaRoleType = "primary" + // Secondary ... + Secondary IotHubReplicaRoleType = "secondary" +) + +// PossibleIotHubReplicaRoleTypeValues returns an array of possible values for the IotHubReplicaRoleType const type. +func PossibleIotHubReplicaRoleTypeValues() []IotHubReplicaRoleType { + return []IotHubReplicaRoleType{Primary, Secondary} +} + +// 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 ( + // B1 ... + B1 IotHubSku = "B1" + // B2 ... + B2 IotHubSku = "B2" + // B3 ... + B3 IotHubSku = "B3" + // 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{B1, B2, B3, F1, S1, S2, S3} +} + +// IotHubSkuTier enumerates the values for iot hub sku tier. +type IotHubSkuTier string + +const ( + // Basic ... + Basic IotHubSkuTier = "Basic" + // 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{Basic, 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 ( + // JobStatusCancelled ... + JobStatusCancelled JobStatus = "cancelled" + // JobStatusCompleted ... + JobStatusCompleted JobStatus = "completed" + // JobStatusEnqueued ... + JobStatusEnqueued JobStatus = "enqueued" + // JobStatusFailed ... + JobStatusFailed JobStatus = "failed" + // JobStatusRunning ... + JobStatusRunning JobStatus = "running" + // JobStatusUnknown ... + JobStatusUnknown JobStatus = "unknown" +) + +// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{JobStatusCancelled, JobStatusCompleted, JobStatusEnqueued, JobStatusFailed, JobStatusRunning, JobStatusUnknown} +} + +// 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} +} + +// NetworkRuleIPAction enumerates the values for network rule ip action. +type NetworkRuleIPAction string + +const ( + // NetworkRuleIPActionAllow ... + NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" +) + +// PossibleNetworkRuleIPActionValues returns an array of possible values for the NetworkRuleIPAction const type. +func PossibleNetworkRuleIPActionValues() []NetworkRuleIPAction { + return []NetworkRuleIPAction{NetworkRuleIPActionAllow} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // Approved ... + Approved PrivateLinkServiceConnectionStatus = "Approved" + // Disconnected ... + Disconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // Pending ... + Pending PrivateLinkServiceConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{Approved, Disconnected, Pending, Rejected} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // Disabled ... + Disabled PublicNetworkAccess = "Disabled" + // Enabled ... + Enabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{Disabled, Enabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// RouteErrorSeverity enumerates the values for route error severity. +type RouteErrorSeverity string + +const ( + // Error ... + Error RouteErrorSeverity = "error" + // Warning ... + Warning RouteErrorSeverity = "warning" +) + +// PossibleRouteErrorSeverityValues returns an array of possible values for the RouteErrorSeverity const type. +func PossibleRouteErrorSeverityValues() []RouteErrorSeverity { + return []RouteErrorSeverity{Error, Warning} +} + +// RoutingSource enumerates the values for routing source. +type RoutingSource string + +const ( + // RoutingSourceDeviceConnectionStateEvents ... + RoutingSourceDeviceConnectionStateEvents RoutingSource = "DeviceConnectionStateEvents" + // RoutingSourceDeviceJobLifecycleEvents ... + RoutingSourceDeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" + // RoutingSourceDeviceLifecycleEvents ... + RoutingSourceDeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" + // RoutingSourceDeviceMessages ... + RoutingSourceDeviceMessages RoutingSource = "DeviceMessages" + // RoutingSourceInvalid ... + RoutingSourceInvalid RoutingSource = "Invalid" + // RoutingSourceTwinChangeEvents ... + RoutingSourceTwinChangeEvents RoutingSource = "TwinChangeEvents" +) + +// PossibleRoutingSourceValues returns an array of possible values for the RoutingSource const type. +func PossibleRoutingSourceValues() []RoutingSource { + return []RoutingSource{RoutingSourceDeviceConnectionStateEvents, RoutingSourceDeviceJobLifecycleEvents, RoutingSourceDeviceLifecycleEvents, RoutingSourceDeviceMessages, RoutingSourceInvalid, RoutingSourceTwinChangeEvents} +} + +// TestResultStatus enumerates the values for test result status. +type TestResultStatus string + +const ( + // False ... + False TestResultStatus = "false" + // True ... + True TestResultStatus = "true" + // Undefined ... + Undefined TestResultStatus = "undefined" +) + +// PossibleTestResultStatusValues returns an array of possible values for the TestResultStatus const type. +func PossibleTestResultStatusValues() []TestResultStatus { + return []TestResultStatus{False, True, Undefined} +} diff --git a/services/iothub/mgmt/2021-03-31/devices/iothub.go b/services/iothub/mgmt/2021-03-31/devices/iothub.go new file mode 100644 index 000000000000..d50e6eca339b --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/iothub.go @@ -0,0 +1,121 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IotHubClient is the use this API to manage the IoT hubs in your Azure subscription. +type IotHubClient struct { + BaseClient +} + +// NewIotHubClient creates an instance of the IotHubClient client. +func NewIotHubClient(subscriptionID string) IotHubClient { + return NewIotHubClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIotHubClientWithBaseURI creates an instance of the IotHubClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIotHubClientWithBaseURI(baseURI string, subscriptionID string) IotHubClient { + return IotHubClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ManualFailover manually initiate a failover for the IoT Hub to its secondary region. To learn more, see +// https://aka.ms/manualfailover +// Parameters: +// iotHubName - name of the IoT hub to failover +// failoverInput - region to failover to. Must be the Azure paired region. Get the value from the secondary +// location in the locations property. To learn more, see https://aka.ms/manualfailover/region +// resourceGroupName - name of the resource group containing the IoT hub resource +func (client IotHubClient) ManualFailover(ctx context.Context, iotHubName string, failoverInput FailoverInput, resourceGroupName string) (result IotHubManualFailoverFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubClient.ManualFailover") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: failoverInput, + Constraints: []validation.Constraint{{Target: "failoverInput.FailoverRegion", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.IotHubClient", "ManualFailover", err.Error()) + } + + req, err := client.ManualFailoverPreparer(ctx, iotHubName, failoverInput, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", nil, "Failure preparing request") + return + } + + result, err = client.ManualFailoverSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", result.Response(), "Failure sending request") + return + } + + return +} + +// ManualFailoverPreparer prepares the ManualFailover request. +func (client IotHubClient) ManualFailoverPreparer(ctx context.Context, iotHubName string, failoverInput FailoverInput, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotHubName": autorest.Encode("path", iotHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover", pathParameters), + autorest.WithJSON(failoverInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ManualFailoverSender sends the ManualFailover request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubClient) ManualFailoverSender(req *http.Request) (future IotHubManualFailoverFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ManualFailoverResponder handles the response to the ManualFailover request. The method always +// closes the http.Response Body. +func (client IotHubClient) ManualFailoverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/iothubresource.go b/services/iothub/mgmt/2021-03-31/devices/iothubresource.go new file mode 100644 index 000000000000..0ddf0a58a8b8 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/iothubresource.go @@ -0,0 +1,2246 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IotHubResourceClient is the use this API to manage the IoT hubs in your Azure subscription. +type IotHubResourceClient struct { + BaseClient +} + +// NewIotHubResourceClient creates an instance of the IotHubResourceClient client. +func NewIotHubResourceClient(subscriptionID string) IotHubResourceClient { + return NewIotHubResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIotHubResourceClientWithBaseURI creates an instance of the IotHubResourceClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIotHubResourceClientWithBaseURI(baseURI string, subscriptionID string) IotHubResourceClient { + return IotHubResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability check if an IoT hub name is available. +// Parameters: +// operationInputs - set the name parameter in the OperationInputs structure to the name of the IoT hub to +// check. +func (client IotHubResourceClient) CheckNameAvailability(ctx context.Context, operationInputs OperationInputs) (result IotHubNameAvailabilityInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: operationInputs, + Constraints: []validation.Constraint{{Target: "operationInputs.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, operationInputs) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client IotHubResourceClient) CheckNameAvailabilityPreparer(ctx context.Context, operationInputs OperationInputs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability", pathParameters), + autorest.WithJSON(operationInputs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result IotHubNameAvailabilityInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateEventHubConsumerGroup add a consumer group to an Event Hub-compatible endpoint in an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// eventHubEndpointName - the name of the Event Hub-compatible endpoint in the IoT hub. +// name - the name of the consumer group to add. +// consumerGroupBody - the consumer group to add. +func (client IotHubResourceClient) CreateEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, consumerGroupBody EventHubConsumerGroupBodyDescription) (result EventHubConsumerGroupInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.CreateEventHubConsumerGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: consumerGroupBody, + Constraints: []validation.Constraint{{Target: "consumerGroupBody.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "consumerGroupBody.Properties.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "CreateEventHubConsumerGroup", err.Error()) + } + + req, err := client.CreateEventHubConsumerGroupPreparer(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.CreateEventHubConsumerGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.CreateEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateEventHubConsumerGroup", resp, "Failure responding to request") + return + } + + return +} + +// CreateEventHubConsumerGroupPreparer prepares the CreateEventHubConsumerGroup request. +func (client IotHubResourceClient) CreateEventHubConsumerGroupPreparer(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, consumerGroupBody EventHubConsumerGroupBodyDescription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithJSON(consumerGroupBody), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateEventHubConsumerGroupSender sends the CreateEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) CreateEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateEventHubConsumerGroupResponder handles the response to the CreateEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve +// the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// iotHubDescription - the IoT hub metadata and security metadata. +// ifMatch - eTag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an +// existing IoT Hub. +func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription IotHubDescription, ifMatch string) (result IotHubResourceCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: iotHubDescription, + Constraints: []validation.Constraint{{Target: "iotHubDescription.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.NetworkRuleSets", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.NetworkRuleSets.ApplyToBuiltInEventHubEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotHubDescription.Properties.NetworkRuleSets.IPRules", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "iotHubDescription.Properties.Routing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.Routing.FallbackRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.Routing.FallbackRoute.Source", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotHubDescription.Properties.Routing.FallbackRoute.EndpointNames", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.Routing.FallbackRoute.EndpointNames", Name: validation.MaxItems, Rule: 1, Chain: nil}, + {Target: "iotHubDescription.Properties.Routing.FallbackRoute.EndpointNames", Name: validation.MinItems, Rule: 1, Chain: nil}, + }}, + {Target: "iotHubDescription.Properties.Routing.FallbackRoute.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "iotHubDescription.Properties.CloudToDevice", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "iotHubDescription.Properties.CloudToDevice.Feedback", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "iotHubDescription.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, iotHubDescription, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription IotHubDescription, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithJSON(iotHubDescription), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) CreateOrUpdateResponder(resp *http.Response) (result IotHubDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubResourceDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteEventHubConsumerGroup delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// eventHubEndpointName - the name of the Event Hub-compatible endpoint in the IoT hub. +// name - the name of the consumer group to delete. +func (client IotHubResourceClient) DeleteEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.DeleteEventHubConsumerGroup") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteEventHubConsumerGroupPreparer(ctx, resourceGroupName, resourceName, eventHubEndpointName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "DeleteEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteEventHubConsumerGroupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.DeleteEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure responding to request") + return + } + + return +} + +// DeleteEventHubConsumerGroupPreparer prepares the DeleteEventHubConsumerGroup request. +func (client IotHubResourceClient) DeleteEventHubConsumerGroupPreparer(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteEventHubConsumerGroupSender sends the DeleteEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) DeleteEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteEventHubConsumerGroupResponder handles the response to the DeleteEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) DeleteEventHubConsumerGroupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportDevices exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. +// For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// exportDevicesParameters - the parameters that specify the export devices operation. +func (client IotHubResourceClient) ExportDevices(ctx context.Context, resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (result JobResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ExportDevices") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: exportDevicesParameters, + Constraints: []validation.Constraint{{Target: "exportDevicesParameters.ExportBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "exportDevicesParameters.ExcludeKeys", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "ExportDevices", err.Error()) + } + + req, err := client.ExportDevicesPreparer(ctx, resourceGroupName, resourceName, exportDevicesParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ExportDevices", nil, "Failure preparing request") + return + } + + resp, err := client.ExportDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ExportDevices", resp, "Failure sending request") + return + } + + result, err = client.ExportDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ExportDevices", resp, "Failure responding to request") + return + } + + return +} + +// ExportDevicesPreparer prepares the ExportDevices request. +func (client IotHubResourceClient) ExportDevicesPreparer(ctx context.Context, resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices", pathParameters), + autorest.WithJSON(exportDevicesParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportDevicesSender sends the ExportDevices request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ExportDevicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExportDevicesResponder handles the response to the ExportDevices request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ExportDevicesResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the non-security related metadata of an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubDescription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IotHubResourceClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetResponder(resp *http.Response) (result IotHubDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEndpointHealth get the health for routing endpoints. +func (client IotHubResourceClient) GetEndpointHealth(ctx context.Context, resourceGroupName string, iotHubName string) (result EndpointHealthDataListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetEndpointHealth") + defer func() { + sc := -1 + if result.ehdlr.Response.Response != nil { + sc = result.ehdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getEndpointHealthNextResults + req, err := client.GetEndpointHealthPreparer(ctx, resourceGroupName, iotHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEndpointHealth", nil, "Failure preparing request") + return + } + + resp, err := client.GetEndpointHealthSender(req) + if err != nil { + result.ehdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEndpointHealth", resp, "Failure sending request") + return + } + + result.ehdlr, err = client.GetEndpointHealthResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEndpointHealth", resp, "Failure responding to request") + return + } + if result.ehdlr.hasNextLink() && result.ehdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetEndpointHealthPreparer prepares the GetEndpointHealth request. +func (client IotHubResourceClient) GetEndpointHealthPreparer(ctx context.Context, resourceGroupName string, iotHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotHubName": autorest.Encode("path", iotHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEndpointHealthSender sends the GetEndpointHealth request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetEndpointHealthSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetEndpointHealthResponder handles the response to the GetEndpointHealth request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetEndpointHealthResponder(resp *http.Response) (result EndpointHealthDataListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getEndpointHealthNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) getEndpointHealthNextResults(ctx context.Context, lastResults EndpointHealthDataListResult) (result EndpointHealthDataListResult, err error) { + req, err := lastResults.endpointHealthDataListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getEndpointHealthNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetEndpointHealthSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getEndpointHealthNextResults", resp, "Failure sending next results request") + } + result, err = client.GetEndpointHealthResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getEndpointHealthNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetEndpointHealthComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) GetEndpointHealthComplete(ctx context.Context, resourceGroupName string, iotHubName string) (result EndpointHealthDataListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetEndpointHealth") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetEndpointHealth(ctx, resourceGroupName, iotHubName) + return +} + +// GetEventHubConsumerGroup get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// eventHubEndpointName - the name of the Event Hub-compatible endpoint in the IoT hub. +// name - the name of the consumer group to retrieve. +func (client IotHubResourceClient) GetEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result EventHubConsumerGroupInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetEventHubConsumerGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEventHubConsumerGroupPreparer(ctx, resourceGroupName, resourceName, eventHubEndpointName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.GetEventHubConsumerGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.GetEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetEventHubConsumerGroup", resp, "Failure responding to request") + return + } + + return +} + +// GetEventHubConsumerGroupPreparer prepares the GetEventHubConsumerGroup request. +func (client IotHubResourceClient) GetEventHubConsumerGroupPreparer(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEventHubConsumerGroupSender sends the GetEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetEventHubConsumerGroupResponder handles the response to the GetEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetJob get the details of a job from an IoT hub. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// jobID - the job identifier. +func (client IotHubResourceClient) GetJob(ctx context.Context, resourceGroupName string, resourceName string, jobID string) (result JobResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetJob") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetJobPreparer(ctx, resourceGroupName, resourceName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetJob", nil, "Failure preparing request") + return + } + + resp, err := client.GetJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetJob", resp, "Failure sending request") + return + } + + result, err = client.GetJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetJob", resp, "Failure responding to request") + return + } + + return +} + +// GetJobPreparer prepares the GetJob request. +func (client IotHubResourceClient) GetJobPreparer(ctx context.Context, resourceGroupName string, resourceName string, jobID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetJobSender sends the GetJob request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetJobResponder handles the response to the GetJob request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetJobResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeysForKeyName get a shared access policy by name from an IoT hub. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// keyName - the name of the shared access policy. +func (client IotHubResourceClient) GetKeysForKeyName(ctx context.Context, resourceGroupName string, resourceName string, keyName string) (result SharedAccessSignatureAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetKeysForKeyName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetKeysForKeyNamePreparer(ctx, resourceGroupName, resourceName, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetKeysForKeyName", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysForKeyNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetKeysForKeyName", resp, "Failure sending request") + return + } + + result, err = client.GetKeysForKeyNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetKeysForKeyName", resp, "Failure responding to request") + return + } + + return +} + +// GetKeysForKeyNamePreparer prepares the GetKeysForKeyName request. +func (client IotHubResourceClient) GetKeysForKeyNamePreparer(ctx context.Context, resourceGroupName string, resourceName string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeysForKeyNameSender sends the GetKeysForKeyName request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetKeysForKeyNameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetKeysForKeyNameResponder handles the response to the GetKeysForKeyName request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetKeysForKeyNameResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQuotaMetrics get the quota metrics for an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) GetQuotaMetrics(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubQuotaMetricInfoListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetQuotaMetrics") + defer func() { + sc := -1 + if result.ihqmilr.Response.Response != nil { + sc = result.ihqmilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getQuotaMetricsNextResults + req, err := client.GetQuotaMetricsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetQuotaMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetQuotaMetricsSender(req) + if err != nil { + result.ihqmilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetQuotaMetrics", resp, "Failure sending request") + return + } + + result.ihqmilr, err = client.GetQuotaMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetQuotaMetrics", resp, "Failure responding to request") + return + } + if result.ihqmilr.hasNextLink() && result.ihqmilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetQuotaMetricsPreparer prepares the GetQuotaMetrics request. +func (client IotHubResourceClient) GetQuotaMetricsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetQuotaMetricsSender sends the GetQuotaMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetQuotaMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetQuotaMetricsResponder handles the response to the GetQuotaMetrics request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetQuotaMetricsResponder(resp *http.Response) (result IotHubQuotaMetricInfoListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getQuotaMetricsNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) getQuotaMetricsNextResults(ctx context.Context, lastResults IotHubQuotaMetricInfoListResult) (result IotHubQuotaMetricInfoListResult, err error) { + req, err := lastResults.iotHubQuotaMetricInfoListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getQuotaMetricsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetQuotaMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getQuotaMetricsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetQuotaMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getQuotaMetricsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetQuotaMetricsComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) GetQuotaMetricsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubQuotaMetricInfoListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetQuotaMetrics") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetQuotaMetrics(ctx, resourceGroupName, resourceName) + return +} + +// GetStats get the statistics from an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) GetStats(ctx context.Context, resourceGroupName string, resourceName string) (result RegistryStatistics, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetStats") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetStatsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetStats", resp, "Failure sending request") + return + } + + result, err = client.GetStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetStats", resp, "Failure responding to request") + return + } + + return +} + +// GetStatsPreparer prepares the GetStats request. +func (client IotHubResourceClient) GetStatsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStatsSender sends the GetStats request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetStatsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStatsResponder handles the response to the GetStats request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetStatsResponder(resp *http.Response) (result RegistryStatistics, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetValidSkus get the list of valid SKUs for an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) GetValidSkus(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubSkuDescriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetValidSkus") + defer func() { + sc := -1 + if result.ihsdlr.Response.Response != nil { + sc = result.ihsdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getValidSkusNextResults + req, err := client.GetValidSkusPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetValidSkus", nil, "Failure preparing request") + return + } + + resp, err := client.GetValidSkusSender(req) + if err != nil { + result.ihsdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetValidSkus", resp, "Failure sending request") + return + } + + result.ihsdlr, err = client.GetValidSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "GetValidSkus", resp, "Failure responding to request") + return + } + if result.ihsdlr.hasNextLink() && result.ihsdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetValidSkusPreparer prepares the GetValidSkus request. +func (client IotHubResourceClient) GetValidSkusPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetValidSkusSender sends the GetValidSkus request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) GetValidSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetValidSkusResponder handles the response to the GetValidSkus request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) GetValidSkusResponder(resp *http.Response) (result IotHubSkuDescriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getValidSkusNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) getValidSkusNextResults(ctx context.Context, lastResults IotHubSkuDescriptionListResult) (result IotHubSkuDescriptionListResult, err error) { + req, err := lastResults.iotHubSkuDescriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getValidSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetValidSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getValidSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.GetValidSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "getValidSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetValidSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) GetValidSkusComplete(ctx context.Context, resourceGroupName string, resourceName string) (result IotHubSkuDescriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.GetValidSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetValidSkus(ctx, resourceGroupName, resourceName) + return +} + +// ImportDevices import, update, or delete device identities in the IoT hub identity registry from a blob. For more +// information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// importDevicesParameters - the parameters that specify the import devices operation. +func (client IotHubResourceClient) ImportDevices(ctx context.Context, resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (result JobResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ImportDevices") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: importDevicesParameters, + Constraints: []validation.Constraint{{Target: "importDevicesParameters.InputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "importDevicesParameters.OutputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "ImportDevices", err.Error()) + } + + req, err := client.ImportDevicesPreparer(ctx, resourceGroupName, resourceName, importDevicesParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ImportDevices", nil, "Failure preparing request") + return + } + + resp, err := client.ImportDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ImportDevices", resp, "Failure sending request") + return + } + + result, err = client.ImportDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ImportDevices", resp, "Failure responding to request") + return + } + + return +} + +// ImportDevicesPreparer prepares the ImportDevices request. +func (client IotHubResourceClient) ImportDevicesPreparer(ctx context.Context, resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices", pathParameters), + autorest.WithJSON(importDevicesParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportDevicesSender sends the ImportDevices request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ImportDevicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ImportDevicesResponder handles the response to the ImportDevices request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ImportDevicesResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all the IoT hubs in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +func (client IotHubResourceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result IotHubDescriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ihdlr.Response.Response != nil { + sc = result.ihdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ihdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ihdlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ihdlr.hasNextLink() && result.ihdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IotHubResourceClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ListByResourceGroupResponder(resp *http.Response) (result IotHubDescriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) listByResourceGroupNextResults(ctx context.Context, lastResults IotHubDescriptionListResult) (result IotHubDescriptionListResult, err error) { + req, err := lastResults.iotHubDescriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result IotHubDescriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription get all the IoT hubs in a subscription. +func (client IotHubResourceClient) ListBySubscription(ctx context.Context) (result IotHubDescriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListBySubscription") + defer func() { + sc := -1 + if result.ihdlr.Response.Response != nil { + sc = result.ihdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.ihdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.ihdlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.ihdlr.hasNextLink() && result.ihdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client IotHubResourceClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ListBySubscriptionResponder(resp *http.Response) (result IotHubDescriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) listBySubscriptionNextResults(ctx context.Context, lastResults IotHubDescriptionListResult) (result IotHubDescriptionListResult, err error) { + req, err := lastResults.iotHubDescriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) ListBySubscriptionComplete(ctx context.Context) (result IotHubDescriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListEventHubConsumerGroups get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in +// an IoT hub. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// eventHubEndpointName - the name of the Event Hub-compatible endpoint. +func (client IotHubResourceClient) ListEventHubConsumerGroups(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string) (result EventHubConsumerGroupsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListEventHubConsumerGroups") + defer func() { + sc := -1 + if result.ehcglr.Response.Response != nil { + sc = result.ehcglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listEventHubConsumerGroupsNextResults + req, err := client.ListEventHubConsumerGroupsPreparer(ctx, resourceGroupName, resourceName, eventHubEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListEventHubConsumerGroups", nil, "Failure preparing request") + return + } + + resp, err := client.ListEventHubConsumerGroupsSender(req) + if err != nil { + result.ehcglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListEventHubConsumerGroups", resp, "Failure sending request") + return + } + + result.ehcglr, err = client.ListEventHubConsumerGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to request") + return + } + if result.ehcglr.hasNextLink() && result.ehcglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListEventHubConsumerGroupsPreparer prepares the ListEventHubConsumerGroups request. +func (client IotHubResourceClient) ListEventHubConsumerGroupsPreparer(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEventHubConsumerGroupsSender sends the ListEventHubConsumerGroups request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ListEventHubConsumerGroupsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListEventHubConsumerGroupsResponder handles the response to the ListEventHubConsumerGroups request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ListEventHubConsumerGroupsResponder(resp *http.Response) (result EventHubConsumerGroupsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listEventHubConsumerGroupsNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) listEventHubConsumerGroupsNextResults(ctx context.Context, lastResults EventHubConsumerGroupsListResult) (result EventHubConsumerGroupsListResult, err error) { + req, err := lastResults.eventHubConsumerGroupsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listEventHubConsumerGroupsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListEventHubConsumerGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listEventHubConsumerGroupsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListEventHubConsumerGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listEventHubConsumerGroupsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListEventHubConsumerGroupsComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) ListEventHubConsumerGroupsComplete(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string) (result EventHubConsumerGroupsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListEventHubConsumerGroups") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListEventHubConsumerGroups(ctx, resourceGroupName, resourceName, eventHubEndpointName) + return +} + +// ListJobs get a list of all the jobs in an IoT hub. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) ListJobs(ctx context.Context, resourceGroupName string, resourceName string) (result JobResponseListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListJobs") + defer func() { + sc := -1 + if result.jrlr.Response.Response != nil { + sc = result.jrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listJobsNextResults + req, err := client.ListJobsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListJobsSender(req) + if err != nil { + result.jrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListJobs", resp, "Failure sending request") + return + } + + result.jrlr, err = client.ListJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListJobs", resp, "Failure responding to request") + return + } + if result.jrlr.hasNextLink() && result.jrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListJobsPreparer prepares the ListJobs request. +func (client IotHubResourceClient) ListJobsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListJobsSender sends the ListJobs request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ListJobsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListJobsResponder handles the response to the ListJobs request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ListJobsResponder(resp *http.Response) (result JobResponseListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listJobsNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) listJobsNextResults(ctx context.Context, lastResults JobResponseListResult) (result JobResponseListResult, err error) { + req, err := lastResults.jobResponseListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listJobsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listJobsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listJobsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListJobsComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) ListJobsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result JobResponseListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListJobs") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListJobs(ctx, resourceGroupName, resourceName) + return +} + +// ListKeys get the security metadata for an IoT hub. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client IotHubResourceClient) ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result SharedAccessSignatureAuthorizationRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListKeys") + defer func() { + sc := -1 + if result.sasarlr.Response.Response != nil { + sc = result.sasarlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listKeysNextResults + req, err := client.ListKeysPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.sasarlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListKeys", resp, "Failure sending request") + return + } + + result.sasarlr, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "ListKeys", resp, "Failure responding to request") + return + } + if result.sasarlr.hasNextLink() && result.sasarlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client IotHubResourceClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) ListKeysResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listKeysNextResults retrieves the next set of results, if any. +func (client IotHubResourceClient) listKeysNextResults(ctx context.Context, lastResults SharedAccessSignatureAuthorizationRuleListResult) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { + req, err := lastResults.sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listKeysNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listKeysNextResults", resp, "Failure sending next results request") + } + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "listKeysNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListKeysComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotHubResourceClient) ListKeysComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SharedAccessSignatureAuthorizationRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.ListKeys") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListKeys(ctx, resourceGroupName, resourceName) + return +} + +// TestAllRoutes test all routes configured in this Iot Hub +// Parameters: +// input - input for testing all routes +// iotHubName - iotHub to be tested +// resourceGroupName - resource group which Iot Hub belongs to +func (client IotHubResourceClient) TestAllRoutes(ctx context.Context, input TestAllRoutesInput, iotHubName string, resourceGroupName string) (result TestAllRoutesResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.TestAllRoutes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TestAllRoutesPreparer(ctx, input, iotHubName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestAllRoutes", nil, "Failure preparing request") + return + } + + resp, err := client.TestAllRoutesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestAllRoutes", resp, "Failure sending request") + return + } + + result, err = client.TestAllRoutesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestAllRoutes", resp, "Failure responding to request") + return + } + + return +} + +// TestAllRoutesPreparer prepares the TestAllRoutes request. +func (client IotHubResourceClient) TestAllRoutesPreparer(ctx context.Context, input TestAllRoutesInput, iotHubName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotHubName": autorest.Encode("path", iotHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TestAllRoutesSender sends the TestAllRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) TestAllRoutesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// TestAllRoutesResponder handles the response to the TestAllRoutes request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) TestAllRoutesResponder(resp *http.Response) (result TestAllRoutesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TestRoute test the new route for this Iot Hub +// Parameters: +// input - route that needs to be tested +// iotHubName - iotHub to be tested +// resourceGroupName - resource group which Iot Hub belongs to +func (client IotHubResourceClient) TestRoute(ctx context.Context, input TestRouteInput, iotHubName string, resourceGroupName string) (result TestRouteResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.TestRoute") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Route", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "input.Route.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "input.Route.Name", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]{1,64}$`, Chain: nil}}}, + {Target: "input.Route.EndpointNames", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "input.Route.EndpointNames", Name: validation.MaxItems, Rule: 1, Chain: nil}, + {Target: "input.Route.EndpointNames", Name: validation.MinItems, Rule: 1, Chain: nil}, + }}, + {Target: "input.Route.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("devices.IotHubResourceClient", "TestRoute", err.Error()) + } + + req, err := client.TestRoutePreparer(ctx, input, iotHubName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestRoute", nil, "Failure preparing request") + return + } + + resp, err := client.TestRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestRoute", resp, "Failure sending request") + return + } + + result, err = client.TestRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "TestRoute", resp, "Failure responding to request") + return + } + + return +} + +// TestRoutePreparer prepares the TestRoute request. +func (client IotHubResourceClient) TestRoutePreparer(ctx context.Context, input TestRouteInput, iotHubName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotHubName": autorest.Encode("path", iotHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TestRouteSender sends the TestRoute request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) TestRouteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// TestRouteResponder handles the response to the TestRoute request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) TestRouteResponder(resp *http.Response) (result TestRouteResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method +// Parameters: +// resourceGroupName - resource group identifier. +// resourceName - name of iot hub to update. +// iotHubTags - updated tag information to set into the iot hub instance. +func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource) (result IotHubResourceUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubResourceClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, iotHubTags) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithJSON(iotHubTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client IotHubResourceClient) UpdateResponder(resp *http.Response) (result IotHubDescription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/models.go b/services/iothub/mgmt/2021-03-31/devices/models.go new file mode 100644 index 000000000000..102a717a5199 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/models.go @@ -0,0 +1,2791 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices" + +// ArmIdentity ... +type ArmIdentity struct { + // PrincipalID - READ-ONLY; Principal Id + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; Tenant Id + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + UserAssignedIdentities map[string]*ArmUserIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ArmIdentity. +func (ai ArmIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ai.Type != "" { + objectMap["type"] = ai.Type + } + if ai.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ai.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ArmUserIdentity ... +type ArmUserIdentity struct { + // PrincipalID - READ-ONLY + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArmUserIdentity. +func (aui ArmUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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. + Certificate *string `json:"certificate,omitempty"` +} + +// CertificateDescription the X509 Certificate. +type CertificateDescription struct { + autorest.Response `json:"-"` + Properties *CertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the certificate. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; The entity tag. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + 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:"-"` + // Value - The array of Certificate objects. + Value *[]CertificateDescription `json:"value,omitempty"` +} + +// CertificateProperties the description of an X509 CA Certificate. +type CertificateProperties struct { + // Subject - READ-ONLY; The certificate's subject name. + Subject *string `json:"subject,omitempty"` + // Expiry - READ-ONLY; The certificate's expiration date and time. + Expiry *date.TimeRFC1123 `json:"expiry,omitempty"` + // Thumbprint - READ-ONLY; The certificate's thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // IsVerified - READ-ONLY; Determines whether certificate has been verified. + IsVerified *bool `json:"isVerified,omitempty"` + // Created - READ-ONLY; The certificate's create date and time. + Created *date.TimeRFC1123 `json:"created,omitempty"` + // Updated - READ-ONLY; The certificate's last update date and time. + Updated *date.TimeRFC1123 `json:"updated,omitempty"` + // Certificate - The certificate content + Certificate *string `json:"certificate,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Certificate != nil { + objectMap["certificate"] = cp.Certificate + } + return json.Marshal(objectMap) +} + +// CertificatePropertiesWithNonce the description of an X509 CA Certificate including the challenge nonce +// issued for the Proof-Of-Possession flow. +type CertificatePropertiesWithNonce struct { + // Subject - READ-ONLY; The certificate's subject name. + Subject *string `json:"subject,omitempty"` + // Expiry - READ-ONLY; The certificate's expiration date and time. + Expiry *date.TimeRFC1123 `json:"expiry,omitempty"` + // Thumbprint - READ-ONLY; The certificate's thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // IsVerified - READ-ONLY; Determines whether certificate has been verified. + IsVerified *bool `json:"isVerified,omitempty"` + // Created - READ-ONLY; The certificate's create date and time. + Created *date.TimeRFC1123 `json:"created,omitempty"` + // Updated - READ-ONLY; The certificate's last update date and time. + Updated *date.TimeRFC1123 `json:"updated,omitempty"` + // VerificationCode - READ-ONLY; The certificate's verification code that will be used for proof of possession. + VerificationCode *string `json:"verificationCode,omitempty"` + // Certificate - READ-ONLY; The certificate content + Certificate *string `json:"certificate,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificatePropertiesWithNonce. +func (cpwn CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CertificateVerificationDescription the JSON-serialized leaf certificate +type CertificateVerificationDescription struct { + // Certificate - base-64 representation of X509 certificate .cer file or just .pem file content. + Certificate *string `json:"certificate,omitempty"` +} + +// CertificateWithNonceDescription the X509 Certificate. +type CertificateWithNonceDescription struct { + autorest.Response `json:"-"` + Properties *CertificatePropertiesWithNonce `json:"properties,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the certificate. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; The entity tag. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + 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. + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + // 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. + DefaultTTLAsIso8601 *string `json:"defaultTtlAsIso8601,omitempty"` + Feedback *FeedbackProperties `json:"feedback,omitempty"` +} + +// EndpointHealthData the health data for an endpoint +type EndpointHealthData struct { + // EndpointID - Id of the endpoint + EndpointID *string `json:"endpointId,omitempty"` + // HealthStatus - Health statuses have following meanings. The 'healthy' status shows that the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually consistent state of health. The 'dead' status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Unhealthy', 'Dead' + HealthStatus EndpointHealthStatus `json:"healthStatus,omitempty"` + // LastKnownError - Last error obtained when a message failed to be delivered to iot hub + LastKnownError *string `json:"lastKnownError,omitempty"` + // LastKnownErrorTime - Time at which the last known error occurred + LastKnownErrorTime *date.TimeRFC1123 `json:"lastKnownErrorTime,omitempty"` + // LastSuccessfulSendAttemptTime - Last time iot hub successfully sent a message to the endpoint + LastSuccessfulSendAttemptTime *date.TimeRFC1123 `json:"lastSuccessfulSendAttemptTime,omitempty"` + // LastSendAttemptTime - Last time iot hub tried to send a message to the endpoint + LastSendAttemptTime *date.TimeRFC1123 `json:"lastSendAttemptTime,omitempty"` +} + +// EndpointHealthDataListResult the JSON-serialized array of EndpointHealthData objects with a next link. +type EndpointHealthDataListResult struct { + autorest.Response `json:"-"` + // Value - JSON-serialized array of Endpoint health data + Value *[]EndpointHealthData `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to more results + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointHealthDataListResult. +func (ehdlr EndpointHealthDataListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehdlr.Value != nil { + objectMap["value"] = ehdlr.Value + } + return json.Marshal(objectMap) +} + +// EndpointHealthDataListResultIterator provides access to a complete listing of EndpointHealthData values. +type EndpointHealthDataListResultIterator struct { + i int + page EndpointHealthDataListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointHealthDataListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointHealthDataListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointHealthDataListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointHealthDataListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointHealthDataListResultIterator) Response() EndpointHealthDataListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointHealthDataListResultIterator) Value() EndpointHealthData { + if !iter.page.NotDone() { + return EndpointHealthData{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointHealthDataListResultIterator type. +func NewEndpointHealthDataListResultIterator(page EndpointHealthDataListResultPage) EndpointHealthDataListResultIterator { + return EndpointHealthDataListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ehdlr EndpointHealthDataListResult) IsEmpty() bool { + return ehdlr.Value == nil || len(*ehdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ehdlr EndpointHealthDataListResult) hasNextLink() bool { + return ehdlr.NextLink != nil && len(*ehdlr.NextLink) != 0 +} + +// endpointHealthDataListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ehdlr EndpointHealthDataListResult) endpointHealthDataListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ehdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ehdlr.NextLink))) +} + +// EndpointHealthDataListResultPage contains a page of EndpointHealthData values. +type EndpointHealthDataListResultPage struct { + fn func(context.Context, EndpointHealthDataListResult) (EndpointHealthDataListResult, error) + ehdlr EndpointHealthDataListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointHealthDataListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointHealthDataListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ehdlr) + if err != nil { + return err + } + page.ehdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointHealthDataListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointHealthDataListResultPage) NotDone() bool { + return !page.ehdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointHealthDataListResultPage) Response() EndpointHealthDataListResult { + return page.ehdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointHealthDataListResultPage) Values() []EndpointHealthData { + if page.ehdlr.IsEmpty() { + return nil + } + return *page.ehdlr.Value +} + +// Creates a new instance of the EndpointHealthDataListResultPage type. +func NewEndpointHealthDataListResultPage(cur EndpointHealthDataListResult, getNextPage func(context.Context, EndpointHealthDataListResult) (EndpointHealthDataListResult, error)) EndpointHealthDataListResultPage { + return EndpointHealthDataListResultPage{ + fn: getNextPage, + ehdlr: cur, + } +} + +// EnrichmentProperties the properties of an enrichment that your IoT hub applies to messages delivered to +// endpoints. +type EnrichmentProperties struct { + // Key - The key or name for the enrichment property. + Key *string `json:"key,omitempty"` + // Value - The value for the enrichment property. + Value *string `json:"value,omitempty"` + // EndpointNames - The list of endpoints for which the enrichment is applied to the message. + EndpointNames *[]string `json:"endpointNames,omitempty"` +} + +// ErrorDetails error details. +type ErrorDetails struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // HTTPStatusCode - READ-ONLY; The HTTP status code. + HTTPStatusCode *string `json:"httpStatusCode,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Details - READ-ONLY; The error details. + Details *string `json:"details,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetails. +func (ed ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EventHubConsumerGroupBodyDescription the EventHub consumer group. +type EventHubConsumerGroupBodyDescription struct { + Properties *EventHubConsumerGroupName `json:"properties,omitempty"` +} + +// EventHubConsumerGroupInfo the properties of the EventHubConsumerGroupInfo object. +type EventHubConsumerGroupInfo struct { + autorest.Response `json:"-"` + // Properties - The tags. + Properties map[string]interface{} `json:"properties"` + // ID - READ-ONLY; The Event Hub-compatible consumer group identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The Event Hub-compatible consumer group name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; the resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The etag. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubConsumerGroupInfo. +func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehcgi.Properties != nil { + objectMap["properties"] = ehcgi.Properties + } + return json.Marshal(objectMap) +} + +// EventHubConsumerGroupName the EventHub consumer group name. +type EventHubConsumerGroupName struct { + // Name - EventHub consumer group name + Name *string `json:"name,omitempty"` +} + +// 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 + Value *[]EventHubConsumerGroupInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + NextLink *string `json:"nextLink,omitempty"` +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EventHubConsumerGroupsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EventHubConsumerGroupsListResultIterator) Value() EventHubConsumerGroupInfo { + if !iter.page.NotDone() { + return EventHubConsumerGroupInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventHubConsumerGroupsListResultIterator type. +func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator { + return EventHubConsumerGroupsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ehcglr.NextLink))) +} + +// EventHubConsumerGroupsListResultPage contains a page of EventHubConsumerGroupInfo values. +type EventHubConsumerGroupsListResultPage struct { + fn func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error) + ehcglr EventHubConsumerGroupsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ehcglr) + if err != nil { + return err + } + page.ehcglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EventHubConsumerGroupsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventHubConsumerGroupsListResultPage) NotDone() bool { + return !page.ehcglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult { + return page.ehcglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventHubConsumerGroupsListResultPage) Values() []EventHubConsumerGroupInfo { + if page.ehcglr.IsEmpty() { + return nil + } + return *page.ehcglr.Value +} + +// Creates a new instance of the EventHubConsumerGroupsListResultPage type. +func NewEventHubConsumerGroupsListResultPage(cur EventHubConsumerGroupsListResult, getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage { + return EventHubConsumerGroupsListResultPage{ + fn: getNextPage, + ehcglr: cur, + } +} + +// EventHubProperties the properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. +type EventHubProperties struct { + // 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 + RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"` + // 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. + PartitionCount *int32 `json:"partitionCount,omitempty"` + // PartitionIds - READ-ONLY; The partition ids in the Event Hub-compatible endpoint. + PartitionIds *[]string `json:"partitionIds,omitempty"` + // Path - READ-ONLY; The Event Hub-compatible name. + Path *string `json:"path,omitempty"` + // Endpoint - READ-ONLY; The Event Hub-compatible endpoint. + 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. + ExportBlobContainerURI *string `json:"exportBlobContainerUri,omitempty"` + // ExcludeKeys - The value indicating whether keys should be excluded during export. + ExcludeKeys *bool `json:"excludeKeys,omitempty"` + // ExportBlobName - The name of the blob that will be created in the provided output blob container. This blob will contain the exported device registry information for the IoT Hub. + ExportBlobName *string `json:"exportBlobName,omitempty"` + // AuthenticationType - Specifies authentication type being used for connecting to the storage account. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of storage endpoint for export devices. + Identity *ManagedIdentity `json:"identity,omitempty"` + // IncludeConfigurations - The value indicating whether configurations should be exported. + IncludeConfigurations *bool `json:"includeConfigurations,omitempty"` + // ConfigurationsBlobName - The name of the blob that will be created in the provided output blob container. This blob will contain the exported configurations for the Iot Hub. + ConfigurationsBlobName *string `json:"configurationsBlobName,omitempty"` +} + +// FailoverInput use to provide failover region when requesting manual Failover for a hub. +type FailoverInput struct { + // FailoverRegion - Region the hub will be failed over to + FailoverRegion *string `json:"failoverRegion,omitempty"` +} + +// 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"` + // Source - The source to which the routing rule is to be applied to. For example, DeviceMessages + Source *string `json:"source,omitempty"` + // 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 + Condition *string `json:"condition,omitempty"` + // EndpointNames - The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. + EndpointNames *[]string `json:"endpointNames,omitempty"` + // IsEnabled - Used to specify whether the fallback route is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// FeedbackProperties the properties of the feedback queue for cloud-to-device messages. +type FeedbackProperties struct { + // LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` + // 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. + TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` + // 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. + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` +} + +// GroupIDInformation the group information for creating a private endpoint on an IotHub +type GroupIDInformation struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + Properties *GroupIDInformationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupIDInformation. +func (gii GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gii.Properties != nil { + objectMap["properties"] = gii.Properties + } + return json.Marshal(objectMap) +} + +// GroupIDInformationProperties the properties for a group information object +type GroupIDInformationProperties struct { + // GroupID - The group id + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The required members for a specific group id + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The required DNS zones for a specific group id + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub. +type ImportDevicesRequest struct { + // InputBlobContainerURI - The input blob container URI. + InputBlobContainerURI *string `json:"inputBlobContainerUri,omitempty"` + // OutputBlobContainerURI - The output blob container URI. + OutputBlobContainerURI *string `json:"outputBlobContainerUri,omitempty"` + // InputBlobName - The blob name to be used when importing from the provided input blob container. + InputBlobName *string `json:"inputBlobName,omitempty"` + // OutputBlobName - The blob name to use for storing the status of the import job. + OutputBlobName *string `json:"outputBlobName,omitempty"` + // AuthenticationType - Specifies authentication type being used for connecting to the storage account. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of storage endpoint for import devices. + Identity *ManagedIdentity `json:"identity,omitempty"` + // IncludeConfigurations - The value indicating whether configurations should be imported. + IncludeConfigurations *bool `json:"includeConfigurations,omitempty"` + // ConfigurationsBlobName - The blob name to be used when importing configurations from the provided input blob container. + ConfigurationsBlobName *string `json:"configurationsBlobName,omitempty"` +} + +// IotHubCapacity ioT Hub capacity information. +type IotHubCapacity struct { + // Minimum - READ-ONLY; The minimum number of units. + Minimum *int64 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The maximum number of units. + Maximum *int64 `json:"maximum,omitempty"` + // Default - READ-ONLY; The default number of units. + Default *int64 `json:"default,omitempty"` + // ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone' + ScaleType IotHubScaleType `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotHubCapacity. +func (ihc IotHubCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IotHubDescription the description of the IoT hub. +type IotHubDescription struct { + autorest.Response `json:"-"` + // 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. + Etag *string `json:"etag,omitempty"` + // Properties - IotHub properties + Properties *IotHubProperties `json:"properties,omitempty"` + // Sku - IotHub SKU info + Sku *IotHubSkuInfo `json:"sku,omitempty"` + // Identity - The managed identities for the IotHub. + Identity *ArmIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IotHubDescription. +func (ihd IotHubDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihd.Etag != nil { + objectMap["etag"] = ihd.Etag + } + if ihd.Properties != nil { + objectMap["properties"] = ihd.Properties + } + if ihd.Sku != nil { + objectMap["sku"] = ihd.Sku + } + if ihd.Identity != nil { + objectMap["identity"] = ihd.Identity + } + if ihd.Location != nil { + objectMap["location"] = ihd.Location + } + if ihd.Tags != nil { + objectMap["tags"] = ihd.Tags + } + return json.Marshal(objectMap) +} + +// IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link. +type IotHubDescriptionListResult struct { + autorest.Response `json:"-"` + // Value - The array of IotHubDescription objects. + Value *[]IotHubDescription `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + 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 + page IotHubDescriptionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IotHubDescriptionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IotHubDescriptionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription { + if !iter.page.NotDone() { + return IotHubDescription{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IotHubDescriptionListResultIterator type. +func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator { + return IotHubDescriptionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ihdlr.NextLink))) +} + +// IotHubDescriptionListResultPage contains a page of IotHubDescription values. +type IotHubDescriptionListResultPage struct { + fn func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error) + ihdlr IotHubDescriptionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ihdlr) + if err != nil { + return err + } + page.ihdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IotHubDescriptionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IotHubDescriptionListResultPage) NotDone() bool { + return !page.ihdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult { + return page.ihdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IotHubDescriptionListResultPage) Values() []IotHubDescription { + if page.ihdlr.IsEmpty() { + return nil + } + return *page.ihdlr.Value +} + +// Creates a new instance of the IotHubDescriptionListResultPage type. +func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage { + return IotHubDescriptionListResultPage{ + fn: getNextPage, + ihdlr: cur, + } +} + +// IotHubLocationDescription public representation of one of the locations where a resource is provisioned. +type IotHubLocationDescription struct { + // Location - The name of the Azure region + Location *string `json:"location,omitempty"` + // Role - The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: 'Primary', 'Secondary' + Role IotHubReplicaRoleType `json:"role,omitempty"` +} + +// IotHubManualFailoverFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IotHubManualFailoverFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IotHubClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IotHubManualFailoverFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IotHubManualFailoverFuture.Result. +func (future *IotHubManualFailoverFuture) result(client IotHubClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubManualFailoverFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.IotHubManualFailoverFuture") + return + } + ar.Response = future.Response() + return +} + +// IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available. +type IotHubNameAvailabilityInfo struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; The value which indicates whether the provided name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists' + Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"` + // Message - The detailed reason message. + 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. + AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // IPFilterRules - The IP filter rules. + IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"` + NetworkRuleSets *NetworkRuleSetProperties `json:"networkRuleSets,omitempty"` + // MinTLSVersion - Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + MinTLSVersion *string `json:"minTlsVersion,omitempty"` + // PrivateEndpointConnections - Private endpoint connections created on this IotHub + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // State - READ-ONLY; The hub state. + State *string `json:"state,omitempty"` + // HostName - READ-ONLY; The name of the host. + HostName *string `json:"hostName,omitempty"` + // EventHubEndpoints - The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. + EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"` + Routing *RoutingProperties `json:"routing,omitempty"` + // 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. + StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"` + // MessagingEndpoints - The messaging endpoint properties for the file upload notification queue. + MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"` + // EnableFileUploadNotifications - If True, file upload notifications are enabled. + EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"` + CloudToDevice *CloudToDeviceProperties `json:"cloudToDevice,omitempty"` + // Comments - IoT hub comments. + Comments *string `json:"comments,omitempty"` + // Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement' + Features Capabilities `json:"features,omitempty"` + // Locations - READ-ONLY; Primary and secondary location for iot hub + Locations *[]IotHubLocationDescription `json:"locations,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotHubProperties. +func (ihp IotHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihp.AuthorizationPolicies != nil { + objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies + } + if ihp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = ihp.PublicNetworkAccess + } + if ihp.IPFilterRules != nil { + objectMap["ipFilterRules"] = ihp.IPFilterRules + } + if ihp.NetworkRuleSets != nil { + objectMap["networkRuleSets"] = ihp.NetworkRuleSets + } + if ihp.MinTLSVersion != nil { + objectMap["minTlsVersion"] = ihp.MinTLSVersion + } + if ihp.PrivateEndpointConnections != nil { + objectMap["privateEndpointConnections"] = ihp.PrivateEndpointConnections + } + if ihp.EventHubEndpoints != nil { + objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints + } + if ihp.Routing != nil { + objectMap["routing"] = ihp.Routing + } + if ihp.StorageEndpoints != nil { + objectMap["storageEndpoints"] = ihp.StorageEndpoints + } + if ihp.MessagingEndpoints != nil { + objectMap["messagingEndpoints"] = ihp.MessagingEndpoints + } + if ihp.EnableFileUploadNotifications != nil { + objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications + } + if ihp.CloudToDevice != nil { + objectMap["cloudToDevice"] = ihp.CloudToDevice + } + if ihp.Comments != nil { + objectMap["comments"] = ihp.Comments + } + if ihp.Features != "" { + objectMap["features"] = ihp.Features + } + return json.Marshal(objectMap) +} + +// IotHubQuotaMetricInfo quota metrics properties. +type IotHubQuotaMetricInfo struct { + // Name - READ-ONLY; The name of the quota metric. + Name *string `json:"name,omitempty"` + // CurrentValue - READ-ONLY; The current value for the quota metric. + CurrentValue *int64 `json:"currentValue,omitempty"` + // MaxValue - READ-ONLY; The maximum value of the quota metric. + MaxValue *int64 `json:"maxValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotHubQuotaMetricInfo. +func (ihqmi IotHubQuotaMetricInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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. + Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + 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 { + i int + page IotHubQuotaMetricInfoListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo { + if !iter.page.NotDone() { + return IotHubQuotaMetricInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type. +func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator { + return IotHubQuotaMetricInfoListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ihqmilr.NextLink))) +} + +// IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values. +type IotHubQuotaMetricInfoListResultPage struct { + fn func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error) + ihqmilr IotHubQuotaMetricInfoListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ihqmilr) + if err != nil { + return err + } + page.ihqmilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IotHubQuotaMetricInfoListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool { + return !page.ihqmilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult { + return page.ihqmilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo { + if page.ihqmilr.IsEmpty() { + return nil + } + return *page.ihqmilr.Value +} + +// Creates a new instance of the IotHubQuotaMetricInfoListResultPage type. +func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage { + return IotHubQuotaMetricInfoListResultPage{ + fn: getNextPage, + ihqmilr: cur, + } +} + +// IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type IotHubResourceCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IotHubResourceClient) (IotHubDescription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IotHubResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IotHubResourceCreateOrUpdateFuture.Result. +func (future *IotHubResourceCreateOrUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ihd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent { + ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request") + } + } + return +} + +// IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IotHubResourceDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IotHubResourceClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IotHubResourceDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IotHubResourceDeleteFuture.Result. +func (future *IotHubResourceDeleteFuture) result(client IotHubResourceClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.DeleteResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// IotHubResourceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IotHubResourceUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IotHubResourceClient) (IotHubDescription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IotHubResourceUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IotHubResourceUpdateFuture.Result. +func (future *IotHubResourceUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ihd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent { + ihd, err = client.UpdateResponder(ihd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request") + } + } + return +} + +// IotHubSkuDescription SKU properties. +type IotHubSkuDescription struct { + // ResourceType - READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - The type of the resource. + Sku *IotHubSkuInfo `json:"sku,omitempty"` + // Capacity - IotHub capacity + Capacity *IotHubCapacity `json:"capacity,omitempty"` +} + +// 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. + Value *[]IotHubSkuDescription `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + NextLink *string `json:"nextLink,omitempty"` +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IotHubSkuDescriptionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription { + if !iter.page.NotDone() { + return IotHubSkuDescription{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IotHubSkuDescriptionListResultIterator type. +func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator { + return IotHubSkuDescriptionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ihsdlr.NextLink))) +} + +// IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values. +type IotHubSkuDescriptionListResultPage struct { + fn func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error) + ihsdlr IotHubSkuDescriptionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ihsdlr) + if err != nil { + return err + } + page.ihsdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IotHubSkuDescriptionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IotHubSkuDescriptionListResultPage) NotDone() bool { + return !page.ihsdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult { + return page.ihsdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription { + if page.ihsdlr.IsEmpty() { + return nil + } + return *page.ihsdlr.Value +} + +// Creates a new instance of the IotHubSkuDescriptionListResultPage type. +func NewIotHubSkuDescriptionListResultPage(cur IotHubSkuDescriptionListResult, getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage { + return IotHubSkuDescriptionListResultPage{ + fn: getNextPage, + ihsdlr: cur, + } +} + +// IotHubSkuInfo information about the SKU of the IoT hub. +type IotHubSkuInfo struct { + // Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3', 'B1', 'B2', 'B3' + Name IotHubSku `json:"name,omitempty"` + // Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard', 'Basic' + Tier IotHubSkuTier `json:"tier,omitempty"` + // Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + 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. + FilterName *string `json:"filterName,omitempty"` + // Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject' + Action IPFilterActionType `json:"action,omitempty"` + // IPMask - A string that contains the IP address range in CIDR notation for the rule. + IPMask *string `json:"ipMask,omitempty"` +} + +// JobResponse the properties of the Job Response object. +type JobResponse struct { + autorest.Response `json:"-"` + // JobID - READ-ONLY; The job identifier. + JobID *string `json:"jobId,omitempty"` + // StartTimeUtc - READ-ONLY; The start time of the job. + StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"` + // EndTimeUtc - READ-ONLY; The time the job stopped processing. + EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"` + // Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate' + Type JobType `json:"type,omitempty"` + // Status - READ-ONLY; The status of the job. Possible values include: 'JobStatusUnknown', 'JobStatusEnqueued', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCancelled' + Status JobStatus `json:"status,omitempty"` + // FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure. + FailureReason *string `json:"failureReason,omitempty"` + // StatusMessage - READ-ONLY; The status message for the job. + StatusMessage *string `json:"statusMessage,omitempty"` + // ParentJobID - READ-ONLY; The job identifier of the parent job, if any. + ParentJobID *string `json:"parentJobId,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobResponse. +func (jr JobResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobResponseListResult the JSON-serialized array of JobResponse objects with a next link. +type JobResponseListResult struct { + autorest.Response `json:"-"` + // Value - The array of JobResponse objects. + Value *[]JobResponse `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + 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 + page JobResponseListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *JobResponseListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JobResponseListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter JobResponseListResultIterator) Response() JobResponseListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter JobResponseListResultIterator) Value() JobResponse { + if !iter.page.NotDone() { + return JobResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JobResponseListResultIterator type. +func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator { + return JobResponseListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jrlr.NextLink))) +} + +// JobResponseListResultPage contains a page of JobResponse values. +type JobResponseListResultPage struct { + fn func(context.Context, JobResponseListResult) (JobResponseListResult, error) + jrlr JobResponseListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.jrlr) + if err != nil { + return err + } + page.jrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *JobResponseListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JobResponseListResultPage) NotDone() bool { + return !page.jrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JobResponseListResultPage) Response() JobResponseListResult { + return page.jrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JobResponseListResultPage) Values() []JobResponse { + if page.jrlr.IsEmpty() { + return nil + } + return *page.jrlr.Value +} + +// Creates a new instance of the JobResponseListResultPage type. +func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage { + return JobResponseListResultPage{ + fn: getNextPage, + jrlr: cur, + } +} + +// ListPrivateEndpointConnection ... +type ListPrivateEndpointConnection struct { + autorest.Response `json:"-"` + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// ManagedIdentity the properties of the Managed identity. +type ManagedIdentity struct { + // UserAssignedIdentity - The user assigned identity. + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} + +// MatchedRoute routes that matched +type MatchedRoute struct { + // Properties - Properties of routes that matched + Properties *RouteProperties `json:"properties,omitempty"` +} + +// MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub. +type MessagingEndpointProperties struct { + // LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` + // 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. + TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` + // 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. + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` +} + +// Name name of Iot Hub type +type Name struct { + // Value - IotHub type + Value *string `json:"value,omitempty"` + // LocalizedValue - Localized value of name + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// NetworkRuleSetIPRule IP Rule to be applied as part of Network Rule Set +type NetworkRuleSetIPRule struct { + // FilterName - Name of the IP filter rule. + FilterName *string `json:"filterName,omitempty"` + // Action - IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow' + Action NetworkRuleIPAction `json:"action,omitempty"` + // IPMask - A string that contains the IP address range in CIDR notation for the rule. + IPMask *string `json:"ipMask,omitempty"` +} + +// NetworkRuleSetProperties network Rule Set Properties of IotHub +type NetworkRuleSetProperties struct { + // DefaultAction - Default Action for Network Rule Set. Possible values include: 'Deny', 'Allow' + DefaultAction DefaultAction `json:"defaultAction,omitempty"` + // ApplyToBuiltInEventHubEndpoint - If True, then Network Rule Set is also applied to BuiltIn EventHub EndPoint of IotHub + ApplyToBuiltInEventHubEndpoint *bool `json:"applyToBuiltInEventHubEndpoint,omitempty"` + // IPRules - List of IP Rules + IPRules *[]NetworkRuleSetIPRule `json:"ipRules,omitempty"` +} + +// Operation ioT Hub REST API operation +type Operation struct { + // Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + 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 + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; Resource Type: IotHubs + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; Name of the operation + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; Description of the operation + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationInputs input values. +type OperationInputs struct { + // Name - The name of the IoT hub to check. + 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. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of IoT Hub operations supported by the Microsoft.Devices resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PrivateEndpoint the private endpoint property of a private endpoint connection +type PrivateEndpoint struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the private endpoint connection of an IotHub +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.Properties != nil { + objectMap["properties"] = pec.Properties + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties the properties of a private endpoint connection +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.PrivateEndpointConnectionsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.DeleteResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsDeleteFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsUpdateFuture.Result. +func (future *PrivateEndpointConnectionsUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("devices.PrivateEndpointConnectionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.UpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkResources the available private link resources for an IotHub +type PrivateLinkResources struct { + autorest.Response `json:"-"` + // Value - The list of available private link resources for an IotHub + Value *[]GroupIDInformation `json:"value,omitempty"` +} + +// PrivateLinkServiceConnectionState the current state of a private endpoint connection +type PrivateLinkServiceConnectionState struct { + // Status - The status of a private endpoint connection. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The description for the current state of a private endpoint connection + Description *string `json:"description,omitempty"` + // ActionsRequired - Actions required for a private endpoint connection + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// RegistryStatistics identity registry statistics. +type RegistryStatistics struct { + autorest.Response `json:"-"` + // TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry. + TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"` + // EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry. + EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"` + // DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry. + DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryStatistics. +func (rs RegistryStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource the common properties of an Azure resource. +type Resource struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// RouteCompilationError compilation error when evaluating route +type RouteCompilationError struct { + // Message - Route error message + Message *string `json:"message,omitempty"` + // Severity - Severity of the route error. Possible values include: 'Error', 'Warning' + Severity RouteErrorSeverity `json:"severity,omitempty"` + // Location - Location where the route error happened + Location *RouteErrorRange `json:"location,omitempty"` +} + +// RouteErrorPosition position where the route error happened +type RouteErrorPosition struct { + // Line - Line where the route error happened + Line *int32 `json:"line,omitempty"` + // Column - Column where the route error happened + Column *int32 `json:"column,omitempty"` +} + +// RouteErrorRange range of route errors +type RouteErrorRange struct { + // Start - Start where the route error happened + Start *RouteErrorPosition `json:"start,omitempty"` + // End - End where the route error happened + End *RouteErrorPosition `json:"end,omitempty"` +} + +// RouteProperties the properties of a routing rule that your IoT hub uses to route messages to endpoints. +type RouteProperties 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"` + // Source - The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: 'RoutingSourceInvalid', 'RoutingSourceDeviceMessages', 'RoutingSourceTwinChangeEvents', 'RoutingSourceDeviceLifecycleEvents', 'RoutingSourceDeviceJobLifecycleEvents', 'RoutingSourceDeviceConnectionStateEvents' + Source RoutingSource `json:"source,omitempty"` + // 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 + Condition *string `json:"condition,omitempty"` + // EndpointNames - The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed. + EndpointNames *[]string `json:"endpointNames,omitempty"` + // IsEnabled - Used to specify whether a route is enabled. + 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. +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"` + // ServiceBusTopics - The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. + ServiceBusTopics *[]RoutingServiceBusTopicEndpointProperties `json:"serviceBusTopics,omitempty"` + // 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. + EventHubs *[]RoutingEventHubProperties `json:"eventHubs,omitempty"` + // StorageContainers - The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. + StorageContainers *[]RoutingStorageContainerProperties `json:"storageContainers,omitempty"` +} + +// RoutingEventHubProperties the properties related to an event hub endpoint. +type RoutingEventHubProperties struct { + // ID - Id of the event hub endpoint + ID *string `json:"id,omitempty"` + // ConnectionString - The connection string of the event hub endpoint. + ConnectionString *string `json:"connectionString,omitempty"` + // EndpointURI - The url of the event hub endpoint. It must include the protocol sb:// + EndpointURI *string `json:"endpointUri,omitempty"` + // EntityPath - Event hub name on the event hub namespace + EntityPath *string `json:"entityPath,omitempty"` + // AuthenticationType - Method used to authenticate against the event hub endpoint. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of routing event hub endpoint. + Identity *ManagedIdentity `json:"identity,omitempty"` + // 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. + Name *string `json:"name,omitempty"` + // SubscriptionID - The subscription identifier of the event hub endpoint. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroup - The name of the resource group of the event hub endpoint. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// RoutingMessage routing message +type RoutingMessage struct { + // Body - Body of routing message + Body *string `json:"body,omitempty"` + // AppProperties - App properties + AppProperties map[string]*string `json:"appProperties"` + // SystemProperties - System properties + SystemProperties map[string]*string `json:"systemProperties"` +} + +// MarshalJSON is the custom marshaler for RoutingMessage. +func (rm RoutingMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rm.Body != nil { + objectMap["body"] = rm.Body + } + if rm.AppProperties != nil { + objectMap["appProperties"] = rm.AppProperties + } + if rm.SystemProperties != nil { + objectMap["systemProperties"] = rm.SystemProperties + } + return json.Marshal(objectMap) +} + +// RoutingProperties the routing related properties of the IoT hub. See: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging +type RoutingProperties struct { + Endpoints *RoutingEndpoints `json:"endpoints,omitempty"` + // 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. + Routes *[]RouteProperties `json:"routes,omitempty"` + // 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. + FallbackRoute *FallbackRouteProperties `json:"fallbackRoute,omitempty"` + // Enrichments - The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid + Enrichments *[]EnrichmentProperties `json:"enrichments,omitempty"` +} + +// RoutingServiceBusQueueEndpointProperties the properties related to service bus queue endpoint types. +type RoutingServiceBusQueueEndpointProperties struct { + // ID - Id of the service bus queue endpoint + ID *string `json:"id,omitempty"` + // ConnectionString - The connection string of the service bus queue endpoint. + ConnectionString *string `json:"connectionString,omitempty"` + // EndpointURI - The url of the service bus queue endpoint. It must include the protocol sb:// + EndpointURI *string `json:"endpointUri,omitempty"` + // EntityPath - Queue name on the service bus namespace + EntityPath *string `json:"entityPath,omitempty"` + // AuthenticationType - Method used to authenticate against the service bus queue endpoint. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of routing service bus queue endpoint. + Identity *ManagedIdentity `json:"identity,omitempty"` + // 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name. + Name *string `json:"name,omitempty"` + // SubscriptionID - The subscription identifier of the service bus queue endpoint. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroup - The name of the resource group of the service bus queue endpoint. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// RoutingServiceBusTopicEndpointProperties the properties related to service bus topic endpoint types. +type RoutingServiceBusTopicEndpointProperties struct { + // ID - Id of the service bus topic endpoint + ID *string `json:"id,omitempty"` + // ConnectionString - The connection string of the service bus topic endpoint. + ConnectionString *string `json:"connectionString,omitempty"` + // EndpointURI - The url of the service bus topic endpoint. It must include the protocol sb:// + EndpointURI *string `json:"endpointUri,omitempty"` + // EntityPath - Queue name on the service bus topic + EntityPath *string `json:"entityPath,omitempty"` + // AuthenticationType - Method used to authenticate against the service bus topic endpoint. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of routing service bus topic endpoint. + Identity *ManagedIdentity `json:"identity,omitempty"` + // 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual topic name. + Name *string `json:"name,omitempty"` + // SubscriptionID - The subscription identifier of the service bus topic endpoint. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroup - The name of the resource group of the service bus topic endpoint. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// RoutingStorageContainerProperties the properties related to a storage container endpoint. +type RoutingStorageContainerProperties struct { + // ID - Id of the storage container endpoint + ID *string `json:"id,omitempty"` + // ConnectionString - The connection string of the storage account. + ConnectionString *string `json:"connectionString,omitempty"` + // EndpointURI - The url of the storage endpoint. It must include the protocol https:// + EndpointURI *string `json:"endpointUri,omitempty"` + // AuthenticationType - Method used to authenticate against the storage endpoint. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of routing storage endpoint. + Identity *ManagedIdentity `json:"identity,omitempty"` + // 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. + Name *string `json:"name,omitempty"` + // SubscriptionID - The subscription identifier of the storage account. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroup - The name of the resource group of the storage account. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // ContainerName - The name of storage container in the storage account. + ContainerName *string `json:"containerName,omitempty"` + // 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. + FileNameFormat *string `json:"fileNameFormat,omitempty"` + // BatchFrequencyInSeconds - Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds. + BatchFrequencyInSeconds *int32 `json:"batchFrequencyInSeconds,omitempty"` + // 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). + MaxChunkSizeInBytes *int32 `json:"maxChunkSizeInBytes,omitempty"` + // Encoding - Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: 'Avro', 'AvroDeflate', 'JSON' + Encoding Encoding `json:"encoding,omitempty"` +} + +// RoutingTwin twin reference input parameter. This is an optional parameter +type RoutingTwin struct { + // Tags - Twin Tags + Tags interface{} `json:"tags,omitempty"` + Properties *RoutingTwinProperties `json:"properties,omitempty"` +} + +// RoutingTwinProperties ... +type RoutingTwinProperties struct { + // Desired - Twin desired properties + Desired interface{} `json:"desired,omitempty"` + // Reported - Twin desired properties + Reported interface{} `json:"reported,omitempty"` +} + +// SetObject ... +type SetObject struct { + autorest.Response `json:"-"` + Value interface{} `json:"value,omitempty"` +} + +// SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy. +type SharedAccessSignatureAuthorizationRule struct { + autorest.Response `json:"-"` + // KeyName - The name of the shared access policy. + KeyName *string `json:"keyName,omitempty"` + // PrimaryKey - The primary key. + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - The secondary key. + SecondaryKey *string `json:"secondaryKey,omitempty"` + // 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' + Rights AccessRights `json:"rights,omitempty"` +} + +// SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link. +type SharedAccessSignatureAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + // Value - The list of shared access policies. + Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The next link. + 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 { + i int + page SharedAccessSignatureAuthorizationRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule { + if !iter.page.NotDone() { + return SharedAccessSignatureAuthorizationRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type. +func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator { + return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +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.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sasarlr.NextLink))) +} + +// SharedAccessSignatureAuthorizationRuleListResultPage contains a page of +// SharedAccessSignatureAuthorizationRule values. +type SharedAccessSignatureAuthorizationRuleListResultPage struct { + fn func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error) + sasarlr SharedAccessSignatureAuthorizationRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sasarlr) + if err != nil { + return err + } + page.sasarlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool { + return !page.sasarlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult { + return page.sasarlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule { + if page.sasarlr.IsEmpty() { + return nil + } + return *page.sasarlr.Value +} + +// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type. +func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage { + return SharedAccessSignatureAuthorizationRuleListResultPage{ + fn: getNextPage, + sasarlr: cur, + } +} + +// StorageEndpointProperties the properties of the Azure Storage endpoint for file upload. +type StorageEndpointProperties struct { + // 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. + SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"` + // ConnectionString - The connection string for the Azure Storage account to which files are uploaded. + ConnectionString *string `json:"connectionString,omitempty"` + // ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. + ContainerName *string `json:"containerName,omitempty"` + // AuthenticationType - Specifies authentication type being used for connecting to the storage account. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Identity - Managed identity properties of storage endpoint for file upload. + Identity *ManagedIdentity `json:"identity,omitempty"` +} + +// 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"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// TestAllRoutesInput input for testing all routes +type TestAllRoutesInput struct { + // RoutingSource - Routing source. Possible values include: 'RoutingSourceInvalid', 'RoutingSourceDeviceMessages', 'RoutingSourceTwinChangeEvents', 'RoutingSourceDeviceLifecycleEvents', 'RoutingSourceDeviceJobLifecycleEvents', 'RoutingSourceDeviceConnectionStateEvents' + RoutingSource RoutingSource `json:"routingSource,omitempty"` + // Message - Routing message + Message *RoutingMessage `json:"message,omitempty"` + // Twin - Routing Twin Reference + Twin *RoutingTwin `json:"twin,omitempty"` +} + +// TestAllRoutesResult result of testing all routes +type TestAllRoutesResult struct { + autorest.Response `json:"-"` + // Routes - JSON-serialized array of matched routes + Routes *[]MatchedRoute `json:"routes,omitempty"` +} + +// TestRouteInput input for testing route +type TestRouteInput struct { + // Message - Routing message + Message *RoutingMessage `json:"message,omitempty"` + // Route - Route properties + Route *RouteProperties `json:"route,omitempty"` + // Twin - Routing Twin Reference + Twin *RoutingTwin `json:"twin,omitempty"` +} + +// TestRouteResult result of testing one route +type TestRouteResult struct { + autorest.Response `json:"-"` + // Result - Result of testing route. Possible values include: 'Undefined', 'False', 'True' + Result TestResultStatus `json:"result,omitempty"` + // Details - Detailed result of testing route + Details *TestRouteResultDetails `json:"details,omitempty"` +} + +// TestRouteResultDetails detailed result of testing a route +type TestRouteResultDetails struct { + // CompilationErrors - JSON-serialized list of route compilation errors + CompilationErrors *[]RouteCompilationError `json:"compilationErrors,omitempty"` +} + +// UserSubscriptionQuota user subscription quota response +type UserSubscriptionQuota struct { + // ID - IotHub type id + ID *string `json:"id,omitempty"` + // Type - Response type + Type *string `json:"type,omitempty"` + // Unit - Unit of IotHub type + Unit *string `json:"unit,omitempty"` + // CurrentValue - Current number of IotHub type + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - Numerical limit on IotHub type + Limit *int32 `json:"limit,omitempty"` + // Name - IotHub type + Name *Name `json:"name,omitempty"` +} + +// UserSubscriptionQuotaListResult json-serialized array of User subscription quota response +type UserSubscriptionQuotaListResult struct { + autorest.Response `json:"-"` + Value *[]UserSubscriptionQuota `json:"value,omitempty"` + // NextLink - READ-ONLY + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserSubscriptionQuotaListResult. +func (usqlr UserSubscriptionQuotaListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if usqlr.Value != nil { + objectMap["value"] = usqlr.Value + } + return json.Marshal(objectMap) +} diff --git a/services/iothub/mgmt/2021-03-31/devices/operations.go b/services/iothub/mgmt/2021-03-31/devices/operations.go new file mode 100644 index 000000000000..0ed65ff50166 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/operations.go @@ -0,0 +1,140 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the use this API to manage the IoT hubs in your Azure subscription. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available IoT Hub REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Devices/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devices.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devices.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/privateendpointconnections.go b/services/iothub/mgmt/2021-03-31/devices/privateendpointconnections.go new file mode 100644 index 000000000000..d0891b7bd525 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/privateendpointconnections.go @@ -0,0 +1,364 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the use this API to manage the IoT hubs in your Azure subscription. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get private endpoint connection properties +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private endpoint connection properties +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListPrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result ListPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update the status of a private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// privateEndpointConnectionName - the name of the private endpoint connection +// privateEndpointConnection - the private endpoint connection with updated properties +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: privateEndpointConnection, + Constraints: []validation.Constraint{{Target: "privateEndpointConnection.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "privateEndpointConnection.Properties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "privateEndpointConnection.Properties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("devices.PrivateEndpointConnectionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + privateEndpointConnection.ID = nil + privateEndpointConnection.Name = nil + privateEndpointConnection.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/privatelinkresources.go b/services/iothub/mgmt/2021-03-31/devices/privatelinkresources.go new file mode 100644 index 000000000000..015c3e360688 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/privatelinkresources.go @@ -0,0 +1,186 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the use this API to manage the IoT hubs in your Azure subscription. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified private link resource for the given IotHub +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +// groupID - the name of the private link resource +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupID string) (result GroupIDInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result GroupIDInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private link resources for the given IotHub +// Parameters: +// resourceGroupName - the name of the resource group that contains the IoT hub. +// resourceName - the name of the IoT hub. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResources, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResources, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/resourceprovidercommon.go b/services/iothub/mgmt/2021-03-31/devices/resourceprovidercommon.go new file mode 100644 index 000000000000..65e21f57ef30 --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/resourceprovidercommon.go @@ -0,0 +1,103 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceProviderCommonClient is the use this API to manage the IoT hubs in your Azure subscription. +type ResourceProviderCommonClient struct { + BaseClient +} + +// NewResourceProviderCommonClient creates an instance of the ResourceProviderCommonClient client. +func NewResourceProviderCommonClient(subscriptionID string) ResourceProviderCommonClient { + return NewResourceProviderCommonClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceProviderCommonClientWithBaseURI creates an instance of the ResourceProviderCommonClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewResourceProviderCommonClientWithBaseURI(baseURI string, subscriptionID string) ResourceProviderCommonClient { + return ResourceProviderCommonClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetSubscriptionQuota get the number of free and paid iot hubs in the subscription +func (client ResourceProviderCommonClient) GetSubscriptionQuota(ctx context.Context) (result UserSubscriptionQuotaListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderCommonClient.GetSubscriptionQuota") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSubscriptionQuotaPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.ResourceProviderCommonClient", "GetSubscriptionQuota", nil, "Failure preparing request") + return + } + + resp, err := client.GetSubscriptionQuotaSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devices.ResourceProviderCommonClient", "GetSubscriptionQuota", resp, "Failure sending request") + return + } + + result, err = client.GetSubscriptionQuotaResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.ResourceProviderCommonClient", "GetSubscriptionQuota", resp, "Failure responding to request") + return + } + + return +} + +// GetSubscriptionQuotaPreparer prepares the GetSubscriptionQuota request. +func (client ResourceProviderCommonClient) GetSubscriptionQuotaPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSubscriptionQuotaSender sends the GetSubscriptionQuota request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceProviderCommonClient) GetSubscriptionQuotaSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSubscriptionQuotaResponder handles the response to the GetSubscriptionQuota request. The method always +// closes the http.Response Body. +func (client ResourceProviderCommonClient) GetSubscriptionQuotaResponder(resp *http.Response) (result UserSubscriptionQuotaListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/iothub/mgmt/2021-03-31/devices/version.go b/services/iothub/mgmt/2021-03-31/devices/version.go new file mode 100644 index 000000000000..fa2bdb3461eb --- /dev/null +++ b/services/iothub/mgmt/2021-03-31/devices/version.go @@ -0,0 +1,19 @@ +package devices + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " devices/2021-03-31" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/CHANGELOG.md b/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/CHANGELOG.md +++ b/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/_meta.json b/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/_meta.json index 0bda477bc4cb..d69d85af7a93 100644 --- a/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/_meta.json +++ b/services/preview/containerinstance/mgmt/2017-08-01-preview/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2017-08-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2017-08-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-08-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/CHANGELOG.md b/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/CHANGELOG.md index d6841f1e1548..a1ecf841edb0 100644 --- a/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/CHANGELOG.md +++ b/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/CHANGELOG.md @@ -1,8 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) diff --git a/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/_meta.json b/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/_meta.json index 8d947638abc0..8baf1ea95bf5 100644 --- a/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/_meta.json +++ b/services/preview/containerinstance/mgmt/2017-10-01-preview/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2017-10-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2017-10-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-10-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/CHANGELOG.md b/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/CHANGELOG.md index 561c5545ab95..a1ecf841edb0 100644 --- a/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/CHANGELOG.md +++ b/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/_meta.json b/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/_meta.json index 9e7d45972765..4e0615b26be0 100644 --- a/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/_meta.json +++ b/services/preview/containerinstance/mgmt/2017-12-01-preview/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2017-12-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2017-12-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-12-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/CHANGELOG.md b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/CHANGELOG.md index 561c5545ab95..a1ecf841edb0 100644 --- a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/CHANGELOG.md +++ b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ContainerGroupPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. ContainerPropertiesInstanceView.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageListResult.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) diff --git a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/_meta.json b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/_meta.json index b369281ab36e..3d72014a4f80 100644 --- a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/_meta.json +++ b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "tag": "package-2018-02-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-02-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-02-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/containergroups.go b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/containergroups.go index e513695fb3ff..1596d2a6371e 100644 --- a/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/containergroups.go +++ b/services/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance/containergroups.go @@ -67,7 +67,7 @@ func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resource result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -101,6 +101,7 @@ func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2018-12-01-preview/devices/CHANGELOG.md b/services/preview/iothub/mgmt/2018-12-01-preview/devices/CHANGELOG.md index 1ef15e7e7f4e..a1ecf841edb0 100644 --- a/services/preview/iothub/mgmt/2018-12-01-preview/devices/CHANGELOG.md +++ b/services/preview/iothub/mgmt/2018-12-01-preview/devices/CHANGELOG.md @@ -1,14 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/preview/iothub/mgmt/2018-12-01-preview/devices/_meta.json b/services/preview/iothub/mgmt/2018-12-01-preview/devices/_meta.json index ad48d9e19abf..66bfb30e6741 100644 --- a/services/preview/iothub/mgmt/2018-12-01-preview/devices/_meta.json +++ b/services/preview/iothub/mgmt/2018-12-01-preview/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-2018-12-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-12-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-12-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/iothub/mgmt/2018-12-01-preview/devices/iothubresource.go b/services/preview/iothub/mgmt/2018-12-01-preview/devices/iothubresource.go index 395486359be3..c47610910365 100644 --- a/services/preview/iothub/mgmt/2018-12-01-preview/devices/iothubresource.go +++ b/services/preview/iothub/mgmt/2018-12-01-preview/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2170,7 +2173,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2204,6 +2207,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2019-03-22-preview/devices/CHANGELOG.md b/services/preview/iothub/mgmt/2019-03-22-preview/devices/CHANGELOG.md index 1ef15e7e7f4e..a1ecf841edb0 100644 --- a/services/preview/iothub/mgmt/2019-03-22-preview/devices/CHANGELOG.md +++ b/services/preview/iothub/mgmt/2019-03-22-preview/devices/CHANGELOG.md @@ -1,14 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/preview/iothub/mgmt/2019-03-22-preview/devices/_meta.json b/services/preview/iothub/mgmt/2019-03-22-preview/devices/_meta.json index 8df86fdbea06..ae2b636c3212 100644 --- a/services/preview/iothub/mgmt/2019-03-22-preview/devices/_meta.json +++ b/services/preview/iothub/mgmt/2019-03-22-preview/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-preview-2019-03", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-preview-2019-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2019-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothub.go b/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothub.go index 698c36b2b629..959819a53bab 100644 --- a/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothub.go +++ b/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothub.go @@ -61,7 +61,7 @@ func (client IotHubClient) ManualFailover(ctx context.Context, iotHubName string result, err = client.ManualFailoverSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", result.Response(), "Failure sending request") return } @@ -95,6 +95,7 @@ func (client IotHubClient) ManualFailoverPreparer(ctx context.Context, iotHubNam // http.Response Body if it receives an error. func (client IotHubClient) ManualFailoverSender(req *http.Request) (future IotHubManualFailoverFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothubresource.go b/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothubresource.go index f8a8d4ac2e33..34658bc87c79 100644 --- a/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothubresource.go +++ b/services/preview/iothub/mgmt/2019-03-22-preview/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2170,7 +2173,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2204,6 +2207,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2019-07-01-preview/devices/CHANGELOG.md b/services/preview/iothub/mgmt/2019-07-01-preview/devices/CHANGELOG.md index 1ef15e7e7f4e..a1ecf841edb0 100644 --- a/services/preview/iothub/mgmt/2019-07-01-preview/devices/CHANGELOG.md +++ b/services/preview/iothub/mgmt/2019-07-01-preview/devices/CHANGELOG.md @@ -1,14 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/preview/iothub/mgmt/2019-07-01-preview/devices/_meta.json b/services/preview/iothub/mgmt/2019-07-01-preview/devices/_meta.json index 85e2350428bb..d5cf2c36c897 100644 --- a/services/preview/iothub/mgmt/2019-07-01-preview/devices/_meta.json +++ b/services/preview/iothub/mgmt/2019-07-01-preview/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "8a3d2f1e61ac486406edc077f29060de8c02beea", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-preview-2019-07", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-preview-2019-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2019-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothub.go b/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothub.go index 2783cc9e89d1..88bfeda1c46c 100644 --- a/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothub.go +++ b/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothub.go @@ -61,7 +61,7 @@ func (client IotHubClient) ManualFailover(ctx context.Context, iotHubName string result, err = client.ManualFailoverSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", result.Response(), "Failure sending request") return } @@ -95,6 +95,7 @@ func (client IotHubClient) ManualFailoverPreparer(ctx context.Context, iotHubNam // http.Response Body if it receives an error. func (client IotHubClient) ManualFailoverSender(req *http.Request) (future IotHubManualFailoverFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothubresource.go b/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothubresource.go index 4badca2abfc3..3d04e17c4f34 100644 --- a/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothubresource.go +++ b/services/preview/iothub/mgmt/2019-07-01-preview/devices/iothubresource.go @@ -195,7 +195,8 @@ func (client IotHubResourceClient) CreateEventHubConsumerGroupResponder(resp *ht // CreateOrUpdate create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update -// the IoT hub. +// the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to +// default, which may lead to unexpected behavior. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT hub. // resourceName - the name of the IoT hub. @@ -251,7 +252,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -289,6 +290,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -335,7 +337,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -367,6 +369,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -384,7 +387,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2170,7 +2173,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2204,6 +2207,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2021-03-03-preview/devices/CHANGELOG.md b/services/preview/iothub/mgmt/2021-03-03-preview/devices/CHANGELOG.md index 7209a9c23cd7..a1ecf841edb0 100644 --- a/services/preview/iothub/mgmt/2021-03-03-preview/devices/CHANGELOG.md +++ b/services/preview/iothub/mgmt/2021-03-03-preview/devices/CHANGELOG.md @@ -1,16 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ArmUserIdentity.MarshalJSON() ([]byte, error) -1. CertificatePropertiesWithNonce.MarshalJSON() ([]byte, error) -1. ErrorDetails.MarshalJSON() ([]byte, error) -1. IotHubCapacity.MarshalJSON() ([]byte, error) -1. IotHubQuotaMetricInfo.MarshalJSON() ([]byte, error) -1. JobResponse.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. OperationListResult.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. RegistryStatistics.MarshalJSON() ([]byte, error) diff --git a/services/preview/iothub/mgmt/2021-03-03-preview/devices/_meta.json b/services/preview/iothub/mgmt/2021-03-03-preview/devices/_meta.json index 9563c711a1ad..04c7a64c7079 100644 --- a/services/preview/iothub/mgmt/2021-03-03-preview/devices/_meta.json +++ b/services/preview/iothub/mgmt/2021-03-03-preview/devices/_meta.json @@ -1,10 +1,10 @@ { - "commit": "e5839301dfd424559851119c99ef0a2699fbd228", + "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", "readme": "/_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "tag": "package-preview-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-preview-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/iothub/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" } diff --git a/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothub.go b/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothub.go index d94503f419de..5883fa8540df 100644 --- a/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothub.go +++ b/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothub.go @@ -63,7 +63,7 @@ func (client IotHubClient) ManualFailover(ctx context.Context, iotHubName string result, err = client.ManualFailoverSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubClient", "ManualFailover", result.Response(), "Failure sending request") return } @@ -97,6 +97,7 @@ func (client IotHubClient) ManualFailoverPreparer(ctx context.Context, iotHubNam // http.Response Body if it receives an error. func (client IotHubClient) ManualFailoverSender(req *http.Request) (future IotHubManualFailoverFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothubresource.go b/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothubresource.go index 88ff77e6fc7b..9bae69542d97 100644 --- a/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothubresource.go +++ b/services/preview/iothub/mgmt/2021-03-03-preview/devices/iothubresource.go @@ -258,7 +258,7 @@ func (client IotHubResourceClient) CreateOrUpdate(ctx context.Context, resourceG result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -296,6 +296,7 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -342,7 +343,7 @@ func (client IotHubResourceClient) Delete(ctx context.Context, resourceGroupName result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Delete", result.Response(), "Failure sending request") return } @@ -374,6 +375,7 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -391,7 +393,7 @@ func (client IotHubResourceClient) DeleteResponder(resp *http.Response) (result err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -2177,7 +2179,7 @@ func (client IotHubResourceClient) Update(ctx context.Context, resourceGroupName result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.IotHubResourceClient", "Update", result.Response(), "Failure sending request") return } @@ -2211,6 +2213,7 @@ func (client IotHubResourceClient) UpdatePreparer(ctx context.Context, resourceG // http.Response Body if it receives an error. func (client IotHubResourceClient) UpdateSender(req *http.Request) (future IotHubResourceUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return diff --git a/services/preview/iothub/mgmt/2021-03-03-preview/devices/privateendpointconnections.go b/services/preview/iothub/mgmt/2021-03-03-preview/devices/privateendpointconnections.go index 09757ab40d93..50db6679fe24 100644 --- a/services/preview/iothub/mgmt/2021-03-03-preview/devices/privateendpointconnections.go +++ b/services/preview/iothub/mgmt/2021-03-03-preview/devices/privateendpointconnections.go @@ -56,7 +56,7 @@ func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resou result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") return } @@ -89,6 +89,7 @@ func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Contex // http.Response Body if it receives an error. func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -300,7 +301,7 @@ func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resou result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "devices.PrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") return } @@ -338,6 +339,7 @@ func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Contex // http.Response Body if it receives an error. func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return