diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/CHANGELOG.md b/sdk/resourcemanager/databoxedge/armdataboxedge/CHANGELOG.md new file mode 100644 index 000000000000..2e68b73b5168 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 0.1.0 (2021-11-25) diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/LICENSE.txt b/sdk/resourcemanager/databoxedge/armdataboxedge/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/README.md b/sdk/resourcemanager/databoxedge/armdataboxedge/README.md new file mode 100644 index 000000000000..92b40c1ead9a --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/README.md @@ -0,0 +1,75 @@ +# Azure Databoxedge Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoxedge/armdataboxedge)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoxedge/armdataboxedge) + +The `armdataboxedge` module provides operations for working with Azure Databoxedge. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/databoxedge/armdataboxedge) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Databoxedge module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoxedge/armdataboxedge +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Databoxedge. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Databoxedge modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client := armdataboxedge.NewStorageAccountsClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armdataboxedge.NewStorageAccountsClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Databoxedge` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/autorest.md b/sdk/resourcemanager/databoxedge/armdataboxedge/autorest.md new file mode 100644 index 000000000000..b78c3d1b8d14 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /home/vsts/work/1/s/azure-rest-api-specs/specification/databoxedge/resource-manager/readme.md +- /home/vsts/work/1/s/azure-rest-api-specs/specification/databoxedge/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/build.go b/sdk/resourcemanager/databoxedge/armdataboxedge/build.go new file mode 100644 index 000000000000..046de739045a --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/databoxedge/armdataboxedge + +package armdataboxedge diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/ci.yml b/sdk/resourcemanager/databoxedge/armdataboxedge/ci.yml new file mode 100644 index 000000000000..7b650250cc86 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databoxedge/armdataboxedge/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databoxedge/armdataboxedge/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/databoxedge/armdataboxedge' diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/go.mod b/sdk/resourcemanager/databoxedge/armdataboxedge/go.mod new file mode 100644 index 000000000000..3e8e5f49dcaa --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoxedge/armdataboxedge + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v59.3.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 +) diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/go.sum b/sdk/resourcemanager/databoxedge/armdataboxedge/go.sum new file mode 100644 index 000000000000..76d3fa8fd576 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/go.sum @@ -0,0 +1,37 @@ +github.com/Azure/azure-sdk-for-go v59.3.0+incompatible h1:dPIm0BO4jsMXFcCI/sLTPkBtE7mk8WMuRHA0JeWhlcQ= +github.com/Azure/azure-sdk-for-go v59.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/go_mod_tidy_hack.go b/sdk/resourcemanager/databoxedge/armdataboxedge/go_mod_tidy_hack.go new file mode 100644 index 000000000000..1be8792ac64b --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armdataboxedge + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_addons_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_addons_client.go new file mode 100644 index 000000000000..5b7c86d49217 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_addons_client.go @@ -0,0 +1,350 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AddonsClient contains the methods for the Addons group. +// Don't use this type directly, use NewAddonsClient() instead. +type AddonsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAddonsClient creates a new instance of AddonsClient with the specified values. +func NewAddonsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AddonsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AddonsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update a addon. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, addon AddonClassification, options *AddonsBeginCreateOrUpdateOptions) (AddonsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, roleName, addonName, resourceGroupName, addon, options) + if err != nil { + return AddonsCreateOrUpdatePollerResponse{}, err + } + result := AddonsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AddonsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return AddonsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &AddonsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a addon. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) createOrUpdate(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, addon AddonClassification, options *AddonsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, roleName, addonName, resourceGroupName, addon, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AddonsClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, addon AddonClassification, options *AddonsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if addonName == "" { + return nil, errors.New("parameter addonName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addonName}", url.PathEscape(addonName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, addon) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AddonsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the addon on the device. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) BeginDelete(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, options *AddonsBeginDeleteOptions) (AddonsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, roleName, addonName, resourceGroupName, options) + if err != nil { + return AddonsDeletePollerResponse{}, err + } + result := AddonsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AddonsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return AddonsDeletePollerResponse{}, err + } + result.Poller = &AddonsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the addon on the device. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) deleteOperation(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, options *AddonsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, roleName, addonName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AddonsClient) deleteCreateRequest(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, options *AddonsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if addonName == "" { + return nil, errors.New("parameter addonName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addonName}", url.PathEscape(addonName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AddonsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a specific addon by name. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) Get(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, options *AddonsGetOptions) (AddonsGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, roleName, addonName, resourceGroupName, options) + if err != nil { + return AddonsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AddonsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AddonsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AddonsClient) getCreateRequest(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string, options *AddonsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if addonName == "" { + return nil, errors.New("parameter addonName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addonName}", url.PathEscape(addonName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AddonsClient) getHandleResponse(resp *http.Response) (AddonsGetResponse, error) { + result := AddonsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return AddonsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AddonsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByRole - Lists all the addons configured in the role. +// If the operation fails it returns the *CloudError error type. +func (client *AddonsClient) ListByRole(deviceName string, roleName string, resourceGroupName string, options *AddonsListByRoleOptions) *AddonsListByRolePager { + return &AddonsListByRolePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByRoleCreateRequest(ctx, deviceName, roleName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp AddonsListByRoleResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AddonList.NextLink) + }, + } +} + +// listByRoleCreateRequest creates the ListByRole request. +func (client *AddonsClient) listByRoleCreateRequest(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *AddonsListByRoleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByRoleHandleResponse handles the ListByRole response. +func (client *AddonsClient) listByRoleHandleResponse(resp *http.Response) (AddonsListByRoleResponse, error) { + result := AddonsListByRoleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AddonList); err != nil { + return AddonsListByRoleResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByRoleHandleError handles the ListByRole error response. +func (client *AddonsClient) listByRoleHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_alerts_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_alerts_client.go new file mode 100644 index 000000000000..39dd5a663759 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_alerts_client.go @@ -0,0 +1,174 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AlertsClient contains the methods for the Alerts group. +// Don't use this type directly, use NewAlertsClient() instead. +type AlertsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAlertsClient creates a new instance of AlertsClient with the specified values. +func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets an alert by name. +// If the operation fails it returns the *CloudError error type. +func (client *AlertsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *AlertsGetOptions) (AlertsGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return AlertsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertsClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *AlertsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsGetResponse, error) { + result := AlertsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { + return AlertsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AlertsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Gets all the alerts for a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *AlertsClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *AlertsListByDataBoxEdgeDeviceOptions) *AlertsListByDataBoxEdgeDevicePager { + return &AlertsListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp AlertsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AlertList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *AlertsClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *AlertsListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *AlertsClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (AlertsListByDataBoxEdgeDeviceResponse, error) { + result := AlertsListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { + return AlertsListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *AlertsClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_availableskus_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_availableskus_client.go new file mode 100644 index 000000000000..b5ef8be47dfd --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_availableskus_client.go @@ -0,0 +1,97 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableSKUsClient contains the methods for the AvailableSKUs group. +// Don't use this type directly, use NewAvailableSKUsClient() instead. +type AvailableSKUsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAvailableSKUsClient creates a new instance of AvailableSKUsClient with the specified values. +func NewAvailableSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - List all the available Skus and information related to them. +// If the operation fails it returns the *CloudError error type. +func (client *AvailableSKUsClient) List(options *AvailableSKUsListOptions) *AvailableSKUsListPager { + return &AvailableSKUsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp AvailableSKUsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DataBoxEdgeSKUList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *AvailableSKUsClient) listCreateRequest(ctx context.Context, options *AvailableSKUsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableSKUsClient) listHandleResponse(resp *http.Response) (AvailableSKUsListResponse, error) { + result := AvailableSKUsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeSKUList); err != nil { + return AvailableSKUsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AvailableSKUsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_bandwidthschedules_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_bandwidthschedules_client.go new file mode 100644 index 000000000000..acb1dbbadba1 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_bandwidthschedules_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BandwidthSchedulesClient contains the methods for the BandwidthSchedules group. +// Don't use this type directly, use NewBandwidthSchedulesClient() instead. +type BandwidthSchedulesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewBandwidthSchedulesClient creates a new instance of BandwidthSchedulesClient with the specified values. +func NewBandwidthSchedulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BandwidthSchedulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BandwidthSchedulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a bandwidth schedule. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, parameters BandwidthSchedule, options *BandwidthSchedulesBeginCreateOrUpdateOptions) (BandwidthSchedulesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, parameters, options) + if err != nil { + return BandwidthSchedulesCreateOrUpdatePollerResponse{}, err + } + result := BandwidthSchedulesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BandwidthSchedulesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return BandwidthSchedulesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &BandwidthSchedulesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a bandwidth schedule. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, parameters BandwidthSchedule, options *BandwidthSchedulesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BandwidthSchedulesClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, parameters BandwidthSchedule, options *BandwidthSchedulesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *BandwidthSchedulesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified bandwidth schedule. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *BandwidthSchedulesBeginDeleteOptions) (BandwidthSchedulesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return BandwidthSchedulesDeletePollerResponse{}, err + } + result := BandwidthSchedulesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BandwidthSchedulesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return BandwidthSchedulesDeletePollerResponse{}, err + } + result.Poller = &BandwidthSchedulesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified bandwidth schedule. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *BandwidthSchedulesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BandwidthSchedulesClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *BandwidthSchedulesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *BandwidthSchedulesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified bandwidth schedule. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *BandwidthSchedulesGetOptions) (BandwidthSchedulesGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return BandwidthSchedulesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BandwidthSchedulesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BandwidthSchedulesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BandwidthSchedulesClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *BandwidthSchedulesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BandwidthSchedulesClient) getHandleResponse(resp *http.Response) (BandwidthSchedulesGetResponse, error) { + result := BandwidthSchedulesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BandwidthSchedule); err != nil { + return BandwidthSchedulesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *BandwidthSchedulesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *BandwidthSchedulesClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *BandwidthSchedulesListByDataBoxEdgeDeviceOptions) *BandwidthSchedulesListByDataBoxEdgeDevicePager { + return &BandwidthSchedulesListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp BandwidthSchedulesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.BandwidthSchedulesList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *BandwidthSchedulesClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *BandwidthSchedulesListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *BandwidthSchedulesClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (BandwidthSchedulesListByDataBoxEdgeDeviceResponse, error) { + result := BandwidthSchedulesListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BandwidthSchedulesList); err != nil { + return BandwidthSchedulesListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *BandwidthSchedulesClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_constants.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_constants.go new file mode 100644 index 000000000000..98f1ea91a8cd --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_constants.go @@ -0,0 +1,1661 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +const ( + module = "armdataboxedge" + version = "v0.1.0" +) + +// AccessLevel - Access level allowed for this remote application type +type AccessLevel string + +const ( + AccessLevelFullAccess AccessLevel = "FullAccess" + AccessLevelNone AccessLevel = "None" + AccessLevelReadOnly AccessLevel = "ReadOnly" + AccessLevelReadWrite AccessLevel = "ReadWrite" +) + +// PossibleAccessLevelValues returns the possible values for the AccessLevel const type. +func PossibleAccessLevelValues() []AccessLevel { + return []AccessLevel{ + AccessLevelFullAccess, + AccessLevelNone, + AccessLevelReadOnly, + AccessLevelReadWrite, + } +} + +// ToPtr returns a *AccessLevel pointing to the current value. +func (c AccessLevel) ToPtr() *AccessLevel { + return &c +} + +// AccountType - Type of storage accessed on the storage account. +type AccountType string + +const ( + AccountTypeBlobStorage AccountType = "BlobStorage" + AccountTypeGeneralPurposeStorage AccountType = "GeneralPurposeStorage" +) + +// PossibleAccountTypeValues returns the possible values for the AccountType const type. +func PossibleAccountTypeValues() []AccountType { + return []AccountType{ + AccountTypeBlobStorage, + AccountTypeGeneralPurposeStorage, + } +} + +// ToPtr returns a *AccountType pointing to the current value. +func (c AccountType) ToPtr() *AccountType { + return &c +} + +// AddonState - Addon Provisioning State +type AddonState string + +const ( + AddonStateCreated AddonState = "Created" + AddonStateCreating AddonState = "Creating" + AddonStateDeleting AddonState = "Deleting" + AddonStateFailed AddonState = "Failed" + AddonStateInvalid AddonState = "Invalid" + AddonStateReconfiguring AddonState = "Reconfiguring" + AddonStateUpdating AddonState = "Updating" +) + +// PossibleAddonStateValues returns the possible values for the AddonState const type. +func PossibleAddonStateValues() []AddonState { + return []AddonState{ + AddonStateCreated, + AddonStateCreating, + AddonStateDeleting, + AddonStateFailed, + AddonStateInvalid, + AddonStateReconfiguring, + AddonStateUpdating, + } +} + +// ToPtr returns a *AddonState pointing to the current value. +func (c AddonState) ToPtr() *AddonState { + return &c +} + +// AddonType - Addon type. +type AddonType string + +const ( + AddonTypeArcForKubernetes AddonType = "ArcForKubernetes" + AddonTypeIotEdge AddonType = "IotEdge" +) + +// PossibleAddonTypeValues returns the possible values for the AddonType const type. +func PossibleAddonTypeValues() []AddonType { + return []AddonType{ + AddonTypeArcForKubernetes, + AddonTypeIotEdge, + } +} + +// ToPtr returns a *AddonType pointing to the current value. +func (c AddonType) ToPtr() *AddonType { + return &c +} + +// AlertSeverity - Severity of the alert. +type AlertSeverity string + +const ( + AlertSeverityCritical AlertSeverity = "Critical" + AlertSeverityInformational AlertSeverity = "Informational" + AlertSeverityWarning AlertSeverity = "Warning" +) + +// PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type. +func PossibleAlertSeverityValues() []AlertSeverity { + return []AlertSeverity{ + AlertSeverityCritical, + AlertSeverityInformational, + AlertSeverityWarning, + } +} + +// ToPtr returns a *AlertSeverity pointing to the current value. +func (c AlertSeverity) ToPtr() *AlertSeverity { + return &c +} + +// AuthenticationType - The authentication type. +type AuthenticationType string + +const ( + AuthenticationTypeAzureActiveDirectory AuthenticationType = "AzureActiveDirectory" + AuthenticationTypeInvalid AuthenticationType = "Invalid" +) + +// PossibleAuthenticationTypeValues returns the possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{ + AuthenticationTypeAzureActiveDirectory, + AuthenticationTypeInvalid, + } +} + +// ToPtr returns a *AuthenticationType pointing to the current value. +func (c AuthenticationType) ToPtr() *AuthenticationType { + return &c +} + +// AzureContainerDataFormat - Storage format used for the file represented by the share. +type AzureContainerDataFormat string + +const ( + AzureContainerDataFormatAzureFile AzureContainerDataFormat = "AzureFile" + AzureContainerDataFormatBlockBlob AzureContainerDataFormat = "BlockBlob" + AzureContainerDataFormatPageBlob AzureContainerDataFormat = "PageBlob" +) + +// PossibleAzureContainerDataFormatValues returns the possible values for the AzureContainerDataFormat const type. +func PossibleAzureContainerDataFormatValues() []AzureContainerDataFormat { + return []AzureContainerDataFormat{ + AzureContainerDataFormatAzureFile, + AzureContainerDataFormatBlockBlob, + AzureContainerDataFormatPageBlob, + } +} + +// ToPtr returns a *AzureContainerDataFormat pointing to the current value. +func (c AzureContainerDataFormat) ToPtr() *AzureContainerDataFormat { + return &c +} + +// ClientPermissionType - Type of access to be allowed for the client. +type ClientPermissionType string + +const ( + ClientPermissionTypeNoAccess ClientPermissionType = "NoAccess" + ClientPermissionTypeReadOnly ClientPermissionType = "ReadOnly" + ClientPermissionTypeReadWrite ClientPermissionType = "ReadWrite" +) + +// PossibleClientPermissionTypeValues returns the possible values for the ClientPermissionType const type. +func PossibleClientPermissionTypeValues() []ClientPermissionType { + return []ClientPermissionType{ + ClientPermissionTypeNoAccess, + ClientPermissionTypeReadOnly, + ClientPermissionTypeReadWrite, + } +} + +// ToPtr returns a *ClientPermissionType pointing to the current value. +func (c ClientPermissionType) ToPtr() *ClientPermissionType { + return &c +} + +// ContainerStatus - Current status of the container. +type ContainerStatus string + +const ( + ContainerStatusNeedsAttention ContainerStatus = "NeedsAttention" + ContainerStatusOK ContainerStatus = "OK" + ContainerStatusOffline ContainerStatus = "Offline" + ContainerStatusUnknown ContainerStatus = "Unknown" + ContainerStatusUpdating ContainerStatus = "Updating" +) + +// PossibleContainerStatusValues returns the possible values for the ContainerStatus const type. +func PossibleContainerStatusValues() []ContainerStatus { + return []ContainerStatus{ + ContainerStatusNeedsAttention, + ContainerStatusOK, + ContainerStatusOffline, + ContainerStatusUnknown, + ContainerStatusUpdating, + } +} + +// ToPtr returns a *ContainerStatus pointing to the current value. +func (c ContainerStatus) ToPtr() *ContainerStatus { + return &c +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// DataBoxEdgeDeviceKind - The kind of the device. +type DataBoxEdgeDeviceKind string + +const ( + DataBoxEdgeDeviceKindAzureDataBoxGateway DataBoxEdgeDeviceKind = "AzureDataBoxGateway" + DataBoxEdgeDeviceKindAzureModularDataCentre DataBoxEdgeDeviceKind = "AzureModularDataCentre" + DataBoxEdgeDeviceKindAzureStackEdge DataBoxEdgeDeviceKind = "AzureStackEdge" + DataBoxEdgeDeviceKindAzureStackHub DataBoxEdgeDeviceKind = "AzureStackHub" +) + +// PossibleDataBoxEdgeDeviceKindValues returns the possible values for the DataBoxEdgeDeviceKind const type. +func PossibleDataBoxEdgeDeviceKindValues() []DataBoxEdgeDeviceKind { + return []DataBoxEdgeDeviceKind{ + DataBoxEdgeDeviceKindAzureDataBoxGateway, + DataBoxEdgeDeviceKindAzureModularDataCentre, + DataBoxEdgeDeviceKindAzureStackEdge, + DataBoxEdgeDeviceKindAzureStackHub, + } +} + +// ToPtr returns a *DataBoxEdgeDeviceKind pointing to the current value. +func (c DataBoxEdgeDeviceKind) ToPtr() *DataBoxEdgeDeviceKind { + return &c +} + +// DataBoxEdgeDeviceStatus - The status of the Data Box Edge/Gateway device. +type DataBoxEdgeDeviceStatus string + +const ( + DataBoxEdgeDeviceStatusDisconnected DataBoxEdgeDeviceStatus = "Disconnected" + DataBoxEdgeDeviceStatusMaintenance DataBoxEdgeDeviceStatus = "Maintenance" + DataBoxEdgeDeviceStatusNeedsAttention DataBoxEdgeDeviceStatus = "NeedsAttention" + DataBoxEdgeDeviceStatusOffline DataBoxEdgeDeviceStatus = "Offline" + DataBoxEdgeDeviceStatusOnline DataBoxEdgeDeviceStatus = "Online" + DataBoxEdgeDeviceStatusPartiallyDisconnected DataBoxEdgeDeviceStatus = "PartiallyDisconnected" + DataBoxEdgeDeviceStatusReadyToSetup DataBoxEdgeDeviceStatus = "ReadyToSetup" +) + +// PossibleDataBoxEdgeDeviceStatusValues returns the possible values for the DataBoxEdgeDeviceStatus const type. +func PossibleDataBoxEdgeDeviceStatusValues() []DataBoxEdgeDeviceStatus { + return []DataBoxEdgeDeviceStatus{ + DataBoxEdgeDeviceStatusDisconnected, + DataBoxEdgeDeviceStatusMaintenance, + DataBoxEdgeDeviceStatusNeedsAttention, + DataBoxEdgeDeviceStatusOffline, + DataBoxEdgeDeviceStatusOnline, + DataBoxEdgeDeviceStatusPartiallyDisconnected, + DataBoxEdgeDeviceStatusReadyToSetup, + } +} + +// ToPtr returns a *DataBoxEdgeDeviceStatus pointing to the current value. +func (c DataBoxEdgeDeviceStatus) ToPtr() *DataBoxEdgeDeviceStatus { + return &c +} + +// DataPolicy - Data policy of the share. +type DataPolicy string + +const ( + DataPolicyCloud DataPolicy = "Cloud" + DataPolicyLocal DataPolicy = "Local" +) + +// PossibleDataPolicyValues returns the possible values for the DataPolicy const type. +func PossibleDataPolicyValues() []DataPolicy { + return []DataPolicy{ + DataPolicyCloud, + DataPolicyLocal, + } +} + +// ToPtr returns a *DataPolicy pointing to the current value. +func (c DataPolicy) ToPtr() *DataPolicy { + return &c +} + +// DataResidencyType - DataResidencyType enum +type DataResidencyType string + +const ( + DataResidencyTypeGeoZoneReplication DataResidencyType = "GeoZoneReplication" + DataResidencyTypeZoneReplication DataResidencyType = "ZoneReplication" +) + +// PossibleDataResidencyTypeValues returns the possible values for the DataResidencyType const type. +func PossibleDataResidencyTypeValues() []DataResidencyType { + return []DataResidencyType{ + DataResidencyTypeGeoZoneReplication, + DataResidencyTypeZoneReplication, + } +} + +// ToPtr returns a *DataResidencyType pointing to the current value. +func (c DataResidencyType) ToPtr() *DataResidencyType { + return &c +} + +type DayOfWeek string + +const ( + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +// PossibleDayOfWeekValues returns the possible values for the DayOfWeek const type. +func PossibleDayOfWeekValues() []DayOfWeek { + return []DayOfWeek{ + DayOfWeekFriday, + DayOfWeekMonday, + DayOfWeekSaturday, + DayOfWeekSunday, + DayOfWeekThursday, + DayOfWeekTuesday, + DayOfWeekWednesday, + } +} + +// ToPtr returns a *DayOfWeek pointing to the current value. +func (c DayOfWeek) ToPtr() *DayOfWeek { + return &c +} + +// DeviceType - The type of the Data Box Edge/Gateway device. +type DeviceType string + +const ( + DeviceTypeDataBoxEdgeDevice DeviceType = "DataBoxEdgeDevice" +) + +// PossibleDeviceTypeValues returns the possible values for the DeviceType const type. +func PossibleDeviceTypeValues() []DeviceType { + return []DeviceType{ + DeviceTypeDataBoxEdgeDevice, + } +} + +// ToPtr returns a *DeviceType pointing to the current value. +func (c DeviceType) ToPtr() *DeviceType { + return &c +} + +// DownloadPhase - The download phase. +type DownloadPhase string + +const ( + DownloadPhaseDownloading DownloadPhase = "Downloading" + DownloadPhaseInitializing DownloadPhase = "Initializing" + DownloadPhaseUnknown DownloadPhase = "Unknown" + DownloadPhaseVerifying DownloadPhase = "Verifying" +) + +// PossibleDownloadPhaseValues returns the possible values for the DownloadPhase const type. +func PossibleDownloadPhaseValues() []DownloadPhase { + return []DownloadPhase{ + DownloadPhaseDownloading, + DownloadPhaseInitializing, + DownloadPhaseUnknown, + DownloadPhaseVerifying, + } +} + +// ToPtr returns a *DownloadPhase pointing to the current value. +func (c DownloadPhase) ToPtr() *DownloadPhase { + return &c +} + +// EncryptionAlgorithm - The algorithm used to encrypt "Value". +type EncryptionAlgorithm string + +const ( + EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + EncryptionAlgorithmRSAESPKCS1V15 EncryptionAlgorithm = "RSAES_PKCS1_v_1_5" +) + +// PossibleEncryptionAlgorithmValues returns the possible values for the EncryptionAlgorithm const type. +func PossibleEncryptionAlgorithmValues() []EncryptionAlgorithm { + return []EncryptionAlgorithm{ + EncryptionAlgorithmAES256, + EncryptionAlgorithmNone, + EncryptionAlgorithmRSAESPKCS1V15, + } +} + +// ToPtr returns a *EncryptionAlgorithm pointing to the current value. +func (c EncryptionAlgorithm) ToPtr() *EncryptionAlgorithm { + return &c +} + +// HostPlatformType - Platform where the runtime is hosted. +type HostPlatformType string + +const ( + HostPlatformTypeKubernetesCluster HostPlatformType = "KubernetesCluster" + HostPlatformTypeLinuxVM HostPlatformType = "LinuxVM" +) + +// PossibleHostPlatformTypeValues returns the possible values for the HostPlatformType const type. +func PossibleHostPlatformTypeValues() []HostPlatformType { + return []HostPlatformType{ + HostPlatformTypeKubernetesCluster, + HostPlatformTypeLinuxVM, + } +} + +// ToPtr returns a *HostPlatformType pointing to the current value. +func (c HostPlatformType) ToPtr() *HostPlatformType { + return &c +} + +// InstallRebootBehavior - Indicates if updates are available and at least one of the updates needs a reboot. +type InstallRebootBehavior string + +const ( + InstallRebootBehaviorNeverReboots InstallRebootBehavior = "NeverReboots" + InstallRebootBehaviorRequestReboot InstallRebootBehavior = "RequestReboot" + InstallRebootBehaviorRequiresReboot InstallRebootBehavior = "RequiresReboot" +) + +// PossibleInstallRebootBehaviorValues returns the possible values for the InstallRebootBehavior const type. +func PossibleInstallRebootBehaviorValues() []InstallRebootBehavior { + return []InstallRebootBehavior{ + InstallRebootBehaviorNeverReboots, + InstallRebootBehaviorRequestReboot, + InstallRebootBehaviorRequiresReboot, + } +} + +// ToPtr returns a *InstallRebootBehavior pointing to the current value. +func (c InstallRebootBehavior) ToPtr() *InstallRebootBehavior { + return &c +} + +// InstallationImpact - Impact of Installing an updateType +type InstallationImpact string + +const ( + InstallationImpactDeviceRebooted InstallationImpact = "DeviceRebooted" + InstallationImpactKubernetesWorkloadsDown InstallationImpact = "KubernetesWorkloadsDown" + InstallationImpactNone InstallationImpact = "None" +) + +// PossibleInstallationImpactValues returns the possible values for the InstallationImpact const type. +func PossibleInstallationImpactValues() []InstallationImpact { + return []InstallationImpact{ + InstallationImpactDeviceRebooted, + InstallationImpactKubernetesWorkloadsDown, + InstallationImpactNone, + } +} + +// ToPtr returns a *InstallationImpact pointing to the current value. +func (c InstallationImpact) ToPtr() *InstallationImpact { + return &c +} + +// JobStatus - The current status of the job. +type JobStatus string + +const ( + JobStatusCanceled JobStatus = "Canceled" + JobStatusFailed JobStatus = "Failed" + JobStatusInvalid JobStatus = "Invalid" + JobStatusPaused JobStatus = "Paused" + JobStatusRunning JobStatus = "Running" + JobStatusScheduled JobStatus = "Scheduled" + JobStatusSucceeded JobStatus = "Succeeded" +) + +// PossibleJobStatusValues returns the possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{ + JobStatusCanceled, + JobStatusFailed, + JobStatusInvalid, + JobStatusPaused, + JobStatusRunning, + JobStatusScheduled, + JobStatusSucceeded, + } +} + +// ToPtr returns a *JobStatus pointing to the current value. +func (c JobStatus) ToPtr() *JobStatus { + return &c +} + +// JobType - The type of the job. +type JobType string + +const ( + JobTypeBackup JobType = "Backup" + JobTypeDownloadUpdates JobType = "DownloadUpdates" + JobTypeInstallUpdates JobType = "InstallUpdates" + JobTypeInvalid JobType = "Invalid" + JobTypeRefreshContainer JobType = "RefreshContainer" + JobTypeRefreshShare JobType = "RefreshShare" + JobTypeRestore JobType = "Restore" + JobTypeScanForUpdates JobType = "ScanForUpdates" + JobTypeTriggerSupportPackage JobType = "TriggerSupportPackage" +) + +// PossibleJobTypeValues returns the possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{ + JobTypeBackup, + JobTypeDownloadUpdates, + JobTypeInstallUpdates, + JobTypeInvalid, + JobTypeRefreshContainer, + JobTypeRefreshShare, + JobTypeRestore, + JobTypeScanForUpdates, + JobTypeTriggerSupportPackage, + } +} + +// ToPtr returns a *JobType pointing to the current value. +func (c JobType) ToPtr() *JobType { + return &c +} + +// KeyVaultSyncStatus - For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. +type KeyVaultSyncStatus string + +const ( + KeyVaultSyncStatusKeyVaultNotConfigured KeyVaultSyncStatus = "KeyVaultNotConfigured" + KeyVaultSyncStatusKeyVaultNotSynced KeyVaultSyncStatus = "KeyVaultNotSynced" + KeyVaultSyncStatusKeyVaultSyncFailed KeyVaultSyncStatus = "KeyVaultSyncFailed" + KeyVaultSyncStatusKeyVaultSyncPending KeyVaultSyncStatus = "KeyVaultSyncPending" + KeyVaultSyncStatusKeyVaultSynced KeyVaultSyncStatus = "KeyVaultSynced" + KeyVaultSyncStatusKeyVaultSyncing KeyVaultSyncStatus = "KeyVaultSyncing" +) + +// PossibleKeyVaultSyncStatusValues returns the possible values for the KeyVaultSyncStatus const type. +func PossibleKeyVaultSyncStatusValues() []KeyVaultSyncStatus { + return []KeyVaultSyncStatus{ + KeyVaultSyncStatusKeyVaultNotConfigured, + KeyVaultSyncStatusKeyVaultNotSynced, + KeyVaultSyncStatusKeyVaultSyncFailed, + KeyVaultSyncStatusKeyVaultSyncPending, + KeyVaultSyncStatusKeyVaultSynced, + KeyVaultSyncStatusKeyVaultSyncing, + } +} + +// ToPtr returns a *KeyVaultSyncStatus pointing to the current value. +func (c KeyVaultSyncStatus) ToPtr() *KeyVaultSyncStatus { + return &c +} + +// KubernetesNodeType - Node type - Master/Worker +type KubernetesNodeType string + +const ( + KubernetesNodeTypeInvalid KubernetesNodeType = "Invalid" + KubernetesNodeTypeMaster KubernetesNodeType = "Master" + KubernetesNodeTypeWorker KubernetesNodeType = "Worker" +) + +// PossibleKubernetesNodeTypeValues returns the possible values for the KubernetesNodeType const type. +func PossibleKubernetesNodeTypeValues() []KubernetesNodeType { + return []KubernetesNodeType{ + KubernetesNodeTypeInvalid, + KubernetesNodeTypeMaster, + KubernetesNodeTypeWorker, + } +} + +// ToPtr returns a *KubernetesNodeType pointing to the current value. +func (c KubernetesNodeType) ToPtr() *KubernetesNodeType { + return &c +} + +// KubernetesState - State of Kubernetes deployment +type KubernetesState string + +const ( + KubernetesStateCreated KubernetesState = "Created" + KubernetesStateCreating KubernetesState = "Creating" + KubernetesStateDeleting KubernetesState = "Deleting" + KubernetesStateFailed KubernetesState = "Failed" + KubernetesStateInvalid KubernetesState = "Invalid" + KubernetesStateReconfiguring KubernetesState = "Reconfiguring" + KubernetesStateUpdating KubernetesState = "Updating" +) + +// PossibleKubernetesStateValues returns the possible values for the KubernetesState const type. +func PossibleKubernetesStateValues() []KubernetesState { + return []KubernetesState{ + KubernetesStateCreated, + KubernetesStateCreating, + KubernetesStateDeleting, + KubernetesStateFailed, + KubernetesStateInvalid, + KubernetesStateReconfiguring, + KubernetesStateUpdating, + } +} + +// ToPtr returns a *KubernetesState pointing to the current value. +func (c KubernetesState) ToPtr() *KubernetesState { + return &c +} + +// MetricAggregationType - Metric aggregation type. +type MetricAggregationType string + +const ( + MetricAggregationTypeAverage MetricAggregationType = "Average" + MetricAggregationTypeCount MetricAggregationType = "Count" + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + MetricAggregationTypeNone MetricAggregationType = "None" + MetricAggregationTypeNotSpecified MetricAggregationType = "NotSpecified" + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{ + MetricAggregationTypeAverage, + MetricAggregationTypeCount, + MetricAggregationTypeMaximum, + MetricAggregationTypeMinimum, + MetricAggregationTypeNone, + MetricAggregationTypeNotSpecified, + MetricAggregationTypeTotal, + } +} + +// ToPtr returns a *MetricAggregationType pointing to the current value. +func (c MetricAggregationType) ToPtr() *MetricAggregationType { + return &c +} + +// MetricCategory - Metric category. +type MetricCategory string + +const ( + MetricCategoryCapacity MetricCategory = "Capacity" + MetricCategoryTransaction MetricCategory = "Transaction" +) + +// PossibleMetricCategoryValues returns the possible values for the MetricCategory const type. +func PossibleMetricCategoryValues() []MetricCategory { + return []MetricCategory{ + MetricCategoryCapacity, + MetricCategoryTransaction, + } +} + +// ToPtr returns a *MetricCategory pointing to the current value. +func (c MetricCategory) ToPtr() *MetricCategory { + return &c +} + +// MetricUnit - Metric units. +type MetricUnit string + +const ( + MetricUnitBytes MetricUnit = "Bytes" + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + MetricUnitCount MetricUnit = "Count" + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + MetricUnitMilliseconds MetricUnit = "Milliseconds" + MetricUnitNotSpecified MetricUnit = "NotSpecified" + MetricUnitPercent MetricUnit = "Percent" + MetricUnitSeconds MetricUnit = "Seconds" +) + +// PossibleMetricUnitValues returns the possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{ + MetricUnitBytes, + MetricUnitBytesPerSecond, + MetricUnitCount, + MetricUnitCountPerSecond, + MetricUnitMilliseconds, + MetricUnitNotSpecified, + MetricUnitPercent, + MetricUnitSeconds, + } +} + +// ToPtr returns a *MetricUnit pointing to the current value. +func (c MetricUnit) ToPtr() *MetricUnit { + return &c +} + +// MonitoringStatus - Current monitoring status of the share. +type MonitoringStatus string + +const ( + MonitoringStatusDisabled MonitoringStatus = "Disabled" + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +// PossibleMonitoringStatusValues returns the possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{ + MonitoringStatusDisabled, + MonitoringStatusEnabled, + } +} + +// ToPtr returns a *MonitoringStatus pointing to the current value. +func (c MonitoringStatus) ToPtr() *MonitoringStatus { + return &c +} + +// MountType - Mounting type. +type MountType string + +const ( + MountTypeHostPath MountType = "HostPath" + MountTypeVolume MountType = "Volume" +) + +// PossibleMountTypeValues returns the possible values for the MountType const type. +func PossibleMountTypeValues() []MountType { + return []MountType{ + MountTypeHostPath, + MountTypeVolume, + } +} + +// ToPtr returns a *MountType pointing to the current value. +func (c MountType) ToPtr() *MountType { + return &c +} + +// MsiIdentityType - Identity type +type MsiIdentityType string + +const ( + MsiIdentityTypeNone MsiIdentityType = "None" + MsiIdentityTypeSystemAssigned MsiIdentityType = "SystemAssigned" + MsiIdentityTypeUserAssigned MsiIdentityType = "UserAssigned" +) + +// PossibleMsiIdentityTypeValues returns the possible values for the MsiIdentityType const type. +func PossibleMsiIdentityTypeValues() []MsiIdentityType { + return []MsiIdentityType{ + MsiIdentityTypeNone, + MsiIdentityTypeSystemAssigned, + MsiIdentityTypeUserAssigned, + } +} + +// ToPtr returns a *MsiIdentityType pointing to the current value. +func (c MsiIdentityType) ToPtr() *MsiIdentityType { + return &c +} + +// NetworkAdapterDHCPStatus - Value indicating whether this adapter has DHCP enabled. +type NetworkAdapterDHCPStatus string + +const ( + NetworkAdapterDHCPStatusDisabled NetworkAdapterDHCPStatus = "Disabled" + NetworkAdapterDHCPStatusEnabled NetworkAdapterDHCPStatus = "Enabled" +) + +// PossibleNetworkAdapterDHCPStatusValues returns the possible values for the NetworkAdapterDHCPStatus const type. +func PossibleNetworkAdapterDHCPStatusValues() []NetworkAdapterDHCPStatus { + return []NetworkAdapterDHCPStatus{ + NetworkAdapterDHCPStatusDisabled, + NetworkAdapterDHCPStatusEnabled, + } +} + +// ToPtr returns a *NetworkAdapterDHCPStatus pointing to the current value. +func (c NetworkAdapterDHCPStatus) ToPtr() *NetworkAdapterDHCPStatus { + return &c +} + +// NetworkAdapterRDMAStatus - Value indicating whether this adapter is RDMA capable. +type NetworkAdapterRDMAStatus string + +const ( + NetworkAdapterRDMAStatusCapable NetworkAdapterRDMAStatus = "Capable" + NetworkAdapterRDMAStatusIncapable NetworkAdapterRDMAStatus = "Incapable" +) + +// PossibleNetworkAdapterRDMAStatusValues returns the possible values for the NetworkAdapterRDMAStatus const type. +func PossibleNetworkAdapterRDMAStatusValues() []NetworkAdapterRDMAStatus { + return []NetworkAdapterRDMAStatus{ + NetworkAdapterRDMAStatusCapable, + NetworkAdapterRDMAStatusIncapable, + } +} + +// ToPtr returns a *NetworkAdapterRDMAStatus pointing to the current value. +func (c NetworkAdapterRDMAStatus) ToPtr() *NetworkAdapterRDMAStatus { + return &c +} + +// NetworkAdapterStatus - Value indicating whether this adapter is valid. +type NetworkAdapterStatus string + +const ( + NetworkAdapterStatusActive NetworkAdapterStatus = "Active" + NetworkAdapterStatusInactive NetworkAdapterStatus = "Inactive" +) + +// PossibleNetworkAdapterStatusValues returns the possible values for the NetworkAdapterStatus const type. +func PossibleNetworkAdapterStatusValues() []NetworkAdapterStatus { + return []NetworkAdapterStatus{ + NetworkAdapterStatusActive, + NetworkAdapterStatusInactive, + } +} + +// ToPtr returns a *NetworkAdapterStatus pointing to the current value. +func (c NetworkAdapterStatus) ToPtr() *NetworkAdapterStatus { + return &c +} + +// NetworkGroup - The network group. +type NetworkGroup string + +const ( + NetworkGroupNonRDMA NetworkGroup = "NonRDMA" + NetworkGroupNone NetworkGroup = "None" + NetworkGroupRDMA NetworkGroup = "RDMA" +) + +// PossibleNetworkGroupValues returns the possible values for the NetworkGroup const type. +func PossibleNetworkGroupValues() []NetworkGroup { + return []NetworkGroup{ + NetworkGroupNonRDMA, + NetworkGroupNone, + NetworkGroupRDMA, + } +} + +// ToPtr returns a *NetworkGroup pointing to the current value. +func (c NetworkGroup) ToPtr() *NetworkGroup { + return &c +} + +// NodeStatus - The current status of the individual node +type NodeStatus string + +const ( + NodeStatusDown NodeStatus = "Down" + NodeStatusRebooting NodeStatus = "Rebooting" + NodeStatusShuttingDown NodeStatus = "ShuttingDown" + NodeStatusUnknown NodeStatus = "Unknown" + NodeStatusUp NodeStatus = "Up" +) + +// PossibleNodeStatusValues returns the possible values for the NodeStatus const type. +func PossibleNodeStatusValues() []NodeStatus { + return []NodeStatus{ + NodeStatusDown, + NodeStatusRebooting, + NodeStatusShuttingDown, + NodeStatusUnknown, + NodeStatusUp, + } +} + +// ToPtr returns a *NodeStatus pointing to the current value. +func (c NodeStatus) ToPtr() *NodeStatus { + return &c +} + +// OrderState - Status of the order as per the allowed status types. +type OrderState string + +const ( + OrderStateArriving OrderState = "Arriving" + OrderStateAwaitingDrop OrderState = "AwaitingDrop" + OrderStateAwaitingFulfillment OrderState = "AwaitingFulfillment" + OrderStateAwaitingPickup OrderState = "AwaitingPickup" + OrderStateAwaitingPreparation OrderState = "AwaitingPreparation" + OrderStateAwaitingReturnShipment OrderState = "AwaitingReturnShipment" + OrderStateAwaitingShipment OrderState = "AwaitingShipment" + OrderStateCollectedAtMicrosoft OrderState = "CollectedAtMicrosoft" + OrderStateDeclined OrderState = "Declined" + OrderStateDelivered OrderState = "Delivered" + OrderStateLostDevice OrderState = "LostDevice" + OrderStatePickupCompleted OrderState = "PickupCompleted" + OrderStateReplacementRequested OrderState = "ReplacementRequested" + OrderStateReturnInitiated OrderState = "ReturnInitiated" + OrderStateShipped OrderState = "Shipped" + OrderStateShippedBack OrderState = "ShippedBack" + OrderStateUntracked OrderState = "Untracked" +) + +// PossibleOrderStateValues returns the possible values for the OrderState const type. +func PossibleOrderStateValues() []OrderState { + return []OrderState{ + OrderStateArriving, + OrderStateAwaitingDrop, + OrderStateAwaitingFulfillment, + OrderStateAwaitingPickup, + OrderStateAwaitingPreparation, + OrderStateAwaitingReturnShipment, + OrderStateAwaitingShipment, + OrderStateCollectedAtMicrosoft, + OrderStateDeclined, + OrderStateDelivered, + OrderStateLostDevice, + OrderStatePickupCompleted, + OrderStateReplacementRequested, + OrderStateReturnInitiated, + OrderStateShipped, + OrderStateShippedBack, + OrderStateUntracked, + } +} + +// ToPtr returns a *OrderState pointing to the current value. +func (c OrderState) ToPtr() *OrderState { + return &c +} + +// PlatformType - Host OS supported by the Arc addon. +type PlatformType string + +const ( + PlatformTypeLinux PlatformType = "Linux" + PlatformTypeWindows PlatformType = "Windows" +) + +// PossiblePlatformTypeValues returns the possible values for the PlatformType const type. +func PossiblePlatformTypeValues() []PlatformType { + return []PlatformType{ + PlatformTypeLinux, + PlatformTypeWindows, + } +} + +// ToPtr returns a *PlatformType pointing to the current value. +func (c PlatformType) ToPtr() *PlatformType { + return &c +} + +// PosixComplianceStatus - If provisioned storage is posix compliant. +type PosixComplianceStatus string + +const ( + PosixComplianceStatusDisabled PosixComplianceStatus = "Disabled" + PosixComplianceStatusEnabled PosixComplianceStatus = "Enabled" + PosixComplianceStatusInvalid PosixComplianceStatus = "Invalid" +) + +// PossiblePosixComplianceStatusValues returns the possible values for the PosixComplianceStatus const type. +func PossiblePosixComplianceStatusValues() []PosixComplianceStatus { + return []PosixComplianceStatus{ + PosixComplianceStatusDisabled, + PosixComplianceStatusEnabled, + PosixComplianceStatusInvalid, + } +} + +// ToPtr returns a *PosixComplianceStatus pointing to the current value. +func (c PosixComplianceStatus) ToPtr() *PosixComplianceStatus { + return &c +} + +// ProactiveDiagnosticsConsent - Proactive diagnostic collection consent flag +type ProactiveDiagnosticsConsent string + +const ( + ProactiveDiagnosticsConsentDisabled ProactiveDiagnosticsConsent = "Disabled" + ProactiveDiagnosticsConsentEnabled ProactiveDiagnosticsConsent = "Enabled" +) + +// PossibleProactiveDiagnosticsConsentValues returns the possible values for the ProactiveDiagnosticsConsent const type. +func PossibleProactiveDiagnosticsConsentValues() []ProactiveDiagnosticsConsent { + return []ProactiveDiagnosticsConsent{ + ProactiveDiagnosticsConsentDisabled, + ProactiveDiagnosticsConsentEnabled, + } +} + +// ToPtr returns a *ProactiveDiagnosticsConsent pointing to the current value. +func (c ProactiveDiagnosticsConsent) ToPtr() *ProactiveDiagnosticsConsent { + return &c +} + +// RemoteApplicationType - Remote application type +type RemoteApplicationType string + +const ( + RemoteApplicationTypeAllApplications RemoteApplicationType = "AllApplications" + RemoteApplicationTypeLocalUI RemoteApplicationType = "LocalUI" + RemoteApplicationTypePowershell RemoteApplicationType = "Powershell" + RemoteApplicationTypeWAC RemoteApplicationType = "WAC" +) + +// PossibleRemoteApplicationTypeValues returns the possible values for the RemoteApplicationType const type. +func PossibleRemoteApplicationTypeValues() []RemoteApplicationType { + return []RemoteApplicationType{ + RemoteApplicationTypeAllApplications, + RemoteApplicationTypeLocalUI, + RemoteApplicationTypePowershell, + RemoteApplicationTypeWAC, + } +} + +// ToPtr returns a *RemoteApplicationType pointing to the current value. +func (c RemoteApplicationType) ToPtr() *RemoteApplicationType { + return &c +} + +// ResourceMoveStatus - Denotes whether move operation is in progress +type ResourceMoveStatus string + +const ( + ResourceMoveStatusNone ResourceMoveStatus = "None" + ResourceMoveStatusResourceMoveFailed ResourceMoveStatus = "ResourceMoveFailed" + ResourceMoveStatusResourceMoveInProgress ResourceMoveStatus = "ResourceMoveInProgress" +) + +// PossibleResourceMoveStatusValues returns the possible values for the ResourceMoveStatus const type. +func PossibleResourceMoveStatusValues() []ResourceMoveStatus { + return []ResourceMoveStatus{ + ResourceMoveStatusNone, + ResourceMoveStatusResourceMoveFailed, + ResourceMoveStatusResourceMoveInProgress, + } +} + +// ToPtr returns a *ResourceMoveStatus pointing to the current value. +func (c ResourceMoveStatus) ToPtr() *ResourceMoveStatus { + return &c +} + +// RoleStatus - Local Edge Management Status +type RoleStatus string + +const ( + RoleStatusDisabled RoleStatus = "Disabled" + RoleStatusEnabled RoleStatus = "Enabled" +) + +// PossibleRoleStatusValues returns the possible values for the RoleStatus const type. +func PossibleRoleStatusValues() []RoleStatus { + return []RoleStatus{ + RoleStatusDisabled, + RoleStatusEnabled, + } +} + +// ToPtr returns a *RoleStatus pointing to the current value. +func (c RoleStatus) ToPtr() *RoleStatus { + return &c +} + +type RoleTypes string + +const ( + RoleTypesASA RoleTypes = "ASA" + RoleTypesCloudEdgeManagement RoleTypes = "CloudEdgeManagement" + RoleTypesCognitive RoleTypes = "Cognitive" + RoleTypesFunctions RoleTypes = "Functions" + RoleTypesIOT RoleTypes = "IOT" + RoleTypesKubernetes RoleTypes = "Kubernetes" + RoleTypesMEC RoleTypes = "MEC" +) + +// PossibleRoleTypesValues returns the possible values for the RoleTypes const type. +func PossibleRoleTypesValues() []RoleTypes { + return []RoleTypes{ + RoleTypesASA, + RoleTypesCloudEdgeManagement, + RoleTypesCognitive, + RoleTypesFunctions, + RoleTypesIOT, + RoleTypesKubernetes, + RoleTypesMEC, + } +} + +// ToPtr returns a *RoleTypes pointing to the current value. +func (c RoleTypes) ToPtr() *RoleTypes { + return &c +} + +// SKUAvailability - Links to the next set of results +type SKUAvailability string + +const ( + SKUAvailabilityAvailable SKUAvailability = "Available" + SKUAvailabilityUnavailable SKUAvailability = "Unavailable" +) + +// PossibleSKUAvailabilityValues returns the possible values for the SKUAvailability const type. +func PossibleSKUAvailabilityValues() []SKUAvailability { + return []SKUAvailability{ + SKUAvailabilityAvailable, + SKUAvailabilityUnavailable, + } +} + +// ToPtr returns a *SKUAvailability pointing to the current value. +func (c SKUAvailability) ToPtr() *SKUAvailability { + return &c +} + +// SKUName - The Sku name. +type SKUName string + +const ( + SKUNameEP21281T4Mx1W SKUName = "EP2_128_1T4_Mx1_W" + SKUNameEP22562T4W SKUName = "EP2_256_2T4_W" + SKUNameEP2641VPUW SKUName = "EP2_64_1VPU_W" + SKUNameEdge SKUName = "Edge" + SKUNameEdgeMRMini SKUName = "EdgeMR_Mini" + SKUNameEdgePBase SKUName = "EdgeP_Base" + SKUNameEdgePHigh SKUName = "EdgeP_High" + SKUNameEdgePRBase SKUName = "EdgePR_Base" + SKUNameEdgePRBaseUPS SKUName = "EdgePR_Base_UPS" + SKUNameGPU SKUName = "GPU" + SKUNameGateway SKUName = "Gateway" + SKUNameManagement SKUName = "Management" + SKUNameRCALarge SKUName = "RCA_Large" + SKUNameRCASmall SKUName = "RCA_Small" + SKUNameRDC SKUName = "RDC" + SKUNameTCALarge SKUName = "TCA_Large" + SKUNameTCASmall SKUName = "TCA_Small" + SKUNameTDC SKUName = "TDC" + SKUNameTEA1Node SKUName = "TEA_1Node" + SKUNameTEA1NodeHeater SKUName = "TEA_1Node_Heater" + SKUNameTEA1NodeUPS SKUName = "TEA_1Node_UPS" + SKUNameTEA1NodeUPSHeater SKUName = "TEA_1Node_UPS_Heater" + SKUNameTEA4NodeHeater SKUName = "TEA_4Node_Heater" + SKUNameTEA4NodeUPSHeater SKUName = "TEA_4Node_UPS_Heater" + SKUNameTMA SKUName = "TMA" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNameEP21281T4Mx1W, + SKUNameEP22562T4W, + SKUNameEP2641VPUW, + SKUNameEdge, + SKUNameEdgeMRMini, + SKUNameEdgePBase, + SKUNameEdgePHigh, + SKUNameEdgePRBase, + SKUNameEdgePRBaseUPS, + SKUNameGPU, + SKUNameGateway, + SKUNameManagement, + SKUNameRCALarge, + SKUNameRCASmall, + SKUNameRDC, + SKUNameTCALarge, + SKUNameTCASmall, + SKUNameTDC, + SKUNameTEA1Node, + SKUNameTEA1NodeHeater, + SKUNameTEA1NodeUPS, + SKUNameTEA1NodeUPSHeater, + SKUNameTEA4NodeHeater, + SKUNameTEA4NodeUPSHeater, + SKUNameTMA, + } +} + +// ToPtr returns a *SKUName pointing to the current value. +func (c SKUName) ToPtr() *SKUName { + return &c +} + +// SKUSignupOption - Sku can be signed up by customer or not. +type SKUSignupOption string + +const ( + SKUSignupOptionAvailable SKUSignupOption = "Available" + SKUSignupOptionNone SKUSignupOption = "None" +) + +// PossibleSKUSignupOptionValues returns the possible values for the SKUSignupOption const type. +func PossibleSKUSignupOptionValues() []SKUSignupOption { + return []SKUSignupOption{ + SKUSignupOptionAvailable, + SKUSignupOptionNone, + } +} + +// ToPtr returns a *SKUSignupOption pointing to the current value. +func (c SKUSignupOption) ToPtr() *SKUSignupOption { + return &c +} + +// SKUTier - The Sku tier. +type SKUTier string + +const ( + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierStandard, + } +} + +// ToPtr returns a *SKUTier pointing to the current value. +func (c SKUTier) ToPtr() *SKUTier { + return &c +} + +// SKUVersion - Availability of the Sku as preview/stable. +type SKUVersion string + +const ( + SKUVersionPreview SKUVersion = "Preview" + SKUVersionStable SKUVersion = "Stable" +) + +// PossibleSKUVersionValues returns the possible values for the SKUVersion const type. +func PossibleSKUVersionValues() []SKUVersion { + return []SKUVersion{ + SKUVersionPreview, + SKUVersionStable, + } +} + +// ToPtr returns a *SKUVersion pointing to the current value. +func (c SKUVersion) ToPtr() *SKUVersion { + return &c +} + +// SSLStatus - Signifies whether SSL needs to be enabled or not. +type SSLStatus string + +const ( + SSLStatusDisabled SSLStatus = "Disabled" + SSLStatusEnabled SSLStatus = "Enabled" +) + +// PossibleSSLStatusValues returns the possible values for the SSLStatus const type. +func PossibleSSLStatusValues() []SSLStatus { + return []SSLStatus{ + SSLStatusDisabled, + SSLStatusEnabled, + } +} + +// ToPtr returns a *SSLStatus pointing to the current value. +func (c SSLStatus) ToPtr() *SSLStatus { + return &c +} + +// ShareAccessProtocol - Access protocol to be used by the share. +type ShareAccessProtocol string + +const ( + ShareAccessProtocolNFS ShareAccessProtocol = "NFS" + ShareAccessProtocolSMB ShareAccessProtocol = "SMB" +) + +// PossibleShareAccessProtocolValues returns the possible values for the ShareAccessProtocol const type. +func PossibleShareAccessProtocolValues() []ShareAccessProtocol { + return []ShareAccessProtocol{ + ShareAccessProtocolNFS, + ShareAccessProtocolSMB, + } +} + +// ToPtr returns a *ShareAccessProtocol pointing to the current value. +func (c ShareAccessProtocol) ToPtr() *ShareAccessProtocol { + return &c +} + +// ShareAccessType - Type of access to be allowed on the share for this user. +type ShareAccessType string + +const ( + ShareAccessTypeChange ShareAccessType = "Change" + ShareAccessTypeCustom ShareAccessType = "Custom" + ShareAccessTypeRead ShareAccessType = "Read" +) + +// PossibleShareAccessTypeValues returns the possible values for the ShareAccessType const type. +func PossibleShareAccessTypeValues() []ShareAccessType { + return []ShareAccessType{ + ShareAccessTypeChange, + ShareAccessTypeCustom, + ShareAccessTypeRead, + } +} + +// ToPtr returns a *ShareAccessType pointing to the current value. +func (c ShareAccessType) ToPtr() *ShareAccessType { + return &c +} + +// ShareStatus - Current status of the share. +type ShareStatus string + +const ( + ShareStatusNeedsAttention ShareStatus = "NeedsAttention" + ShareStatusOK ShareStatus = "OK" + ShareStatusOffline ShareStatus = "Offline" + ShareStatusUnknown ShareStatus = "Unknown" + ShareStatusUpdating ShareStatus = "Updating" +) + +// PossibleShareStatusValues returns the possible values for the ShareStatus const type. +func PossibleShareStatusValues() []ShareStatus { + return []ShareStatus{ + ShareStatusNeedsAttention, + ShareStatusOK, + ShareStatusOffline, + ShareStatusUnknown, + ShareStatusUpdating, + } +} + +// ToPtr returns a *ShareStatus pointing to the current value. +func (c ShareStatus) ToPtr() *ShareStatus { + return &c +} + +type ShipmentType string + +const ( + ShipmentTypeNotApplicable ShipmentType = "NotApplicable" + ShipmentTypeSelfPickup ShipmentType = "SelfPickup" + ShipmentTypeShippedToCustomer ShipmentType = "ShippedToCustomer" +) + +// PossibleShipmentTypeValues returns the possible values for the ShipmentType const type. +func PossibleShipmentTypeValues() []ShipmentType { + return []ShipmentType{ + ShipmentTypeNotApplicable, + ShipmentTypeSelfPickup, + ShipmentTypeShippedToCustomer, + } +} + +// ToPtr returns a *ShipmentType pointing to the current value. +func (c ShipmentType) ToPtr() *ShipmentType { + return &c +} + +// StorageAccountStatus - Current status of the storage account +type StorageAccountStatus string + +const ( + StorageAccountStatusNeedsAttention StorageAccountStatus = "NeedsAttention" + StorageAccountStatusOK StorageAccountStatus = "OK" + StorageAccountStatusOffline StorageAccountStatus = "Offline" + StorageAccountStatusUnknown StorageAccountStatus = "Unknown" + StorageAccountStatusUpdating StorageAccountStatus = "Updating" +) + +// PossibleStorageAccountStatusValues returns the possible values for the StorageAccountStatus const type. +func PossibleStorageAccountStatusValues() []StorageAccountStatus { + return []StorageAccountStatus{ + StorageAccountStatusNeedsAttention, + StorageAccountStatusOK, + StorageAccountStatusOffline, + StorageAccountStatusUnknown, + StorageAccountStatusUpdating, + } +} + +// ToPtr returns a *StorageAccountStatus pointing to the current value. +func (c StorageAccountStatus) ToPtr() *StorageAccountStatus { + return &c +} + +type SubscriptionState string + +const ( + SubscriptionStateDeleted SubscriptionState = "Deleted" + SubscriptionStateRegistered SubscriptionState = "Registered" + SubscriptionStateSuspended SubscriptionState = "Suspended" + SubscriptionStateUnregistered SubscriptionState = "Unregistered" + SubscriptionStateWarned SubscriptionState = "Warned" +) + +// PossibleSubscriptionStateValues returns the possible values for the SubscriptionState const type. +func PossibleSubscriptionStateValues() []SubscriptionState { + return []SubscriptionState{ + SubscriptionStateDeleted, + SubscriptionStateRegistered, + SubscriptionStateSuspended, + SubscriptionStateUnregistered, + SubscriptionStateWarned, + } +} + +// ToPtr returns a *SubscriptionState pointing to the current value. +func (c SubscriptionState) ToPtr() *SubscriptionState { + return &c +} + +type TimeGrain string + +const ( + TimeGrainPT12H TimeGrain = "PT12H" + TimeGrainPT15M TimeGrain = "PT15M" + TimeGrainPT1D TimeGrain = "PT1D" + TimeGrainPT1H TimeGrain = "PT1H" + TimeGrainPT1M TimeGrain = "PT1M" + TimeGrainPT30M TimeGrain = "PT30M" + TimeGrainPT5M TimeGrain = "PT5M" + TimeGrainPT6H TimeGrain = "PT6H" +) + +// PossibleTimeGrainValues returns the possible values for the TimeGrain const type. +func PossibleTimeGrainValues() []TimeGrain { + return []TimeGrain{ + TimeGrainPT12H, + TimeGrainPT15M, + TimeGrainPT1D, + TimeGrainPT1H, + TimeGrainPT1M, + TimeGrainPT30M, + TimeGrainPT5M, + TimeGrainPT6H, + } +} + +// ToPtr returns a *TimeGrain pointing to the current value. +func (c TimeGrain) ToPtr() *TimeGrain { + return &c +} + +// TriggerEventType - Trigger Kind. +type TriggerEventType string + +const ( + TriggerEventTypeFileEvent TriggerEventType = "FileEvent" + TriggerEventTypePeriodicTimerEvent TriggerEventType = "PeriodicTimerEvent" +) + +// PossibleTriggerEventTypeValues returns the possible values for the TriggerEventType const type. +func PossibleTriggerEventTypeValues() []TriggerEventType { + return []TriggerEventType{ + TriggerEventTypeFileEvent, + TriggerEventTypePeriodicTimerEvent, + } +} + +// ToPtr returns a *TriggerEventType pointing to the current value. +func (c TriggerEventType) ToPtr() *TriggerEventType { + return &c +} + +// UpdateOperation - The current update operation. +type UpdateOperation string + +const ( + UpdateOperationDownload UpdateOperation = "Download" + UpdateOperationInstall UpdateOperation = "Install" + UpdateOperationNone UpdateOperation = "None" + UpdateOperationScan UpdateOperation = "Scan" +) + +// PossibleUpdateOperationValues returns the possible values for the UpdateOperation const type. +func PossibleUpdateOperationValues() []UpdateOperation { + return []UpdateOperation{ + UpdateOperationDownload, + UpdateOperationInstall, + UpdateOperationNone, + UpdateOperationScan, + } +} + +// ToPtr returns a *UpdateOperation pointing to the current value. +func (c UpdateOperation) ToPtr() *UpdateOperation { + return &c +} + +// UpdateOperationStage - Current stage of the update operation. +type UpdateOperationStage string + +const ( + UpdateOperationStageDownloadComplete UpdateOperationStage = "DownloadComplete" + UpdateOperationStageDownloadFailed UpdateOperationStage = "DownloadFailed" + UpdateOperationStageDownloadStarted UpdateOperationStage = "DownloadStarted" + UpdateOperationStageFailure UpdateOperationStage = "Failure" + UpdateOperationStageInitial UpdateOperationStage = "Initial" + UpdateOperationStageInstallComplete UpdateOperationStage = "InstallComplete" + UpdateOperationStageInstallFailed UpdateOperationStage = "InstallFailed" + UpdateOperationStageInstallStarted UpdateOperationStage = "InstallStarted" + UpdateOperationStageRebootInitiated UpdateOperationStage = "RebootInitiated" + UpdateOperationStageRescanComplete UpdateOperationStage = "RescanComplete" + UpdateOperationStageRescanFailed UpdateOperationStage = "RescanFailed" + UpdateOperationStageRescanStarted UpdateOperationStage = "RescanStarted" + UpdateOperationStageScanComplete UpdateOperationStage = "ScanComplete" + UpdateOperationStageScanFailed UpdateOperationStage = "ScanFailed" + UpdateOperationStageScanStarted UpdateOperationStage = "ScanStarted" + UpdateOperationStageSuccess UpdateOperationStage = "Success" + UpdateOperationStageUnknown UpdateOperationStage = "Unknown" +) + +// PossibleUpdateOperationStageValues returns the possible values for the UpdateOperationStage const type. +func PossibleUpdateOperationStageValues() []UpdateOperationStage { + return []UpdateOperationStage{ + UpdateOperationStageDownloadComplete, + UpdateOperationStageDownloadFailed, + UpdateOperationStageDownloadStarted, + UpdateOperationStageFailure, + UpdateOperationStageInitial, + UpdateOperationStageInstallComplete, + UpdateOperationStageInstallFailed, + UpdateOperationStageInstallStarted, + UpdateOperationStageRebootInitiated, + UpdateOperationStageRescanComplete, + UpdateOperationStageRescanFailed, + UpdateOperationStageRescanStarted, + UpdateOperationStageScanComplete, + UpdateOperationStageScanFailed, + UpdateOperationStageScanStarted, + UpdateOperationStageSuccess, + UpdateOperationStageUnknown, + } +} + +// ToPtr returns a *UpdateOperationStage pointing to the current value. +func (c UpdateOperationStage) ToPtr() *UpdateOperationStage { + return &c +} + +// UpdateStatus - Status of the update. +type UpdateStatus string + +const ( + UpdateStatusDownloadCompleted UpdateStatus = "DownloadCompleted" + UpdateStatusDownloadPending UpdateStatus = "DownloadPending" + UpdateStatusDownloadStarted UpdateStatus = "DownloadStarted" + UpdateStatusInstallCompleted UpdateStatus = "InstallCompleted" + UpdateStatusInstallStarted UpdateStatus = "InstallStarted" +) + +// PossibleUpdateStatusValues returns the possible values for the UpdateStatus const type. +func PossibleUpdateStatusValues() []UpdateStatus { + return []UpdateStatus{ + UpdateStatusDownloadCompleted, + UpdateStatusDownloadPending, + UpdateStatusDownloadStarted, + UpdateStatusInstallCompleted, + UpdateStatusInstallStarted, + } +} + +// ToPtr returns a *UpdateStatus pointing to the current value. +func (c UpdateStatus) ToPtr() *UpdateStatus { + return &c +} + +// UpdateType - Type of the Update +type UpdateType string + +const ( + UpdateTypeFirmware UpdateType = "Firmware" + UpdateTypeKubernetes UpdateType = "Kubernetes" + UpdateTypeSoftware UpdateType = "Software" +) + +// PossibleUpdateTypeValues returns the possible values for the UpdateType const type. +func PossibleUpdateTypeValues() []UpdateType { + return []UpdateType{ + UpdateTypeFirmware, + UpdateTypeKubernetes, + UpdateTypeSoftware, + } +} + +// ToPtr returns a *UpdateType pointing to the current value. +func (c UpdateType) ToPtr() *UpdateType { + return &c +} + +// UserType - Type of the user. +type UserType string + +const ( + UserTypeARM UserType = "ARM" + UserTypeLocalManagement UserType = "LocalManagement" + UserTypeShare UserType = "Share" +) + +// PossibleUserTypeValues returns the possible values for the UserType const type. +func PossibleUserTypeValues() []UserType { + return []UserType{ + UserTypeARM, + UserTypeLocalManagement, + UserTypeShare, + } +} + +// ToPtr returns a *UserType pointing to the current value. +func (c UserType) ToPtr() *UserType { + return &c +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_containers_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_containers_client.go new file mode 100644 index 000000000000..ad6ab30e9390 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_containers_client.go @@ -0,0 +1,434 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ContainersClient contains the methods for the Containers group. +// Don't use this type directly, use NewContainersClient() instead. +type ContainersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewContainersClient creates a new instance of ContainersClient with the specified values. +func NewContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ContainersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ContainersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a new container or updates an existing container on the device. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, containerParam Container, options *ContainersBeginCreateOrUpdateOptions) (ContainersCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, storageAccountName, containerName, resourceGroupName, containerParam, options) + if err != nil { + return ContainersCreateOrUpdatePollerResponse{}, err + } + result := ContainersCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainersClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return ContainersCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ContainersCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a new container or updates an existing container on the device. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) createOrUpdate(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, containerParam Container, options *ContainersBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, storageAccountName, containerName, resourceGroupName, containerParam, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, containerParam Container, options *ContainersBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, containerParam) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *ContainersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the container on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) BeginDelete(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginDeleteOptions) (ContainersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, storageAccountName, containerName, resourceGroupName, options) + if err != nil { + return ContainersDeletePollerResponse{}, err + } + result := ContainersDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainersClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return ContainersDeletePollerResponse{}, err + } + result.Poller = &ContainersDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the container on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) deleteOperation(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, storageAccountName, containerName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainersClient) deleteCreateRequest(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *ContainersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a container by name. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) Get(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersGetOptions) (ContainersGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, storageAccountName, containerName, resourceGroupName, options) + if err != nil { + return ContainersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ContainersClient) getCreateRequest(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ContainersClient) getHandleResponse(resp *http.Response) (ContainersGetResponse, error) { + result := ContainersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Container); err != nil { + return ContainersGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *ContainersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByStorageAccount - Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) ListByStorageAccount(deviceName string, storageAccountName string, resourceGroupName string, options *ContainersListByStorageAccountOptions) *ContainersListByStorageAccountPager { + return &ContainersListByStorageAccountPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByStorageAccountCreateRequest(ctx, deviceName, storageAccountName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp ContainersListByStorageAccountResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ContainerList.NextLink) + }, + } +} + +// listByStorageAccountCreateRequest creates the ListByStorageAccount request. +func (client *ContainersClient) listByStorageAccountCreateRequest(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *ContainersListByStorageAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByStorageAccountHandleResponse handles the ListByStorageAccount response. +func (client *ContainersClient) listByStorageAccountHandleResponse(resp *http.Response) (ContainersListByStorageAccountResponse, error) { + result := ContainersListByStorageAccountResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerList); err != nil { + return ContainersListByStorageAccountResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByStorageAccountHandleError handles the ListByStorageAccount error response. +func (client *ContainersClient) listByStorageAccountHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginRefresh - Refreshes the container metadata with the data from the cloud. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) BeginRefresh(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginRefreshOptions) (ContainersRefreshPollerResponse, error) { + resp, err := client.refresh(ctx, deviceName, storageAccountName, containerName, resourceGroupName, options) + if err != nil { + return ContainersRefreshPollerResponse{}, err + } + result := ContainersRefreshPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainersClient.Refresh", "", resp, client.pl, client.refreshHandleError) + if err != nil { + return ContainersRefreshPollerResponse{}, err + } + result.Poller = &ContainersRefreshPoller{ + pt: pt, + } + return result, nil +} + +// Refresh - Refreshes the container metadata with the data from the cloud. +// If the operation fails it returns the *CloudError error type. +func (client *ContainersClient) refresh(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginRefreshOptions) (*http.Response, error) { + req, err := client.refreshCreateRequest(ctx, deviceName, storageAccountName, containerName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.refreshHandleError(resp) + } + return resp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *ContainersClient) refreshCreateRequest(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string, options *ContainersBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// refreshHandleError handles the Refresh error response. +func (client *ContainersClient) refreshHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_devices_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_devices_client.go new file mode 100644 index 000000000000..4835db76ac9d --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_devices_client.go @@ -0,0 +1,1127 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DevicesClient contains the methods for the Devices group. +// Don't use this type directly, use NewDevicesClient() instead. +type DevicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewDevicesClient creates a new instance of DevicesClient with the specified values. +func NewDevicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DevicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DevicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CreateOrUpdate - Creates or updates a Data Box Edge/Data Box Gateway resource. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) CreateOrUpdate(ctx context.Context, deviceName string, resourceGroupName string, dataBoxEdgeDevice DataBoxEdgeDevice, options *DevicesCreateOrUpdateOptions) (DevicesCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, resourceGroupName, dataBoxEdgeDevice, options) + if err != nil { + return DevicesCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DevicesClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, dataBoxEdgeDevice DataBoxEdgeDevice, options *DevicesCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, dataBoxEdgeDevice) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DevicesClient) createOrUpdateHandleResponse(resp *http.Response) (DevicesCreateOrUpdateResponse, error) { + result := DevicesCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDevice); err != nil { + return DevicesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *DevicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginCreateOrUpdateSecuritySettings - Updates the security settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) BeginCreateOrUpdateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, securitySettings SecuritySettings, options *DevicesBeginCreateOrUpdateSecuritySettingsOptions) (DevicesCreateOrUpdateSecuritySettingsPollerResponse, error) { + resp, err := client.createOrUpdateSecuritySettings(ctx, deviceName, resourceGroupName, securitySettings, options) + if err != nil { + return DevicesCreateOrUpdateSecuritySettingsPollerResponse{}, err + } + result := DevicesCreateOrUpdateSecuritySettingsPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.CreateOrUpdateSecuritySettings", "", resp, client.pl, client.createOrUpdateSecuritySettingsHandleError) + if err != nil { + return DevicesCreateOrUpdateSecuritySettingsPollerResponse{}, err + } + result.Poller = &DevicesCreateOrUpdateSecuritySettingsPoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdateSecuritySettings - Updates the security settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) createOrUpdateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, securitySettings SecuritySettings, options *DevicesBeginCreateOrUpdateSecuritySettingsOptions) (*http.Response, error) { + req, err := client.createOrUpdateSecuritySettingsCreateRequest(ctx, deviceName, resourceGroupName, securitySettings, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.createOrUpdateSecuritySettingsHandleError(resp) + } + return resp, nil +} + +// createOrUpdateSecuritySettingsCreateRequest creates the CreateOrUpdateSecuritySettings request. +func (client *DevicesClient) createOrUpdateSecuritySettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, securitySettings SecuritySettings, options *DevicesBeginCreateOrUpdateSecuritySettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, securitySettings) +} + +// createOrUpdateSecuritySettingsHandleError handles the CreateOrUpdateSecuritySettings error response. +func (client *DevicesClient) createOrUpdateSecuritySettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) BeginDelete(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDeleteOptions) (DevicesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesDeletePollerResponse{}, err + } + result := DevicesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return DevicesDeletePollerResponse{}, err + } + result.Poller = &DevicesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) deleteOperation(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DevicesClient) deleteCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *DevicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDownloadUpdates - Downloads the updates on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) BeginDownloadUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDownloadUpdatesOptions) (DevicesDownloadUpdatesPollerResponse, error) { + resp, err := client.downloadUpdates(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesDownloadUpdatesPollerResponse{}, err + } + result := DevicesDownloadUpdatesPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.DownloadUpdates", "", resp, client.pl, client.downloadUpdatesHandleError) + if err != nil { + return DevicesDownloadUpdatesPollerResponse{}, err + } + result.Poller = &DevicesDownloadUpdatesPoller{ + pt: pt, + } + return result, nil +} + +// DownloadUpdates - Downloads the updates on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) downloadUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDownloadUpdatesOptions) (*http.Response, error) { + req, err := client.downloadUpdatesCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.downloadUpdatesHandleError(resp) + } + return resp, nil +} + +// downloadUpdatesCreateRequest creates the DownloadUpdates request. +func (client *DevicesClient) downloadUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginDownloadUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// downloadUpdatesHandleError handles the DownloadUpdates error response. +func (client *DevicesClient) downloadUpdatesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GenerateCertificate - Generates certificate for activation key. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) GenerateCertificate(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGenerateCertificateOptions) (DevicesGenerateCertificateResponse, error) { + req, err := client.generateCertificateCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesGenerateCertificateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGenerateCertificateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGenerateCertificateResponse{}, client.generateCertificateHandleError(resp) + } + return client.generateCertificateHandleResponse(resp) +} + +// generateCertificateCreateRequest creates the GenerateCertificate request. +func (client *DevicesClient) generateCertificateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGenerateCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// generateCertificateHandleResponse handles the GenerateCertificate response. +func (client *DevicesClient) generateCertificateHandleResponse(resp *http.Response) (DevicesGenerateCertificateResponse, error) { + result := DevicesGenerateCertificateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GenerateCertResponse); err != nil { + return DevicesGenerateCertificateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// generateCertificateHandleError handles the GenerateCertificate error response. +func (client *DevicesClient) generateCertificateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) Get(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetOptions) (DevicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DevicesClient) getCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DevicesClient) getHandleResponse(resp *http.Response) (DevicesGetResponse, error) { + result := DevicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDevice); err != nil { + return DevicesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *DevicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetExtendedInformation - Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) GetExtendedInformation(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetExtendedInformationOptions) (DevicesGetExtendedInformationResponse, error) { + req, err := client.getExtendedInformationCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesGetExtendedInformationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGetExtendedInformationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGetExtendedInformationResponse{}, client.getExtendedInformationHandleError(resp) + } + return client.getExtendedInformationHandleResponse(resp) +} + +// getExtendedInformationCreateRequest creates the GetExtendedInformation request. +func (client *DevicesClient) getExtendedInformationCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetExtendedInformationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getExtendedInformationHandleResponse handles the GetExtendedInformation response. +func (client *DevicesClient) getExtendedInformationHandleResponse(resp *http.Response) (DevicesGetExtendedInformationResponse, error) { + result := DevicesGetExtendedInformationResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDeviceExtendedInfo); err != nil { + return DevicesGetExtendedInformationResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getExtendedInformationHandleError handles the GetExtendedInformation error response. +func (client *DevicesClient) getExtendedInformationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetNetworkSettings - Gets the network settings of the specified Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetNetworkSettingsOptions) (DevicesGetNetworkSettingsResponse, error) { + req, err := client.getNetworkSettingsCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesGetNetworkSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGetNetworkSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGetNetworkSettingsResponse{}, client.getNetworkSettingsHandleError(resp) + } + return client.getNetworkSettingsHandleResponse(resp) +} + +// getNetworkSettingsCreateRequest creates the GetNetworkSettings request. +func (client *DevicesClient) getNetworkSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetNetworkSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getNetworkSettingsHandleResponse handles the GetNetworkSettings response. +func (client *DevicesClient) getNetworkSettingsHandleResponse(resp *http.Response) (DevicesGetNetworkSettingsResponse, error) { + result := DevicesGetNetworkSettingsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSettings); err != nil { + return DevicesGetNetworkSettingsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getNetworkSettingsHandleError handles the GetNetworkSettings error response. +func (client *DevicesClient) getNetworkSettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetUpdateSummary - Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing +// download or install jobs on the device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) GetUpdateSummary(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetUpdateSummaryOptions) (DevicesGetUpdateSummaryResponse, error) { + req, err := client.getUpdateSummaryCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesGetUpdateSummaryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGetUpdateSummaryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGetUpdateSummaryResponse{}, client.getUpdateSummaryHandleError(resp) + } + return client.getUpdateSummaryHandleResponse(resp) +} + +// getUpdateSummaryCreateRequest creates the GetUpdateSummary request. +func (client *DevicesClient) getUpdateSummaryCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesGetUpdateSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getUpdateSummaryHandleResponse handles the GetUpdateSummary response. +func (client *DevicesClient) getUpdateSummaryHandleResponse(resp *http.Response) (DevicesGetUpdateSummaryResponse, error) { + result := DevicesGetUpdateSummaryResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummary); err != nil { + return DevicesGetUpdateSummaryResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getUpdateSummaryHandleError handles the GetUpdateSummary error response. +func (client *DevicesClient) getUpdateSummaryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginInstallUpdates - Installs the updates on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) BeginInstallUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginInstallUpdatesOptions) (DevicesInstallUpdatesPollerResponse, error) { + resp, err := client.installUpdates(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesInstallUpdatesPollerResponse{}, err + } + result := DevicesInstallUpdatesPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.InstallUpdates", "", resp, client.pl, client.installUpdatesHandleError) + if err != nil { + return DevicesInstallUpdatesPollerResponse{}, err + } + result.Poller = &DevicesInstallUpdatesPoller{ + pt: pt, + } + return result, nil +} + +// InstallUpdates - Installs the updates on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) installUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginInstallUpdatesOptions) (*http.Response, error) { + req, err := client.installUpdatesCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.installUpdatesHandleError(resp) + } + return resp, nil +} + +// installUpdatesCreateRequest creates the InstallUpdates request. +func (client *DevicesClient) installUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginInstallUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// installUpdatesHandleError handles the InstallUpdates error response. +func (client *DevicesClient) installUpdatesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Gets all the Data Box Edge/Data Box Gateway devices in a resource group. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) ListByResourceGroup(resourceGroupName string, options *DevicesListByResourceGroupOptions) *DevicesListByResourceGroupPager { + return &DevicesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp DevicesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DataBoxEdgeDeviceList.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DevicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DevicesListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DevicesClient) listByResourceGroupHandleResponse(resp *http.Response) (DevicesListByResourceGroupResponse, error) { + result := DevicesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDeviceList); err != nil { + return DevicesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *DevicesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Gets all the Data Box Edge/Data Box Gateway devices in a subscription. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) ListBySubscription(options *DevicesListBySubscriptionOptions) *DevicesListBySubscriptionPager { + return &DevicesListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp DevicesListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DataBoxEdgeDeviceList.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DevicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DevicesListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DevicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DevicesListBySubscriptionResponse, error) { + result := DevicesListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDeviceList); err != nil { + return DevicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *DevicesClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginScanForUpdates - Scans for updates on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) BeginScanForUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginScanForUpdatesOptions) (DevicesScanForUpdatesPollerResponse, error) { + resp, err := client.scanForUpdates(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DevicesScanForUpdatesPollerResponse{}, err + } + result := DevicesScanForUpdatesPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.ScanForUpdates", "", resp, client.pl, client.scanForUpdatesHandleError) + if err != nil { + return DevicesScanForUpdatesPollerResponse{}, err + } + result.Poller = &DevicesScanForUpdatesPoller{ + pt: pt, + } + return result, nil +} + +// ScanForUpdates - Scans for updates on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) scanForUpdates(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginScanForUpdatesOptions) (*http.Response, error) { + req, err := client.scanForUpdatesCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.scanForUpdatesHandleError(resp) + } + return resp, nil +} + +// scanForUpdatesCreateRequest creates the ScanForUpdates request. +func (client *DevicesClient) scanForUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DevicesBeginScanForUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// scanForUpdatesHandleError handles the ScanForUpdates error response. +func (client *DevicesClient) scanForUpdatesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Modifies a Data Box Edge/Data Box Gateway resource. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) Update(ctx context.Context, deviceName string, resourceGroupName string, parameters DataBoxEdgeDevicePatch, options *DevicesUpdateOptions) (DevicesUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, deviceName, resourceGroupName, parameters, options) + if err != nil { + return DevicesUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *DevicesClient) updateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, parameters DataBoxEdgeDevicePatch, options *DevicesUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *DevicesClient) updateHandleResponse(resp *http.Response) (DevicesUpdateResponse, error) { + result := DevicesUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDevice); err != nil { + return DevicesUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *DevicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// UpdateExtendedInformation - Gets additional information for the specified Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) UpdateExtendedInformation(ctx context.Context, deviceName string, resourceGroupName string, parameters DataBoxEdgeDeviceExtendedInfoPatch, options *DevicesUpdateExtendedInformationOptions) (DevicesUpdateExtendedInformationResponse, error) { + req, err := client.updateExtendedInformationCreateRequest(ctx, deviceName, resourceGroupName, parameters, options) + if err != nil { + return DevicesUpdateExtendedInformationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesUpdateExtendedInformationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesUpdateExtendedInformationResponse{}, client.updateExtendedInformationHandleError(resp) + } + return client.updateExtendedInformationHandleResponse(resp) +} + +// updateExtendedInformationCreateRequest creates the UpdateExtendedInformation request. +func (client *DevicesClient) updateExtendedInformationCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, parameters DataBoxEdgeDeviceExtendedInfoPatch, options *DevicesUpdateExtendedInformationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateExtendedInformationHandleResponse handles the UpdateExtendedInformation response. +func (client *DevicesClient) updateExtendedInformationHandleResponse(resp *http.Response) (DevicesUpdateExtendedInformationResponse, error) { + result := DevicesUpdateExtendedInformationResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DataBoxEdgeDeviceExtendedInfo); err != nil { + return DevicesUpdateExtendedInformationResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateExtendedInformationHandleError handles the UpdateExtendedInformation error response. +func (client *DevicesClient) updateExtendedInformationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// UploadCertificate - Uploads registration certificate for the device. +// If the operation fails it returns the *CloudError error type. +func (client *DevicesClient) UploadCertificate(ctx context.Context, deviceName string, resourceGroupName string, parameters UploadCertificateRequest, options *DevicesUploadCertificateOptions) (DevicesUploadCertificateResponse, error) { + req, err := client.uploadCertificateCreateRequest(ctx, deviceName, resourceGroupName, parameters, options) + if err != nil { + return DevicesUploadCertificateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesUploadCertificateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesUploadCertificateResponse{}, client.uploadCertificateHandleError(resp) + } + return client.uploadCertificateHandleResponse(resp) +} + +// uploadCertificateCreateRequest creates the UploadCertificate request. +func (client *DevicesClient) uploadCertificateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, parameters UploadCertificateRequest, options *DevicesUploadCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// uploadCertificateHandleResponse handles the UploadCertificate response. +func (client *DevicesClient) uploadCertificateHandleResponse(resp *http.Response) (DevicesUploadCertificateResponse, error) { + result := DevicesUploadCertificateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UploadCertificateResponse); err != nil { + return DevicesUploadCertificateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// uploadCertificateHandleError handles the UploadCertificate error response. +func (client *DevicesClient) uploadCertificateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_diagnosticsettings_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_diagnosticsettings_client.go new file mode 100644 index 000000000000..080d41c55f66 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_diagnosticsettings_client.go @@ -0,0 +1,325 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DiagnosticSettingsClient contains the methods for the DiagnosticSettings group. +// Don't use this type directly, use NewDiagnosticSettingsClient() instead. +type DiagnosticSettingsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient with the specified values. +func NewDiagnosticSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiagnosticSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiagnosticSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// GetDiagnosticProactiveLogCollectionSettings - Gets the proactive log collection settings of the specified Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) GetDiagnosticProactiveLogCollectionSettings(ctx context.Context, deviceName string, resourceGroupName string, options *DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsOptions) (DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse, error) { + req, err := client.getDiagnosticProactiveLogCollectionSettingsCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse{}, client.getDiagnosticProactiveLogCollectionSettingsHandleError(resp) + } + return client.getDiagnosticProactiveLogCollectionSettingsHandleResponse(resp) +} + +// getDiagnosticProactiveLogCollectionSettingsCreateRequest creates the GetDiagnosticProactiveLogCollectionSettings request. +func (client *DiagnosticSettingsClient) getDiagnosticProactiveLogCollectionSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getDiagnosticProactiveLogCollectionSettingsHandleResponse handles the GetDiagnosticProactiveLogCollectionSettings response. +func (client *DiagnosticSettingsClient) getDiagnosticProactiveLogCollectionSettingsHandleResponse(resp *http.Response) (DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse, error) { + result := DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticProactiveLogCollectionSettings); err != nil { + return DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getDiagnosticProactiveLogCollectionSettingsHandleError handles the GetDiagnosticProactiveLogCollectionSettings error response. +func (client *DiagnosticSettingsClient) getDiagnosticProactiveLogCollectionSettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetDiagnosticRemoteSupportSettings - Gets the diagnostic remote support settings of the specified Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) GetDiagnosticRemoteSupportSettings(ctx context.Context, deviceName string, resourceGroupName string, options *DiagnosticSettingsGetDiagnosticRemoteSupportSettingsOptions) (DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse, error) { + req, err := client.getDiagnosticRemoteSupportSettingsCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse{}, client.getDiagnosticRemoteSupportSettingsHandleError(resp) + } + return client.getDiagnosticRemoteSupportSettingsHandleResponse(resp) +} + +// getDiagnosticRemoteSupportSettingsCreateRequest creates the GetDiagnosticRemoteSupportSettings request. +func (client *DiagnosticSettingsClient) getDiagnosticRemoteSupportSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *DiagnosticSettingsGetDiagnosticRemoteSupportSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getDiagnosticRemoteSupportSettingsHandleResponse handles the GetDiagnosticRemoteSupportSettings response. +func (client *DiagnosticSettingsClient) getDiagnosticRemoteSupportSettingsHandleResponse(resp *http.Response) (DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse, error) { + result := DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticRemoteSupportSettings); err != nil { + return DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getDiagnosticRemoteSupportSettingsHandleError handles the GetDiagnosticRemoteSupportSettings error response. +func (client *DiagnosticSettingsClient) getDiagnosticRemoteSupportSettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdateDiagnosticProactiveLogCollectionSettings - Updates the proactive log collection settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) BeginUpdateDiagnosticProactiveLogCollectionSettings(ctx context.Context, deviceName string, resourceGroupName string, proactiveLogCollectionSettings DiagnosticProactiveLogCollectionSettings, options *DiagnosticSettingsBeginUpdateDiagnosticProactiveLogCollectionSettingsOptions) (DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse, error) { + resp, err := client.updateDiagnosticProactiveLogCollectionSettings(ctx, deviceName, resourceGroupName, proactiveLogCollectionSettings, options) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse{}, err + } + result := DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DiagnosticSettingsClient.UpdateDiagnosticProactiveLogCollectionSettings", "", resp, client.pl, client.updateDiagnosticProactiveLogCollectionSettingsHandleError) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse{}, err + } + result.Poller = &DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller{ + pt: pt, + } + return result, nil +} + +// UpdateDiagnosticProactiveLogCollectionSettings - Updates the proactive log collection settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) updateDiagnosticProactiveLogCollectionSettings(ctx context.Context, deviceName string, resourceGroupName string, proactiveLogCollectionSettings DiagnosticProactiveLogCollectionSettings, options *DiagnosticSettingsBeginUpdateDiagnosticProactiveLogCollectionSettingsOptions) (*http.Response, error) { + req, err := client.updateDiagnosticProactiveLogCollectionSettingsCreateRequest(ctx, deviceName, resourceGroupName, proactiveLogCollectionSettings, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateDiagnosticProactiveLogCollectionSettingsHandleError(resp) + } + return resp, nil +} + +// updateDiagnosticProactiveLogCollectionSettingsCreateRequest creates the UpdateDiagnosticProactiveLogCollectionSettings request. +func (client *DiagnosticSettingsClient) updateDiagnosticProactiveLogCollectionSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, proactiveLogCollectionSettings DiagnosticProactiveLogCollectionSettings, options *DiagnosticSettingsBeginUpdateDiagnosticProactiveLogCollectionSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, proactiveLogCollectionSettings) +} + +// updateDiagnosticProactiveLogCollectionSettingsHandleError handles the UpdateDiagnosticProactiveLogCollectionSettings error response. +func (client *DiagnosticSettingsClient) updateDiagnosticProactiveLogCollectionSettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdateDiagnosticRemoteSupportSettings - Updates the diagnostic remote support settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) BeginUpdateDiagnosticRemoteSupportSettings(ctx context.Context, deviceName string, resourceGroupName string, diagnosticRemoteSupportSettings DiagnosticRemoteSupportSettings, options *DiagnosticSettingsBeginUpdateDiagnosticRemoteSupportSettingsOptions) (DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse, error) { + resp, err := client.updateDiagnosticRemoteSupportSettings(ctx, deviceName, resourceGroupName, diagnosticRemoteSupportSettings, options) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse{}, err + } + result := DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DiagnosticSettingsClient.UpdateDiagnosticRemoteSupportSettings", "", resp, client.pl, client.updateDiagnosticRemoteSupportSettingsHandleError) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse{}, err + } + result.Poller = &DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller{ + pt: pt, + } + return result, nil +} + +// UpdateDiagnosticRemoteSupportSettings - Updates the diagnostic remote support settings on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *DiagnosticSettingsClient) updateDiagnosticRemoteSupportSettings(ctx context.Context, deviceName string, resourceGroupName string, diagnosticRemoteSupportSettings DiagnosticRemoteSupportSettings, options *DiagnosticSettingsBeginUpdateDiagnosticRemoteSupportSettingsOptions) (*http.Response, error) { + req, err := client.updateDiagnosticRemoteSupportSettingsCreateRequest(ctx, deviceName, resourceGroupName, diagnosticRemoteSupportSettings, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateDiagnosticRemoteSupportSettingsHandleError(resp) + } + return resp, nil +} + +// updateDiagnosticRemoteSupportSettingsCreateRequest creates the UpdateDiagnosticRemoteSupportSettings request. +func (client *DiagnosticSettingsClient) updateDiagnosticRemoteSupportSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, diagnosticRemoteSupportSettings DiagnosticRemoteSupportSettings, options *DiagnosticSettingsBeginUpdateDiagnosticRemoteSupportSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diagnosticRemoteSupportSettings) +} + +// updateDiagnosticRemoteSupportSettingsHandleError handles the UpdateDiagnosticRemoteSupportSettings error response. +func (client *DiagnosticSettingsClient) updateDiagnosticRemoteSupportSettingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_jobs_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_jobs_client.go new file mode 100644 index 000000000000..509dceecbdf8 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_jobs_client.go @@ -0,0 +1,112 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// JobsClient contains the methods for the Jobs group. +// Don't use this type directly, use NewJobsClient() instead. +type JobsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewJobsClient creates a new instance of JobsClient with the specified values. +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *JobsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *JobsGetOptions) (JobsGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return JobsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *JobsClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *JobsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsGetResponse, error) { + result := JobsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *JobsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_models.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_models.go new file mode 100644 index 000000000000..4a586b312012 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_models.go @@ -0,0 +1,4691 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// ARMBaseModel - Represents the base class for all object models. +type ARMBaseModel struct { + // READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The object name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ARMBaseModel. +func (a ARMBaseModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ARMBaseModel. +func (a *ARMBaseModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return a.unmarshalInternal(rawMsg) +} + +func (a ARMBaseModel) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "type", a.Type) +} + +func (a *ARMBaseModel) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &a.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// AddonClassification provides polymorphic access to related types. +// Call the interface's GetAddon() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Addon, *ArcAddon, *IoTAddon +type AddonClassification interface { + // GetAddon returns the Addon content of the underlying type. + GetAddon() *Addon +} + +// Addon - Role Addon +type Addon struct { + ARMBaseModel + // REQUIRED; Addon type. + Kind *AddonType `json:"kind,omitempty"` + + // READ-ONLY; Addon type + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// GetAddon implements the AddonClassification interface for type Addon. +func (a *Addon) GetAddon() *Addon { return a } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Addon. +func (a *Addon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return a.unmarshalInternal(rawMsg) +} + +func (a Addon) marshalInternal(objectMap map[string]interface{}, discValue AddonType) { + a.ARMBaseModel.marshalInternal(objectMap) + a.Kind = &discValue + objectMap["kind"] = a.Kind + populate(objectMap, "systemData", a.SystemData) +} + +func (a *Addon) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, &a.Kind) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &a.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AddonList - Collection of all the Role addon on the Azure Stack Edge device. +type AddonList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The Value. + Value []AddonClassification `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AddonList. +func (a AddonList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonList. +func (a *AddonList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, &a.NextLink) + delete(rawMsg, key) + case "value": + a.Value, err = unmarshalAddonClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// AddonsBeginCreateOrUpdateOptions contains the optional parameters for the Addons.BeginCreateOrUpdate method. +type AddonsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AddonsBeginDeleteOptions contains the optional parameters for the Addons.BeginDelete method. +type AddonsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// AddonsGetOptions contains the optional parameters for the Addons.Get method. +type AddonsGetOptions struct { + // placeholder for future optional parameters +} + +// AddonsListByRoleOptions contains the optional parameters for the Addons.ListByRole method. +type AddonsListByRoleOptions struct { + // placeholder for future optional parameters +} + +// Address - The shipping address of the customer. +type Address struct { + // REQUIRED; The country name. + Country *string `json:"country,omitempty"` + + // The address line1. + AddressLine1 *string `json:"addressLine1,omitempty"` + + // The address line2. + AddressLine2 *string `json:"addressLine2,omitempty"` + + // The address line3. + AddressLine3 *string `json:"addressLine3,omitempty"` + + // The city name. + City *string `json:"city,omitempty"` + + // The postal code. + PostalCode *string `json:"postalCode,omitempty"` + + // The state name. + State *string `json:"state,omitempty"` +} + +// Alert on the data box edge/gateway device. +type Alert struct { + ARMBaseModel + // READ-ONLY; Properties of alert. + Properties *AlertProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Alert generated in the resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Alert. +func (a *Alert) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &a.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AlertErrorDetails - Error details for the alert. +type AlertErrorDetails struct { + // READ-ONLY; Error code. + ErrorCode *string `json:"errorCode,omitempty" azure:"ro"` + + // READ-ONLY; Error Message. + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; Number of occurrences. + Occurrences *int32 `json:"occurrences,omitempty" azure:"ro"` +} + +// AlertList - Collection of alerts. +type AlertList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The value. + Value []*Alert `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AlertList. +func (a AlertList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AlertProperties - Properties of alert. +type AlertProperties struct { + // READ-ONLY; Alert type. + AlertType *string `json:"alertType,omitempty" azure:"ro"` + + // READ-ONLY; UTC time when the alert appeared. + AppearedAtDateTime *time.Time `json:"appearedAtDateTime,omitempty" azure:"ro"` + + // READ-ONLY; Alert details. + DetailedInformation map[string]*string `json:"detailedInformation,omitempty" azure:"ro"` + + // READ-ONLY; Error details of the alert. + ErrorDetails *AlertErrorDetails `json:"errorDetails,omitempty" azure:"ro"` + + // READ-ONLY; Alert recommendation. + Recommendation *string `json:"recommendation,omitempty" azure:"ro"` + + // READ-ONLY; Severity of the alert. + Severity *AlertSeverity `json:"severity,omitempty" azure:"ro"` + + // READ-ONLY; Alert title. + Title *string `json:"title,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertType", a.AlertType) + populateTimeRFC3339(objectMap, "appearedAtDateTime", a.AppearedAtDateTime) + populate(objectMap, "detailedInformation", a.DetailedInformation) + populate(objectMap, "errorDetails", a.ErrorDetails) + populate(objectMap, "recommendation", a.Recommendation) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. +func (a *AlertProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, &a.AlertType) + delete(rawMsg, key) + case "appearedAtDateTime": + err = unpopulateTimeRFC3339(val, &a.AppearedAtDateTime) + delete(rawMsg, key) + case "detailedInformation": + err = unpopulate(val, &a.DetailedInformation) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, &a.ErrorDetails) + delete(rawMsg, key) + case "recommendation": + err = unpopulate(val, &a.Recommendation) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, &a.Severity) + delete(rawMsg, key) + case "title": + err = unpopulate(val, &a.Title) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// AlertsGetOptions contains the optional parameters for the Alerts.Get method. +type AlertsGetOptions struct { + // placeholder for future optional parameters +} + +// AlertsListByDataBoxEdgeDeviceOptions contains the optional parameters for the Alerts.ListByDataBoxEdgeDevice method. +type AlertsListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// ArcAddon - Arc Addon. +type ArcAddon struct { + Addon + // REQUIRED; Properties specific to Arc addon. + Properties *ArcAddonProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ArcAddon. +func (a ArcAddon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.Addon.marshalInternal(objectMap, AddonTypeArcForKubernetes) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAddon. +func (a *ArcAddon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.Addon.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ArcAddonProperties - Arc addon properties. +type ArcAddonProperties struct { + // REQUIRED; Arc resource group name + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + + // REQUIRED; Arc resource location + ResourceLocation *string `json:"resourceLocation,omitempty"` + + // REQUIRED; Arc resource Name + ResourceName *string `json:"resourceName,omitempty"` + + // REQUIRED; Arc resource subscription Id + SubscriptionID *string `json:"subscriptionId,omitempty"` + + // READ-ONLY; Host OS supported by the Arc addon. + HostPlatform *PlatformType `json:"hostPlatform,omitempty" azure:"ro"` + + // READ-ONLY; Platform where the runtime is hosted. + HostPlatformType *HostPlatformType `json:"hostPlatformType,omitempty" azure:"ro"` + + // READ-ONLY; Addon Provisioning State + ProvisioningState *AddonState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Arc resource version + Version *string `json:"version,omitempty" azure:"ro"` +} + +// AsymmetricEncryptedSecret - Represent the secrets intended for encryption with asymmetric key pair. +type AsymmetricEncryptedSecret struct { + // REQUIRED; The algorithm used to encrypt "Value". + EncryptionAlgorithm *EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + + // REQUIRED; The value of the secret. + Value *string `json:"value,omitempty"` + + // Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. + EncryptionCertThumbprint *string `json:"encryptionCertThumbprint,omitempty"` +} + +// Authentication mechanism for IoT devices. +type Authentication struct { + // Symmetric key for authentication. + SymmetricKey *SymmetricKey `json:"symmetricKey,omitempty"` +} + +// AvailableSKUsListOptions contains the optional parameters for the AvailableSKUs.List method. +type AvailableSKUsListOptions struct { + // placeholder for future optional parameters +} + +// AzureContainerInfo - Azure container mapping of the endpoint. +type AzureContainerInfo struct { + // REQUIRED; Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). + ContainerName *string `json:"containerName,omitempty"` + + // REQUIRED; Storage format used for the file represented by the share. + DataFormat *AzureContainerDataFormat `json:"dataFormat,omitempty"` + + // REQUIRED; ID of the storage account credential used to access storage. + StorageAccountCredentialID *string `json:"storageAccountCredentialId,omitempty"` +} + +// BandwidthSchedule - The bandwidth schedule details. +type BandwidthSchedule struct { + ARMBaseModel + // REQUIRED; The properties of the bandwidth schedule. + Properties *BandwidthScheduleProperties `json:"properties,omitempty"` + + // READ-ONLY; Bandwidth object related to ASE resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type BandwidthSchedule. +func (b BandwidthSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BandwidthSchedule. +func (b *BandwidthSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &b.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// BandwidthScheduleProperties - The properties of the bandwidth schedule. +type BandwidthScheduleProperties struct { + // REQUIRED; The days of the week when this schedule is applicable. + Days []*DayOfWeek `json:"days,omitempty"` + + // REQUIRED; The bandwidth rate in Mbps. + RateInMbps *int32 `json:"rateInMbps,omitempty"` + + // REQUIRED; The start time of the schedule in UTC. + Start *string `json:"start,omitempty"` + + // REQUIRED; The stop time of the schedule in UTC. + Stop *string `json:"stop,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BandwidthScheduleProperties. +func (b BandwidthScheduleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "days", b.Days) + populate(objectMap, "rateInMbps", b.RateInMbps) + populate(objectMap, "start", b.Start) + populate(objectMap, "stop", b.Stop) + return json.Marshal(objectMap) +} + +// BandwidthSchedulesBeginCreateOrUpdateOptions contains the optional parameters for the BandwidthSchedules.BeginCreateOrUpdate method. +type BandwidthSchedulesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BandwidthSchedulesBeginDeleteOptions contains the optional parameters for the BandwidthSchedules.BeginDelete method. +type BandwidthSchedulesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// BandwidthSchedulesGetOptions contains the optional parameters for the BandwidthSchedules.Get method. +type BandwidthSchedulesGetOptions struct { + // placeholder for future optional parameters +} + +// BandwidthSchedulesList - The collection of bandwidth schedules. +type BandwidthSchedulesList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of bandwidth schedules. + Value []*BandwidthSchedule `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type BandwidthSchedulesList. +func (b BandwidthSchedulesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// BandwidthSchedulesListByDataBoxEdgeDeviceOptions contains the optional parameters for the BandwidthSchedules.ListByDataBoxEdgeDevice method. +type BandwidthSchedulesListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// ClientAccessRight - The mapping between a particular client IP and the type of access client has on the NFS share. +type ClientAccessRight struct { + // REQUIRED; Type of access to be allowed for the client. + AccessPermission *ClientPermissionType `json:"accessPermission,omitempty"` + + // REQUIRED; IP of the client. + Client *string `json:"client,omitempty"` +} + +// CloudEdgeManagementRole role. +type CloudEdgeManagementRole struct { + Role + // Properties specific to CloudEdgeManagementRole role. + Properties *CloudEdgeManagementRoleProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CloudEdgeManagementRole. +func (c CloudEdgeManagementRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Role.marshalInternal(objectMap, RoleTypesCloudEdgeManagement) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudEdgeManagementRole. +func (c *CloudEdgeManagementRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.Role.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CloudEdgeManagementRoleProperties - CloudEdgeManagement Role properties. +type CloudEdgeManagementRoleProperties struct { + // REQUIRED; Role status. + RoleStatus *RoleStatus `json:"roleStatus,omitempty"` + + // READ-ONLY; Edge Profile of the resource + EdgeProfile *EdgeProfile `json:"edgeProfile,omitempty" azure:"ro"` + + // READ-ONLY; Local Edge Management Status + LocalManagementStatus *RoleStatus `json:"localManagementStatus,omitempty" azure:"ro"` +} + +// CloudError - An error response from the service. +// Implements the error and azcore.HTTPResponse interfaces. +type CloudError struct { + raw string + // The error details. + InnerError *CloudErrorBody `json:"error,omitempty"` +} + +// Error implements the error interface for type CloudError. +// The contents of the error text are not contractual and subject to change. +func (e CloudError) Error() string { + return e.raw +} + +// CloudErrorBody - An error response from the service. +type CloudErrorBody struct { + // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + + // A list of additional details about the error. + Details []*CloudErrorBody `json:"details,omitempty"` + + // A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + return json.Marshal(objectMap) +} + +// CniConfig - Cni configuration +type CniConfig struct { + // READ-ONLY; Pod Subnet + PodSubnet *string `json:"podSubnet,omitempty" azure:"ro"` + + // READ-ONLY; Service subnet + ServiceSubnet *string `json:"serviceSubnet,omitempty" azure:"ro"` + + // READ-ONLY; Cni type + Type *string `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; Cni version + Version *string `json:"version,omitempty" azure:"ro"` +} + +// ComputeResource - Compute infrastructure Resource +type ComputeResource struct { + // REQUIRED; Memory in GB + MemoryInGB *int64 `json:"memoryInGB,omitempty"` + + // REQUIRED; Processor count + ProcessorCount *int32 `json:"processorCount,omitempty"` +} + +// ContactDetails - Contains all the contact details of the customer. +type ContactDetails struct { + // REQUIRED; The name of the company. + CompanyName *string `json:"companyName,omitempty"` + + // REQUIRED; The contact person name. + ContactPerson *string `json:"contactPerson,omitempty"` + + // REQUIRED; The email list. + EmailList []*string `json:"emailList,omitempty"` + + // REQUIRED; The phone number. + Phone *string `json:"phone,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContactDetails. +func (c ContactDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "companyName", c.CompanyName) + populate(objectMap, "contactPerson", c.ContactPerson) + populate(objectMap, "emailList", c.EmailList) + populate(objectMap, "phone", c.Phone) + return json.Marshal(objectMap) +} + +// Container - Represents a container on the Data Box Edge/Gateway device. +type Container struct { + ARMBaseModel + // REQUIRED; The container properties. + Properties *ContainerProperties `json:"properties,omitempty"` + + // READ-ONLY; Container in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Container. +func (c *Container) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &c.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContainerList - Collection of all the containers on the Data Box Edge/Gateway device. +type ContainerList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of containers. + Value []*Container `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerList. +func (c ContainerList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// ContainerProperties - The container properties. +type ContainerProperties struct { + // REQUIRED; DataFormat for Container + DataFormat *AzureContainerDataFormat `json:"dataFormat,omitempty"` + + // READ-ONLY; Current status of the container. + ContainerStatus *ContainerStatus `json:"containerStatus,omitempty" azure:"ro"` + + // READ-ONLY; The UTC time when container got created. + CreatedDateTime *time.Time `json:"createdDateTime,omitempty" azure:"ro"` + + // READ-ONLY; Details of the refresh job on this container. + RefreshDetails *RefreshDetails `json:"refreshDetails,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerProperties. +func (c ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerStatus", c.ContainerStatus) + populateTimeRFC3339(objectMap, "createdDateTime", c.CreatedDateTime) + populate(objectMap, "dataFormat", c.DataFormat) + populate(objectMap, "refreshDetails", c.RefreshDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerProperties. +func (c *ContainerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "containerStatus": + err = unpopulate(val, &c.ContainerStatus) + delete(rawMsg, key) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, &c.CreatedDateTime) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, &c.DataFormat) + delete(rawMsg, key) + case "refreshDetails": + err = unpopulate(val, &c.RefreshDetails) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContainersBeginCreateOrUpdateOptions contains the optional parameters for the Containers.BeginCreateOrUpdate method. +type ContainersBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ContainersBeginDeleteOptions contains the optional parameters for the Containers.BeginDelete method. +type ContainersBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// ContainersBeginRefreshOptions contains the optional parameters for the Containers.BeginRefresh method. +type ContainersBeginRefreshOptions struct { + // placeholder for future optional parameters +} + +// ContainersGetOptions contains the optional parameters for the Containers.Get method. +type ContainersGetOptions struct { + // placeholder for future optional parameters +} + +// ContainersListByStorageAccountOptions contains the optional parameters for the Containers.ListByStorageAccount method. +type ContainersListByStorageAccountOptions struct { + // placeholder for future optional parameters +} + +// DCAccessCode - DC Access code in the case of Self Managed Shipping. +type DCAccessCode struct { + // DCAccessCode properties. + Properties *DCAccessCodeProperties `json:"properties,omitempty"` +} + +// DCAccessCodeProperties - DCAccessCode Properties. +type DCAccessCodeProperties struct { + // DCAccess Code for the Self Managed shipment. + AuthCode *string `json:"authCode,omitempty"` +} + +// DataBoxEdgeDevice - The Data Box Edge/Gateway device. +type DataBoxEdgeDevice struct { + ARMBaseModel + // REQUIRED; The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). + // The geographical region of a device cannot be changed once + // it is created, but if an identical geographical region is specified on update, the request will succeed. + Location *string `json:"location,omitempty"` + + // The etag for the devices. + Etag *string `json:"etag,omitempty"` + + // Msi identity of the resource + Identity *ResourceIdentity `json:"identity,omitempty"` + + // The kind of the device. + Kind *DataBoxEdgeDeviceKind `json:"kind,omitempty"` + + // The properties of the Data Box Edge/Gateway device. + Properties *DataBoxEdgeDeviceProperties `json:"properties,omitempty"` + + // The SKU type. + SKU *SKU `json:"sku,omitempty"` + + // The list of tags that describe the device. These tags can be used to view and group this device (across resource groups). + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDevice. +func (d DataBoxEdgeDevice) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataBoxEdgeDevice. +func (d *DataBoxEdgeDevice) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, &d.Etag) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, &d.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &d.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &d.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DataBoxEdgeDeviceExtendedInfo - The extended Info of the Data Box Edge/Gateway device. +type DataBoxEdgeDeviceExtendedInfo struct { + ARMBaseModel + // The extended info properties. + Properties *DataBoxEdgeDeviceExtendedInfoProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDeviceExtendedInfo. +func (d DataBoxEdgeDeviceExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataBoxEdgeDeviceExtendedInfo. +func (d *DataBoxEdgeDeviceExtendedInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DataBoxEdgeDeviceExtendedInfoPatch - The Data Box Edge/Gateway device extended info patch. +type DataBoxEdgeDeviceExtendedInfoPatch struct { + // The name for Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + + // The version of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` + + // The Key Vault ARM Id for client secrets + ClientSecretStoreID *string `json:"clientSecretStoreId,omitempty"` + + // The url to access the Client Key Vault + ClientSecretStoreURL *string `json:"clientSecretStoreUrl,omitempty"` + + // For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. + SyncStatus *KeyVaultSyncStatus `json:"syncStatus,omitempty"` +} + +// DataBoxEdgeDeviceExtendedInfoProperties - The properties of the Data Box Edge/Gateway device extended info. +type DataBoxEdgeDeviceExtendedInfoProperties struct { + // The name of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + + // The version of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` + + // The Key Vault ARM Id for client secrets + ClientSecretStoreID *string `json:"clientSecretStoreId,omitempty"` + + // The url to access the Client Key Vault + ClientSecretStoreURL *string `json:"clientSecretStoreUrl,omitempty"` + + // The public part of the encryption certificate. Client uses this to encrypt any secret. + EncryptionKey *string `json:"encryptionKey,omitempty"` + + // The digital signature of encrypted certificate. + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + + // Key vault sync status + KeyVaultSyncStatus *KeyVaultSyncStatus `json:"keyVaultSyncStatus,omitempty"` + + // READ-ONLY; Device secrets, will be returned only with ODataFilter $expand=deviceSecrets + DeviceSecrets map[string]*Secret `json:"deviceSecrets,omitempty" azure:"ro"` + + // READ-ONLY; The Resource ID of the Resource. + ResourceKey *string `json:"resourceKey,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDeviceExtendedInfoProperties. +func (d DataBoxEdgeDeviceExtendedInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "channelIntegrityKeyName", d.ChannelIntegrityKeyName) + populate(objectMap, "channelIntegrityKeyVersion", d.ChannelIntegrityKeyVersion) + populate(objectMap, "clientSecretStoreId", d.ClientSecretStoreID) + populate(objectMap, "clientSecretStoreUrl", d.ClientSecretStoreURL) + populate(objectMap, "deviceSecrets", d.DeviceSecrets) + populate(objectMap, "encryptionKey", d.EncryptionKey) + populate(objectMap, "encryptionKeyThumbprint", d.EncryptionKeyThumbprint) + populate(objectMap, "keyVaultSyncStatus", d.KeyVaultSyncStatus) + populate(objectMap, "resourceKey", d.ResourceKey) + return json.Marshal(objectMap) +} + +// DataBoxEdgeDeviceList - The collection of Data Box Edge/Gateway devices. +type DataBoxEdgeDeviceList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of Data Box Edge/Gateway devices. + Value []*DataBoxEdgeDevice `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDeviceList. +func (d DataBoxEdgeDeviceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// DataBoxEdgeDevicePatch - The Data Box Edge/Gateway device patch. +type DataBoxEdgeDevicePatch struct { + // Msi identity of the resource + Identity *ResourceIdentity `json:"identity,omitempty"` + + // The properties associated with the Data Box Edge/Gateway resource + Properties *DataBoxEdgeDevicePropertiesPatch `json:"properties,omitempty"` + + // The tags attached to the Data Box Edge/Gateway resource. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDevicePatch. +func (d DataBoxEdgeDevicePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// DataBoxEdgeDeviceProperties - The properties of the Data Box Edge/Gateway device. +type DataBoxEdgeDeviceProperties struct { + // The status of the Data Box Edge/Gateway device. + DataBoxEdgeDeviceStatus *DataBoxEdgeDeviceStatus `json:"dataBoxEdgeDeviceStatus,omitempty"` + + // The details of data-residency related properties for this resource + DataResidency *DataResidency `json:"dataResidency,omitempty"` + + // READ-ONLY; Type of compute roles configured. + ConfiguredRoleTypes []*RoleTypes `json:"configuredRoleTypes,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device culture. + Culture *string `json:"culture,omitempty" azure:"ro"` + + // READ-ONLY; The Description of the Data Box Edge/Gateway device. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The device software version number of the device (eg: 1.2.18105.6). + DeviceHcsVersion *string `json:"deviceHcsVersion,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device local capacity in MB. + DeviceLocalCapacity *int64 `json:"deviceLocalCapacity,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device model. + DeviceModel *string `json:"deviceModel,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device software version. + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty" azure:"ro"` + + // READ-ONLY; The type of the Data Box Edge/Gateway device. + DeviceType *DeviceType `json:"deviceType,omitempty" azure:"ro"` + + // READ-ONLY; The details of Edge Profile for this resource + EdgeProfile *EdgeProfile `json:"edgeProfile,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device name. + FriendlyName *string `json:"friendlyName,omitempty" azure:"ro"` + + // READ-ONLY; The description of the Data Box Edge/Gateway device model. + ModelDescription *string `json:"modelDescription,omitempty" azure:"ro"` + + // READ-ONLY; The number of nodes in the cluster. + NodeCount *int32 `json:"nodeCount,omitempty" azure:"ro"` + + // READ-ONLY; The details of the move operation on this resource. + ResourceMoveDetails *ResourceMoveDetails `json:"resourceMoveDetails,omitempty" azure:"ro"` + + // READ-ONLY; The Serial Number of Data Box Edge/Gateway device. + SerialNumber *string `json:"serialNumber,omitempty" azure:"ro"` + + // READ-ONLY; DataBoxEdge Device Properties + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The Data Box Edge/Gateway device timezone. + TimeZone *string `json:"timeZone,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeDeviceProperties. +func (d DataBoxEdgeDeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuredRoleTypes", d.ConfiguredRoleTypes) + populate(objectMap, "culture", d.Culture) + populate(objectMap, "dataBoxEdgeDeviceStatus", d.DataBoxEdgeDeviceStatus) + populate(objectMap, "dataResidency", d.DataResidency) + populate(objectMap, "description", d.Description) + populate(objectMap, "deviceHcsVersion", d.DeviceHcsVersion) + populate(objectMap, "deviceLocalCapacity", d.DeviceLocalCapacity) + populate(objectMap, "deviceModel", d.DeviceModel) + populate(objectMap, "deviceSoftwareVersion", d.DeviceSoftwareVersion) + populate(objectMap, "deviceType", d.DeviceType) + populate(objectMap, "edgeProfile", d.EdgeProfile) + populate(objectMap, "friendlyName", d.FriendlyName) + populate(objectMap, "modelDescription", d.ModelDescription) + populate(objectMap, "nodeCount", d.NodeCount) + populate(objectMap, "resourceMoveDetails", d.ResourceMoveDetails) + populate(objectMap, "serialNumber", d.SerialNumber) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "timeZone", d.TimeZone) + return json.Marshal(objectMap) +} + +// DataBoxEdgeDevicePropertiesPatch - The Data Box Edge/Gateway device properties patch. +type DataBoxEdgeDevicePropertiesPatch struct { + // Edge Profile property of the Data Box Edge/Gateway device + EdgeProfile *EdgeProfilePatch `json:"edgeProfile,omitempty"` +} + +// DataBoxEdgeMoveRequest - Resource Move details +type DataBoxEdgeMoveRequest struct { + // REQUIRED; List of resources to be moved + Resources []*string `json:"resources,omitempty"` + + // REQUIRED; Target resource group ARMId + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeMoveRequest. +func (d DataBoxEdgeMoveRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resources", d.Resources) + populate(objectMap, "targetResourceGroup", d.TargetResourceGroup) + return json.Marshal(objectMap) +} + +// DataBoxEdgeSKU - The Sku information. +type DataBoxEdgeSKU struct { + // READ-ONLY; The API versions in which Sku is available. + APIVersions []*string `json:"apiVersions,omitempty" azure:"ro"` + + // READ-ONLY; Links to the next set of results + Availability *SKUAvailability `json:"availability,omitempty" azure:"ro"` + + // READ-ONLY; The capability info of the SKU. + Capabilities []*SKUCapability `json:"capabilities,omitempty" azure:"ro"` + + // READ-ONLY; The pricing info of the Sku. + Costs []*SKUCost `json:"costs,omitempty" azure:"ro"` + + // READ-ONLY; The Sku family. + Family *string `json:"family,omitempty" azure:"ro"` + + // READ-ONLY; The Sku kind. + Kind *string `json:"kind,omitempty" azure:"ro"` + + // READ-ONLY; Availability of the Sku for the location/zone/site. + LocationInfo []*SKULocationInfo `json:"locationInfo,omitempty" azure:"ro"` + + // READ-ONLY; Availability of the Sku for the region. + Locations []*string `json:"locations,omitempty" azure:"ro"` + + // READ-ONLY; The Sku name. + Name *SKUName `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; List of Shipment Types supported by this SKU + ShipmentTypes []*ShipmentType `json:"shipmentTypes,omitempty" azure:"ro"` + + // READ-ONLY; Sku can be signed up by customer or not. + SignupOption *SKUSignupOption `json:"signupOption,omitempty" azure:"ro"` + + // READ-ONLY; The Sku kind. + Size *string `json:"size,omitempty" azure:"ro"` + + // READ-ONLY; The Sku tier. + Tier *SKUTier `json:"tier,omitempty" azure:"ro"` + + // READ-ONLY; Availability of the Sku as preview/stable. + Version *SKUVersion `json:"version,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeSKU. +func (d DataBoxEdgeSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiVersions", d.APIVersions) + populate(objectMap, "availability", d.Availability) + populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "costs", d.Costs) + populate(objectMap, "family", d.Family) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "locationInfo", d.LocationInfo) + populate(objectMap, "locations", d.Locations) + populate(objectMap, "name", d.Name) + populate(objectMap, "resourceType", d.ResourceType) + populate(objectMap, "shipmentTypes", d.ShipmentTypes) + populate(objectMap, "signupOption", d.SignupOption) + populate(objectMap, "size", d.Size) + populate(objectMap, "tier", d.Tier) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// DataBoxEdgeSKUList - List of SKU Information objects. +type DataBoxEdgeSKUList struct { + // READ-ONLY; Links to the next set of results + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of ResourceType Sku + Value []*DataBoxEdgeSKU `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DataBoxEdgeSKUList. +func (d DataBoxEdgeSKUList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// DataResidency - Wraps data-residency related information for edge-resource and this should be used with ARM layer. +type DataResidency struct { + // DataResidencyType enum + Type *DataResidencyType `json:"type,omitempty"` +} + +// DevicesBeginCreateOrUpdateSecuritySettingsOptions contains the optional parameters for the Devices.BeginCreateOrUpdateSecuritySettings method. +type DevicesBeginCreateOrUpdateSecuritySettingsOptions struct { + // placeholder for future optional parameters +} + +// DevicesBeginDeleteOptions contains the optional parameters for the Devices.BeginDelete method. +type DevicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// DevicesBeginDownloadUpdatesOptions contains the optional parameters for the Devices.BeginDownloadUpdates method. +type DevicesBeginDownloadUpdatesOptions struct { + // placeholder for future optional parameters +} + +// DevicesBeginInstallUpdatesOptions contains the optional parameters for the Devices.BeginInstallUpdates method. +type DevicesBeginInstallUpdatesOptions struct { + // placeholder for future optional parameters +} + +// DevicesBeginScanForUpdatesOptions contains the optional parameters for the Devices.BeginScanForUpdates method. +type DevicesBeginScanForUpdatesOptions struct { + // placeholder for future optional parameters +} + +// DevicesCreateOrUpdateOptions contains the optional parameters for the Devices.CreateOrUpdate method. +type DevicesCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DevicesGenerateCertificateOptions contains the optional parameters for the Devices.GenerateCertificate method. +type DevicesGenerateCertificateOptions struct { + // placeholder for future optional parameters +} + +// DevicesGetExtendedInformationOptions contains the optional parameters for the Devices.GetExtendedInformation method. +type DevicesGetExtendedInformationOptions struct { + // placeholder for future optional parameters +} + +// DevicesGetNetworkSettingsOptions contains the optional parameters for the Devices.GetNetworkSettings method. +type DevicesGetNetworkSettingsOptions struct { + // placeholder for future optional parameters +} + +// DevicesGetOptions contains the optional parameters for the Devices.Get method. +type DevicesGetOptions struct { + // placeholder for future optional parameters +} + +// DevicesGetUpdateSummaryOptions contains the optional parameters for the Devices.GetUpdateSummary method. +type DevicesGetUpdateSummaryOptions struct { + // placeholder for future optional parameters +} + +// DevicesListByResourceGroupOptions contains the optional parameters for the Devices.ListByResourceGroup method. +type DevicesListByResourceGroupOptions struct { + // Specify $expand=details to populate additional fields related to the resource or Specify $skipToken= to populate the next page in the list. + Expand *string +} + +// DevicesListBySubscriptionOptions contains the optional parameters for the Devices.ListBySubscription method. +type DevicesListBySubscriptionOptions struct { + // Specify $expand=details to populate additional fields related to the resource or Specify $skipToken= to populate the next page in the list. + Expand *string +} + +// DevicesUpdateExtendedInformationOptions contains the optional parameters for the Devices.UpdateExtendedInformation method. +type DevicesUpdateExtendedInformationOptions struct { + // placeholder for future optional parameters +} + +// DevicesUpdateOptions contains the optional parameters for the Devices.Update method. +type DevicesUpdateOptions struct { + // placeholder for future optional parameters +} + +// DevicesUploadCertificateOptions contains the optional parameters for the Devices.UploadCertificate method. +type DevicesUploadCertificateOptions struct { + // placeholder for future optional parameters +} + +// DiagnosticProactiveLogCollectionSettings - The diagnostic proactive log collection settings of a device. +type DiagnosticProactiveLogCollectionSettings struct { + ARMBaseModel + // REQUIRED; Properties of the diagnostic proactive log collection settings. + Properties *ProactiveLogCollectionSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; DiagnosticProactiveLogCollectionSettings + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticProactiveLogCollectionSettings. +func (d DiagnosticProactiveLogCollectionSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticProactiveLogCollectionSettings. +func (d *DiagnosticProactiveLogCollectionSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &d.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DiagnosticRemoteSupportSettings - The remote support settings of a device. +type DiagnosticRemoteSupportSettings struct { + ARMBaseModel + // REQUIRED; Properties of the remote support settings. + Properties *DiagnosticRemoteSupportSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; DiagnosticRemoteSupportSettings + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticRemoteSupportSettings. +func (d DiagnosticRemoteSupportSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticRemoteSupportSettings. +func (d *DiagnosticRemoteSupportSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &d.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DiagnosticRemoteSupportSettingsProperties - The properties of remote support settings. +type DiagnosticRemoteSupportSettingsProperties struct { + // Remote support settings list according to the RemoteApplicationType + RemoteSupportSettingsList []*RemoteSupportSettings `json:"remoteSupportSettingsList,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticRemoteSupportSettingsProperties. +func (d DiagnosticRemoteSupportSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "remoteSupportSettingsList", d.RemoteSupportSettingsList) + return json.Marshal(objectMap) +} + +// DiagnosticSettingsBeginUpdateDiagnosticProactiveLogCollectionSettingsOptions contains the optional parameters for the DiagnosticSettings.BeginUpdateDiagnosticProactiveLogCollectionSettings +// method. +type DiagnosticSettingsBeginUpdateDiagnosticProactiveLogCollectionSettingsOptions struct { + // placeholder for future optional parameters +} + +// DiagnosticSettingsBeginUpdateDiagnosticRemoteSupportSettingsOptions contains the optional parameters for the DiagnosticSettings.BeginUpdateDiagnosticRemoteSupportSettings +// method. +type DiagnosticSettingsBeginUpdateDiagnosticRemoteSupportSettingsOptions struct { + // placeholder for future optional parameters +} + +// DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsOptions contains the optional parameters for the DiagnosticSettings.GetDiagnosticProactiveLogCollectionSettings +// method. +type DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsOptions struct { + // placeholder for future optional parameters +} + +// DiagnosticSettingsGetDiagnosticRemoteSupportSettingsOptions contains the optional parameters for the DiagnosticSettings.GetDiagnosticRemoteSupportSettings +// method. +type DiagnosticSettingsGetDiagnosticRemoteSupportSettingsOptions struct { + // placeholder for future optional parameters +} + +// EdgeProfile - Details about Edge Profile for the resource +type EdgeProfile struct { + // Edge Profile Subscription + Subscription *EdgeProfileSubscription `json:"subscription,omitempty"` +} + +// EdgeProfilePatch - The Data Box Edge/Gateway Edge Profile patch. +type EdgeProfilePatch struct { + // The Data Box Edge/Gateway Edge Profile Subscription patch + Subscription *EdgeProfileSubscriptionPatch `json:"subscription,omitempty"` +} + +// EdgeProfileSubscription - Subscription details for the Edge Profile +type EdgeProfileSubscription struct { + // ARM ID of the subscription + ID *string `json:"id,omitempty"` + Properties *SubscriptionProperties `json:"properties,omitempty"` + RegistrationDate *string `json:"registrationDate,omitempty"` + + // Edge Subscription Registration ID + RegistrationID *string `json:"registrationId,omitempty"` + State *SubscriptionState `json:"state,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + +// EdgeProfileSubscriptionPatch - The Data Box Edge/Gateway Edge Profile Subscription patch. +type EdgeProfileSubscriptionPatch struct { + // The path ID that uniquely identifies the subscription of the edge profile. + ID *string `json:"id,omitempty"` +} + +// EtcdInfo - Etcd configuration +type EtcdInfo struct { + // READ-ONLY; Etcd type + Type *string `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; Etcd version + Version *string `json:"version,omitempty" azure:"ro"` +} + +// FileEventTrigger - Trigger details. +type FileEventTrigger struct { + Trigger + // REQUIRED; File trigger properties. + Properties *FileTriggerProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FileEventTrigger. +func (f FileEventTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.Trigger.marshalInternal(objectMap, TriggerEventTypeFileEvent) + populate(objectMap, "properties", f.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileEventTrigger. +func (f *FileEventTrigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &f.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := f.Trigger.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// FileSourceInfo - File source details. +type FileSourceInfo struct { + // REQUIRED; File share ID. + ShareID *string `json:"shareId,omitempty"` +} + +// FileTriggerProperties - File trigger properties. +type FileTriggerProperties struct { + // REQUIRED; Role sink info. + SinkInfo *RoleSinkInfo `json:"sinkInfo,omitempty"` + + // REQUIRED; File event source details. + SourceInfo *FileSourceInfo `json:"sourceInfo,omitempty"` + + // A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific + // IoT modules in the device, the tag can be the + // name or the image URL of the module. + CustomContextTag *string `json:"customContextTag,omitempty"` +} + +// GenerateCertResponse - Used in activation key generation flow. +type GenerateCertResponse struct { + // Gets or sets expiry time in UTC + ExpiryTimeInUTC *string `json:"expiryTimeInUTC,omitempty"` + + // Gets or sets base64 encoded private part of the certificate, needed to form the activation key + PrivateKey *string `json:"privateKey,omitempty"` + + // Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault + PublicKey *string `json:"publicKey,omitempty"` +} + +// IPv4Config - Details related to the IPv4 address configuration. +type IPv4Config struct { + // READ-ONLY; The IPv4 gateway of the network adapter. + Gateway *string `json:"gateway,omitempty" azure:"ro"` + + // READ-ONLY; The IPv4 address of the network adapter. + IPAddress *string `json:"ipAddress,omitempty" azure:"ro"` + + // READ-ONLY; The IPv4 subnet of the network adapter. + Subnet *string `json:"subnet,omitempty" azure:"ro"` +} + +// IPv6Config - Details related to the IPv6 address configuration. +type IPv6Config struct { + // READ-ONLY; The IPv6 gateway of the network adapter. + Gateway *string `json:"gateway,omitempty" azure:"ro"` + + // READ-ONLY; The IPv6 address of the network adapter. + IPAddress *string `json:"ipAddress,omitempty" azure:"ro"` + + // READ-ONLY; The IPv6 prefix of the network adapter. + PrefixLength *int32 `json:"prefixLength,omitempty" azure:"ro"` +} + +// ImageRepositoryCredential - Image repository credential. +type ImageRepositoryCredential struct { + // REQUIRED; Image repository url (e.g.: mcr.microsoft.com). + ImageRepositoryURL *string `json:"imageRepositoryUrl,omitempty"` + + // REQUIRED; Repository user name. + UserName *string `json:"userName,omitempty"` + + // Repository user password. + Password *AsymmetricEncryptedSecret `json:"password,omitempty"` +} + +// IoTAddon - IoT Addon. +type IoTAddon struct { + Addon + // REQUIRED; Properties specific to IOT addon. + Properties *IoTAddonProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IoTAddon. +func (i IoTAddon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.Addon.marshalInternal(objectMap, AddonTypeIotEdge) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTAddon. +func (i *IoTAddon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.Addon.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// IoTAddonProperties - IoT addon properties. +type IoTAddonProperties struct { + // REQUIRED; IoT device metadata to which appliance needs to be connected. + IoTDeviceDetails *IoTDeviceInfo `json:"ioTDeviceDetails,omitempty"` + + // REQUIRED; IoT edge device to which the IoT Addon needs to be configured. + IoTEdgeDeviceDetails *IoTDeviceInfo `json:"ioTEdgeDeviceDetails,omitempty"` + + // READ-ONLY; Host OS supported by the IoT addon. + HostPlatform *PlatformType `json:"hostPlatform,omitempty" azure:"ro"` + + // READ-ONLY; Platform where the runtime is hosted. + HostPlatformType *HostPlatformType `json:"hostPlatformType,omitempty" azure:"ro"` + + // READ-ONLY; Addon Provisioning State + ProvisioningState *AddonState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Version of IoT running on the appliance. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// IoTDeviceInfo - Metadata of IoT device/IoT Edge device to be configured. +type IoTDeviceInfo struct { + // REQUIRED; ID of the IoT device/edge device. + DeviceID *string `json:"deviceId,omitempty"` + + // REQUIRED; Host name for the IoT hub associated to the device. + IoTHostHub *string `json:"ioTHostHub,omitempty"` + + // Encrypted IoT device/IoT edge device connection string. + Authentication *Authentication `json:"authentication,omitempty"` + + // Id for the IoT hub associated to the device. + IoTHostHubID *string `json:"ioTHostHubId,omitempty"` +} + +// IoTEdgeAgentInfo - IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. +type IoTEdgeAgentInfo struct { + // REQUIRED; Name of the IoT edge agent image. + ImageName *string `json:"imageName,omitempty"` + + // REQUIRED; Image Tag. + Tag *string `json:"tag,omitempty"` + + // Image repository details. + ImageRepository *ImageRepositoryCredential `json:"imageRepository,omitempty"` +} + +// IoTRole - Compute role. +type IoTRole struct { + Role + // Properties specific to IoT role. + Properties *IoTRoleProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IoTRole. +func (i IoTRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.Role.marshalInternal(objectMap, RoleTypesIOT) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTRole. +func (i *IoTRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.Role.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// IoTRoleProperties - IoT role properties. +type IoTRoleProperties struct { + // REQUIRED; Host OS supported by the IoT role. + HostPlatform *PlatformType `json:"hostPlatform,omitempty"` + + // REQUIRED; IoT device metadata to which data box edge device needs to be connected. + IoTDeviceDetails *IoTDeviceInfo `json:"ioTDeviceDetails,omitempty"` + + // REQUIRED; IoT edge device to which the IoT role needs to be configured. + IoTEdgeDeviceDetails *IoTDeviceInfo `json:"ioTEdgeDeviceDetails,omitempty"` + + // REQUIRED; Role status. + RoleStatus *RoleStatus `json:"roleStatus,omitempty"` + + // Resource allocation + ComputeResource *ComputeResource `json:"computeResource,omitempty"` + + // Iot edge agent details to download the agent and bootstrap iot runtime. + IoTEdgeAgentInfo *IoTEdgeAgentInfo `json:"ioTEdgeAgentInfo,omitempty"` + + // Mount points of shares in role(s). + ShareMappings []*MountPointMap `json:"shareMappings,omitempty"` + + // READ-ONLY; Platform where the Iot runtime is hosted. + HostPlatformType *HostPlatformType `json:"hostPlatformType,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type IoTRoleProperties. +func (i IoTRoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeResource", i.ComputeResource) + populate(objectMap, "hostPlatform", i.HostPlatform) + populate(objectMap, "hostPlatformType", i.HostPlatformType) + populate(objectMap, "ioTDeviceDetails", i.IoTDeviceDetails) + populate(objectMap, "ioTEdgeAgentInfo", i.IoTEdgeAgentInfo) + populate(objectMap, "ioTEdgeDeviceDetails", i.IoTEdgeDeviceDetails) + populate(objectMap, "roleStatus", i.RoleStatus) + populate(objectMap, "shareMappings", i.ShareMappings) + return json.Marshal(objectMap) +} + +// Job - A device job. +type Job struct { + // READ-ONLY; The UTC date and time at which the job completed. + EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Error *JobErrorDetails `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the object. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The percentage of the job that is complete. + PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + + // READ-ONLY; The properties of the job. + Properties *JobProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time at which the job started. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The current status of the job. + Status *JobStatus `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "error", j.Error) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "percentComplete", j.PercentComplete) + populate(objectMap, "properties", j.Properties) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "status", j.Status) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Job. +func (j *Job) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, &j.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &j.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &j.Name) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, &j.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &j.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &j.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &j.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// JobErrorDetails - The job error information containing the list of job errors. +type JobErrorDetails struct { + // READ-ONLY; The code intended for programmatic access. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + ErrorDetails []*JobErrorItem `json:"errorDetails,omitempty" azure:"ro"` + + // READ-ONLY; The message that describes the error in detail. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobErrorDetails. +func (j JobErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", j.Code) + populate(objectMap, "errorDetails", j.ErrorDetails) + populate(objectMap, "message", j.Message) + return json.Marshal(objectMap) +} + +// JobErrorItem - The job error items. +type JobErrorItem struct { + // READ-ONLY; The code intended for programmatic access. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The message that describes the error in detail. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The recommended actions. + Recommendations []*string `json:"recommendations,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobErrorItem. +func (j JobErrorItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", j.Code) + populate(objectMap, "message", j.Message) + populate(objectMap, "recommendations", j.Recommendations) + return json.Marshal(objectMap) +} + +// JobProperties - The properties for the job. +type JobProperties struct { + // If only subfolders need to be refreshed, then the subfolder path inside the share or container. (The path is empty if there are no subfolders.) + Folder *string `json:"folder,omitempty"` + + // READ-ONLY; Current stage of the update operation. + CurrentStage *UpdateOperationStage `json:"currentStage,omitempty" azure:"ro"` + + // READ-ONLY; The download progress. + DownloadProgress *UpdateDownloadProgress `json:"downloadProgress,omitempty" azure:"ro"` + + // READ-ONLY; Local share/remote container relative path to the error manifest file of the refresh. + ErrorManifestFile *string `json:"errorManifestFile,omitempty" azure:"ro"` + + // READ-ONLY; The install progress. + InstallProgress *UpdateInstallProgress `json:"installProgress,omitempty" azure:"ro"` + + // READ-ONLY; The type of the job. + JobType *JobType `json:"jobType,omitempty" azure:"ro"` + + // READ-ONLY; ARM ID of the entity that was refreshed. + RefreshedEntityID *string `json:"refreshedEntityId,omitempty" azure:"ro"` + + // READ-ONLY; Total number of errors encountered during the refresh process. + TotalRefreshErrors *int32 `json:"totalRefreshErrors,omitempty" azure:"ro"` +} + +// JobsGetOptions contains the optional parameters for the Jobs.Get method. +type JobsGetOptions struct { + // placeholder for future optional parameters +} + +// KubernetesClusterInfo - Kubernetes cluster configuration +type KubernetesClusterInfo struct { + // REQUIRED; Kubernetes cluster version + Version *string `json:"version,omitempty"` + + // READ-ONLY; Etcd configuration + EtcdInfo *EtcdInfo `json:"etcdInfo,omitempty" azure:"ro"` + + // READ-ONLY; Kubernetes cluster nodes + Nodes []*NodeInfo `json:"nodes,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesClusterInfo. +func (k KubernetesClusterInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etcdInfo", k.EtcdInfo) + populate(objectMap, "nodes", k.Nodes) + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// KubernetesIPConfiguration - Kubernetes node IP configuration +type KubernetesIPConfiguration struct { + // IP address of the Kubernetes node. + IPAddress *string `json:"ipAddress,omitempty"` + + // READ-ONLY; Port of the Kubernetes node. + Port *string `json:"port,omitempty" azure:"ro"` +} + +// KubernetesRole - Kubernetes role. +type KubernetesRole struct { + Role + // Properties specific to Kubernetes role. + Properties *KubernetesRoleProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesRole. +func (k KubernetesRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + k.Role.marshalInternal(objectMap, RoleTypesKubernetes) + populate(objectMap, "properties", k.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesRole. +func (k *KubernetesRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &k.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := k.Role.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// KubernetesRoleCompute - Kubernetes role compute resource +type KubernetesRoleCompute struct { + // REQUIRED; VM profile + VMProfile *string `json:"vmProfile,omitempty"` + + // READ-ONLY; Memory in bytes + MemoryInBytes *int64 `json:"memoryInBytes,omitempty" azure:"ro"` + + // READ-ONLY; Processor count + ProcessorCount *int32 `json:"processorCount,omitempty" azure:"ro"` +} + +// KubernetesRoleNetwork - Kubernetes role network resource +type KubernetesRoleNetwork struct { + // READ-ONLY; Cni configuration + CniConfig *CniConfig `json:"cniConfig,omitempty" azure:"ro"` + + // READ-ONLY; Load balancer configuration + LoadBalancerConfig *LoadBalancerConfig `json:"loadBalancerConfig,omitempty" azure:"ro"` +} + +// KubernetesRoleProperties - Kubernetes role properties. +type KubernetesRoleProperties struct { + // REQUIRED; Host OS supported by the Kubernetes role. + HostPlatform *PlatformType `json:"hostPlatform,omitempty"` + + // REQUIRED; Kubernetes cluster configuration + KubernetesClusterInfo *KubernetesClusterInfo `json:"kubernetesClusterInfo,omitempty"` + + // REQUIRED; Kubernetes role resources + KubernetesRoleResources *KubernetesRoleResources `json:"kubernetesRoleResources,omitempty"` + + // REQUIRED; Role status. + RoleStatus *RoleStatus `json:"roleStatus,omitempty"` + + // READ-ONLY; Platform where the runtime is hosted. + HostPlatformType *HostPlatformType `json:"hostPlatformType,omitempty" azure:"ro"` + + // READ-ONLY; State of Kubernetes deployment + ProvisioningState *KubernetesState `json:"provisioningState,omitempty" azure:"ro"` +} + +// KubernetesRoleResources - Kubernetes role resources +type KubernetesRoleResources struct { + // REQUIRED; Kubernetes role compute resource + Compute *KubernetesRoleCompute `json:"compute,omitempty"` + + // Kubernetes role storage resource + Storage *KubernetesRoleStorage `json:"storage,omitempty"` + + // READ-ONLY; Kubernetes role network resource + Network *KubernetesRoleNetwork `json:"network,omitempty" azure:"ro"` +} + +// KubernetesRoleStorage - Kubernetes role storage resource +type KubernetesRoleStorage struct { + // Mount points of shares in role(s). + Endpoints []*MountPointMap `json:"endpoints,omitempty"` + + // READ-ONLY; Kubernetes storage class info. + StorageClasses []*KubernetesRoleStorageClassInfo `json:"storageClasses,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesRoleStorage. +func (k KubernetesRoleStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoints", k.Endpoints) + populate(objectMap, "storageClasses", k.StorageClasses) + return json.Marshal(objectMap) +} + +// KubernetesRoleStorageClassInfo - Kubernetes storage class info. +type KubernetesRoleStorageClassInfo struct { + // READ-ONLY; Storage class name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; If provisioned storage is posix compliant. + PosixCompliant *PosixComplianceStatus `json:"posixCompliant,omitempty" azure:"ro"` + + // READ-ONLY; Storage class type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// LoadBalancerConfig - Load balancer configuration +type LoadBalancerConfig struct { + // READ-ONLY; Load balancer type + Type *string `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; Load balancer version + Version *string `json:"version,omitempty" azure:"ro"` +} + +// MECRole - MEC role. +type MECRole struct { + Role + // Properties specific to MEC role. + Properties *MECRoleProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MECRole. +func (m MECRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.Role.marshalInternal(objectMap, RoleTypesMEC) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MECRole. +func (m *MECRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := m.Role.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// MECRoleProperties - MEC role properties. +type MECRoleProperties struct { + // REQUIRED; Role status. + RoleStatus *RoleStatus `json:"roleStatus,omitempty"` + + // Activation key of the MEC. + ConnectionString *AsymmetricEncryptedSecret `json:"connectionString,omitempty"` + + // Controller Endpoint. + ControllerEndpoint *string `json:"controllerEndpoint,omitempty"` + + // Unique Id of the Resource. + ResourceUniqueID *string `json:"resourceUniqueId,omitempty"` +} + +// MetricConfiguration - Metric configuration. +type MetricConfiguration struct { + // REQUIRED; Host name for the IoT hub associated to the device. + CounterSets []*MetricCounterSet `json:"counterSets,omitempty"` + + // REQUIRED; The Resource ID on which the metrics should be pushed. + ResourceID *string `json:"resourceId,omitempty"` + + // The MDM account to which the counters should be pushed. + MdmAccount *string `json:"mdmAccount,omitempty"` + + // The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified + MetricNameSpace *string `json:"metricNameSpace,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricConfiguration. +func (m MetricConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "counterSets", m.CounterSets) + populate(objectMap, "mdmAccount", m.MdmAccount) + populate(objectMap, "metricNameSpace", m.MetricNameSpace) + populate(objectMap, "resourceId", m.ResourceID) + return json.Marshal(objectMap) +} + +// MetricCounter - The metric counter +type MetricCounter struct { + // REQUIRED; The counter name. + Name *string `json:"name,omitempty"` + + // The additional dimensions to be added to metric. + AdditionalDimensions []*MetricDimension `json:"additionalDimensions,omitempty"` + + // The dimension filter. + DimensionFilter []*MetricDimension `json:"dimensionFilter,omitempty"` + + // The instance from which counter should be collected. + Instance *string `json:"instance,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricCounter. +func (m MetricCounter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalDimensions", m.AdditionalDimensions) + populate(objectMap, "dimensionFilter", m.DimensionFilter) + populate(objectMap, "instance", m.Instance) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// MetricCounterSet - The metric counter set +type MetricCounterSet struct { + // REQUIRED; The counters that should be collected in this set. + Counters []*MetricCounter `json:"counters,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricCounterSet. +func (m MetricCounterSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "counters", m.Counters) + return json.Marshal(objectMap) +} + +// MetricDimension - The metric dimension +type MetricDimension struct { + // REQUIRED; The dimension value. + SourceName *string `json:"sourceName,omitempty"` + + // REQUIRED; The dimension type. + SourceType *string `json:"sourceType,omitempty"` +} + +// MetricDimensionV1 - Metric Dimension v1. +type MetricDimensionV1 struct { + // Display name of the metrics dimension. + DisplayName *string `json:"displayName,omitempty"` + + // Name of the metrics dimension. + Name *string `json:"name,omitempty"` + + // To be exported to shoe box. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecificationV1 - Metric specification version 1. +type MetricSpecificationV1 struct { + // Metric aggregation type. + AggregationType *MetricAggregationType `json:"aggregationType,omitempty"` + + // Metric category. + Category *MetricCategory `json:"category,omitempty"` + + // Metric dimensions, other than default dimension which is resource. + Dimensions []*MetricDimensionV1 `json:"dimensions,omitempty"` + + // Description of the metric to be displayed. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // Display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + + // Set true to fill the gaps with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + + // Name of the metric. + Name *string `json:"name,omitempty"` + + // Resource name override. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` + + // Support metric aggregation type. + SupportedAggregationTypes []*MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + + // Support granularity of metrics. + SupportedTimeGrainTypes []*TimeGrain `json:"supportedTimeGrainTypes,omitempty"` + + // Metric units. + Unit *MetricUnit `json:"unit,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecificationV1. +func (m MetricSpecificationV1) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "name", m.Name) + populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// MonitoringConfigBeginCreateOrUpdateOptions contains the optional parameters for the MonitoringConfig.BeginCreateOrUpdate method. +type MonitoringConfigBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MonitoringConfigBeginDeleteOptions contains the optional parameters for the MonitoringConfig.BeginDelete method. +type MonitoringConfigBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// MonitoringConfigGetOptions contains the optional parameters for the MonitoringConfig.Get method. +type MonitoringConfigGetOptions struct { + // placeholder for future optional parameters +} + +// MonitoringConfigListOptions contains the optional parameters for the MonitoringConfig.List method. +type MonitoringConfigListOptions struct { + // placeholder for future optional parameters +} + +// MonitoringMetricConfiguration - The metric setting details for the role +type MonitoringMetricConfiguration struct { + ARMBaseModel + // REQUIRED; The metric setting properties. + Properties *MonitoringMetricConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; MonitoringConfiguration on ASE device + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringMetricConfiguration. +func (m MonitoringMetricConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringMetricConfiguration. +func (m *MonitoringMetricConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &m.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := m.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// MonitoringMetricConfigurationList - Collection of metric configurations. +type MonitoringMetricConfigurationList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of metric configurations. + Value []*MonitoringMetricConfiguration `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringMetricConfigurationList. +func (m MonitoringMetricConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MonitoringMetricConfigurationProperties - Metrics properties +type MonitoringMetricConfigurationProperties struct { + // REQUIRED; The metrics configuration details + MetricConfigurations []*MetricConfiguration `json:"metricConfigurations,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringMetricConfigurationProperties. +func (m MonitoringMetricConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricConfigurations", m.MetricConfigurations) + return json.Marshal(objectMap) +} + +// MountPointMap - The share mount point. +type MountPointMap struct { + // REQUIRED; ID of the share mounted to the role VM. + ShareID *string `json:"shareId,omitempty"` + + // READ-ONLY; Mount point for the share. + MountPoint *string `json:"mountPoint,omitempty" azure:"ro"` + + // READ-ONLY; Mounting type. + MountType *MountType `json:"mountType,omitempty" azure:"ro"` + + // READ-ONLY; ID of the role to which share is mounted. + RoleID *string `json:"roleId,omitempty" azure:"ro"` + + // READ-ONLY; Role type. + RoleType *RoleTypes `json:"roleType,omitempty" azure:"ro"` +} + +// NetworkAdapter - Represents the networkAdapter on a device. +type NetworkAdapter struct { + // Value indicating whether this adapter has DHCP enabled. + DhcpStatus *NetworkAdapterDHCPStatus `json:"dhcpStatus,omitempty"` + + // Value indicating whether this adapter is RDMA capable. + RdmaStatus *NetworkAdapterRDMAStatus `json:"rdmaStatus,omitempty"` + + // READ-ONLY; Instance ID of network adapter. + AdapterID *string `json:"adapterId,omitempty" azure:"ro"` + + // READ-ONLY; Hardware position of network adapter. + AdapterPosition *NetworkAdapterPosition `json:"adapterPosition,omitempty" azure:"ro"` + + // READ-ONLY; The list of DNS Servers of the device. + DNSServers []*string `json:"dnsServers,omitempty" azure:"ro"` + + // READ-ONLY; The IPv4 configuration of the network adapter. + IPv4Configuration *IPv4Config `json:"ipv4Configuration,omitempty" azure:"ro"` + + // READ-ONLY; The IPv6 configuration of the network adapter. + IPv6Configuration *IPv6Config `json:"ipv6Configuration,omitempty" azure:"ro"` + + // READ-ONLY; The IPv6 local address. + IPv6LinkLocalAddress *string `json:"ipv6LinkLocalAddress,omitempty" azure:"ro"` + + // READ-ONLY; Logical index of the adapter. + Index *int32 `json:"index,omitempty" azure:"ro"` + + // READ-ONLY; Hardware label for the adapter. + Label *string `json:"label,omitempty" azure:"ro"` + + // READ-ONLY; Link speed. + LinkSpeed *int64 `json:"linkSpeed,omitempty" azure:"ro"` + + // READ-ONLY; MAC address. + MacAddress *string `json:"macAddress,omitempty" azure:"ro"` + + // READ-ONLY; Network adapter name. + NetworkAdapterName *string `json:"networkAdapterName,omitempty" azure:"ro"` + + // READ-ONLY; Node ID of the network adapter. + NodeID *string `json:"nodeId,omitempty" azure:"ro"` + + // READ-ONLY; Value indicating whether this adapter is valid. + Status *NetworkAdapterStatus `json:"status,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkAdapter. +func (n NetworkAdapter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adapterId", n.AdapterID) + populate(objectMap, "adapterPosition", n.AdapterPosition) + populate(objectMap, "dnsServers", n.DNSServers) + populate(objectMap, "dhcpStatus", n.DhcpStatus) + populate(objectMap, "ipv4Configuration", n.IPv4Configuration) + populate(objectMap, "ipv6Configuration", n.IPv6Configuration) + populate(objectMap, "ipv6LinkLocalAddress", n.IPv6LinkLocalAddress) + populate(objectMap, "index", n.Index) + populate(objectMap, "label", n.Label) + populate(objectMap, "linkSpeed", n.LinkSpeed) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "networkAdapterName", n.NetworkAdapterName) + populate(objectMap, "nodeId", n.NodeID) + populate(objectMap, "rdmaStatus", n.RdmaStatus) + populate(objectMap, "status", n.Status) + return json.Marshal(objectMap) +} + +// NetworkAdapterPosition - The network adapter position. +type NetworkAdapterPosition struct { + // READ-ONLY; The network group. + NetworkGroup *NetworkGroup `json:"networkGroup,omitempty" azure:"ro"` + + // READ-ONLY; The port. + Port *int32 `json:"port,omitempty" azure:"ro"` +} + +// NetworkSettings - The network settings of a device. +type NetworkSettings struct { + ARMBaseModel + // READ-ONLY; The properties of network settings of a device. + Properties *NetworkSettingsProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; NetworkSettings on ASE device + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSettings. +func (n NetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSettings. +func (n *NetworkSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &n.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := n.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NetworkSettingsProperties - The properties of network settings. +type NetworkSettingsProperties struct { + // READ-ONLY; The network adapter list on the device. + NetworkAdapters []*NetworkAdapter `json:"networkAdapters,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSettingsProperties. +func (n NetworkSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkAdapters", n.NetworkAdapters) + return json.Marshal(objectMap) +} + +// Node - Represents a single node in a Data box Edge/Gateway device Gateway devices, standalone Edge devices and a single node cluster Edge device will +// all have 1 node Multi-node Edge devices will have more +// than 1 nodes +type Node struct { + ARMBaseModel + // READ-ONLY; The properties of the node + Properties *NodeProperties `json:"properties,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Node. +func (n Node) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", n.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Node. +func (n *Node) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &n.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := n.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NodeInfo - Kubernetes node info +type NodeInfo struct { + // IP Configuration of the Kubernetes node. + IPConfiguration []*KubernetesIPConfiguration `json:"ipConfiguration,omitempty"` + + // READ-ONLY; Node name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Node type - Master/Worker + Type *KubernetesNodeType `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NodeInfo. +func (n NodeInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipConfiguration", n.IPConfiguration) + populate(objectMap, "name", n.Name) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// NodeList - Collection of Nodes. +type NodeList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of Nodes. + Value []*Node `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NodeList. +func (n NodeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NodeProperties - This class represents the nodes in a highly available cluster +type NodeProperties struct { + // READ-ONLY; Serial number of the Chassis + NodeChassisSerialNumber *string `json:"nodeChassisSerialNumber,omitempty" azure:"ro"` + + // READ-ONLY; Display Name of the individual node + NodeDisplayName *string `json:"nodeDisplayName,omitempty" azure:"ro"` + + // READ-ONLY; Friendly software version name that is currently installed on the node + NodeFriendlySoftwareVersion *string `json:"nodeFriendlySoftwareVersion,omitempty" azure:"ro"` + + // READ-ONLY; HCS version that is currently installed on the node + NodeHcsVersion *string `json:"nodeHcsVersion,omitempty" azure:"ro"` + + // READ-ONLY; Guid instance id of the node + NodeInstanceID *string `json:"nodeInstanceId,omitempty" azure:"ro"` + + // READ-ONLY; Serial number of the individual node + NodeSerialNumber *string `json:"nodeSerialNumber,omitempty" azure:"ro"` + + // READ-ONLY; The current status of the individual node + NodeStatus *NodeStatus `json:"nodeStatus,omitempty" azure:"ro"` +} + +// NodesListByDataBoxEdgeDeviceOptions contains the optional parameters for the Nodes.ListByDataBoxEdgeDevice method. +type NodesListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// Operations. +type Operation struct { + // Properties displayed for the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // Is data action. + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Name of the operation. + Name *string `json:"name,omitempty"` + + // Origin of the operation. + Origin *string `json:"origin,omitempty"` + + // Operation properties. + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay - Operation display properties. +type OperationDisplay struct { + // Description of the operation to be performed. + Description *string `json:"description,omitempty"` + + // Operation to be performed on the resource. + Operation *string `json:"operation,omitempty"` + + // Provider name. + Provider *string `json:"provider,omitempty"` + + // The type of resource in which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationProperties - Operation properties. +type OperationProperties struct { + // Service specification. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsList - The list of operations used for the discovery of available provider operations. +type OperationsList struct { + // REQUIRED; The value. + Value []*Operation `json:"value,omitempty"` + + // Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsList. +func (o OperationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// OperationsStatusGetOptions contains the optional parameters for the OperationsStatus.Get method. +type OperationsStatusGetOptions struct { + // placeholder for future optional parameters +} + +// Order - The order details. +type Order struct { + ARMBaseModel + // The order properties. + Properties *OrderProperties `json:"properties,omitempty"` + + // READ-ONLY; Order configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Order. +func (o Order) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + o.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Order. +func (o *Order) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &o.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := o.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// OrderList - List of order entities. +type OrderList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of orders. + Value []*Order `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OrderList. +func (o OrderList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OrderProperties - Order properties. +type OrderProperties struct { + // REQUIRED; The contact details. + ContactInformation *ContactDetails `json:"contactInformation,omitempty"` + + // ShipmentType of the order + ShipmentType *ShipmentType `json:"shipmentType,omitempty"` + + // The shipping address. + ShippingAddress *Address `json:"shippingAddress,omitempty"` + + // READ-ONLY; Current status of the order. + CurrentStatus *OrderStatus `json:"currentStatus,omitempty" azure:"ro"` + + // READ-ONLY; Tracking information for the package delivered to the customer whether it has an original or a replacement device. + DeliveryTrackingInfo []*TrackingInfo `json:"deliveryTrackingInfo,omitempty" azure:"ro"` + + // READ-ONLY; List of status changes in the order. + OrderHistory []*OrderStatus `json:"orderHistory,omitempty" azure:"ro"` + + // READ-ONLY; Tracking information for the package returned from the customer whether it has an original or a replacement device. + ReturnTrackingInfo []*TrackingInfo `json:"returnTrackingInfo,omitempty" azure:"ro"` + + // READ-ONLY; Serial number of the device. + SerialNumber *string `json:"serialNumber,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OrderProperties. +func (o OrderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contactInformation", o.ContactInformation) + populate(objectMap, "currentStatus", o.CurrentStatus) + populate(objectMap, "deliveryTrackingInfo", o.DeliveryTrackingInfo) + populate(objectMap, "orderHistory", o.OrderHistory) + populate(objectMap, "returnTrackingInfo", o.ReturnTrackingInfo) + populate(objectMap, "serialNumber", o.SerialNumber) + populate(objectMap, "shipmentType", o.ShipmentType) + populate(objectMap, "shippingAddress", o.ShippingAddress) + return json.Marshal(objectMap) +} + +// OrderStatus - Represents a single status change. +type OrderStatus struct { + // REQUIRED; Status of the order as per the allowed status types. + Status *OrderState `json:"status,omitempty"` + + // Comments related to this status change. + Comments *string `json:"comments,omitempty"` + + // READ-ONLY; Dictionary to hold generic information which is not stored by the already existing properties + AdditionalOrderDetails map[string]*string `json:"additionalOrderDetails,omitempty" azure:"ro"` + + // READ-ONLY; Tracking information related to the state in the ordering flow + TrackingInformation *TrackingInfo `json:"trackingInformation,omitempty" azure:"ro"` + + // READ-ONLY; Time of status update. + UpdateDateTime *time.Time `json:"updateDateTime,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OrderStatus. +func (o OrderStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalOrderDetails", o.AdditionalOrderDetails) + populate(objectMap, "comments", o.Comments) + populate(objectMap, "status", o.Status) + populate(objectMap, "trackingInformation", o.TrackingInformation) + populateTimeRFC3339(objectMap, "updateDateTime", o.UpdateDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderStatus. +func (o *OrderStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalOrderDetails": + err = unpopulate(val, &o.AdditionalOrderDetails) + delete(rawMsg, key) + case "comments": + err = unpopulate(val, &o.Comments) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &o.Status) + delete(rawMsg, key) + case "trackingInformation": + err = unpopulate(val, &o.TrackingInformation) + delete(rawMsg, key) + case "updateDateTime": + err = unpopulateTimeRFC3339(val, &o.UpdateDateTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// OrdersBeginCreateOrUpdateOptions contains the optional parameters for the Orders.BeginCreateOrUpdate method. +type OrdersBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// OrdersBeginDeleteOptions contains the optional parameters for the Orders.BeginDelete method. +type OrdersBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// OrdersGetOptions contains the optional parameters for the Orders.Get method. +type OrdersGetOptions struct { + // placeholder for future optional parameters +} + +// OrdersListByDataBoxEdgeDeviceOptions contains the optional parameters for the Orders.ListByDataBoxEdgeDevice method. +type OrdersListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// OrdersListDCAccessCodeOptions contains the optional parameters for the Orders.ListDCAccessCode method. +type OrdersListDCAccessCodeOptions struct { + // placeholder for future optional parameters +} + +// PeriodicTimerEventTrigger - Trigger details. +type PeriodicTimerEventTrigger struct { + Trigger + // REQUIRED; Periodic timer trigger properties. + Properties *PeriodicTimerProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PeriodicTimerEventTrigger. +func (p PeriodicTimerEventTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Trigger.marshalInternal(objectMap, TriggerEventTypePeriodicTimerEvent) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicTimerEventTrigger. +func (p *PeriodicTimerEventTrigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := p.Trigger.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// PeriodicTimerProperties - Periodic timer trigger properties. +type PeriodicTimerProperties struct { + // REQUIRED; Role Sink information. + SinkInfo *RoleSinkInfo `json:"sinkInfo,omitempty"` + + // REQUIRED; Periodic timer details. + SourceInfo *PeriodicTimerSourceInfo `json:"sourceInfo,omitempty"` + + // A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific + // IoT modules in the device, the tag can be the + // name or the image URL of the module. + CustomContextTag *string `json:"customContextTag,omitempty"` +} + +// PeriodicTimerSourceInfo - Periodic timer event source. +type PeriodicTimerSourceInfo struct { + // REQUIRED; Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. + Schedule *string `json:"schedule,omitempty"` + + // REQUIRED; The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is + // not specified the time will considered to be in device + // timezone. The value will always be returned as UTC time. + StartTime *time.Time `json:"startTime,omitempty"` + + // Topic where periodic events are published to IoT device. + Topic *string `json:"topic,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PeriodicTimerSourceInfo. +func (p PeriodicTimerSourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "schedule", p.Schedule) + populateTimeRFC3339(objectMap, "startTime", p.StartTime) + populate(objectMap, "topic", p.Topic) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicTimerSourceInfo. +func (p *PeriodicTimerSourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "schedule": + err = unpopulate(val, &p.Schedule) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &p.StartTime) + delete(rawMsg, key) + case "topic": + err = unpopulate(val, &p.Topic) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ProactiveLogCollectionSettingsProperties - The properties of proactive log collection settings. +type ProactiveLogCollectionSettingsProperties struct { + // REQUIRED; Proactive diagnostic collection consent flag + UserConsent *ProactiveDiagnosticsConsent `json:"userConsent,omitempty"` +} + +// RawCertificateData - Raw Certificate Data. +type RawCertificateData struct { + // REQUIRED; The base64 encoded certificate raw data. + Certificate *string `json:"certificate,omitempty"` + + // The authentication type. + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` +} + +// RefreshDetails - Fields for tracking refresh job on the share or container. +type RefreshDetails struct { + // Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a + // successful job. + ErrorManifestFile *string `json:"errorManifestFile,omitempty"` + + // If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no + // job is in progress. + InProgressRefreshJobID *string `json:"inProgressRefreshJobId,omitempty"` + + // Indicates the completed time for the last refresh job on this particular share or container, if any.This could be a failed job or a successful job. + LastCompletedRefreshJobTimeInUTC *time.Time `json:"lastCompletedRefreshJobTimeInUTC,omitempty"` + + // Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. + LastJob *string `json:"lastJob,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RefreshDetails. +func (r RefreshDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorManifestFile", r.ErrorManifestFile) + populate(objectMap, "inProgressRefreshJobId", r.InProgressRefreshJobID) + populateTimeRFC3339(objectMap, "lastCompletedRefreshJobTimeInUTC", r.LastCompletedRefreshJobTimeInUTC) + populate(objectMap, "lastJob", r.LastJob) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefreshDetails. +func (r *RefreshDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "errorManifestFile": + err = unpopulate(val, &r.ErrorManifestFile) + delete(rawMsg, key) + case "inProgressRefreshJobId": + err = unpopulate(val, &r.InProgressRefreshJobID) + delete(rawMsg, key) + case "lastCompletedRefreshJobTimeInUTC": + err = unpopulateTimeRFC3339(val, &r.LastCompletedRefreshJobTimeInUTC) + delete(rawMsg, key) + case "lastJob": + err = unpopulate(val, &r.LastJob) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// RemoteSupportSettings - RemoteApplicationType for which remote support settings is being modified +type RemoteSupportSettings struct { + // Access level allowed for this remote application type + AccessLevel *AccessLevel `json:"accessLevel,omitempty"` + + // Expiration time stamp + ExpirationTimeStampInUTC *time.Time `json:"expirationTimeStampInUTC,omitempty"` + + // Remote application type + RemoteApplicationType *RemoteApplicationType `json:"remoteApplicationType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RemoteSupportSettings. +func (r RemoteSupportSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessLevel", r.AccessLevel) + populateTimeRFC3339(objectMap, "expirationTimeStampInUTC", r.ExpirationTimeStampInUTC) + populate(objectMap, "remoteApplicationType", r.RemoteApplicationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemoteSupportSettings. +func (r *RemoteSupportSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "accessLevel": + err = unpopulate(val, &r.AccessLevel) + delete(rawMsg, key) + case "expirationTimeStampInUTC": + err = unpopulateTimeRFC3339(val, &r.ExpirationTimeStampInUTC) + delete(rawMsg, key) + case "remoteApplicationType": + err = unpopulate(val, &r.RemoteApplicationType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ResourceIdentity - Msi identity details of the resource +type ResourceIdentity struct { + // Identity type + Type *MsiIdentityType `json:"type,omitempty"` + + // READ-ONLY; Service Principal Id backing the Msi + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; Home Tenant Id + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// ResourceMoveDetails - Fields for tracking resource move +type ResourceMoveDetails struct { + // Denotes whether move operation is in progress + OperationInProgress *ResourceMoveStatus `json:"operationInProgress,omitempty"` + + // Denotes the timeout of the operation to finish + OperationInProgressLockTimeoutInUTC *time.Time `json:"operationInProgressLockTimeoutInUTC,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceMoveDetails. +func (r ResourceMoveDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationInProgress", r.OperationInProgress) + populateTimeRFC3339(objectMap, "operationInProgressLockTimeoutInUTC", r.OperationInProgressLockTimeoutInUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveDetails. +func (r *ResourceMoveDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "operationInProgress": + err = unpopulate(val, &r.OperationInProgress) + delete(rawMsg, key) + case "operationInProgressLockTimeoutInUTC": + err = unpopulateTimeRFC3339(val, &r.OperationInProgressLockTimeoutInUTC) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ResourceTypeSKU - Resource type Sku object +type ResourceTypeSKU struct { + // READ-ONLY; The resource type. + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; The skus. + SKUs []*SKUInformation `json:"skus,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceTypeSKU. +func (r ResourceTypeSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "skus", r.SKUs) + return json.Marshal(objectMap) +} + +// RoleClassification provides polymorphic access to related types. +// Call the interface's GetRole() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CloudEdgeManagementRole, *IoTRole, *KubernetesRole, *MECRole, *Role +type RoleClassification interface { + // GetRole returns the Role content of the underlying type. + GetRole() *Role +} + +// Role - Compute role. +type Role struct { + ARMBaseModel + // REQUIRED; Role type. + Kind *RoleTypes `json:"kind,omitempty"` + + // READ-ONLY; Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// GetRole implements the RoleClassification interface for type Role. +func (r *Role) GetRole() *Role { return r } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Role. +func (r *Role) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return r.unmarshalInternal(rawMsg) +} + +func (r Role) marshalInternal(objectMap map[string]interface{}, discValue RoleTypes) { + r.ARMBaseModel.marshalInternal(objectMap) + r.Kind = &discValue + objectMap["kind"] = r.Kind + populate(objectMap, "systemData", r.SystemData) +} + +func (r *Role) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, &r.Kind) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &r.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := r.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// RoleList - Collection of all the roles on the Data Box Edge device. +type RoleList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The Value. + Value []RoleClassification `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type RoleList. +func (r RoleList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleList. +func (r *RoleList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, &r.NextLink) + delete(rawMsg, key) + case "value": + r.Value, err = unmarshalRoleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// RoleSinkInfo - Compute role against which events will be raised. +type RoleSinkInfo struct { + // REQUIRED; Compute role ID. + RoleID *string `json:"roleId,omitempty"` +} + +// RolesBeginCreateOrUpdateOptions contains the optional parameters for the Roles.BeginCreateOrUpdate method. +type RolesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RolesBeginDeleteOptions contains the optional parameters for the Roles.BeginDelete method. +type RolesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// RolesGetOptions contains the optional parameters for the Roles.Get method. +type RolesGetOptions struct { + // placeholder for future optional parameters +} + +// RolesListByDataBoxEdgeDeviceOptions contains the optional parameters for the Roles.ListByDataBoxEdgeDevice method. +type RolesListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// SKU - The SKU type. +type SKU struct { + // SKU name. + Name *SKUName `json:"name,omitempty"` + + // The SKU tier. This is based on the SKU name. + Tier *SKUTier `json:"tier,omitempty"` +} + +// SKUCapability - The metadata to describe the capability. +type SKUCapability struct { + // READ-ONLY; An invariant to describe the feature. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty" azure:"ro"` +} + +// SKUCost - The metadata for retrieving price info. +type SKUCost struct { + // READ-ONLY; The extended unit. + ExtendedUnit *string `json:"extendedUnit,omitempty" azure:"ro"` + + // READ-ONLY; Used for querying price from commerce. + MeterID *string `json:"meterId,omitempty" azure:"ro"` + + // READ-ONLY; The cost quantity. + Quantity *int64 `json:"quantity,omitempty" azure:"ro"` +} + +// SKUInformation - Sku information +type SKUInformation struct { + // READ-ONLY; The pricing info of the Sku. + Costs []*SKUCost `json:"costs,omitempty" azure:"ro"` + + // READ-ONLY; The Sku family. + Family *string `json:"family,omitempty" azure:"ro"` + + // READ-ONLY; The sku kind. + Kind *string `json:"kind,omitempty" azure:"ro"` + + // READ-ONLY; The locations where Sku is available with zones and sites info + LocationInfo []*SKULocationInfo `json:"locationInfo,omitempty" azure:"ro"` + + // READ-ONLY; The locations where Sku is available. + Locations []*string `json:"locations,omitempty" azure:"ro"` + + // READ-ONLY; The sku name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The required features for the sku to be available. + RequiredFeatures []*string `json:"requiredFeatures,omitempty" azure:"ro"` + + // READ-ONLY; The required quotaIds for the sku to be available. + RequiredQuotaIDs []*string `json:"requiredQuotaIds,omitempty" azure:"ro"` + + // READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SKUInformation. +func (s SKUInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "costs", s.Costs) + populate(objectMap, "family", s.Family) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "locationInfo", s.LocationInfo) + populate(objectMap, "locations", s.Locations) + populate(objectMap, "name", s.Name) + populate(objectMap, "requiredFeatures", s.RequiredFeatures) + populate(objectMap, "requiredQuotaIds", s.RequiredQuotaIDs) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// SKUInformationList - List of SKU Information objects +type SKUInformationList struct { + // READ-ONLY; Links to the next set of results + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of ResourceTypeSku objects + Value []*ResourceTypeSKU `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SKUInformationList. +func (s SKUInformationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SKULocationInfo - The location info. +type SKULocationInfo struct { + // READ-ONLY; The location. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; The sites. + Sites []*string `json:"sites,omitempty" azure:"ro"` + + // READ-ONLY; The zones. + Zones []*string `json:"zones,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SKULocationInfo. +func (s SKULocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", s.Location) + populate(objectMap, "sites", s.Sites) + populate(objectMap, "zones", s.Zones) + return json.Marshal(objectMap) +} + +// Secret - Holds device secret either as a KeyVault reference or as an encrypted value. +type Secret struct { + // Encrypted (using device public key) secret value. + EncryptedSecret *AsymmetricEncryptedSecret `json:"encryptedSecret,omitempty"` + + // Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). + KeyVaultID *string `json:"keyVaultId,omitempty"` +} + +// SecuritySettings - The security settings of a device. +type SecuritySettings struct { + ARMBaseModel + // REQUIRED; Properties of the security settings. + Properties *SecuritySettingsProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SecuritySettings. +func (s SecuritySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySettings. +func (s *SecuritySettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SecuritySettingsProperties - The properties of security settings. +type SecuritySettingsProperties struct { + // REQUIRED; Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The + // Actual password should have at least 8 characters that are a + // combination of uppercase, lowercase, numeric, and special characters. + DeviceAdminPassword *AsymmetricEncryptedSecret `json:"deviceAdminPassword,omitempty"` +} + +// ServiceSpecification - Service specification. +type ServiceSpecification struct { + // Metric specification as defined by shoebox. + MetricSpecifications []*MetricSpecificationV1 `json:"metricSpecifications,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// Share - Represents a share on the Data Box Edge/Gateway device. +type Share struct { + ARMBaseModel + // REQUIRED; The share properties. + Properties *ShareProperties `json:"properties,omitempty"` + + // READ-ONLY; Share on ASE device + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Share. +func (s Share) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Share. +func (s *Share) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &s.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ShareAccessRight - Specifies the mapping between this particular user and the type of access he has on shares on this device. +type ShareAccessRight struct { + // REQUIRED; Type of access to be allowed on the share for this user. + AccessType *ShareAccessType `json:"accessType,omitempty"` + + // REQUIRED; The share ID. + ShareID *string `json:"shareId,omitempty"` +} + +// ShareList - Collection of all the shares on the Data Box Edge/Gateway device. +type ShareList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of shares. + Value []*Share `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ShareList. +func (s ShareList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// ShareProperties - The share properties. +type ShareProperties struct { + // REQUIRED; Access protocol to be used by the share. + AccessProtocol *ShareAccessProtocol `json:"accessProtocol,omitempty"` + + // REQUIRED; Current monitoring status of the share. + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty"` + + // REQUIRED; Current status of the share. + ShareStatus *ShareStatus `json:"shareStatus,omitempty"` + + // Azure container mapping for the share. + AzureContainerInfo *AzureContainerInfo `json:"azureContainerInfo,omitempty"` + + // List of IP addresses and corresponding access rights on the share(required for NFS protocol). + ClientAccessRights []*ClientAccessRight `json:"clientAccessRights,omitempty"` + + // Data policy of the share. + DataPolicy *DataPolicy `json:"dataPolicy,omitempty"` + + // Description for the share. + Description *string `json:"description,omitempty"` + + // Details of the refresh job on this share. + RefreshDetails *RefreshDetails `json:"refreshDetails,omitempty"` + + // Mapping of users and corresponding access rights on the share (required for SMB protocol). + UserAccessRights []*UserAccessRight `json:"userAccessRights,omitempty"` + + // READ-ONLY; Share mount point to the role. + ShareMappings []*MountPointMap `json:"shareMappings,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ShareProperties. +func (s ShareProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessProtocol", s.AccessProtocol) + populate(objectMap, "azureContainerInfo", s.AzureContainerInfo) + populate(objectMap, "clientAccessRights", s.ClientAccessRights) + populate(objectMap, "dataPolicy", s.DataPolicy) + populate(objectMap, "description", s.Description) + populate(objectMap, "monitoringStatus", s.MonitoringStatus) + populate(objectMap, "refreshDetails", s.RefreshDetails) + populate(objectMap, "shareMappings", s.ShareMappings) + populate(objectMap, "shareStatus", s.ShareStatus) + populate(objectMap, "userAccessRights", s.UserAccessRights) + return json.Marshal(objectMap) +} + +// SharesBeginCreateOrUpdateOptions contains the optional parameters for the Shares.BeginCreateOrUpdate method. +type SharesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SharesBeginDeleteOptions contains the optional parameters for the Shares.BeginDelete method. +type SharesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SharesBeginRefreshOptions contains the optional parameters for the Shares.BeginRefresh method. +type SharesBeginRefreshOptions struct { + // placeholder for future optional parameters +} + +// SharesGetOptions contains the optional parameters for the Shares.Get method. +type SharesGetOptions struct { + // placeholder for future optional parameters +} + +// SharesListByDataBoxEdgeDeviceOptions contains the optional parameters for the Shares.ListByDataBoxEdgeDevice method. +type SharesListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// StorageAccount - Represents a Storage Account on the Data Box Edge/Gateway device. +type StorageAccount struct { + ARMBaseModel + // REQUIRED; The Storage Account properties. + Properties *StorageAccountProperties `json:"properties,omitempty"` + + // READ-ONLY; StorageAccount object on ASE device + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageAccount. +func (s StorageAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccount. +func (s *StorageAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &s.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StorageAccountCredential - The storage account credential. +type StorageAccountCredential struct { + ARMBaseModel + // REQUIRED; The storage account credential properties. + Properties *StorageAccountCredentialProperties `json:"properties,omitempty"` + + // READ-ONLY; StorageAccountCredential object + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageAccountCredential. +func (s StorageAccountCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountCredential. +func (s *StorageAccountCredential) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &s.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StorageAccountCredentialList - The collection of storage account credentials. +type StorageAccountCredentialList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The value. + Value []*StorageAccountCredential `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageAccountCredentialList. +func (s StorageAccountCredentialList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StorageAccountCredentialProperties - The storage account credential properties. +type StorageAccountCredentialProperties struct { + // REQUIRED; Type of storage accessed on the storage account. + AccountType *AccountType `json:"accountType,omitempty"` + + // REQUIRED; Alias for the storage account. + Alias *string `json:"alias,omitempty"` + + // REQUIRED; Signifies whether SSL needs to be enabled or not. + SSLStatus *SSLStatus `json:"sslStatus,omitempty"` + + // Encrypted storage key. + AccountKey *AsymmetricEncryptedSecret `json:"accountKey,omitempty"` + + // Blob end point for private clouds. + BlobDomainName *string `json:"blobDomainName,omitempty"` + + // Connection string for the storage account. Use this string if username and account key are not specified. + ConnectionString *string `json:"connectionString,omitempty"` + + // Id of the storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` + + // Username for the storage account. + UserName *string `json:"userName,omitempty"` +} + +// StorageAccountCredentialsBeginCreateOrUpdateOptions contains the optional parameters for the StorageAccountCredentials.BeginCreateOrUpdate method. +type StorageAccountCredentialsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountCredentialsBeginDeleteOptions contains the optional parameters for the StorageAccountCredentials.BeginDelete method. +type StorageAccountCredentialsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountCredentialsGetOptions contains the optional parameters for the StorageAccountCredentials.Get method. +type StorageAccountCredentialsGetOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountCredentialsListByDataBoxEdgeDeviceOptions contains the optional parameters for the StorageAccountCredentials.ListByDataBoxEdgeDevice method. +type StorageAccountCredentialsListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountList - Collection of all the Storage Accounts on the Data Box Edge/Gateway device. +type StorageAccountList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of storageAccounts. + Value []*StorageAccount `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageAccountList. +func (s StorageAccountList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StorageAccountProperties - The storage account properties. +type StorageAccountProperties struct { + // REQUIRED; Data policy of the storage Account. + DataPolicy *DataPolicy `json:"dataPolicy,omitempty"` + + // Description for the storage Account. + Description *string `json:"description,omitempty"` + + // Storage Account Credential Id + StorageAccountCredentialID *string `json:"storageAccountCredentialId,omitempty"` + + // Current status of the storage account + StorageAccountStatus *StorageAccountStatus `json:"storageAccountStatus,omitempty"` + + // READ-ONLY; BlobEndpoint of Storage Account + BlobEndpoint *string `json:"blobEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The Container Count. Present only for Storage Accounts with DataPolicy set to Cloud. + ContainerCount *int32 `json:"containerCount,omitempty" azure:"ro"` +} + +// StorageAccountsBeginCreateOrUpdateOptions contains the optional parameters for the StorageAccounts.BeginCreateOrUpdate method. +type StorageAccountsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountsBeginDeleteOptions contains the optional parameters for the StorageAccounts.BeginDelete method. +type StorageAccountsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountsGetOptions contains the optional parameters for the StorageAccounts.Get method. +type StorageAccountsGetOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountsListByDataBoxEdgeDeviceOptions contains the optional parameters for the StorageAccounts.ListByDataBoxEdgeDevice method. +type StorageAccountsListByDataBoxEdgeDeviceOptions struct { + // placeholder for future optional parameters +} + +type SubscriptionProperties struct { + LocationPlacementID *string `json:"locationPlacementId,omitempty"` + QuotaID *string `json:"quotaId,omitempty"` + RegisteredFeatures []*SubscriptionRegisteredFeatures `json:"registeredFeatures,omitempty"` + SerializedDetails *string `json:"serializedDetails,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionProperties. +func (s SubscriptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "locationPlacementId", s.LocationPlacementID) + populate(objectMap, "quotaId", s.QuotaID) + populate(objectMap, "registeredFeatures", s.RegisteredFeatures) + populate(objectMap, "serializedDetails", s.SerializedDetails) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +type SubscriptionRegisteredFeatures struct { + Name *string `json:"name,omitempty"` + State *string `json:"state,omitempty"` +} + +// SupportPackageRequestProperties - The share properties. +type SupportPackageRequestProperties struct { + // Type of files, which need to be included in the logs This will contain the type of logs (Default/DefaultWithDumps/None/All/DefaultWithArchived) or a + // comma separated list of log types that are required + Include *string `json:"include,omitempty"` + + // MaximumTimeStamp until where logs need to be collected + MaximumTimeStamp *time.Time `json:"maximumTimeStamp,omitempty"` + + // Start of the timespan of the log collection + MinimumTimeStamp *time.Time `json:"minimumTimeStamp,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SupportPackageRequestProperties. +func (s SupportPackageRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "include", s.Include) + populateTimeRFC3339(objectMap, "maximumTimeStamp", s.MaximumTimeStamp) + populateTimeRFC3339(objectMap, "minimumTimeStamp", s.MinimumTimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SupportPackageRequestProperties. +func (s *SupportPackageRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "include": + err = unpopulate(val, &s.Include) + delete(rawMsg, key) + case "maximumTimeStamp": + err = unpopulateTimeRFC3339(val, &s.MaximumTimeStamp) + delete(rawMsg, key) + case "minimumTimeStamp": + err = unpopulateTimeRFC3339(val, &s.MinimumTimeStamp) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SupportPackagesBeginTriggerSupportPackageOptions contains the optional parameters for the SupportPackages.BeginTriggerSupportPackage method. +type SupportPackagesBeginTriggerSupportPackageOptions struct { + // placeholder for future optional parameters +} + +// SymmetricKey - Symmetric key for authentication. +type SymmetricKey struct { + // Connection string based on the symmetric key. + ConnectionString *AsymmetricEncryptedSecret `json:"connectionString,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TrackingInfo - Tracking courier information. +type TrackingInfo struct { + // Name of the carrier used in the delivery. + CarrierName *string `json:"carrierName,omitempty"` + + // Serial number of the device being tracked. + SerialNumber *string `json:"serialNumber,omitempty"` + + // Tracking ID of the shipment. + TrackingID *string `json:"trackingId,omitempty"` + + // Tracking URL of the shipment. + TrackingURL *string `json:"trackingUrl,omitempty"` +} + +// TriggerClassification provides polymorphic access to related types. +// Call the interface's GetTrigger() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FileEventTrigger, *PeriodicTimerEventTrigger, *Trigger +type TriggerClassification interface { + // GetTrigger returns the Trigger content of the underlying type. + GetTrigger() *Trigger +} + +// Trigger details. +type Trigger struct { + ARMBaseModel + // REQUIRED; Trigger Kind. + Kind *TriggerEventType `json:"kind,omitempty"` + + // READ-ONLY; Trigger in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// GetTrigger implements the TriggerClassification interface for type Trigger. +func (t *Trigger) GetTrigger() *Trigger { return t } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Trigger. +func (t *Trigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return t.unmarshalInternal(rawMsg) +} + +func (t Trigger) marshalInternal(objectMap map[string]interface{}, discValue TriggerEventType) { + t.ARMBaseModel.marshalInternal(objectMap) + t.Kind = &discValue + objectMap["kind"] = t.Kind + populate(objectMap, "systemData", t.SystemData) +} + +func (t *Trigger) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, &t.Kind) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &t.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := t.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// TriggerList - Collection of all trigger on the data box edge device. +type TriggerList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of triggers. + Value []TriggerClassification `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type TriggerList. +func (t TriggerList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerList. +func (t *TriggerList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, &t.NextLink) + delete(rawMsg, key) + case "value": + t.Value, err = unmarshalTriggerClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TriggerSupportPackageRequest - The request object for trigger support package. +type TriggerSupportPackageRequest struct { + ARMBaseModel + // REQUIRED; The TriggerSupportPackageRequest properties. + Properties *SupportPackageRequestProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TriggerSupportPackageRequest. +func (t TriggerSupportPackageRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerSupportPackageRequest. +func (t *TriggerSupportPackageRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := t.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// TriggersBeginCreateOrUpdateOptions contains the optional parameters for the Triggers.BeginCreateOrUpdate method. +type TriggersBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TriggersBeginDeleteOptions contains the optional parameters for the Triggers.BeginDelete method. +type TriggersBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// TriggersGetOptions contains the optional parameters for the Triggers.Get method. +type TriggersGetOptions struct { + // placeholder for future optional parameters +} + +// TriggersListByDataBoxEdgeDeviceOptions contains the optional parameters for the Triggers.ListByDataBoxEdgeDevice method. +type TriggersListByDataBoxEdgeDeviceOptions struct { + // Specify $filter='CustomContextTag eq ' to filter on custom context tag property + Filter *string +} + +// UpdateDetails - Update Specific attributes +type UpdateDetails struct { + // Estimated Install Time for the update + EstimatedInstallTimeInMins *int32 `json:"estimatedInstallTimeInMins,omitempty"` + + // Friendly Version Number + FriendlyVersionNumber *string `json:"friendlyVersionNumber,omitempty"` + + // Impact of Installing an updateType + InstallationImpact *InstallationImpact `json:"installationImpact,omitempty"` + + // Indicates if updates are available and at least one of the updates needs a reboot. + RebootBehavior *InstallRebootBehavior `json:"rebootBehavior,omitempty"` + + // Status of the update. + Status *UpdateStatus `json:"status,omitempty"` + + // Target Version number + TargetVersion *string `json:"targetVersion,omitempty"` + + // Size of the update(In Bytes) + UpdateSize *float64 `json:"updateSize,omitempty"` + + // Title of the Update + UpdateTitle *string `json:"updateTitle,omitempty"` + + // Type of the Update + UpdateType *UpdateType `json:"updateType,omitempty"` +} + +// UpdateDownloadProgress - Details about the download progress of update. +type UpdateDownloadProgress struct { + // READ-ONLY; The download phase. + DownloadPhase *DownloadPhase `json:"downloadPhase,omitempty" azure:"ro"` + + // READ-ONLY; Number of updates downloaded. + NumberOfUpdatesDownloaded *int32 `json:"numberOfUpdatesDownloaded,omitempty" azure:"ro"` + + // READ-ONLY; Number of updates to download. + NumberOfUpdatesToDownload *int32 `json:"numberOfUpdatesToDownload,omitempty" azure:"ro"` + + // READ-ONLY; Percentage of completion. + PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + + // READ-ONLY; Total bytes downloaded. + TotalBytesDownloaded *float64 `json:"totalBytesDownloaded,omitempty" azure:"ro"` + + // READ-ONLY; Total bytes to download. + TotalBytesToDownload *float64 `json:"totalBytesToDownload,omitempty" azure:"ro"` +} + +// UpdateInstallProgress - Progress details during installation of updates. +type UpdateInstallProgress struct { + // READ-ONLY; Number of updates installed. + NumberOfUpdatesInstalled *int32 `json:"numberOfUpdatesInstalled,omitempty" azure:"ro"` + + // READ-ONLY; Number of updates to install. + NumberOfUpdatesToInstall *int32 `json:"numberOfUpdatesToInstall,omitempty" azure:"ro"` + + // READ-ONLY; Percentage completed. + PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` +} + +// UpdateSummary - Details about ongoing updates and availability of updates on the device. +type UpdateSummary struct { + ARMBaseModel + // The device update information summary. + Properties *UpdateSummaryProperties `json:"properties,omitempty"` + + // READ-ONLY; UpdateSummary Result + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSummary. +func (u UpdateSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + u.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummary. +func (u *UpdateSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &u.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := u.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// UpdateSummaryProperties - The device update information summary. +type UpdateSummaryProperties struct { + // The last time when a scan was done on the device. + DeviceLastScannedDateTime *time.Time `json:"deviceLastScannedDateTime,omitempty"` + + // The current version of the device in format: 1.2.17312.13.", + DeviceVersionNumber *string `json:"deviceVersionNumber,omitempty"` + + // The current version of the device in text format. + FriendlyDeviceVersionName *string `json:"friendlyDeviceVersionName,omitempty"` + + // The time when the last scan job was completed (success/cancelled/failed) on the appliance. + LastCompletedScanJobDateTime *time.Time `json:"lastCompletedScanJobDateTime,omitempty"` + + // The time when the Last Install job was completed successfully on the appliance + LastSuccessfulInstallJobDateTime *time.Time `json:"lastSuccessfulInstallJobDateTime,omitempty"` + + // Time when the last scan job is successfully completed. + LastSuccessfulScanJobTime *time.Time `json:"lastSuccessfulScanJobTime,omitempty"` + + // READ-ONLY; The job ID of the download job in progress. + InProgressDownloadJobID *string `json:"inProgressDownloadJobId,omitempty" azure:"ro"` + + // READ-ONLY; The time when the currently running download (if any) started. + InProgressDownloadJobStartedDateTime *time.Time `json:"inProgressDownloadJobStartedDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The job ID of the install job in progress. + InProgressInstallJobID *string `json:"inProgressInstallJobId,omitempty" azure:"ro"` + + // READ-ONLY; The time when the currently running install (if any) started. + InProgressInstallJobStartedDateTime *time.Time `json:"inProgressInstallJobStartedDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The time when the last Download job was completed (success/cancelled/failed) on the appliance. + LastCompletedDownloadJobDateTime *time.Time `json:"lastCompletedDownloadJobDateTime,omitempty" azure:"ro"` + + // READ-ONLY; JobId of the last ran download job.(Can be success/cancelled/failed) + LastCompletedDownloadJobID *string `json:"lastCompletedDownloadJobId,omitempty" azure:"ro"` + + // READ-ONLY; The time when the last Install job was completed (success/cancelled/failed) on the appliance. + LastCompletedInstallJobDateTime *time.Time `json:"lastCompletedInstallJobDateTime,omitempty" azure:"ro"` + + // READ-ONLY; JobId of the last ran install job.(Can be success/cancelled/failed) + LastCompletedInstallJobID *string `json:"lastCompletedInstallJobId,omitempty" azure:"ro"` + + // READ-ONLY; JobStatus of the last ran download job. + LastDownloadJobStatus *JobStatus `json:"lastDownloadJobStatus,omitempty" azure:"ro"` + + // READ-ONLY; JobStatus of the last ran install job. + LastInstallJobStatus *JobStatus `json:"lastInstallJobStatus,omitempty" azure:"ro"` + + // READ-ONLY; The current update operation. + OngoingUpdateOperation *UpdateOperation `json:"ongoingUpdateOperation,omitempty" azure:"ro"` + + // READ-ONLY; Indicates if updates are available and at least one of the updates needs a reboot. + RebootBehavior *InstallRebootBehavior `json:"rebootBehavior,omitempty" azure:"ro"` + + // READ-ONLY; The number of updates available for the current device version as per the last device scan. + TotalNumberOfUpdatesAvailable *int32 `json:"totalNumberOfUpdatesAvailable,omitempty" azure:"ro"` + + // READ-ONLY; The total number of items pending download. + TotalNumberOfUpdatesPendingDownload *int32 `json:"totalNumberOfUpdatesPendingDownload,omitempty" azure:"ro"` + + // READ-ONLY; The total number of items pending install. + TotalNumberOfUpdatesPendingInstall *int32 `json:"totalNumberOfUpdatesPendingInstall,omitempty" azure:"ro"` + + // READ-ONLY; The total time in Minutes + TotalTimeInMinutes *int32 `json:"totalTimeInMinutes,omitempty" azure:"ro"` + + // READ-ONLY; The total size of updates available for download in bytes. + TotalUpdateSizeInBytes *float64 `json:"totalUpdateSizeInBytes,omitempty" azure:"ro"` + + // READ-ONLY; The list of updates available for install. + UpdateTitles []*string `json:"updateTitles,omitempty" azure:"ro"` + + // READ-ONLY; The list of updates available for install. + Updates []*UpdateDetails `json:"updates,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSummaryProperties. +func (u UpdateSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "deviceLastScannedDateTime", u.DeviceLastScannedDateTime) + populate(objectMap, "deviceVersionNumber", u.DeviceVersionNumber) + populate(objectMap, "friendlyDeviceVersionName", u.FriendlyDeviceVersionName) + populate(objectMap, "inProgressDownloadJobId", u.InProgressDownloadJobID) + populateTimeRFC3339(objectMap, "inProgressDownloadJobStartedDateTime", u.InProgressDownloadJobStartedDateTime) + populate(objectMap, "inProgressInstallJobId", u.InProgressInstallJobID) + populateTimeRFC3339(objectMap, "inProgressInstallJobStartedDateTime", u.InProgressInstallJobStartedDateTime) + populateTimeRFC3339(objectMap, "lastCompletedDownloadJobDateTime", u.LastCompletedDownloadJobDateTime) + populate(objectMap, "lastCompletedDownloadJobId", u.LastCompletedDownloadJobID) + populateTimeRFC3339(objectMap, "lastCompletedInstallJobDateTime", u.LastCompletedInstallJobDateTime) + populate(objectMap, "lastCompletedInstallJobId", u.LastCompletedInstallJobID) + populateTimeRFC3339(objectMap, "lastCompletedScanJobDateTime", u.LastCompletedScanJobDateTime) + populate(objectMap, "lastDownloadJobStatus", u.LastDownloadJobStatus) + populate(objectMap, "lastInstallJobStatus", u.LastInstallJobStatus) + populateTimeRFC3339(objectMap, "lastSuccessfulInstallJobDateTime", u.LastSuccessfulInstallJobDateTime) + populateTimeRFC3339(objectMap, "lastSuccessfulScanJobTime", u.LastSuccessfulScanJobTime) + populate(objectMap, "ongoingUpdateOperation", u.OngoingUpdateOperation) + populate(objectMap, "rebootBehavior", u.RebootBehavior) + populate(objectMap, "totalNumberOfUpdatesAvailable", u.TotalNumberOfUpdatesAvailable) + populate(objectMap, "totalNumberOfUpdatesPendingDownload", u.TotalNumberOfUpdatesPendingDownload) + populate(objectMap, "totalNumberOfUpdatesPendingInstall", u.TotalNumberOfUpdatesPendingInstall) + populate(objectMap, "totalTimeInMinutes", u.TotalTimeInMinutes) + populate(objectMap, "totalUpdateSizeInBytes", u.TotalUpdateSizeInBytes) + populate(objectMap, "updateTitles", u.UpdateTitles) + populate(objectMap, "updates", u.Updates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummaryProperties. +func (u *UpdateSummaryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceLastScannedDateTime": + err = unpopulateTimeRFC3339(val, &u.DeviceLastScannedDateTime) + delete(rawMsg, key) + case "deviceVersionNumber": + err = unpopulate(val, &u.DeviceVersionNumber) + delete(rawMsg, key) + case "friendlyDeviceVersionName": + err = unpopulate(val, &u.FriendlyDeviceVersionName) + delete(rawMsg, key) + case "inProgressDownloadJobId": + err = unpopulate(val, &u.InProgressDownloadJobID) + delete(rawMsg, key) + case "inProgressDownloadJobStartedDateTime": + err = unpopulateTimeRFC3339(val, &u.InProgressDownloadJobStartedDateTime) + delete(rawMsg, key) + case "inProgressInstallJobId": + err = unpopulate(val, &u.InProgressInstallJobID) + delete(rawMsg, key) + case "inProgressInstallJobStartedDateTime": + err = unpopulateTimeRFC3339(val, &u.InProgressInstallJobStartedDateTime) + delete(rawMsg, key) + case "lastCompletedDownloadJobDateTime": + err = unpopulateTimeRFC3339(val, &u.LastCompletedDownloadJobDateTime) + delete(rawMsg, key) + case "lastCompletedDownloadJobId": + err = unpopulate(val, &u.LastCompletedDownloadJobID) + delete(rawMsg, key) + case "lastCompletedInstallJobDateTime": + err = unpopulateTimeRFC3339(val, &u.LastCompletedInstallJobDateTime) + delete(rawMsg, key) + case "lastCompletedInstallJobId": + err = unpopulate(val, &u.LastCompletedInstallJobID) + delete(rawMsg, key) + case "lastCompletedScanJobDateTime": + err = unpopulateTimeRFC3339(val, &u.LastCompletedScanJobDateTime) + delete(rawMsg, key) + case "lastDownloadJobStatus": + err = unpopulate(val, &u.LastDownloadJobStatus) + delete(rawMsg, key) + case "lastInstallJobStatus": + err = unpopulate(val, &u.LastInstallJobStatus) + delete(rawMsg, key) + case "lastSuccessfulInstallJobDateTime": + err = unpopulateTimeRFC3339(val, &u.LastSuccessfulInstallJobDateTime) + delete(rawMsg, key) + case "lastSuccessfulScanJobTime": + err = unpopulateTimeRFC3339(val, &u.LastSuccessfulScanJobTime) + delete(rawMsg, key) + case "ongoingUpdateOperation": + err = unpopulate(val, &u.OngoingUpdateOperation) + delete(rawMsg, key) + case "rebootBehavior": + err = unpopulate(val, &u.RebootBehavior) + delete(rawMsg, key) + case "totalNumberOfUpdatesAvailable": + err = unpopulate(val, &u.TotalNumberOfUpdatesAvailable) + delete(rawMsg, key) + case "totalNumberOfUpdatesPendingDownload": + err = unpopulate(val, &u.TotalNumberOfUpdatesPendingDownload) + delete(rawMsg, key) + case "totalNumberOfUpdatesPendingInstall": + err = unpopulate(val, &u.TotalNumberOfUpdatesPendingInstall) + delete(rawMsg, key) + case "totalTimeInMinutes": + err = unpopulate(val, &u.TotalTimeInMinutes) + delete(rawMsg, key) + case "totalUpdateSizeInBytes": + err = unpopulate(val, &u.TotalUpdateSizeInBytes) + delete(rawMsg, key) + case "updateTitles": + err = unpopulate(val, &u.UpdateTitles) + delete(rawMsg, key) + case "updates": + err = unpopulate(val, &u.Updates) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// UploadCertificateRequest - The upload certificate request. +type UploadCertificateRequest struct { + // REQUIRED; The Base 64 encoded certificate raw data. + Properties *RawCertificateData `json:"properties,omitempty"` +} + +// UploadCertificateResponse - The upload registration certificate response. +type UploadCertificateResponse struct { + // Specifies authentication type. + AuthType *AuthenticationType `json:"authType,omitempty"` + + // READ-ONLY; Identifier of the target resource that is the recipient of the requested token. + AADAudience *string `json:"aadAudience,omitempty" azure:"ro"` + + // READ-ONLY; Azure Active Directory tenant authority. + AADAuthority *string `json:"aadAuthority,omitempty" azure:"ro"` + + // READ-ONLY; Azure Active Directory tenant ID. + AADTenantID *string `json:"aadTenantId,omitempty" azure:"ro"` + + // READ-ONLY; The azure management endpoint audience. + AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty" azure:"ro"` + + // READ-ONLY; The resource ID of the Data Box Edge/Gateway device. + ResourceID *string `json:"resourceId,omitempty" azure:"ro"` + + // READ-ONLY; Azure Active Directory service principal client ID. + ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty" azure:"ro"` + + // READ-ONLY; Azure Active Directory service principal object ID. + ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty" azure:"ro"` +} + +// User - Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. +type User struct { + ARMBaseModel + // REQUIRED; The storage account credential properties. + Properties *UserProperties `json:"properties,omitempty"` + + // READ-ONLY; User in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type User. +func (u User) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + u.ARMBaseModel.marshalInternal(objectMap) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type User. +func (u *User) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &u.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := u.ARMBaseModel.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// UserAccessRight - The mapping between a particular user and the access type on the SMB share. +type UserAccessRight struct { + // REQUIRED; Type of access to be allowed for the user. + AccessType *ShareAccessType `json:"accessType,omitempty"` + + // REQUIRED; User ID (already existing in the device). + UserID *string `json:"userId,omitempty"` +} + +// UserList - Collection of users. +type UserList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of users. + Value []*User `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type UserList. +func (u UserList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UserProperties - The user properties. +type UserProperties struct { + // REQUIRED; Type of the user. + UserType *UserType `json:"userType,omitempty"` + + // The password details. + EncryptedPassword *AsymmetricEncryptedSecret `json:"encryptedPassword,omitempty"` + + // READ-ONLY; List of shares that the user has rights on. This field should not be specified during user creation. + ShareAccessRights []*ShareAccessRight `json:"shareAccessRights,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type UserProperties. +func (u UserProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptedPassword", u.EncryptedPassword) + populate(objectMap, "shareAccessRights", u.ShareAccessRights) + populate(objectMap, "userType", u.UserType) + return json.Marshal(objectMap) +} + +// UsersBeginCreateOrUpdateOptions contains the optional parameters for the Users.BeginCreateOrUpdate method. +type UsersBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// UsersBeginDeleteOptions contains the optional parameters for the Users.BeginDelete method. +type UsersBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// UsersGetOptions contains the optional parameters for the Users.Get method. +type UsersGetOptions struct { + // placeholder for future optional parameters +} + +// UsersListByDataBoxEdgeDeviceOptions contains the optional parameters for the Users.ListByDataBoxEdgeDevice method. +type UsersListByDataBoxEdgeDeviceOptions struct { + // Specify $filter='Type eq ' to filter on user type property + Filter *string +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_monitoringconfig_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_monitoringconfig_client.go new file mode 100644 index 000000000000..9125713e270e --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_monitoringconfig_client.go @@ -0,0 +1,338 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MonitoringConfigClient contains the methods for the MonitoringConfig group. +// Don't use this type directly, use NewMonitoringConfigClient() instead. +type MonitoringConfigClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewMonitoringConfigClient creates a new instance of MonitoringConfigClient with the specified values. +func NewMonitoringConfigClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MonitoringConfigClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MonitoringConfigClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a new metric configuration or updates an existing one for a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, roleName string, resourceGroupName string, monitoringMetricConfiguration MonitoringMetricConfiguration, options *MonitoringConfigBeginCreateOrUpdateOptions) (MonitoringConfigCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, roleName, resourceGroupName, monitoringMetricConfiguration, options) + if err != nil { + return MonitoringConfigCreateOrUpdatePollerResponse{}, err + } + result := MonitoringConfigCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MonitoringConfigClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return MonitoringConfigCreateOrUpdatePollerResponse{}, err + } + result.Poller = &MonitoringConfigCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a new metric configuration or updates an existing one for a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) createOrUpdate(ctx context.Context, deviceName string, roleName string, resourceGroupName string, monitoringMetricConfiguration MonitoringMetricConfiguration, options *MonitoringConfigBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, roleName, resourceGroupName, monitoringMetricConfiguration, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *MonitoringConfigClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, roleName string, resourceGroupName string, monitoringMetricConfiguration MonitoringMetricConfiguration, options *MonitoringConfigBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, monitoringMetricConfiguration) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *MonitoringConfigClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - deletes a new metric configuration for a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) BeginDelete(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigBeginDeleteOptions) (MonitoringConfigDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, roleName, resourceGroupName, options) + if err != nil { + return MonitoringConfigDeletePollerResponse{}, err + } + result := MonitoringConfigDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MonitoringConfigClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return MonitoringConfigDeletePollerResponse{}, err + } + result.Poller = &MonitoringConfigDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - deletes a new metric configuration for a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) deleteOperation(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, roleName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MonitoringConfigClient) deleteCreateRequest(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *MonitoringConfigClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a metric configuration of a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) Get(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigGetOptions) (MonitoringConfigGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, roleName, resourceGroupName, options) + if err != nil { + return MonitoringConfigGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MonitoringConfigGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MonitoringConfigGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MonitoringConfigClient) getCreateRequest(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MonitoringConfigClient) getHandleResponse(resp *http.Response) (MonitoringConfigGetResponse, error) { + result := MonitoringConfigGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitoringMetricConfiguration); err != nil { + return MonitoringConfigGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *MonitoringConfigClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists metric configurations in a role. +// If the operation fails it returns the *CloudError error type. +func (client *MonitoringConfigClient) List(deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigListOptions) *MonitoringConfigListPager { + return &MonitoringConfigListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, deviceName, roleName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp MonitoringConfigListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MonitoringMetricConfigurationList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *MonitoringConfigClient) listCreateRequest(ctx context.Context, deviceName string, roleName string, resourceGroupName string, options *MonitoringConfigListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MonitoringConfigClient) listHandleResponse(resp *http.Response) (MonitoringConfigListResponse, error) { + result := MonitoringConfigListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitoringMetricConfigurationList); err != nil { + return MonitoringConfigListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *MonitoringConfigClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_nodes_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_nodes_client.go new file mode 100644 index 000000000000..07a7b60c0cc1 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_nodes_client.go @@ -0,0 +1,105 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NodesClient contains the methods for the Nodes group. +// Don't use this type directly, use NewNodesClient() instead. +type NodesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNodesClient creates a new instance of NodesClient with the specified values. +func NewNodesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NodesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NodesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// ListByDataBoxEdgeDevice - Gets all the nodes currently configured under this Data Box Edge device +// If the operation fails it returns the *CloudError error type. +func (client *NodesClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *NodesListByDataBoxEdgeDeviceOptions) *NodesListByDataBoxEdgeDevicePager { + return &NodesListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp NodesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NodeList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *NodesClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *NodesListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *NodesClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (NodesListByDataBoxEdgeDeviceResponse, error) { + result := NodesListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NodeList); err != nil { + return NodesListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *NodesClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operations_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operations_client.go new file mode 100644 index 000000000000..5a5877852668 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operations_client.go @@ -0,0 +1,89 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - List all the supported operations. +// If the operation fails it returns the *CloudError error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationsList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DataBoxEdge/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationsList); err != nil { + return OperationsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operationsstatus_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operationsstatus_client.go new file mode 100644 index 000000000000..1a7a5e6db60c --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_operationsstatus_client.go @@ -0,0 +1,112 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OperationsStatusClient contains the methods for the OperationsStatus group. +// Don't use this type directly, use NewOperationsStatusClient() instead. +type OperationsStatusClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewOperationsStatusClient creates a new instance of OperationsStatusClient with the specified values. +func NewOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsStatusClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *OperationsStatusClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *OperationsStatusGetOptions) (OperationsStatusGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return OperationsStatusGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsStatusGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsStatusGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationsStatusClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *OperationsStatusGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationsStatusClient) getHandleResponse(resp *http.Response) (OperationsStatusGetResponse, error) { + result := OperationsStatusGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return OperationsStatusGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *OperationsStatusClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_orders_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_orders_client.go new file mode 100644 index 000000000000..2473fbe8d9f3 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_orders_client.go @@ -0,0 +1,387 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OrdersClient contains the methods for the Orders group. +// Don't use this type directly, use NewOrdersClient() instead. +type OrdersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewOrdersClient creates a new instance of OrdersClient with the specified values. +func NewOrdersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OrdersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OrdersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates an order. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, resourceGroupName string, order Order, options *OrdersBeginCreateOrUpdateOptions) (OrdersCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, resourceGroupName, order, options) + if err != nil { + return OrdersCreateOrUpdatePollerResponse{}, err + } + result := OrdersCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("OrdersClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return OrdersCreateOrUpdatePollerResponse{}, err + } + result.Poller = &OrdersCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates an order. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) createOrUpdate(ctx context.Context, deviceName string, resourceGroupName string, order Order, options *OrdersBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, resourceGroupName, order, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *OrdersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, order Order, options *OrdersBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, order) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *OrdersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the order related to the device. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) BeginDelete(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersBeginDeleteOptions) (OrdersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, resourceGroupName, options) + if err != nil { + return OrdersDeletePollerResponse{}, err + } + result := OrdersDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("OrdersClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return OrdersDeletePollerResponse{}, err + } + result.Poller = &OrdersDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the order related to the device. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) deleteOperation(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OrdersClient) deleteCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *OrdersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a specific order by name. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) Get(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersGetOptions) (OrdersGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return OrdersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrdersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrdersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OrdersClient) getCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OrdersClient) getHandleResponse(resp *http.Response) (OrdersGetResponse, error) { + result := OrdersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Order); err != nil { + return OrdersGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *OrdersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Lists all the orders related to a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *OrdersListByDataBoxEdgeDeviceOptions) *OrdersListByDataBoxEdgeDevicePager { + return &OrdersListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp OrdersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OrderList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *OrdersClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *OrdersClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (OrdersListByDataBoxEdgeDeviceResponse, error) { + result := OrdersListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderList); err != nil { + return OrdersListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *OrdersClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListDCAccessCode - Gets the DCAccess Code +// If the operation fails it returns the *CloudError error type. +func (client *OrdersClient) ListDCAccessCode(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersListDCAccessCodeOptions) (OrdersListDCAccessCodeResponse, error) { + req, err := client.listDCAccessCodeCreateRequest(ctx, deviceName, resourceGroupName, options) + if err != nil { + return OrdersListDCAccessCodeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrdersListDCAccessCodeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrdersListDCAccessCodeResponse{}, client.listDCAccessCodeHandleError(resp) + } + return client.listDCAccessCodeHandleResponse(resp) +} + +// listDCAccessCodeCreateRequest creates the ListDCAccessCode request. +func (client *OrdersClient) listDCAccessCodeCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *OrdersListDCAccessCodeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listDCAccessCodeHandleResponse handles the ListDCAccessCode response. +func (client *OrdersClient) listDCAccessCodeHandleResponse(resp *http.Response) (OrdersListDCAccessCodeResponse, error) { + result := OrdersListDCAccessCodeResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DCAccessCode); err != nil { + return OrdersListDCAccessCodeResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listDCAccessCodeHandleError handles the ListDCAccessCode error response. +func (client *OrdersClient) listDCAccessCodeHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pagers.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pagers.go new file mode 100644 index 000000000000..25afd3199583 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pagers.go @@ -0,0 +1,935 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// AddonsListByRolePager provides operations for iterating over paged responses. +type AddonsListByRolePager struct { + client *AddonsClient + current AddonsListByRoleResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AddonsListByRoleResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AddonsListByRolePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AddonsListByRolePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AddonList.NextLink == nil || len(*p.current.AddonList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByRoleHandleError(resp) + return false + } + result, err := p.client.listByRoleHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AddonsListByRoleResponse page. +func (p *AddonsListByRolePager) PageResponse() AddonsListByRoleResponse { + return p.current +} + +// AlertsListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type AlertsListByDataBoxEdgeDevicePager struct { + client *AlertsClient + current AlertsListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AlertsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AlertsListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AlertsListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AlertList.NextLink == nil || len(*p.current.AlertList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AlertsListByDataBoxEdgeDeviceResponse page. +func (p *AlertsListByDataBoxEdgeDevicePager) PageResponse() AlertsListByDataBoxEdgeDeviceResponse { + return p.current +} + +// AvailableSKUsListPager provides operations for iterating over paged responses. +type AvailableSKUsListPager struct { + client *AvailableSKUsClient + current AvailableSKUsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AvailableSKUsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AvailableSKUsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AvailableSKUsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DataBoxEdgeSKUList.NextLink == nil || len(*p.current.DataBoxEdgeSKUList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AvailableSKUsListResponse page. +func (p *AvailableSKUsListPager) PageResponse() AvailableSKUsListResponse { + return p.current +} + +// BandwidthSchedulesListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type BandwidthSchedulesListByDataBoxEdgeDevicePager struct { + client *BandwidthSchedulesClient + current BandwidthSchedulesListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, BandwidthSchedulesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *BandwidthSchedulesListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *BandwidthSchedulesListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.BandwidthSchedulesList.NextLink == nil || len(*p.current.BandwidthSchedulesList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current BandwidthSchedulesListByDataBoxEdgeDeviceResponse page. +func (p *BandwidthSchedulesListByDataBoxEdgeDevicePager) PageResponse() BandwidthSchedulesListByDataBoxEdgeDeviceResponse { + return p.current +} + +// ContainersListByStorageAccountPager provides operations for iterating over paged responses. +type ContainersListByStorageAccountPager struct { + client *ContainersClient + current ContainersListByStorageAccountResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainersListByStorageAccountResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainersListByStorageAccountPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainersListByStorageAccountPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ContainerList.NextLink == nil || len(*p.current.ContainerList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByStorageAccountHandleError(resp) + return false + } + result, err := p.client.listByStorageAccountHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainersListByStorageAccountResponse page. +func (p *ContainersListByStorageAccountPager) PageResponse() ContainersListByStorageAccountResponse { + return p.current +} + +// DevicesListByResourceGroupPager provides operations for iterating over paged responses. +type DevicesListByResourceGroupPager struct { + client *DevicesClient + current DevicesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DevicesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DevicesListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DevicesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DataBoxEdgeDeviceList.NextLink == nil || len(*p.current.DataBoxEdgeDeviceList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DevicesListByResourceGroupResponse page. +func (p *DevicesListByResourceGroupPager) PageResponse() DevicesListByResourceGroupResponse { + return p.current +} + +// DevicesListBySubscriptionPager provides operations for iterating over paged responses. +type DevicesListBySubscriptionPager struct { + client *DevicesClient + current DevicesListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DevicesListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DevicesListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DevicesListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DataBoxEdgeDeviceList.NextLink == nil || len(*p.current.DataBoxEdgeDeviceList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DevicesListBySubscriptionResponse page. +func (p *DevicesListBySubscriptionPager) PageResponse() DevicesListBySubscriptionResponse { + return p.current +} + +// MonitoringConfigListPager provides operations for iterating over paged responses. +type MonitoringConfigListPager struct { + client *MonitoringConfigClient + current MonitoringConfigListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MonitoringConfigListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MonitoringConfigListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *MonitoringConfigListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MonitoringMetricConfigurationList.NextLink == nil || len(*p.current.MonitoringMetricConfigurationList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current MonitoringConfigListResponse page. +func (p *MonitoringConfigListPager) PageResponse() MonitoringConfigListResponse { + return p.current +} + +// NodesListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type NodesListByDataBoxEdgeDevicePager struct { + client *NodesClient + current NodesListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NodesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NodesListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NodesListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NodeList.NextLink == nil || len(*p.current.NodeList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NodesListByDataBoxEdgeDeviceResponse page. +func (p *NodesListByDataBoxEdgeDevicePager) PageResponse() NodesListByDataBoxEdgeDeviceResponse { + return p.current +} + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OperationsList.NextLink == nil || len(*p.current.OperationsList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} + +// OrdersListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type OrdersListByDataBoxEdgeDevicePager struct { + client *OrdersClient + current OrdersListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OrdersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OrdersListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OrdersListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OrderList.NextLink == nil || len(*p.current.OrderList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OrdersListByDataBoxEdgeDeviceResponse page. +func (p *OrdersListByDataBoxEdgeDevicePager) PageResponse() OrdersListByDataBoxEdgeDeviceResponse { + return p.current +} + +// RolesListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type RolesListByDataBoxEdgeDevicePager struct { + client *RolesClient + current RolesListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RolesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RolesListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RolesListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RoleList.NextLink == nil || len(*p.current.RoleList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RolesListByDataBoxEdgeDeviceResponse page. +func (p *RolesListByDataBoxEdgeDevicePager) PageResponse() RolesListByDataBoxEdgeDeviceResponse { + return p.current +} + +// SharesListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type SharesListByDataBoxEdgeDevicePager struct { + client *SharesClient + current SharesListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SharesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SharesListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SharesListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ShareList.NextLink == nil || len(*p.current.ShareList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SharesListByDataBoxEdgeDeviceResponse page. +func (p *SharesListByDataBoxEdgeDevicePager) PageResponse() SharesListByDataBoxEdgeDeviceResponse { + return p.current +} + +// StorageAccountCredentialsListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type StorageAccountCredentialsListByDataBoxEdgeDevicePager struct { + client *StorageAccountCredentialsClient + current StorageAccountCredentialsListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StorageAccountCredentialsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StorageAccountCredentialsListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StorageAccountCredentialsListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StorageAccountCredentialList.NextLink == nil || len(*p.current.StorageAccountCredentialList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StorageAccountCredentialsListByDataBoxEdgeDeviceResponse page. +func (p *StorageAccountCredentialsListByDataBoxEdgeDevicePager) PageResponse() StorageAccountCredentialsListByDataBoxEdgeDeviceResponse { + return p.current +} + +// StorageAccountsListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type StorageAccountsListByDataBoxEdgeDevicePager struct { + client *StorageAccountsClient + current StorageAccountsListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StorageAccountsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StorageAccountsListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StorageAccountsListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StorageAccountList.NextLink == nil || len(*p.current.StorageAccountList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StorageAccountsListByDataBoxEdgeDeviceResponse page. +func (p *StorageAccountsListByDataBoxEdgeDevicePager) PageResponse() StorageAccountsListByDataBoxEdgeDeviceResponse { + return p.current +} + +// TriggersListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type TriggersListByDataBoxEdgeDevicePager struct { + client *TriggersClient + current TriggersListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, TriggersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *TriggersListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *TriggersListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.TriggerList.NextLink == nil || len(*p.current.TriggerList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current TriggersListByDataBoxEdgeDeviceResponse page. +func (p *TriggersListByDataBoxEdgeDevicePager) PageResponse() TriggersListByDataBoxEdgeDeviceResponse { + return p.current +} + +// UsersListByDataBoxEdgeDevicePager provides operations for iterating over paged responses. +type UsersListByDataBoxEdgeDevicePager struct { + client *UsersClient + current UsersListByDataBoxEdgeDeviceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, UsersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *UsersListByDataBoxEdgeDevicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *UsersListByDataBoxEdgeDevicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.UserList.NextLink == nil || len(*p.current.UserList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByDataBoxEdgeDeviceHandleError(resp) + return false + } + result, err := p.client.listByDataBoxEdgeDeviceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current UsersListByDataBoxEdgeDeviceResponse page. +func (p *UsersListByDataBoxEdgeDevicePager) PageResponse() UsersListByDataBoxEdgeDeviceResponse { + return p.current +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pollers.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pollers.go new file mode 100644 index 000000000000..d29e454bab7e --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_pollers.go @@ -0,0 +1,1391 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// AddonsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type AddonsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AddonsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *AddonsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final AddonsCreateOrUpdateResponse will be returned. +func (p *AddonsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (AddonsCreateOrUpdateResponse, error) { + respType := AddonsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.AddonClassification) + if err != nil { + return AddonsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *AddonsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// AddonsDeletePoller provides polling facilities until the operation reaches a terminal state. +type AddonsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AddonsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *AddonsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final AddonsDeleteResponse will be returned. +func (p *AddonsDeletePoller) FinalResponse(ctx context.Context) (AddonsDeleteResponse, error) { + respType := AddonsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return AddonsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *AddonsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BandwidthSchedulesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type BandwidthSchedulesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BandwidthSchedulesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *BandwidthSchedulesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final BandwidthSchedulesCreateOrUpdateResponse will be returned. +func (p *BandwidthSchedulesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (BandwidthSchedulesCreateOrUpdateResponse, error) { + respType := BandwidthSchedulesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.BandwidthSchedule) + if err != nil { + return BandwidthSchedulesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *BandwidthSchedulesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BandwidthSchedulesDeletePoller provides polling facilities until the operation reaches a terminal state. +type BandwidthSchedulesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BandwidthSchedulesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *BandwidthSchedulesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final BandwidthSchedulesDeleteResponse will be returned. +func (p *BandwidthSchedulesDeletePoller) FinalResponse(ctx context.Context) (BandwidthSchedulesDeleteResponse, error) { + respType := BandwidthSchedulesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return BandwidthSchedulesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *BandwidthSchedulesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ContainersCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainersCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainersCreateOrUpdateResponse will be returned. +func (p *ContainersCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ContainersCreateOrUpdateResponse, error) { + respType := ContainersCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Container) + if err != nil { + return ContainersCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainersCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainersDeletePoller provides polling facilities until the operation reaches a terminal state. +type ContainersDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainersDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainersDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainersDeleteResponse will be returned. +func (p *ContainersDeletePoller) FinalResponse(ctx context.Context) (ContainersDeleteResponse, error) { + respType := ContainersDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ContainersDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainersDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainersRefreshPoller provides polling facilities until the operation reaches a terminal state. +type ContainersRefreshPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainersRefreshPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainersRefreshPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainersRefreshResponse will be returned. +func (p *ContainersRefreshPoller) FinalResponse(ctx context.Context) (ContainersRefreshResponse, error) { + respType := ContainersRefreshResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ContainersRefreshResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainersRefreshPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesCreateOrUpdateSecuritySettingsPoller provides polling facilities until the operation reaches a terminal state. +type DevicesCreateOrUpdateSecuritySettingsPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesCreateOrUpdateSecuritySettingsPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesCreateOrUpdateSecuritySettingsPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesCreateOrUpdateSecuritySettingsResponse will be returned. +func (p *DevicesCreateOrUpdateSecuritySettingsPoller) FinalResponse(ctx context.Context) (DevicesCreateOrUpdateSecuritySettingsResponse, error) { + respType := DevicesCreateOrUpdateSecuritySettingsResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesCreateOrUpdateSecuritySettingsResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesCreateOrUpdateSecuritySettingsPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type DevicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesDeleteResponse will be returned. +func (p *DevicesDeletePoller) FinalResponse(ctx context.Context) (DevicesDeleteResponse, error) { + respType := DevicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesDownloadUpdatesPoller provides polling facilities until the operation reaches a terminal state. +type DevicesDownloadUpdatesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesDownloadUpdatesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesDownloadUpdatesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesDownloadUpdatesResponse will be returned. +func (p *DevicesDownloadUpdatesPoller) FinalResponse(ctx context.Context) (DevicesDownloadUpdatesResponse, error) { + respType := DevicesDownloadUpdatesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesDownloadUpdatesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesDownloadUpdatesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesInstallUpdatesPoller provides polling facilities until the operation reaches a terminal state. +type DevicesInstallUpdatesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesInstallUpdatesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesInstallUpdatesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesInstallUpdatesResponse will be returned. +func (p *DevicesInstallUpdatesPoller) FinalResponse(ctx context.Context) (DevicesInstallUpdatesResponse, error) { + respType := DevicesInstallUpdatesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesInstallUpdatesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesInstallUpdatesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesScanForUpdatesPoller provides polling facilities until the operation reaches a terminal state. +type DevicesScanForUpdatesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesScanForUpdatesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesScanForUpdatesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesScanForUpdatesResponse will be returned. +func (p *DevicesScanForUpdatesPoller) FinalResponse(ctx context.Context) (DevicesScanForUpdatesResponse, error) { + respType := DevicesScanForUpdatesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesScanForUpdatesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesScanForUpdatesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller provides polling facilities until the operation reaches a terminal state. +type DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse will be returned. +func (p *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller) FinalResponse(ctx context.Context) (DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse, error) { + respType := DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiagnosticProactiveLogCollectionSettings) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller provides polling facilities until the operation reaches a terminal state. +type DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse will be returned. +func (p *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller) FinalResponse(ctx context.Context) (DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse, error) { + respType := DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiagnosticRemoteSupportSettings) + if err != nil { + return DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MonitoringConfigCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type MonitoringConfigCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MonitoringConfigCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *MonitoringConfigCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final MonitoringConfigCreateOrUpdateResponse will be returned. +func (p *MonitoringConfigCreateOrUpdatePoller) FinalResponse(ctx context.Context) (MonitoringConfigCreateOrUpdateResponse, error) { + respType := MonitoringConfigCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.MonitoringMetricConfiguration) + if err != nil { + return MonitoringConfigCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *MonitoringConfigCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MonitoringConfigDeletePoller provides polling facilities until the operation reaches a terminal state. +type MonitoringConfigDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MonitoringConfigDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *MonitoringConfigDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final MonitoringConfigDeleteResponse will be returned. +func (p *MonitoringConfigDeletePoller) FinalResponse(ctx context.Context) (MonitoringConfigDeleteResponse, error) { + respType := MonitoringConfigDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return MonitoringConfigDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *MonitoringConfigDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// OrdersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type OrdersCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *OrdersCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *OrdersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final OrdersCreateOrUpdateResponse will be returned. +func (p *OrdersCreateOrUpdatePoller) FinalResponse(ctx context.Context) (OrdersCreateOrUpdateResponse, error) { + respType := OrdersCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Order) + if err != nil { + return OrdersCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *OrdersCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// OrdersDeletePoller provides polling facilities until the operation reaches a terminal state. +type OrdersDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *OrdersDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *OrdersDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final OrdersDeleteResponse will be returned. +func (p *OrdersDeletePoller) FinalResponse(ctx context.Context) (OrdersDeleteResponse, error) { + respType := OrdersDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return OrdersDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *OrdersDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RolesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type RolesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RolesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RolesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RolesCreateOrUpdateResponse will be returned. +func (p *RolesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (RolesCreateOrUpdateResponse, error) { + respType := RolesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RoleClassification) + if err != nil { + return RolesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RolesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RolesDeletePoller provides polling facilities until the operation reaches a terminal state. +type RolesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RolesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RolesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RolesDeleteResponse will be returned. +func (p *RolesDeletePoller) FinalResponse(ctx context.Context) (RolesDeleteResponse, error) { + respType := RolesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RolesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RolesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SharesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SharesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SharesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SharesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SharesCreateOrUpdateResponse will be returned. +func (p *SharesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (SharesCreateOrUpdateResponse, error) { + respType := SharesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Share) + if err != nil { + return SharesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SharesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SharesDeletePoller provides polling facilities until the operation reaches a terminal state. +type SharesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SharesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SharesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SharesDeleteResponse will be returned. +func (p *SharesDeletePoller) FinalResponse(ctx context.Context) (SharesDeleteResponse, error) { + respType := SharesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SharesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SharesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SharesRefreshPoller provides polling facilities until the operation reaches a terminal state. +type SharesRefreshPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SharesRefreshPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SharesRefreshPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SharesRefreshResponse will be returned. +func (p *SharesRefreshPoller) FinalResponse(ctx context.Context) (SharesRefreshResponse, error) { + respType := SharesRefreshResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SharesRefreshResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SharesRefreshPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StorageAccountCredentialsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type StorageAccountCredentialsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StorageAccountCredentialsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StorageAccountCredentialsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StorageAccountCredentialsCreateOrUpdateResponse will be returned. +func (p *StorageAccountCredentialsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (StorageAccountCredentialsCreateOrUpdateResponse, error) { + respType := StorageAccountCredentialsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StorageAccountCredential) + if err != nil { + return StorageAccountCredentialsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StorageAccountCredentialsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StorageAccountCredentialsDeletePoller provides polling facilities until the operation reaches a terminal state. +type StorageAccountCredentialsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StorageAccountCredentialsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StorageAccountCredentialsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StorageAccountCredentialsDeleteResponse will be returned. +func (p *StorageAccountCredentialsDeletePoller) FinalResponse(ctx context.Context) (StorageAccountCredentialsDeleteResponse, error) { + respType := StorageAccountCredentialsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StorageAccountCredentialsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StorageAccountCredentialsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StorageAccountsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type StorageAccountsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StorageAccountsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StorageAccountsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StorageAccountsCreateOrUpdateResponse will be returned. +func (p *StorageAccountsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (StorageAccountsCreateOrUpdateResponse, error) { + respType := StorageAccountsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StorageAccount) + if err != nil { + return StorageAccountsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StorageAccountsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StorageAccountsDeletePoller provides polling facilities until the operation reaches a terminal state. +type StorageAccountsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StorageAccountsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StorageAccountsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StorageAccountsDeleteResponse will be returned. +func (p *StorageAccountsDeletePoller) FinalResponse(ctx context.Context) (StorageAccountsDeleteResponse, error) { + respType := StorageAccountsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StorageAccountsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StorageAccountsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SupportPackagesTriggerSupportPackagePoller provides polling facilities until the operation reaches a terminal state. +type SupportPackagesTriggerSupportPackagePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SupportPackagesTriggerSupportPackagePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SupportPackagesTriggerSupportPackagePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SupportPackagesTriggerSupportPackageResponse will be returned. +func (p *SupportPackagesTriggerSupportPackagePoller) FinalResponse(ctx context.Context) (SupportPackagesTriggerSupportPackageResponse, error) { + respType := SupportPackagesTriggerSupportPackageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SupportPackagesTriggerSupportPackageResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SupportPackagesTriggerSupportPackagePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// TriggersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type TriggersCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *TriggersCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *TriggersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final TriggersCreateOrUpdateResponse will be returned. +func (p *TriggersCreateOrUpdatePoller) FinalResponse(ctx context.Context) (TriggersCreateOrUpdateResponse, error) { + respType := TriggersCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.TriggerClassification) + if err != nil { + return TriggersCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *TriggersCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// TriggersDeletePoller provides polling facilities until the operation reaches a terminal state. +type TriggersDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *TriggersDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *TriggersDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final TriggersDeleteResponse will be returned. +func (p *TriggersDeletePoller) FinalResponse(ctx context.Context) (TriggersDeleteResponse, error) { + respType := TriggersDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return TriggersDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *TriggersDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// UsersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type UsersCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *UsersCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *UsersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final UsersCreateOrUpdateResponse will be returned. +func (p *UsersCreateOrUpdatePoller) FinalResponse(ctx context.Context) (UsersCreateOrUpdateResponse, error) { + respType := UsersCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.User) + if err != nil { + return UsersCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *UsersCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// UsersDeletePoller provides polling facilities until the operation reaches a terminal state. +type UsersDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *UsersDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *UsersDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final UsersDeleteResponse will be returned. +func (p *UsersDeletePoller) FinalResponse(ctx context.Context) (UsersDeleteResponse, error) { + respType := UsersDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return UsersDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *UsersDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..59654907b6e0 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_polymorphic_helpers.go @@ -0,0 +1,189 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import "encoding/json" + +func unmarshalAddonClassification(rawMsg json.RawMessage) (AddonClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AddonClassification + switch m["kind"] { + case string(AddonTypeArcForKubernetes): + b = &ArcAddon{} + case string(AddonTypeIotEdge): + b = &IoTAddon{} + default: + b = &Addon{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAddonClassificationArray(rawMsg json.RawMessage) ([]AddonClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]AddonClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalAddonClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalAddonClassificationMap(rawMsg json.RawMessage) (map[string]AddonClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AddonClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAddonClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + +func unmarshalRoleClassification(rawMsg json.RawMessage) (RoleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b RoleClassification + switch m["kind"] { + case string(RoleTypesCloudEdgeManagement): + b = &CloudEdgeManagementRole{} + case string(RoleTypesIOT): + b = &IoTRole{} + case string(RoleTypesKubernetes): + b = &KubernetesRole{} + case string(RoleTypesMEC): + b = &MECRole{} + default: + b = &Role{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalRoleClassificationArray(rawMsg json.RawMessage) ([]RoleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]RoleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalRoleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalRoleClassificationMap(rawMsg json.RawMessage) (map[string]RoleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RoleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRoleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + +func unmarshalTriggerClassification(rawMsg json.RawMessage) (TriggerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b TriggerClassification + switch m["kind"] { + case string(TriggerEventTypeFileEvent): + b = &FileEventTrigger{} + case string(TriggerEventTypePeriodicTimerEvent): + b = &PeriodicTimerEventTrigger{} + default: + b = &Trigger{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalTriggerClassificationArray(rawMsg json.RawMessage) ([]TriggerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]TriggerClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalTriggerClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalTriggerClassificationMap(rawMsg json.RawMessage) (map[string]TriggerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]TriggerClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalTriggerClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_response_types.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_response_types.go new file mode 100644 index 000000000000..5841e7c0bfe9 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_response_types.go @@ -0,0 +1,2142 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// AddonsCreateOrUpdatePollerResponse contains the response from method Addons.CreateOrUpdate. +type AddonsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *AddonsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l AddonsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AddonsCreateOrUpdateResponse, error) { + respType := AddonsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AddonClassification) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AddonsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *AddonsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AddonsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AddonsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &AddonsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AddonsCreateOrUpdateResponse contains the response from method Addons.CreateOrUpdate. +type AddonsCreateOrUpdateResponse struct { + AddonsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AddonsCreateOrUpdateResult contains the result from method Addons.CreateOrUpdate. +type AddonsCreateOrUpdateResult struct { + AddonClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonsCreateOrUpdateResult. +func (a *AddonsCreateOrUpdateResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalAddonClassification(data) + if err != nil { + return err + } + a.AddonClassification = res + return nil +} + +// AddonsDeletePollerResponse contains the response from method Addons.Delete. +type AddonsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *AddonsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l AddonsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AddonsDeleteResponse, error) { + respType := AddonsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AddonsDeletePollerResponse from the provided client and resume token. +func (l *AddonsDeletePollerResponse) Resume(ctx context.Context, client *AddonsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AddonsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &AddonsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AddonsDeleteResponse contains the response from method Addons.Delete. +type AddonsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AddonsGetResponse contains the response from method Addons.Get. +type AddonsGetResponse struct { + AddonsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AddonsGetResult contains the result from method Addons.Get. +type AddonsGetResult struct { + AddonClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonsGetResult. +func (a *AddonsGetResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalAddonClassification(data) + if err != nil { + return err + } + a.AddonClassification = res + return nil +} + +// AddonsListByRoleResponse contains the response from method Addons.ListByRole. +type AddonsListByRoleResponse struct { + AddonsListByRoleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AddonsListByRoleResult contains the result from method Addons.ListByRole. +type AddonsListByRoleResult struct { + AddonList +} + +// AlertsGetResponse contains the response from method Alerts.Get. +type AlertsGetResponse struct { + AlertsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AlertsGetResult contains the result from method Alerts.Get. +type AlertsGetResult struct { + Alert +} + +// AlertsListByDataBoxEdgeDeviceResponse contains the response from method Alerts.ListByDataBoxEdgeDevice. +type AlertsListByDataBoxEdgeDeviceResponse struct { + AlertsListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AlertsListByDataBoxEdgeDeviceResult contains the result from method Alerts.ListByDataBoxEdgeDevice. +type AlertsListByDataBoxEdgeDeviceResult struct { + AlertList +} + +// AvailableSKUsListResponse contains the response from method AvailableSKUs.List. +type AvailableSKUsListResponse struct { + AvailableSKUsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AvailableSKUsListResult contains the result from method AvailableSKUs.List. +type AvailableSKUsListResult struct { + DataBoxEdgeSKUList +} + +// BandwidthSchedulesCreateOrUpdatePollerResponse contains the response from method BandwidthSchedules.CreateOrUpdate. +type BandwidthSchedulesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *BandwidthSchedulesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l BandwidthSchedulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BandwidthSchedulesCreateOrUpdateResponse, error) { + respType := BandwidthSchedulesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BandwidthSchedule) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BandwidthSchedulesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *BandwidthSchedulesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *BandwidthSchedulesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BandwidthSchedulesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &BandwidthSchedulesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BandwidthSchedulesCreateOrUpdateResponse contains the response from method BandwidthSchedules.CreateOrUpdate. +type BandwidthSchedulesCreateOrUpdateResponse struct { + BandwidthSchedulesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BandwidthSchedulesCreateOrUpdateResult contains the result from method BandwidthSchedules.CreateOrUpdate. +type BandwidthSchedulesCreateOrUpdateResult struct { + BandwidthSchedule +} + +// BandwidthSchedulesDeletePollerResponse contains the response from method BandwidthSchedules.Delete. +type BandwidthSchedulesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *BandwidthSchedulesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l BandwidthSchedulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BandwidthSchedulesDeleteResponse, error) { + respType := BandwidthSchedulesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BandwidthSchedulesDeletePollerResponse from the provided client and resume token. +func (l *BandwidthSchedulesDeletePollerResponse) Resume(ctx context.Context, client *BandwidthSchedulesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BandwidthSchedulesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &BandwidthSchedulesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BandwidthSchedulesDeleteResponse contains the response from method BandwidthSchedules.Delete. +type BandwidthSchedulesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BandwidthSchedulesGetResponse contains the response from method BandwidthSchedules.Get. +type BandwidthSchedulesGetResponse struct { + BandwidthSchedulesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BandwidthSchedulesGetResult contains the result from method BandwidthSchedules.Get. +type BandwidthSchedulesGetResult struct { + BandwidthSchedule +} + +// BandwidthSchedulesListByDataBoxEdgeDeviceResponse contains the response from method BandwidthSchedules.ListByDataBoxEdgeDevice. +type BandwidthSchedulesListByDataBoxEdgeDeviceResponse struct { + BandwidthSchedulesListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BandwidthSchedulesListByDataBoxEdgeDeviceResult contains the result from method BandwidthSchedules.ListByDataBoxEdgeDevice. +type BandwidthSchedulesListByDataBoxEdgeDeviceResult struct { + BandwidthSchedulesList +} + +// ContainersCreateOrUpdatePollerResponse contains the response from method Containers.CreateOrUpdate. +type ContainersCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainersCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainersCreateOrUpdateResponse, error) { + respType := ContainersCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Container) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainersCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ContainersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainersClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &ContainersCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainersCreateOrUpdateResponse contains the response from method Containers.CreateOrUpdate. +type ContainersCreateOrUpdateResponse struct { + ContainersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainersCreateOrUpdateResult contains the result from method Containers.CreateOrUpdate. +type ContainersCreateOrUpdateResult struct { + Container +} + +// ContainersDeletePollerResponse contains the response from method Containers.Delete. +type ContainersDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainersDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainersDeleteResponse, error) { + respType := ContainersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainersDeletePollerResponse from the provided client and resume token. +func (l *ContainersDeletePollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainersClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &ContainersDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainersDeleteResponse contains the response from method Containers.Delete. +type ContainersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainersGetResponse contains the response from method Containers.Get. +type ContainersGetResponse struct { + ContainersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainersGetResult contains the result from method Containers.Get. +type ContainersGetResult struct { + Container +} + +// ContainersListByStorageAccountResponse contains the response from method Containers.ListByStorageAccount. +type ContainersListByStorageAccountResponse struct { + ContainersListByStorageAccountResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainersListByStorageAccountResult contains the result from method Containers.ListByStorageAccount. +type ContainersListByStorageAccountResult struct { + ContainerList +} + +// ContainersRefreshPollerResponse contains the response from method Containers.Refresh. +type ContainersRefreshPollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainersRefreshPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainersRefreshPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainersRefreshResponse, error) { + respType := ContainersRefreshResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainersRefreshPollerResponse from the provided client and resume token. +func (l *ContainersRefreshPollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainersClient.Refresh", token, client.pl, client.refreshHandleError) + if err != nil { + return err + } + poller := &ContainersRefreshPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainersRefreshResponse contains the response from method Containers.Refresh. +type ContainersRefreshResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesCreateOrUpdateResponse contains the response from method Devices.CreateOrUpdate. +type DevicesCreateOrUpdateResponse struct { + DevicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesCreateOrUpdateResult contains the result from method Devices.CreateOrUpdate. +type DevicesCreateOrUpdateResult struct { + DataBoxEdgeDevice +} + +// DevicesCreateOrUpdateSecuritySettingsPollerResponse contains the response from method Devices.CreateOrUpdateSecuritySettings. +type DevicesCreateOrUpdateSecuritySettingsPollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesCreateOrUpdateSecuritySettingsPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesCreateOrUpdateSecuritySettingsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesCreateOrUpdateSecuritySettingsResponse, error) { + respType := DevicesCreateOrUpdateSecuritySettingsResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesCreateOrUpdateSecuritySettingsPollerResponse from the provided client and resume token. +func (l *DevicesCreateOrUpdateSecuritySettingsPollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.CreateOrUpdateSecuritySettings", token, client.pl, client.createOrUpdateSecuritySettingsHandleError) + if err != nil { + return err + } + poller := &DevicesCreateOrUpdateSecuritySettingsPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesCreateOrUpdateSecuritySettingsResponse contains the response from method Devices.CreateOrUpdateSecuritySettings. +type DevicesCreateOrUpdateSecuritySettingsResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesDeletePollerResponse contains the response from method Devices.Delete. +type DevicesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesDeleteResponse, error) { + respType := DevicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesDeletePollerResponse from the provided client and resume token. +func (l *DevicesDeletePollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DevicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesDeleteResponse contains the response from method Devices.Delete. +type DevicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesDownloadUpdatesPollerResponse contains the response from method Devices.DownloadUpdates. +type DevicesDownloadUpdatesPollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesDownloadUpdatesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesDownloadUpdatesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesDownloadUpdatesResponse, error) { + respType := DevicesDownloadUpdatesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesDownloadUpdatesPollerResponse from the provided client and resume token. +func (l *DevicesDownloadUpdatesPollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.DownloadUpdates", token, client.pl, client.downloadUpdatesHandleError) + if err != nil { + return err + } + poller := &DevicesDownloadUpdatesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesDownloadUpdatesResponse contains the response from method Devices.DownloadUpdates. +type DevicesDownloadUpdatesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGenerateCertificateResponse contains the response from method Devices.GenerateCertificate. +type DevicesGenerateCertificateResponse struct { + DevicesGenerateCertificateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGenerateCertificateResult contains the result from method Devices.GenerateCertificate. +type DevicesGenerateCertificateResult struct { + GenerateCertResponse +} + +// DevicesGetExtendedInformationResponse contains the response from method Devices.GetExtendedInformation. +type DevicesGetExtendedInformationResponse struct { + DevicesGetExtendedInformationResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetExtendedInformationResult contains the result from method Devices.GetExtendedInformation. +type DevicesGetExtendedInformationResult struct { + DataBoxEdgeDeviceExtendedInfo +} + +// DevicesGetNetworkSettingsResponse contains the response from method Devices.GetNetworkSettings. +type DevicesGetNetworkSettingsResponse struct { + DevicesGetNetworkSettingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetNetworkSettingsResult contains the result from method Devices.GetNetworkSettings. +type DevicesGetNetworkSettingsResult struct { + NetworkSettings +} + +// DevicesGetResponse contains the response from method Devices.Get. +type DevicesGetResponse struct { + DevicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetResult contains the result from method Devices.Get. +type DevicesGetResult struct { + DataBoxEdgeDevice +} + +// DevicesGetUpdateSummaryResponse contains the response from method Devices.GetUpdateSummary. +type DevicesGetUpdateSummaryResponse struct { + DevicesGetUpdateSummaryResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetUpdateSummaryResult contains the result from method Devices.GetUpdateSummary. +type DevicesGetUpdateSummaryResult struct { + UpdateSummary +} + +// DevicesInstallUpdatesPollerResponse contains the response from method Devices.InstallUpdates. +type DevicesInstallUpdatesPollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesInstallUpdatesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesInstallUpdatesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesInstallUpdatesResponse, error) { + respType := DevicesInstallUpdatesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesInstallUpdatesPollerResponse from the provided client and resume token. +func (l *DevicesInstallUpdatesPollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.InstallUpdates", token, client.pl, client.installUpdatesHandleError) + if err != nil { + return err + } + poller := &DevicesInstallUpdatesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesInstallUpdatesResponse contains the response from method Devices.InstallUpdates. +type DevicesInstallUpdatesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListByResourceGroupResponse contains the response from method Devices.ListByResourceGroup. +type DevicesListByResourceGroupResponse struct { + DevicesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListByResourceGroupResult contains the result from method Devices.ListByResourceGroup. +type DevicesListByResourceGroupResult struct { + DataBoxEdgeDeviceList +} + +// DevicesListBySubscriptionResponse contains the response from method Devices.ListBySubscription. +type DevicesListBySubscriptionResponse struct { + DevicesListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListBySubscriptionResult contains the result from method Devices.ListBySubscription. +type DevicesListBySubscriptionResult struct { + DataBoxEdgeDeviceList +} + +// DevicesScanForUpdatesPollerResponse contains the response from method Devices.ScanForUpdates. +type DevicesScanForUpdatesPollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesScanForUpdatesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesScanForUpdatesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesScanForUpdatesResponse, error) { + respType := DevicesScanForUpdatesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesScanForUpdatesPollerResponse from the provided client and resume token. +func (l *DevicesScanForUpdatesPollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.ScanForUpdates", token, client.pl, client.scanForUpdatesHandleError) + if err != nil { + return err + } + poller := &DevicesScanForUpdatesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesScanForUpdatesResponse contains the response from method Devices.ScanForUpdates. +type DevicesScanForUpdatesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesUpdateExtendedInformationResponse contains the response from method Devices.UpdateExtendedInformation. +type DevicesUpdateExtendedInformationResponse struct { + DevicesUpdateExtendedInformationResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesUpdateExtendedInformationResult contains the result from method Devices.UpdateExtendedInformation. +type DevicesUpdateExtendedInformationResult struct { + DataBoxEdgeDeviceExtendedInfo +} + +// DevicesUpdateResponse contains the response from method Devices.Update. +type DevicesUpdateResponse struct { + DevicesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesUpdateResult contains the result from method Devices.Update. +type DevicesUpdateResult struct { + DataBoxEdgeDevice +} + +// DevicesUploadCertificateResponse contains the response from method Devices.UploadCertificate. +type DevicesUploadCertificateResponse struct { + DevicesUploadCertificateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesUploadCertificateResult contains the result from method Devices.UploadCertificate. +type DevicesUploadCertificateResult struct { + UploadCertificateResponse +} + +// DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse contains the response from method DiagnosticSettings.GetDiagnosticProactiveLogCollectionSettings. +type DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResponse struct { + DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResult contains the result from method DiagnosticSettings.GetDiagnosticProactiveLogCollectionSettings. +type DiagnosticSettingsGetDiagnosticProactiveLogCollectionSettingsResult struct { + DiagnosticProactiveLogCollectionSettings +} + +// DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse contains the response from method DiagnosticSettings.GetDiagnosticRemoteSupportSettings. +type DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResponse struct { + DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResult contains the result from method DiagnosticSettings.GetDiagnosticRemoteSupportSettings. +type DiagnosticSettingsGetDiagnosticRemoteSupportSettingsResult struct { + DiagnosticRemoteSupportSettings +} + +// DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse contains the response from method DiagnosticSettings.UpdateDiagnosticProactiveLogCollectionSettings. +type DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse struct { + // Poller contains an initialized poller. + Poller *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse, error) { + respType := DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiagnosticProactiveLogCollectionSettings) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse from the provided client and resume token. +func (l *DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPollerResponse) Resume(ctx context.Context, client *DiagnosticSettingsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiagnosticSettingsClient.UpdateDiagnosticProactiveLogCollectionSettings", token, client.pl, client.updateDiagnosticProactiveLogCollectionSettingsHandleError) + if err != nil { + return err + } + poller := &DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse contains the response from method DiagnosticSettings.UpdateDiagnosticProactiveLogCollectionSettings. +type DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResponse struct { + DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResult contains the result from method DiagnosticSettings.UpdateDiagnosticProactiveLogCollectionSettings. +type DiagnosticSettingsUpdateDiagnosticProactiveLogCollectionSettingsResult struct { + DiagnosticProactiveLogCollectionSettings +} + +// DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse contains the response from method DiagnosticSettings.UpdateDiagnosticRemoteSupportSettings. +type DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse struct { + // Poller contains an initialized poller. + Poller *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse, error) { + respType := DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiagnosticRemoteSupportSettings) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse from the provided client and resume token. +func (l *DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPollerResponse) Resume(ctx context.Context, client *DiagnosticSettingsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiagnosticSettingsClient.UpdateDiagnosticRemoteSupportSettings", token, client.pl, client.updateDiagnosticRemoteSupportSettingsHandleError) + if err != nil { + return err + } + poller := &DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse contains the response from method DiagnosticSettings.UpdateDiagnosticRemoteSupportSettings. +type DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResponse struct { + DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResult contains the result from method DiagnosticSettings.UpdateDiagnosticRemoteSupportSettings. +type DiagnosticSettingsUpdateDiagnosticRemoteSupportSettingsResult struct { + DiagnosticRemoteSupportSettings +} + +// JobsGetResponse contains the response from method Jobs.Get. +type JobsGetResponse struct { + JobsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsGetResult contains the result from method Jobs.Get. +type JobsGetResult struct { + Job +} + +// MonitoringConfigCreateOrUpdatePollerResponse contains the response from method MonitoringConfig.CreateOrUpdate. +type MonitoringConfigCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *MonitoringConfigCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MonitoringConfigCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MonitoringConfigCreateOrUpdateResponse, error) { + respType := MonitoringConfigCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MonitoringMetricConfiguration) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MonitoringConfigCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *MonitoringConfigCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *MonitoringConfigClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MonitoringConfigClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &MonitoringConfigCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MonitoringConfigCreateOrUpdateResponse contains the response from method MonitoringConfig.CreateOrUpdate. +type MonitoringConfigCreateOrUpdateResponse struct { + MonitoringConfigCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MonitoringConfigCreateOrUpdateResult contains the result from method MonitoringConfig.CreateOrUpdate. +type MonitoringConfigCreateOrUpdateResult struct { + MonitoringMetricConfiguration +} + +// MonitoringConfigDeletePollerResponse contains the response from method MonitoringConfig.Delete. +type MonitoringConfigDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *MonitoringConfigDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MonitoringConfigDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MonitoringConfigDeleteResponse, error) { + respType := MonitoringConfigDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MonitoringConfigDeletePollerResponse from the provided client and resume token. +func (l *MonitoringConfigDeletePollerResponse) Resume(ctx context.Context, client *MonitoringConfigClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MonitoringConfigClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &MonitoringConfigDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MonitoringConfigDeleteResponse contains the response from method MonitoringConfig.Delete. +type MonitoringConfigDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MonitoringConfigGetResponse contains the response from method MonitoringConfig.Get. +type MonitoringConfigGetResponse struct { + MonitoringConfigGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MonitoringConfigGetResult contains the result from method MonitoringConfig.Get. +type MonitoringConfigGetResult struct { + MonitoringMetricConfiguration +} + +// MonitoringConfigListResponse contains the response from method MonitoringConfig.List. +type MonitoringConfigListResponse struct { + MonitoringConfigListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MonitoringConfigListResult contains the result from method MonitoringConfig.List. +type MonitoringConfigListResult struct { + MonitoringMetricConfigurationList +} + +// NodesListByDataBoxEdgeDeviceResponse contains the response from method Nodes.ListByDataBoxEdgeDevice. +type NodesListByDataBoxEdgeDeviceResponse struct { + NodesListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NodesListByDataBoxEdgeDeviceResult contains the result from method Nodes.ListByDataBoxEdgeDevice. +type NodesListByDataBoxEdgeDeviceResult struct { + NodeList +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + OperationsList +} + +// OperationsStatusGetResponse contains the response from method OperationsStatus.Get. +type OperationsStatusGetResponse struct { + OperationsStatusGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsStatusGetResult contains the result from method OperationsStatus.Get. +type OperationsStatusGetResult struct { + Job +} + +// OrdersCreateOrUpdatePollerResponse contains the response from method Orders.CreateOrUpdate. +type OrdersCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *OrdersCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l OrdersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OrdersCreateOrUpdateResponse, error) { + respType := OrdersCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Order) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a OrdersCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *OrdersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *OrdersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("OrdersClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &OrdersCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// OrdersCreateOrUpdateResponse contains the response from method Orders.CreateOrUpdate. +type OrdersCreateOrUpdateResponse struct { + OrdersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OrdersCreateOrUpdateResult contains the result from method Orders.CreateOrUpdate. +type OrdersCreateOrUpdateResult struct { + Order +} + +// OrdersDeletePollerResponse contains the response from method Orders.Delete. +type OrdersDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *OrdersDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l OrdersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OrdersDeleteResponse, error) { + respType := OrdersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a OrdersDeletePollerResponse from the provided client and resume token. +func (l *OrdersDeletePollerResponse) Resume(ctx context.Context, client *OrdersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("OrdersClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &OrdersDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// OrdersDeleteResponse contains the response from method Orders.Delete. +type OrdersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OrdersGetResponse contains the response from method Orders.Get. +type OrdersGetResponse struct { + OrdersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OrdersGetResult contains the result from method Orders.Get. +type OrdersGetResult struct { + Order +} + +// OrdersListByDataBoxEdgeDeviceResponse contains the response from method Orders.ListByDataBoxEdgeDevice. +type OrdersListByDataBoxEdgeDeviceResponse struct { + OrdersListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OrdersListByDataBoxEdgeDeviceResult contains the result from method Orders.ListByDataBoxEdgeDevice. +type OrdersListByDataBoxEdgeDeviceResult struct { + OrderList +} + +// OrdersListDCAccessCodeResponse contains the response from method Orders.ListDCAccessCode. +type OrdersListDCAccessCodeResponse struct { + OrdersListDCAccessCodeResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OrdersListDCAccessCodeResult contains the result from method Orders.ListDCAccessCode. +type OrdersListDCAccessCodeResult struct { + DCAccessCode +} + +// RolesCreateOrUpdatePollerResponse contains the response from method Roles.CreateOrUpdate. +type RolesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *RolesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RolesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RolesCreateOrUpdateResponse, error) { + respType := RolesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RoleClassification) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RolesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *RolesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RolesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RolesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &RolesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RolesCreateOrUpdateResponse contains the response from method Roles.CreateOrUpdate. +type RolesCreateOrUpdateResponse struct { + RolesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RolesCreateOrUpdateResult contains the result from method Roles.CreateOrUpdate. +type RolesCreateOrUpdateResult struct { + RoleClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RolesCreateOrUpdateResult. +func (r *RolesCreateOrUpdateResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalRoleClassification(data) + if err != nil { + return err + } + r.RoleClassification = res + return nil +} + +// RolesDeletePollerResponse contains the response from method Roles.Delete. +type RolesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *RolesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RolesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RolesDeleteResponse, error) { + respType := RolesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RolesDeletePollerResponse from the provided client and resume token. +func (l *RolesDeletePollerResponse) Resume(ctx context.Context, client *RolesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RolesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &RolesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RolesDeleteResponse contains the response from method Roles.Delete. +type RolesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RolesGetResponse contains the response from method Roles.Get. +type RolesGetResponse struct { + RolesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RolesGetResult contains the result from method Roles.Get. +type RolesGetResult struct { + RoleClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RolesGetResult. +func (r *RolesGetResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalRoleClassification(data) + if err != nil { + return err + } + r.RoleClassification = res + return nil +} + +// RolesListByDataBoxEdgeDeviceResponse contains the response from method Roles.ListByDataBoxEdgeDevice. +type RolesListByDataBoxEdgeDeviceResponse struct { + RolesListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RolesListByDataBoxEdgeDeviceResult contains the result from method Roles.ListByDataBoxEdgeDevice. +type RolesListByDataBoxEdgeDeviceResult struct { + RoleList +} + +// SharesCreateOrUpdatePollerResponse contains the response from method Shares.CreateOrUpdate. +type SharesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SharesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SharesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharesCreateOrUpdateResponse, error) { + respType := SharesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Share) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SharesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *SharesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SharesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SharesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &SharesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SharesCreateOrUpdateResponse contains the response from method Shares.CreateOrUpdate. +type SharesCreateOrUpdateResponse struct { + SharesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharesCreateOrUpdateResult contains the result from method Shares.CreateOrUpdate. +type SharesCreateOrUpdateResult struct { + Share +} + +// SharesDeletePollerResponse contains the response from method Shares.Delete. +type SharesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SharesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SharesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharesDeleteResponse, error) { + respType := SharesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SharesDeletePollerResponse from the provided client and resume token. +func (l *SharesDeletePollerResponse) Resume(ctx context.Context, client *SharesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SharesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SharesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SharesDeleteResponse contains the response from method Shares.Delete. +type SharesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharesGetResponse contains the response from method Shares.Get. +type SharesGetResponse struct { + SharesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharesGetResult contains the result from method Shares.Get. +type SharesGetResult struct { + Share +} + +// SharesListByDataBoxEdgeDeviceResponse contains the response from method Shares.ListByDataBoxEdgeDevice. +type SharesListByDataBoxEdgeDeviceResponse struct { + SharesListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharesListByDataBoxEdgeDeviceResult contains the result from method Shares.ListByDataBoxEdgeDevice. +type SharesListByDataBoxEdgeDeviceResult struct { + ShareList +} + +// SharesRefreshPollerResponse contains the response from method Shares.Refresh. +type SharesRefreshPollerResponse struct { + // Poller contains an initialized poller. + Poller *SharesRefreshPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SharesRefreshPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharesRefreshResponse, error) { + respType := SharesRefreshResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SharesRefreshPollerResponse from the provided client and resume token. +func (l *SharesRefreshPollerResponse) Resume(ctx context.Context, client *SharesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SharesClient.Refresh", token, client.pl, client.refreshHandleError) + if err != nil { + return err + } + poller := &SharesRefreshPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SharesRefreshResponse contains the response from method Shares.Refresh. +type SharesRefreshResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountCredentialsCreateOrUpdatePollerResponse contains the response from method StorageAccountCredentials.CreateOrUpdate. +type StorageAccountCredentialsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *StorageAccountCredentialsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StorageAccountCredentialsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountCredentialsCreateOrUpdateResponse, error) { + respType := StorageAccountCredentialsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageAccountCredential) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StorageAccountCredentialsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *StorageAccountCredentialsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *StorageAccountCredentialsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StorageAccountCredentialsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &StorageAccountCredentialsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StorageAccountCredentialsCreateOrUpdateResponse contains the response from method StorageAccountCredentials.CreateOrUpdate. +type StorageAccountCredentialsCreateOrUpdateResponse struct { + StorageAccountCredentialsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountCredentialsCreateOrUpdateResult contains the result from method StorageAccountCredentials.CreateOrUpdate. +type StorageAccountCredentialsCreateOrUpdateResult struct { + StorageAccountCredential +} + +// StorageAccountCredentialsDeletePollerResponse contains the response from method StorageAccountCredentials.Delete. +type StorageAccountCredentialsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *StorageAccountCredentialsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StorageAccountCredentialsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountCredentialsDeleteResponse, error) { + respType := StorageAccountCredentialsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StorageAccountCredentialsDeletePollerResponse from the provided client and resume token. +func (l *StorageAccountCredentialsDeletePollerResponse) Resume(ctx context.Context, client *StorageAccountCredentialsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StorageAccountCredentialsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &StorageAccountCredentialsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StorageAccountCredentialsDeleteResponse contains the response from method StorageAccountCredentials.Delete. +type StorageAccountCredentialsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountCredentialsGetResponse contains the response from method StorageAccountCredentials.Get. +type StorageAccountCredentialsGetResponse struct { + StorageAccountCredentialsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountCredentialsGetResult contains the result from method StorageAccountCredentials.Get. +type StorageAccountCredentialsGetResult struct { + StorageAccountCredential +} + +// StorageAccountCredentialsListByDataBoxEdgeDeviceResponse contains the response from method StorageAccountCredentials.ListByDataBoxEdgeDevice. +type StorageAccountCredentialsListByDataBoxEdgeDeviceResponse struct { + StorageAccountCredentialsListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountCredentialsListByDataBoxEdgeDeviceResult contains the result from method StorageAccountCredentials.ListByDataBoxEdgeDevice. +type StorageAccountCredentialsListByDataBoxEdgeDeviceResult struct { + StorageAccountCredentialList +} + +// StorageAccountsCreateOrUpdatePollerResponse contains the response from method StorageAccounts.CreateOrUpdate. +type StorageAccountsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *StorageAccountsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StorageAccountsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsCreateOrUpdateResponse, error) { + respType := StorageAccountsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageAccount) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StorageAccountsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *StorageAccountsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *StorageAccountsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StorageAccountsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &StorageAccountsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StorageAccountsCreateOrUpdateResponse contains the response from method StorageAccounts.CreateOrUpdate. +type StorageAccountsCreateOrUpdateResponse struct { + StorageAccountsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountsCreateOrUpdateResult contains the result from method StorageAccounts.CreateOrUpdate. +type StorageAccountsCreateOrUpdateResult struct { + StorageAccount +} + +// StorageAccountsDeletePollerResponse contains the response from method StorageAccounts.Delete. +type StorageAccountsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *StorageAccountsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StorageAccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsDeleteResponse, error) { + respType := StorageAccountsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StorageAccountsDeletePollerResponse from the provided client and resume token. +func (l *StorageAccountsDeletePollerResponse) Resume(ctx context.Context, client *StorageAccountsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StorageAccountsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &StorageAccountsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StorageAccountsDeleteResponse contains the response from method StorageAccounts.Delete. +type StorageAccountsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountsGetResponse contains the response from method StorageAccounts.Get. +type StorageAccountsGetResponse struct { + StorageAccountsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountsGetResult contains the result from method StorageAccounts.Get. +type StorageAccountsGetResult struct { + StorageAccount +} + +// StorageAccountsListByDataBoxEdgeDeviceResponse contains the response from method StorageAccounts.ListByDataBoxEdgeDevice. +type StorageAccountsListByDataBoxEdgeDeviceResponse struct { + StorageAccountsListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StorageAccountsListByDataBoxEdgeDeviceResult contains the result from method StorageAccounts.ListByDataBoxEdgeDevice. +type StorageAccountsListByDataBoxEdgeDeviceResult struct { + StorageAccountList +} + +// SupportPackagesTriggerSupportPackagePollerResponse contains the response from method SupportPackages.TriggerSupportPackage. +type SupportPackagesTriggerSupportPackagePollerResponse struct { + // Poller contains an initialized poller. + Poller *SupportPackagesTriggerSupportPackagePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SupportPackagesTriggerSupportPackagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SupportPackagesTriggerSupportPackageResponse, error) { + respType := SupportPackagesTriggerSupportPackageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SupportPackagesTriggerSupportPackagePollerResponse from the provided client and resume token. +func (l *SupportPackagesTriggerSupportPackagePollerResponse) Resume(ctx context.Context, client *SupportPackagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SupportPackagesClient.TriggerSupportPackage", token, client.pl, client.triggerSupportPackageHandleError) + if err != nil { + return err + } + poller := &SupportPackagesTriggerSupportPackagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SupportPackagesTriggerSupportPackageResponse contains the response from method SupportPackages.TriggerSupportPackage. +type SupportPackagesTriggerSupportPackageResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TriggersCreateOrUpdatePollerResponse contains the response from method Triggers.CreateOrUpdate. +type TriggersCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *TriggersCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l TriggersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TriggersCreateOrUpdateResponse, error) { + respType := TriggersCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TriggerClassification) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a TriggersCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *TriggersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *TriggersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("TriggersClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &TriggersCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// TriggersCreateOrUpdateResponse contains the response from method Triggers.CreateOrUpdate. +type TriggersCreateOrUpdateResponse struct { + TriggersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TriggersCreateOrUpdateResult contains the result from method Triggers.CreateOrUpdate. +type TriggersCreateOrUpdateResult struct { + TriggerClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggersCreateOrUpdateResult. +func (t *TriggersCreateOrUpdateResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalTriggerClassification(data) + if err != nil { + return err + } + t.TriggerClassification = res + return nil +} + +// TriggersDeletePollerResponse contains the response from method Triggers.Delete. +type TriggersDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *TriggersDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l TriggersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TriggersDeleteResponse, error) { + respType := TriggersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a TriggersDeletePollerResponse from the provided client and resume token. +func (l *TriggersDeletePollerResponse) Resume(ctx context.Context, client *TriggersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("TriggersClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &TriggersDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// TriggersDeleteResponse contains the response from method Triggers.Delete. +type TriggersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TriggersGetResponse contains the response from method Triggers.Get. +type TriggersGetResponse struct { + TriggersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TriggersGetResult contains the result from method Triggers.Get. +type TriggersGetResult struct { + TriggerClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggersGetResult. +func (t *TriggersGetResult) UnmarshalJSON(data []byte) error { + res, err := unmarshalTriggerClassification(data) + if err != nil { + return err + } + t.TriggerClassification = res + return nil +} + +// TriggersListByDataBoxEdgeDeviceResponse contains the response from method Triggers.ListByDataBoxEdgeDevice. +type TriggersListByDataBoxEdgeDeviceResponse struct { + TriggersListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TriggersListByDataBoxEdgeDeviceResult contains the result from method Triggers.ListByDataBoxEdgeDevice. +type TriggersListByDataBoxEdgeDeviceResult struct { + TriggerList +} + +// UsersCreateOrUpdatePollerResponse contains the response from method Users.CreateOrUpdate. +type UsersCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *UsersCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l UsersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (UsersCreateOrUpdateResponse, error) { + respType := UsersCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.User) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a UsersCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *UsersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *UsersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("UsersClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &UsersCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// UsersCreateOrUpdateResponse contains the response from method Users.CreateOrUpdate. +type UsersCreateOrUpdateResponse struct { + UsersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsersCreateOrUpdateResult contains the result from method Users.CreateOrUpdate. +type UsersCreateOrUpdateResult struct { + User +} + +// UsersDeletePollerResponse contains the response from method Users.Delete. +type UsersDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *UsersDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l UsersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (UsersDeleteResponse, error) { + respType := UsersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a UsersDeletePollerResponse from the provided client and resume token. +func (l *UsersDeletePollerResponse) Resume(ctx context.Context, client *UsersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("UsersClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &UsersDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// UsersDeleteResponse contains the response from method Users.Delete. +type UsersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsersGetResponse contains the response from method Users.Get. +type UsersGetResponse struct { + UsersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsersGetResult contains the result from method Users.Get. +type UsersGetResult struct { + User +} + +// UsersListByDataBoxEdgeDeviceResponse contains the response from method Users.ListByDataBoxEdgeDevice. +type UsersListByDataBoxEdgeDeviceResponse struct { + UsersListByDataBoxEdgeDeviceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsersListByDataBoxEdgeDeviceResult contains the result from method Users.ListByDataBoxEdgeDevice. +type UsersListByDataBoxEdgeDeviceResult struct { + UserList +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_roles_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_roles_client.go new file mode 100644 index 000000000000..1660f1c15334 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_roles_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RolesClient contains the methods for the Roles group. +// Don't use this type directly, use NewRolesClient() instead. +type RolesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewRolesClient creates a new instance of RolesClient with the specified values. +func NewRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RolesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RolesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update a role. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, role RoleClassification, options *RolesBeginCreateOrUpdateOptions) (RolesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, role, options) + if err != nil { + return RolesCreateOrUpdatePollerResponse{}, err + } + result := RolesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RolesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return RolesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &RolesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a role. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, role RoleClassification, options *RolesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, role, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RolesClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, role RoleClassification, options *RolesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, role) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *RolesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the role on the device. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *RolesBeginDeleteOptions) (RolesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return RolesDeletePollerResponse{}, err + } + result := RolesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RolesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return RolesDeletePollerResponse{}, err + } + result.Poller = &RolesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the role on the device. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *RolesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RolesClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *RolesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *RolesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a specific role by name. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *RolesGetOptions) (RolesGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return RolesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RolesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RolesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RolesClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *RolesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RolesClient) getHandleResponse(resp *http.Response) (RolesGetResponse, error) { + result := RolesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return RolesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *RolesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Lists all the roles configured in a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *RolesClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *RolesListByDataBoxEdgeDeviceOptions) *RolesListByDataBoxEdgeDevicePager { + return &RolesListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp RolesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RoleList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *RolesClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *RolesListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *RolesClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (RolesListByDataBoxEdgeDeviceResponse, error) { + result := RolesListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleList); err != nil { + return RolesListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *RolesClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_shares_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_shares_client.go new file mode 100644 index 000000000000..45ef78620ff5 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_shares_client.go @@ -0,0 +1,414 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SharesClient contains the methods for the Shares group. +// Don't use this type directly, use NewSharesClient() instead. +type SharesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSharesClient creates a new instance of SharesClient with the specified values. +func NewSharesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a new share or updates an existing share on the device. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, share Share, options *SharesBeginCreateOrUpdateOptions) (SharesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, share, options) + if err != nil { + return SharesCreateOrUpdatePollerResponse{}, err + } + result := SharesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SharesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return SharesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &SharesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a new share or updates an existing share on the device. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, share Share, options *SharesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, share, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SharesClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, share Share, options *SharesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, share) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *SharesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the share on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginDeleteOptions) (SharesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return SharesDeletePollerResponse{}, err + } + result := SharesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SharesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return SharesDeletePollerResponse{}, err + } + result.Poller = &SharesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the share on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SharesClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *SharesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a share by name. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesGetOptions) (SharesGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return SharesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SharesClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SharesClient) getHandleResponse(resp *http.Response) (SharesGetResponse, error) { + result := SharesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Share); err != nil { + return SharesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SharesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Lists all the shares in a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *SharesListByDataBoxEdgeDeviceOptions) *SharesListByDataBoxEdgeDevicePager { + return &SharesListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp SharesListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ShareList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *SharesClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *SharesListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *SharesClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (SharesListByDataBoxEdgeDeviceResponse, error) { + result := SharesListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ShareList); err != nil { + return SharesListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *SharesClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginRefresh - Refreshes the share metadata with the data from the cloud. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) BeginRefresh(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginRefreshOptions) (SharesRefreshPollerResponse, error) { + resp, err := client.refresh(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return SharesRefreshPollerResponse{}, err + } + result := SharesRefreshPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SharesClient.Refresh", "", resp, client.pl, client.refreshHandleError) + if err != nil { + return SharesRefreshPollerResponse{}, err + } + result.Poller = &SharesRefreshPoller{ + pt: pt, + } + return result, nil +} + +// Refresh - Refreshes the share metadata with the data from the cloud. +// If the operation fails it returns the *CloudError error type. +func (client *SharesClient) refresh(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginRefreshOptions) (*http.Response, error) { + req, err := client.refreshCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.refreshHandleError(resp) + } + return resp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *SharesClient) refreshCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *SharesBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// refreshHandleError handles the Refresh error response. +func (client *SharesClient) refreshHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccountcredentials_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccountcredentials_client.go new file mode 100644 index 000000000000..70083c11a0f2 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccountcredentials_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// StorageAccountCredentialsClient contains the methods for the StorageAccountCredentials group. +// Don't use this type directly, use NewStorageAccountCredentialsClient() instead. +type StorageAccountCredentialsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStorageAccountCredentialsClient creates a new instance of StorageAccountCredentialsClient with the specified values. +func NewStorageAccountCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StorageAccountCredentialsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StorageAccountCredentialsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates the storage account credential. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, storageAccountCredential StorageAccountCredential, options *StorageAccountCredentialsBeginCreateOrUpdateOptions) (StorageAccountCredentialsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, storageAccountCredential, options) + if err != nil { + return StorageAccountCredentialsCreateOrUpdatePollerResponse{}, err + } + result := StorageAccountCredentialsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StorageAccountCredentialsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return StorageAccountCredentialsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &StorageAccountCredentialsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates the storage account credential. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, storageAccountCredential StorageAccountCredential, options *StorageAccountCredentialsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, storageAccountCredential, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StorageAccountCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, storageAccountCredential StorageAccountCredential, options *StorageAccountCredentialsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, storageAccountCredential) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *StorageAccountCredentialsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the storage account credential. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *StorageAccountCredentialsBeginDeleteOptions) (StorageAccountCredentialsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return StorageAccountCredentialsDeletePollerResponse{}, err + } + result := StorageAccountCredentialsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StorageAccountCredentialsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return StorageAccountCredentialsDeletePollerResponse{}, err + } + result.Poller = &StorageAccountCredentialsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the storage account credential. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *StorageAccountCredentialsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StorageAccountCredentialsClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *StorageAccountCredentialsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StorageAccountCredentialsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified storage account credential. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *StorageAccountCredentialsGetOptions) (StorageAccountCredentialsGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return StorageAccountCredentialsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageAccountCredentialsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageAccountCredentialsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StorageAccountCredentialsClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *StorageAccountCredentialsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StorageAccountCredentialsClient) getHandleResponse(resp *http.Response) (StorageAccountCredentialsGetResponse, error) { + result := StorageAccountCredentialsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountCredential); err != nil { + return StorageAccountCredentialsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StorageAccountCredentialsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountCredentialsClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *StorageAccountCredentialsListByDataBoxEdgeDeviceOptions) *StorageAccountCredentialsListByDataBoxEdgeDevicePager { + return &StorageAccountCredentialsListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp StorageAccountCredentialsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StorageAccountCredentialList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *StorageAccountCredentialsClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *StorageAccountCredentialsListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *StorageAccountCredentialsClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (StorageAccountCredentialsListByDataBoxEdgeDeviceResponse, error) { + result := StorageAccountCredentialsListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountCredentialList); err != nil { + return StorageAccountCredentialsListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *StorageAccountCredentialsClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccounts_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccounts_client.go new file mode 100644 index 000000000000..8f3d35a950c1 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_storageaccounts_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// StorageAccountsClient contains the methods for the StorageAccounts group. +// Don't use this type directly, use NewStorageAccountsClient() instead. +type StorageAccountsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStorageAccountsClient creates a new instance of StorageAccountsClient with the specified values. +func NewStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StorageAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StorageAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a new StorageAccount or updates an existing StorageAccount on the device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, storageAccount StorageAccount, options *StorageAccountsBeginCreateOrUpdateOptions) (StorageAccountsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, storageAccountName, resourceGroupName, storageAccount, options) + if err != nil { + return StorageAccountsCreateOrUpdatePollerResponse{}, err + } + result := StorageAccountsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StorageAccountsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return StorageAccountsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &StorageAccountsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a new StorageAccount or updates an existing StorageAccount on the device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) createOrUpdate(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, storageAccount StorageAccount, options *StorageAccountsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, storageAccountName, resourceGroupName, storageAccount, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StorageAccountsClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, storageAccount StorageAccount, options *StorageAccountsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, storageAccount) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *StorageAccountsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) BeginDelete(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *StorageAccountsBeginDeleteOptions) (StorageAccountsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, storageAccountName, resourceGroupName, options) + if err != nil { + return StorageAccountsDeletePollerResponse{}, err + } + result := StorageAccountsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StorageAccountsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return StorageAccountsDeletePollerResponse{}, err + } + result.Poller = &StorageAccountsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) deleteOperation(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *StorageAccountsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, storageAccountName, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StorageAccountsClient) deleteCreateRequest(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *StorageAccountsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StorageAccountsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a StorageAccount by name. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) Get(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *StorageAccountsGetOptions) (StorageAccountsGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, storageAccountName, resourceGroupName, options) + if err != nil { + return StorageAccountsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageAccountsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageAccountsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StorageAccountsClient) getCreateRequest(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string, options *StorageAccountsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if storageAccountName == "" { + return nil, errors.New("parameter storageAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageAccountName}", url.PathEscape(storageAccountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StorageAccountsClient) getHandleResponse(resp *http.Response) (StorageAccountsGetResponse, error) { + result := StorageAccountsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccount); err != nil { + return StorageAccountsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StorageAccountsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *StorageAccountsClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *StorageAccountsListByDataBoxEdgeDeviceOptions) *StorageAccountsListByDataBoxEdgeDevicePager { + return &StorageAccountsListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp StorageAccountsListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StorageAccountList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *StorageAccountsClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *StorageAccountsListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *StorageAccountsClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (StorageAccountsListByDataBoxEdgeDeviceResponse, error) { + result := StorageAccountsListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountList); err != nil { + return StorageAccountsListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *StorageAccountsClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_supportpackages_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_supportpackages_client.go new file mode 100644 index 000000000000..edbfd5467a86 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_supportpackages_client.go @@ -0,0 +1,119 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SupportPackagesClient contains the methods for the SupportPackages group. +// Don't use this type directly, use NewSupportPackagesClient() instead. +type SupportPackagesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSupportPackagesClient creates a new instance of SupportPackagesClient with the specified values. +func NewSupportPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SupportPackagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SupportPackagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginTriggerSupportPackage - Triggers support package on the device +// If the operation fails it returns the *CloudError error type. +func (client *SupportPackagesClient) BeginTriggerSupportPackage(ctx context.Context, deviceName string, resourceGroupName string, triggerSupportPackageRequest TriggerSupportPackageRequest, options *SupportPackagesBeginTriggerSupportPackageOptions) (SupportPackagesTriggerSupportPackagePollerResponse, error) { + resp, err := client.triggerSupportPackage(ctx, deviceName, resourceGroupName, triggerSupportPackageRequest, options) + if err != nil { + return SupportPackagesTriggerSupportPackagePollerResponse{}, err + } + result := SupportPackagesTriggerSupportPackagePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SupportPackagesClient.TriggerSupportPackage", "", resp, client.pl, client.triggerSupportPackageHandleError) + if err != nil { + return SupportPackagesTriggerSupportPackagePollerResponse{}, err + } + result.Poller = &SupportPackagesTriggerSupportPackagePoller{ + pt: pt, + } + return result, nil +} + +// TriggerSupportPackage - Triggers support package on the device +// If the operation fails it returns the *CloudError error type. +func (client *SupportPackagesClient) triggerSupportPackage(ctx context.Context, deviceName string, resourceGroupName string, triggerSupportPackageRequest TriggerSupportPackageRequest, options *SupportPackagesBeginTriggerSupportPackageOptions) (*http.Response, error) { + req, err := client.triggerSupportPackageCreateRequest(ctx, deviceName, resourceGroupName, triggerSupportPackageRequest, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.triggerSupportPackageHandleError(resp) + } + return resp, nil +} + +// triggerSupportPackageCreateRequest creates the TriggerSupportPackage request. +func (client *SupportPackagesClient) triggerSupportPackageCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, triggerSupportPackageRequest TriggerSupportPackageRequest, options *SupportPackagesBeginTriggerSupportPackageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, triggerSupportPackageRequest) +} + +// triggerSupportPackageHandleError handles the TriggerSupportPackage error response. +func (client *SupportPackagesClient) triggerSupportPackageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_time_rfc3339.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..dd5339d9317f --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_triggers_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_triggers_client.go new file mode 100644 index 000000000000..a70b11de10cf --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_triggers_client.go @@ -0,0 +1,337 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TriggersClient contains the methods for the Triggers group. +// Don't use this type directly, use NewTriggersClient() instead. +type TriggersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewTriggersClient creates a new instance of TriggersClient with the specified values. +func NewTriggersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TriggersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TriggersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a trigger. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, trigger TriggerClassification, options *TriggersBeginCreateOrUpdateOptions) (TriggersCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, trigger, options) + if err != nil { + return TriggersCreateOrUpdatePollerResponse{}, err + } + result := TriggersCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("TriggersClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return TriggersCreateOrUpdatePollerResponse{}, err + } + result.Poller = &TriggersCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a trigger. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, trigger TriggerClassification, options *TriggersBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, trigger, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TriggersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, trigger TriggerClassification, options *TriggersBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, trigger) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *TriggersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the trigger on the gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *TriggersBeginDeleteOptions) (TriggersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return TriggersDeletePollerResponse{}, err + } + result := TriggersDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("TriggersClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return TriggersDeletePollerResponse{}, err + } + result.Poller = &TriggersDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the trigger on the gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *TriggersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TriggersClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *TriggersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *TriggersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get a specific trigger by name. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *TriggersGetOptions) (TriggersGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return TriggersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TriggersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TriggersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TriggersClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *TriggersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TriggersClient) getHandleResponse(resp *http.Response) (TriggersGetResponse, error) { + result := TriggersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return TriggersGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *TriggersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Lists all the triggers configured in the device. +// If the operation fails it returns the *CloudError error type. +func (client *TriggersClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *TriggersListByDataBoxEdgeDeviceOptions) *TriggersListByDataBoxEdgeDevicePager { + return &TriggersListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp TriggersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.TriggerList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *TriggersClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *TriggersListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *TriggersClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (TriggersListByDataBoxEdgeDeviceResponse, error) { + result := TriggersListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.TriggerList); err != nil { + return TriggersListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *TriggersClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_users_client.go b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_users_client.go new file mode 100644 index 000000000000..6329b6514520 --- /dev/null +++ b/sdk/resourcemanager/databoxedge/armdataboxedge/zz_generated_users_client.go @@ -0,0 +1,337 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armdataboxedge + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsersClient contains the methods for the Users group. +// Don't use this type directly, use NewUsersClient() instead. +type UsersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewUsersClient creates a new instance of UsersClient with the specified values. +func NewUsersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, userParam User, options *UsersBeginCreateOrUpdateOptions) (UsersCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, deviceName, name, resourceGroupName, userParam, options) + if err != nil { + return UsersCreateOrUpdatePollerResponse{}, err + } + result := UsersCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("UsersClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return UsersCreateOrUpdatePollerResponse{}, err + } + result.Poller = &UsersCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) createOrUpdate(ctx context.Context, deviceName string, name string, resourceGroupName string, userParam User, options *UsersBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, name, resourceGroupName, userParam, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *UsersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, userParam User, options *UsersBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, userParam) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *UsersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the user on a databox edge/gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) BeginDelete(ctx context.Context, deviceName string, name string, resourceGroupName string, options *UsersBeginDeleteOptions) (UsersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return UsersDeletePollerResponse{}, err + } + result := UsersDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("UsersClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return UsersDeletePollerResponse{}, err + } + result.Poller = &UsersDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the user on a databox edge/gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) deleteOperation(ctx context.Context, deviceName string, name string, resourceGroupName string, options *UsersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *UsersClient) deleteCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *UsersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *UsersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified user. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string, options *UsersGetOptions) (UsersGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, name, resourceGroupName, options) + if err != nil { + return UsersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *UsersClient) getCreateRequest(ctx context.Context, deviceName string, name string, resourceGroupName string, options *UsersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UsersClient) getHandleResponse(resp *http.Response) (UsersGetResponse, error) { + result := UsersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.User); err != nil { + return UsersGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *UsersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByDataBoxEdgeDevice - Gets all the users registered on a Data Box Edge/Data Box Gateway device. +// If the operation fails it returns the *CloudError error type. +func (client *UsersClient) ListByDataBoxEdgeDevice(deviceName string, resourceGroupName string, options *UsersListByDataBoxEdgeDeviceOptions) *UsersListByDataBoxEdgeDevicePager { + return &UsersListByDataBoxEdgeDevicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByDataBoxEdgeDeviceCreateRequest(ctx, deviceName, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp UsersListByDataBoxEdgeDeviceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.UserList.NextLink) + }, + } +} + +// listByDataBoxEdgeDeviceCreateRequest creates the ListByDataBoxEdgeDevice request. +func (client *UsersClient) listByDataBoxEdgeDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, options *UsersListByDataBoxEdgeDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByDataBoxEdgeDeviceHandleResponse handles the ListByDataBoxEdgeDevice response. +func (client *UsersClient) listByDataBoxEdgeDeviceHandleResponse(resp *http.Response) (UsersListByDataBoxEdgeDeviceResponse, error) { + result := UsersListByDataBoxEdgeDeviceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UserList); err != nil { + return UsersListByDataBoxEdgeDeviceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByDataBoxEdgeDeviceHandleError handles the ListByDataBoxEdgeDevice error response. +func (client *UsersClient) listByDataBoxEdgeDeviceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +}