diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/CHANGELOG.md b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/CHANGELOG.md new file mode 100644 index 000000000000..014bd5826d64 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0 (2022-06-10) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/LICENSE.txt b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/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/storsimple1200series/armstorsimple1200series/README.md b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/README.md new file mode 100644 index 000000000000..cda9ab8fb24b --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/README.md @@ -0,0 +1,77 @@ +# Azure Storsimple1200series Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series) + +The `armstorsimple1200series` module provides operations for working with Azure Storsimple1200series. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/storsimple1200series/armstorsimple1200series) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 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 Storsimple1200series module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Storsimple1200series. 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 Storsimple1200series 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, err := armstorsimple1200series.NewIscsiDisksClient(, 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{ + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armstorsimple1200series.NewIscsiDisksClient(, 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 `Storsimple1200series` 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/storsimple1200series/armstorsimple1200series/autorest.md b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/autorest.md new file mode 100644 index 000000000000..2d7d043f67b0 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/storSimple1200Series/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/storSimple1200Series/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/build.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/build.go new file mode 100644 index 000000000000..5a1e6ee4dd27 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/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/storsimple1200series/armstorsimple1200series + +package armstorsimple1200series diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ci.yml b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ci.yml new file mode 100644 index 000000000000..5dbf957d77d1 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ci.yml @@ -0,0 +1,28 @@ +# 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/storsimple1200series/armstorsimple1200series/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/storsimple1200series/armstorsimple1200series' diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.mod b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.mod new file mode 100644 index 000000000000..9a660f6ca56b --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/text v0.3.7 // indirect +) diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.sum b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.sum new file mode 100644 index 000000000000..8828b17b1853 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/go.sum @@ -0,0 +1,33 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_accesscontrolrecords_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_accesscontrolrecords_client_test.go new file mode 100644 index 000000000000..ef47bc4fbb47 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_accesscontrolrecords_client_test.go @@ -0,0 +1,125 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AccessControlRecordsListByManager.json +func ExampleAccessControlRecordsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAccessControlRecordsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AccessControlRecordsGet.json +func ExampleAccessControlRecordsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAccessControlRecordsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "AcrForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AccessControlRecordsCreateOrUpdate.json +func ExampleAccessControlRecordsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAccessControlRecordsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "AcrForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.AccessControlRecord{ + Name: to.Ptr("AcrForSDKTest"), + Properties: &armstorsimple1200series.AccessControlRecordProperties{ + InitiatorName: to.Ptr("iqn.2017-06.com.contoso:ForTest"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AccessControlRecordsDelete.json +func ExampleAccessControlRecordsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAccessControlRecordsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "AcrForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_alerts_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_alerts_client_test.go new file mode 100644 index 000000000000..1317354a2370 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_alerts_client_test.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AlertsListByManager.json +func ExampleAlertsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAlertsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hManagerForSDKTest4", + &armstorsimple1200series.AlertsClientListByManagerOptions{Filter: to.Ptr("status%20eq%20'Active'%20and%20severity%20eq%20'Critical'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AlertsClear.json +func ExampleAlertsClient_Clear() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAlertsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Clear(ctx, + "ResourceGroupForSDKTest", + "hManagerForSDKTest4", + armstorsimple1200series.ClearAlertRequest{ + Alerts: []*string{ + to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hManagerForSDKTest4/devices/is2-hlmdhdgu1et/alerts/a1f3a945-74dc-4387-bf17-a4f226374833")}, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/AlertsSendTestEmail.json +func ExampleAlertsClient_SendTestEmail() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAlertsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.SendTestEmail(ctx, + "is2-hlmdhdgu1et", + "ResourceGroupForSDKTest", + "hManagerForSDKTest4", + armstorsimple1200series.SendTestAlertEmailRequest{ + EmailList: []*string{ + to.Ptr("testemailid@contoso.com")}, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_availableprovideroperations_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_availableprovideroperations_client_test.go new file mode 100644 index 000000000000..6c7122e5cd9b --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_availableprovideroperations_client_test.go @@ -0,0 +1,41 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/OperationsList.json +func ExampleAvailableProviderOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewAvailableProviderOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backups_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backups_client_test.go new file mode 100644 index 000000000000..bbd38cc6e4f6 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backups_client_test.go @@ -0,0 +1,144 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupsListByManager.json +func ExampleBackupsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.BackupsClientListByManagerOptions{Filter: to.Ptr("createdTime%20ge%20'2018-08-10T17:30:03Z'%20and%20createdTime%20le%20'2018-08-14T17:30:03Z'%20and%20initiatedBy%20eq%20'Manual'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupsListByDevice.json +func ExampleBackupsClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.BackupsClientListByDeviceOptions{ForFailover: nil, + Filter: to.Ptr("initiatedBy%20eq%20'Manual'"), + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupsDelete.json +func ExampleBackupsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-UGU4PITWNI", + "315c3461-96ad-41bf-af0b-3a8be5113203", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupsClone.json +func ExampleBackupsClient_BeginClone() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginClone(ctx, + "HSDK-4XY4FI2IVG", + "58d33025-e837-41cc-b15f-7c85ced64aab", + "2304968f-91af-4f59-8b79-31e321eee40e", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.CloneRequest{ + Properties: &armstorsimple1200series.CloneRequestProperties{ + NewEndpointName: to.Ptr("ClonedTieredFileShareForSDKTest"), + Share: &armstorsimple1200series.FileShare{ + Name: to.Ptr("TieredFileShareForSDKTest"), + Properties: &armstorsimple1200series.FileShareProperties{ + Description: to.Ptr("Restore file Share"), + AdminUser: to.Ptr("HSDK-4XY4FI2IVG\\StorSimpleAdmin"), + DataPolicy: to.Ptr(armstorsimple1200series.DataPolicyTiered), + MonitoringStatus: to.Ptr(armstorsimple1200series.MonitoringStatusEnabled), + ProvisionedCapacityInBytes: to.Ptr[int64](536870912000), + ShareStatus: to.Ptr(armstorsimple1200series.ShareStatusOnline), + }, + }, + TargetAccessPointID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/hsdk-4xy4fi2ivg/fileServers/HSDK-4XY4FI2IVG"), + TargetDeviceID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/hsdk-4xy4fi2ivg"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backupschedulegroups_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backupschedulegroups_client_test.go new file mode 100644 index 000000000000..790346845b66 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_backupschedulegroups_client_test.go @@ -0,0 +1,132 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupScheduleGroupsListByDevice.json +func ExampleBackupScheduleGroupsClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupScheduleGroupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupScheduleGroupsGet.json +func ExampleBackupScheduleGroupsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupScheduleGroupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-4XY4FI2IVG", + "BackupSchGroupForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupScheduleGroupsCreateOrUpdate.json +func ExampleBackupScheduleGroupsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupScheduleGroupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-4XY4FI2IVG", + "BackupSchGroupForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.BackupScheduleGroup{ + Name: to.Ptr("BackupSchGroupForSDKTest"), + Properties: &armstorsimple1200series.BackupScheduleGroupProperties{ + StartTime: &armstorsimple1200series.Time{ + Hour: to.Ptr[int32](17), + Minute: to.Ptr[int32](38), + }, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/BackupScheduleGroupsDelete.json +func ExampleBackupScheduleGroupsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewBackupScheduleGroupsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-DMNJB2PET0", + "BackupSchGroupForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_chapsettings_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_chapsettings_client_test.go new file mode 100644 index 000000000000..714fc15cd8f8 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_chapsettings_client_test.go @@ -0,0 +1,133 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ChapSettingsListByDevice.json +func ExampleChapSettingsClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewChapSettingsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ChapSettingsGet.json +func ExampleChapSettingsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewChapSettingsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-WSJQERQW3F", + "ChapSettingForSDK", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ChapSettingsCreateOrUpdate.json +func ExampleChapSettingsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewChapSettingsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-WSJQERQW3F", + "ChapSettingForSDK", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.ChapSettings{ + Name: to.Ptr("ChapSettingForSDK"), + Properties: &armstorsimple1200series.ChapProperties{ + Password: &armstorsimple1200series.AsymmetricEncryptedSecret{ + EncryptionAlgorithm: to.Ptr(armstorsimple1200series.EncryptionAlgorithmRSAESPKCS1V15), + EncryptionCertificateThumbprint: to.Ptr("D73DB57C4CDD6761E159F8D1E8A7D759424983FD"), + Value: to.Ptr(""), + }, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ChapSettingsDelete.json +func ExampleChapSettingsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewChapSettingsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-WSJQERQW3F", + "ChapSettingForSDKForDelete", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_devices_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_devices_client_test.go new file mode 100644 index 000000000000..28431bfdf2bd --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_devices_client_test.go @@ -0,0 +1,498 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesListByManager.json +func ExampleDevicesClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.DevicesClientListByManagerOptions{Expand: nil}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesGet.json +func ExampleDevicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-ARCSX4MVKZ", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.DevicesClientGetOptions{Expand: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesDelete.json +func ExampleDevicesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "SDK-DELETE", + "ResourceGroupForSDKTest", + "ManagerForDeleteOperation", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesPatch.json +func ExampleDevicesClient_BeginPatch() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginPatch(ctx, + "HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.DevicePatch{ + DeviceDescription: to.Ptr("NewDescription8/14/2018 2:30:34 PM"), + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesGetAlertSettings.json +func ExampleDevicesClient_GetAlertSettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetAlertSettings(ctx, + "HSDK-T4ZA3EAJFR", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesCreateOrUpdateAlertSettings.json +func ExampleDevicesClient_BeginCreateOrUpdateAlertSettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdateAlertSettings(ctx, + "HSDK-T4ZA3EAJFR", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.AlertSettings{ + Name: to.Ptr("default"), + Properties: &armstorsimple1200series.AlertSettingsProperties{ + AdditionalRecipientEmailList: []*string{ + to.Ptr("testuser@abc.com")}, + AlertNotificationCulture: to.Ptr("en-US"), + EmailNotification: to.Ptr(armstorsimple1200series.AlertEmailNotificationStatusEnabled), + NotificationToServiceOwners: to.Ptr(armstorsimple1200series.ServiceOwnersAlertNotificationStatusDisabled), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesDeactivate.json +func ExampleDevicesClient_BeginDeactivate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDeactivate(ctx, + "SDK-DELETE", + "ResourceGroupForSDKTest", + "ManagerForDeleteOperation", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesDownloadUpdates.json +func ExampleDevicesClient_BeginDownloadUpdates() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDownloadUpdates(ctx, + "sugattdeviceforSDK", + "ResourceGroupForSDKTest", + "ManagerForSDKTest1", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesFailover.json +func ExampleDevicesClient_BeginFailover() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginFailover(ctx, + "HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.FailoverRequest{ + AccesspointIDs: []*string{ + to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-0NZI14MDTF/iscsiServers/HSDK-0NZI14MDTF")}, + KeepSourceDevice: to.Ptr(true), + SkipValidation: to.Ptr(true), + TargetDeviceID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-UGU4PITWNI"), + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesListFailoverTarget.json +func ExampleDevicesClient_NewListFailoverTargetPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListFailoverTargetPager("HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.DevicesClientListFailoverTargetOptions{Expand: nil}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesInstallUpdates.json +func ExampleDevicesClient_BeginInstallUpdates() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginInstallUpdates(ctx, + "sugattdeviceforSDK", + "ResourceGroupForSDKTest", + "ManagerForSDKTest1", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesListMetrics.json +func ExampleDevicesClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.DevicesClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-10T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesListMetricDefinition.json +func ExampleDevicesClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesGetNetworkSettings.json +func ExampleDevicesClient_GetNetworkSettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetNetworkSettings(ctx, + "HSDK-T4ZA3EAJFR", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesScanForUpdates.json +func ExampleDevicesClient_BeginScanForUpdates() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginScanForUpdates(ctx, + "HBVT-02X525X2W0", + "ResourceGroupForSDKTest", + "hManagerForSDKTest4", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesCreateOrUpdateSecuritySettings.json +func ExampleDevicesClient_BeginCreateOrUpdateSecuritySettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdateSecuritySettings(ctx, + "HSDK-T4ZA3EAJFR", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.SecuritySettings{ + Properties: &armstorsimple1200series.SecuritySettingsProperties{ + DeviceAdminPassword: &armstorsimple1200series.AsymmetricEncryptedSecret{ + EncryptionAlgorithm: to.Ptr(armstorsimple1200series.EncryptionAlgorithmRSAESPKCS1V15), + EncryptionCertificateThumbprint: to.Ptr("D73DB57C4CDD6761E159F8D1E8A7D759424983FD"), + Value: to.Ptr(""), + }, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesGetTimeSettings.json +func ExampleDevicesClient_GetTimeSettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetTimeSettings(ctx, + "HSDK-T4ZA3EAJFR", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/DevicesGetUpdateSummary.json +func ExampleDevicesClient_GetUpdateSummary() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewDevicesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetUpdateSummary(ctx, + "HBVT-02X525X2W0", + "ResourceGroupForSDKTest", + "hManagerForSDKTest4", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileservers_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileservers_client_test.go new file mode 100644 index 000000000000..141a53912b27 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileservers_client_test.go @@ -0,0 +1,240 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersListByDevice.json +func ExampleFileServersClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-DMNJB2PET0", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersGet.json +func ExampleFileServersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-4XY4FI2IVG", + "HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersCreateOrUpdate.json +func ExampleFileServersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-4XY4FI2IVG", + "HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.FileServer{ + Name: to.Ptr("HSDK-4XY4FI2IVG"), + Properties: &armstorsimple1200series.FileServerProperties{ + Description: to.Ptr("Demo FileServer for SDK Test"), + BackupScheduleGroupID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/hsdk-4xy4fi2ivg/backupScheduleGroups/BackupSchGroupForSDKTest"), + DomainName: to.Ptr("fareast.corp.microsoft.com"), + StorageDomainID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/storageDomains/sd-fs-HSDK-4XY4FI2IVG"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersDelete.json +func ExampleFileServersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersBackupNow.json +func ExampleFileServersClient_BeginBackupNow() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginBackupNow(ctx, + "HSDK-4XY4FI2IVG", + "HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersListMetrics.json +func ExampleFileServersClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.FileServersClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-10T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersListMetricDefinition.json +func ExampleFileServersClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileServersListByManager.json +func ExampleFileServersClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileshares_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileshares_client_test.go new file mode 100644 index 000000000000..bd12b42de970 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_fileshares_client_test.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesListByFileServer.json +func ExampleFileSharesClient_NewListByFileServerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByFileServerPager("HSDK-ARCSX4MVKZ", + "HSDK-ARCSX4MVKZ", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesGet.json +func ExampleFileSharesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-4XY4FI2IVG", + "HSDK-4XY4FI2IVG", + "Auto-TestFileShare1", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesCreateOrUpdate.json +func ExampleFileSharesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-4XY4FI2IVG", + "HSDK-4XY4FI2IVG", + "Auto-TestFileShare1", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.FileShare{ + Name: to.Ptr("Auto-TestFileShare1"), + Properties: &armstorsimple1200series.FileShareProperties{ + Description: to.Ptr("Demo FileShare for SDK Test Tiered"), + AdminUser: to.Ptr("fareast\\idcdlslb"), + DataPolicy: to.Ptr(armstorsimple1200series.DataPolicyTiered), + MonitoringStatus: to.Ptr(armstorsimple1200series.MonitoringStatusEnabled), + ProvisionedCapacityInBytes: to.Ptr[int64](536870912000), + ShareStatus: to.Ptr(armstorsimple1200series.ShareStatusOnline), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesDelete.json +func ExampleFileSharesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "Auto-TestFileShare2", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesListMetrics.json +func ExampleFileSharesClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "Auto-TestFileShare2", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.FileSharesClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-10T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesListMetricDefinition.json +func ExampleFileSharesClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("HSDK-DMNJB2PET0", + "HSDK-DMNJB2PET0", + "Auto-TestFileShare2", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/FileSharesListByDevice.json +func ExampleFileSharesClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewFileSharesClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsidisks_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsidisks_client_test.go new file mode 100644 index 000000000000..fffcf84d2df7 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsidisks_client_test.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksListByDevice.json +func ExampleIscsiDisksClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksListByIscsiServer.json +func ExampleIscsiDisksClient_NewListByIscsiServerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByIscsiServerPager("HSDK-0NZI14MDTF", + "HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksGet.json +func ExampleIscsiDisksClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-0NZI14MDTF", + "HSDK-0NZI14MDTF", + "Auto-TestIscsiDisk1", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksCreateOrUpdate.json +func ExampleIscsiDisksClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-0NZI14MDTF", + "HSDK-0NZI14MDTF", + "Auto-TestIscsiDisk1", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.ISCSIDisk{ + Name: to.Ptr("Auto-TestIscsiDisk1"), + Properties: &armstorsimple1200series.ISCSIDiskProperties{ + Description: to.Ptr("Demo IscsiDisk for SDK Test Tiered"), + AccessControlRecords: []*string{}, + DataPolicy: to.Ptr(armstorsimple1200series.DataPolicyTiered), + DiskStatus: to.Ptr(armstorsimple1200series.DiskStatusOnline), + MonitoringStatus: to.Ptr(armstorsimple1200series.MonitoringStatusEnabled), + ProvisionedCapacityInBytes: to.Ptr[int64](536870912000), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksDelete.json +func ExampleIscsiDisksClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-UGU4PITWNI", + "HSDK-UGU4PITWNI", + "ClonedTieredIscsiDiskForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksListMetrics.json +func ExampleIscsiDisksClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("HSDK-WSJQERQW3F", + "HSDK-WSJQERQW3F", + "TieredIscsiDiskForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.IscsiDisksClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-10T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiDisksListMetricDefinition.json +func ExampleIscsiDisksClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiDisksClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("HSDK-WSJQERQW3F", + "HSDK-WSJQERQW3F", + "TieredIscsiDiskForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsiservers_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsiservers_client_test.go new file mode 100644 index 000000000000..9581d5046458 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_iscsiservers_client_test.go @@ -0,0 +1,242 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersListByDevice.json +func ExampleIscsiServersClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersGet.json +func ExampleIscsiServersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-WSJQERQW3F", + "HSDK-WSJQERQW3F", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersCreateOrUpdate.json +func ExampleIscsiServersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "HSDK-WSJQERQW3F", + "HSDK-WSJQERQW3F", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.ISCSIServer{ + Name: to.Ptr("HSDK-WSJQERQW3F"), + Type: to.Ptr("Microsoft.StorSimple/managers/devices/iscsiServers"), + ID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-WSJQERQW3F/iscsiServers/HSDK-WSJQERQW3F"), + Properties: &armstorsimple1200series.ISCSIServerProperties{ + BackupScheduleGroupID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-WSJQERQW3F/backupScheduleGroups/Default-HSDK-WSJQERQW3F-BackupScheduleGroup"), + ChapID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-WSJQERQW3F/chapSettings/ChapSettingForSDK"), + ReverseChapID: to.Ptr(""), + StorageDomainID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/storageDomains/Default-HSDK-WSJQERQW3F-StorageDomain"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersDelete.json +func ExampleIscsiServersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "HSDK-UGU4PITWNI", + "HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersBackupNow.json +func ExampleIscsiServersClient_BeginBackupNow() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginBackupNow(ctx, + "HSDK-0NZI14MDTF", + "HSDK-0NZI14MDTF", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersListMetrics.json +func ExampleIscsiServersClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("HSDK-UGU4PITWNI", + "HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.IscsiServersClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-10T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersListMetricDefinition.json +func ExampleIscsiServersClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("HSDK-UGU4PITWNI", + "HSDK-UGU4PITWNI", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/IscsiServersListByManager.json +func ExampleIscsiServersClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewIscsiServersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_jobs_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_jobs_client_test.go new file mode 100644 index 000000000000..faff26679914 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_jobs_client_test.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/JobsListByDevice.json +func ExampleJobsClient_NewListByDevicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewJobsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDevicePager("HSDK-ARCSX4MVKZ", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.JobsClientListByDeviceOptions{Filter: to.Ptr("jobType%20eq%20'Backup'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/JobsGet.json +func ExampleJobsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewJobsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "HSDK-ARCSX4MVKZ", + "06c7ee19-35a2-4248-bf1b-408009b31b63", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/JobsListByManager.json +func ExampleJobsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewJobsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.JobsClientListByManagerOptions{Filter: to.Ptr("jobType%20eq%20'Backup'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_managers_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_managers_client_test.go new file mode 100644 index 000000000000..613004a33676 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_managers_client_test.go @@ -0,0 +1,403 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersList.json +func ExampleManagersClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersListByResourceGroup.json +func ExampleManagersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("ResourceGroupForSDKTest", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersGet.json +func ExampleManagersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "ResourceGroupForSDKTest", + "hManagerForSDKTest", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersCreateOrUpdate.json +func ExampleManagersClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, + "ResourceGroupForSDKTest", + "hManagerForSDKTest", + armstorsimple1200series.Manager{ + Name: to.Ptr("hManagerForSDKTest"), + Location: to.Ptr("westus"), + Properties: &armstorsimple1200series.ManagerProperties{ + CisIntrinsicSettings: &armstorsimple1200series.ManagerIntrinsicSettings{ + Type: to.Ptr(armstorsimple1200series.ManagerTypeHelsinkiV1), + }, + SKU: &armstorsimple1200series.ManagerSKU{ + Name: to.Ptr("Standard"), + }, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersDelete.json +func ExampleManagersClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "ResourceGroupForSDKTest", + "ManagerForSDKTest2", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersUpdate.json +func ExampleManagersClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, + "ResourceGroupForSDKTest", + "ManagerForSDKTest2", + armstorsimple1200series.ManagerPatch{ + Tags: map[string]*string{ + "TagName": to.Ptr("ForSDKTest"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersUploadRegistrationCertificate.json +func ExampleManagersClient_UploadRegistrationCertificate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.UploadRegistrationCertificate(ctx, + "windows", + "ResourceGroupForSDKTest", + "ManagerForSDKTest2", + armstorsimple1200series.UploadCertificateRequest{ + ContractVersion: to.Ptr(armstorsimple1200series.ContractVersionsV201212), + Properties: &armstorsimple1200series.RawCertificateData{ + AuthType: to.Ptr(armstorsimple1200series.AuthTypeAzureActiveDirectory), + Certificate: to.Ptr("MIIC3TCCAcWgAwIBAgIQEr0bAWD6wJtA4LIbZ9NtgzANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE4MDkxMDE1MzY0MFoXDTE4MDkxMzE1NDY0MFowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANUsKkz2Z4fECKMyNeLb9v3pr1XF4dVe+MITDtgphjl81ng190Y0IHgCVnh4YjfplUSpMk/1xii0rI5AAPwoz3ze2qRPtnwCiTaoVLkUe6knNRPzrRvVXHB81J0/14MO0lwdByHhdccRcVJZPLt5724t4aQny82v2AayJdDDkBBWNlpcqPy6n3sygP00THMPP0O3sFqy924eHqoDj3qSw79/meaZBJt9S5odPuFoskxjHuI4lM6BmK1Ql7p8Wo9/GhTOIoMz81orKPHRDleLjutwL4mb6NnhI5rfT/MxnHD6m82c4YYqiZC3XiTyJWVCkWkp7PK92OdRp6FA87rdKDMCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAIYlezVU68TuEblkn06vM5dfzSmHKJOQgW61nDlLnyKrmSJtzKZLCAswTE2VyJHwKNdZgW15coJFINjWBLWcLr0/GjNV4u3Z+UL3NhBFQd5xuMtKsIhuoscKtyk0JHQXpBvHNmOUCobfQfOBQfTVC7kmyWdtlGztFUVxD28s6S5gMb1FEWWN68NOOJ3/ZhaTbUEM54yw8Hk8/f0L/Zn/7BYHUyWWA3KStAaYn89C/ZFF+952ark2VaKGIjBRQzgrJEIR8dI4r46I3DoEfzGPESKvQPvVLhOX84RG0PLPOtnRbHBVew1Nh3HE9kgCubkPKK+NPWE9IHZPoRmOTWBe+zU="), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersGetEncryptionSettings.json +func ExampleManagersClient_GetEncryptionSettings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetEncryptionSettings(ctx, + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersGetExtendedInfo.json +func ExampleManagersClient_GetExtendedInfo() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetExtendedInfo(ctx, + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersCreateExtendedInfo.json +func ExampleManagersClient_CreateExtendedInfo() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateExtendedInfo(ctx, + "ResourceGroupForSDKTest", + "ManagerForSDKTest2", + armstorsimple1200series.ManagerExtendedInfo{ + Name: to.Ptr("vaultExtendedInfo"), + Type: to.Ptr("Microsoft.StorSimple/Managers/extendedInformation"), + ID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/Managers/hManagerForSDKTestextendedInformation/vaultExtendedInfo"), + Etag: to.Ptr("6531d5d7-3ced-4f78-83b6-804368f2ca0c"), + Properties: &armstorsimple1200series.ManagerExtendedInfoProperties{ + Algorithm: to.Ptr("SHA256"), + IntegrityKey: to.Ptr("e6501980-7efe-4602-bb0e-3cb9a08a6003"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersDeleteExtendedInfo.json +func ExampleManagersClient_DeleteExtendedInfo() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.DeleteExtendedInfo(ctx, + "ResourceGroupForSDKTest", + "hManagerForSDKTest", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersUpdateExtendedInfo.json +func ExampleManagersClient_UpdateExtendedInfo() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.UpdateExtendedInfo(ctx, + "ResourceGroupForSDKTest", + "hManagerForSDKTest", + "6531d5d7-3ced-4f78-83b6-804368f2ca0c", + armstorsimple1200series.ManagerExtendedInfo{ + Name: to.Ptr("vaultExtendedInfo"), + Type: to.Ptr("Microsoft.StorSimple/Managers/extendedInformation"), + ID: to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/Managers/hManagerForSDKTestextendedInformation/vaultExtendedInfo"), + Etag: to.Ptr("6531d5d7-3ced-4f78-83b6-804368f2ca0c"), + Properties: &armstorsimple1200series.ManagerExtendedInfoProperties{ + Algorithm: to.Ptr("SHA256"), + IntegrityKey: to.Ptr("e6501980-7efe-4602-bb0e-3cb9a08a6003"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersGetEncryptionKey.json +func ExampleManagersClient_GetEncryptionKey() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetEncryptionKey(ctx, + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersListMetrics.json +func ExampleManagersClient_NewListMetricsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricsPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + &armstorsimple1200series.ManagersClientListMetricsOptions{Filter: to.Ptr("startTime%20ge%20'2018-08-04T18:30:00Z'%20and%20endTime%20le%20'2018-08-11T18:30:00Z'")}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/ManagersListMetricDefinition.json +func ExampleManagersClient_NewListMetricDefinitionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewManagersClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMetricDefinitionPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storageaccountcredentials_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storageaccountcredentials_client_test.go new file mode 100644 index 000000000000..13c8779830f7 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storageaccountcredentials_client_test.go @@ -0,0 +1,134 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageAccountCredentialsListByManager.json +func ExampleStorageAccountCredentialsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageAccountCredentialsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageAccountCredentialsGet.json +func ExampleStorageAccountCredentialsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageAccountCredentialsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "SacForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageAccountCredentialsCreateOrUpdate.json +func ExampleStorageAccountCredentialsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageAccountCredentialsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "DummySacForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.StorageAccountCredential{ + Name: to.Ptr("DummySacForSDKTest"), + Properties: &armstorsimple1200series.StorageAccountCredentialProperties{ + AccessKey: &armstorsimple1200series.AsymmetricEncryptedSecret{ + EncryptionAlgorithm: to.Ptr(armstorsimple1200series.EncryptionAlgorithmRSAESPKCS1V15), + EncryptionCertificateThumbprint: to.Ptr("D73DB57C4CDD6761E159F8D1E8A7D759424983FD"), + Value: to.Ptr("Ev1tm0QBmpGGm4a58GkqLqx8veJEEgQtg5K3Jizpmy7JdSv9dlcRwk59THw6KIdMDlEHcS8mPyneBtOEQsh4wkcFB7qrmQz+KsRAyIhEm6bwPEm3qN8+aDDzNcXn/6vu/sqV0AP7zit9/s7SxXGxjKrz4zKnOy16/DbzRRmUHNO+HO6JUM0cUfHXTX0mEecbsXqBq0A8IEG8z+bJgXX1EhoGkzE6yVsObm4S1AcKrLiwWjqmSLji5Q8gGO+y4KTTmC3p45h5GHHXjJyOccHhySWDAffxnTzUD/sOoh+aD2VkAYrL3DdnkVzhAdfcZfVI4soONx7tYMloZIVsfW1M2Q=="), + }, + CloudType: to.Ptr(armstorsimple1200series.CloudTypeAzure), + EnableSSL: to.Ptr(armstorsimple1200series.SSLStatusEnabled), + EndPoint: to.Ptr("blob.core.windows.net"), + Location: to.Ptr("West US"), + Login: to.Ptr("SacForSDKTest"), + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageAccountCredentialsDelete.json +func ExampleStorageAccountCredentialsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageAccountCredentialsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "DummySacForSDKTest", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storagedomains_client_test.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storagedomains_client_test.go new file mode 100644 index 000000000000..f4ff3a8738d6 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/ze_generated_example_storagedomains_client_test.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storsimple1200series/armstorsimple1200series" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageDomainsListByManager.json +func ExampleStorageDomainsClient_NewListByManagerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageDomainsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByManagerPager("ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageDomainsGet.json +func ExampleStorageDomainsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageDomainsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "sd-fs-HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageDomainsCreateOrUpdate.json +func ExampleStorageDomainsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageDomainsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, + "sd-fs-HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + armstorsimple1200series.StorageDomain{ + Name: to.Ptr("sd-fs-HSDK-4XY4FI2IVG"), + Properties: &armstorsimple1200series.StorageDomainProperties{ + EncryptionStatus: to.Ptr(armstorsimple1200series.EncryptionStatusDisabled), + StorageAccountCredentialIDs: []*string{ + to.Ptr("/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/storageAccountCredentials/sacforsdktest")}, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageDomainsDelete.json +func ExampleStorageDomainsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armstorsimple1200series.NewStorageDomainsClient("9eb689cd-7243-43b4-b6f6-5c65cb296641", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, + "sd-fs-HSDK-4XY4FI2IVG", + "ResourceGroupForSDKTest", + "hAzureSDKOperations", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_accesscontrolrecords_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_accesscontrolrecords_client.go new file mode 100644 index 000000000000..b6ce1e35aaa2 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_accesscontrolrecords_client.go @@ -0,0 +1,318 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// AccessControlRecordsClient contains the methods for the AccessControlRecords group. +// Don't use this type directly, use NewAccessControlRecordsClient() instead. +type AccessControlRecordsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAccessControlRecordsClient creates a new instance of AccessControlRecordsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAccessControlRecordsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessControlRecordsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessControlRecordsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or Updates an access control record. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// accessControlRecordName - The name of the access control record. +// resourceGroupName - The resource group name +// managerName - The manager name +// accessControlRecord - The access control record to be added or updated. +// options - AccessControlRecordsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccessControlRecordsClient.BeginCreateOrUpdate +// method. +func (client *AccessControlRecordsClient) BeginCreateOrUpdate(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, accessControlRecord AccessControlRecord, options *AccessControlRecordsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AccessControlRecordsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, accessControlRecordName, resourceGroupName, managerName, accessControlRecord, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AccessControlRecordsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AccessControlRecordsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or Updates an access control record. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *AccessControlRecordsClient) createOrUpdate(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, accessControlRecord AccessControlRecord, options *AccessControlRecordsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, accessControlRecordName, resourceGroupName, managerName, accessControlRecord, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AccessControlRecordsClient) createOrUpdateCreateRequest(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, accessControlRecord AccessControlRecord, options *AccessControlRecordsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}" + if accessControlRecordName == "" { + return nil, errors.New("parameter accessControlRecordName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accessControlRecordName}", url.PathEscape(accessControlRecordName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, accessControlRecord) +} + +// BeginDelete - Deletes the access control record. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// accessControlRecordName - The name of the access control record to delete. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - AccessControlRecordsClientBeginDeleteOptions contains the optional parameters for the AccessControlRecordsClient.BeginDelete +// method. +func (client *AccessControlRecordsClient) BeginDelete(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, options *AccessControlRecordsClientBeginDeleteOptions) (*runtime.Poller[AccessControlRecordsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, accessControlRecordName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AccessControlRecordsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AccessControlRecordsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the access control record. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *AccessControlRecordsClient) deleteOperation(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, options *AccessControlRecordsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, accessControlRecordName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccessControlRecordsClient) deleteCreateRequest(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, options *AccessControlRecordsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}" + if accessControlRecordName == "" { + return nil, errors.New("parameter accessControlRecordName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accessControlRecordName}", url.PathEscape(accessControlRecordName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified access control record name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// accessControlRecordName - Name of access control record to be fetched. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - AccessControlRecordsClientGetOptions contains the optional parameters for the AccessControlRecordsClient.Get +// method. +func (client *AccessControlRecordsClient) Get(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, options *AccessControlRecordsClientGetOptions) (AccessControlRecordsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, accessControlRecordName, resourceGroupName, managerName, options) + if err != nil { + return AccessControlRecordsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccessControlRecordsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessControlRecordsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccessControlRecordsClient) getCreateRequest(ctx context.Context, accessControlRecordName string, resourceGroupName string, managerName string, options *AccessControlRecordsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}" + if accessControlRecordName == "" { + return nil, errors.New("parameter accessControlRecordName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accessControlRecordName}", url.PathEscape(accessControlRecordName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccessControlRecordsClient) getHandleResponse(resp *http.Response) (AccessControlRecordsClientGetResponse, error) { + result := AccessControlRecordsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessControlRecord); err != nil { + return AccessControlRecordsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the access control records in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - AccessControlRecordsClientListByManagerOptions contains the optional parameters for the AccessControlRecordsClient.ListByManager +// method. +func (client *AccessControlRecordsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *AccessControlRecordsClientListByManagerOptions) *runtime.Pager[AccessControlRecordsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessControlRecordsClientListByManagerResponse]{ + More: func(page AccessControlRecordsClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *AccessControlRecordsClientListByManagerResponse) (AccessControlRecordsClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return AccessControlRecordsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccessControlRecordsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessControlRecordsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *AccessControlRecordsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *AccessControlRecordsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *AccessControlRecordsClient) listByManagerHandleResponse(resp *http.Response) (AccessControlRecordsClientListByManagerResponse, error) { + result := AccessControlRecordsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessControlRecordList); err != nil { + return AccessControlRecordsClientListByManagerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_alerts_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_alerts_client.go new file mode 100644 index 000000000000..cd5e710f4610 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_alerts_client.go @@ -0,0 +1,228 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAlertsClient creates a new instance of AlertsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Clear - Clear the alerts. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// request - The clear alert request. +// options - AlertsClientClearOptions contains the optional parameters for the AlertsClient.Clear method. +func (client *AlertsClient) Clear(ctx context.Context, resourceGroupName string, managerName string, request ClearAlertRequest, options *AlertsClientClearOptions) (AlertsClientClearResponse, error) { + req, err := client.clearCreateRequest(ctx, resourceGroupName, managerName, request, options) + if err != nil { + return AlertsClientClearResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsClientClearResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientClearResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientClearResponse{}, nil +} + +// clearCreateRequest creates the Clear request. +func (client *AlertsClient) clearCreateRequest(ctx context.Context, resourceGroupName string, managerName string, request ClearAlertRequest, options *AlertsClientClearOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/clearAlerts" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// NewListByManagerPager - Retrieves all the alerts in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - AlertsClientListByManagerOptions contains the optional parameters for the AlertsClient.ListByManager method. +func (client *AlertsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *AlertsClientListByManagerOptions) *runtime.Pager[AlertsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertsClientListByManagerResponse]{ + More: func(page AlertsClientListByManagerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertsClientListByManagerResponse) (AlertsClientListByManagerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *AlertsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *AlertsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/alerts" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *AlertsClient) listByManagerHandleResponse(resp *http.Response) (AlertsClientListByManagerResponse, error) { + result := AlertsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { + return AlertsClientListByManagerResponse{}, err + } + return result, nil +} + +// SendTestEmail - Sends a test alert email. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// request - The send test alert email request. +// options - AlertsClientSendTestEmailOptions contains the optional parameters for the AlertsClient.SendTestEmail method. +func (client *AlertsClient) SendTestEmail(ctx context.Context, deviceName string, resourceGroupName string, managerName string, request SendTestAlertEmailRequest, options *AlertsClientSendTestEmailOptions) (AlertsClientSendTestEmailResponse, error) { + req, err := client.sendTestEmailCreateRequest(ctx, deviceName, resourceGroupName, managerName, request, options) + if err != nil { + return AlertsClientSendTestEmailResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsClientSendTestEmailResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientSendTestEmailResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientSendTestEmailResponse{}, nil +} + +// sendTestEmailCreateRequest creates the SendTestEmail request. +func (client *AlertsClient) sendTestEmailCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, request SendTestAlertEmailRequest, options *AlertsClientSendTestEmailOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/sendTestAlertEmail" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_availableprovideroperations_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_availableprovideroperations_client.go new file mode 100644 index 000000000000..ef68e954725d --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_availableprovideroperations_client.go @@ -0,0 +1,105 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "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/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// AvailableProviderOperationsClient contains the methods for the AvailableProviderOperations group. +// Don't use this type directly, use NewAvailableProviderOperationsClient() instead. +type AvailableProviderOperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewAvailableProviderOperationsClient creates a new instance of AvailableProviderOperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailableProviderOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableProviderOperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailableProviderOperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List of AvailableProviderOperations +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// options - AvailableProviderOperationsClientListOptions contains the optional parameters for the AvailableProviderOperationsClient.List +// method. +func (client *AvailableProviderOperationsClient) NewListPager(options *AvailableProviderOperationsClientListOptions) *runtime.Pager[AvailableProviderOperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableProviderOperationsClientListResponse]{ + More: func(page AvailableProviderOperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableProviderOperationsClientListResponse) (AvailableProviderOperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableProviderOperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableProviderOperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableProviderOperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableProviderOperationsClient) listCreateRequest(ctx context.Context, options *AvailableProviderOperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.StorSimple/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableProviderOperationsClient) listHandleResponse(resp *http.Response) (AvailableProviderOperationsClientListResponse, error) { + result := AvailableProviderOperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableProviderOperations); err != nil { + return AvailableProviderOperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backups_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backups_client.go new file mode 100644 index 000000000000..dd2ef4307dc1 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backups_client.go @@ -0,0 +1,358 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// BackupsClient contains the methods for the Backups group. +// Don't use this type directly, use NewBackupsClient() instead. +type BackupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewBackupsClient creates a new instance of BackupsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BackupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginClone - Clones the given backup element to a new disk or share with given details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// backupName - The backup name. +// elementName - The backup element name. +// resourceGroupName - The resource group name +// managerName - The manager name +// cloneRequest - The clone request. +// options - BackupsClientBeginCloneOptions contains the optional parameters for the BackupsClient.BeginClone method. +func (client *BackupsClient) BeginClone(ctx context.Context, deviceName string, backupName string, elementName string, resourceGroupName string, managerName string, cloneRequest CloneRequest, options *BackupsClientBeginCloneOptions) (*runtime.Poller[BackupsClientCloneResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.clone(ctx, deviceName, backupName, elementName, resourceGroupName, managerName, cloneRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[BackupsClientCloneResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[BackupsClientCloneResponse](options.ResumeToken, client.pl, nil) + } +} + +// Clone - Clones the given backup element to a new disk or share with given details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *BackupsClient) clone(ctx context.Context, deviceName string, backupName string, elementName string, resourceGroupName string, managerName string, cloneRequest CloneRequest, options *BackupsClientBeginCloneOptions) (*http.Response, error) { + req, err := client.cloneCreateRequest(ctx, deviceName, backupName, elementName, resourceGroupName, managerName, cloneRequest, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// cloneCreateRequest creates the Clone request. +func (client *BackupsClient) cloneCreateRequest(ctx context.Context, deviceName string, backupName string, elementName string, resourceGroupName string, managerName string, cloneRequest CloneRequest, options *BackupsClientBeginCloneOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/elements/{elementName}/clone" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + if elementName == "" { + return nil, errors.New("parameter elementName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{elementName}", url.PathEscape(elementName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, cloneRequest) +} + +// BeginDelete - Deletes the backup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// backupName - The backup name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupsClientBeginDeleteOptions contains the optional parameters for the BackupsClient.BeginDelete method. +func (client *BackupsClient) BeginDelete(ctx context.Context, deviceName string, backupName string, resourceGroupName string, managerName string, options *BackupsClientBeginDeleteOptions) (*runtime.Poller[BackupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, backupName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[BackupsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[BackupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the backup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *BackupsClient) deleteOperation(ctx context.Context, deviceName string, backupName string, resourceGroupName string, managerName string, options *BackupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, backupName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BackupsClient) deleteCreateRequest(ctx context.Context, deviceName string, backupName string, resourceGroupName string, managerName string, options *BackupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByDevicePager - Retrieves all the backups in a device. Can be used to get the backups for failover also. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupsClientListByDeviceOptions contains the optional parameters for the BackupsClient.ListByDevice method. +func (client *BackupsClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *BackupsClientListByDeviceOptions) *runtime.Pager[BackupsClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupsClientListByDeviceResponse]{ + More: func(page BackupsClientListByDeviceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupsClientListByDeviceResponse) (BackupsClientListByDeviceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupsClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *BackupsClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *BackupsClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForFailover != nil { + reqQP.Set("forFailover", strconv.FormatBool(*options.ForFailover)) + } + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *BackupsClient) listByDeviceHandleResponse(resp *http.Response) (BackupsClientListByDeviceResponse, error) { + result := BackupsClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupList); err != nil { + return BackupsClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the backups in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupsClientListByManagerOptions contains the optional parameters for the BackupsClient.ListByManager method. +func (client *BackupsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *BackupsClientListByManagerOptions) *runtime.Pager[BackupsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupsClientListByManagerResponse]{ + More: func(page BackupsClientListByManagerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupsClientListByManagerResponse) (BackupsClientListByManagerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *BackupsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *BackupsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/backups" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *BackupsClient) listByManagerHandleResponse(resp *http.Response) (BackupsClientListByManagerResponse, error) { + result := BackupsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupList); err != nil { + return BackupsClientListByManagerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backupschedulegroups_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backupschedulegroups_client.go new file mode 100644 index 000000000000..40a598364b3c --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_backupschedulegroups_client.go @@ -0,0 +1,338 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// BackupScheduleGroupsClient contains the methods for the BackupScheduleGroups group. +// Don't use this type directly, use NewBackupScheduleGroupsClient() instead. +type BackupScheduleGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewBackupScheduleGroupsClient creates a new instance of BackupScheduleGroupsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewBackupScheduleGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupScheduleGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BackupScheduleGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or Updates the backup schedule Group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// scheduleGroupName - The name of the schedule group. +// resourceGroupName - The resource group name +// managerName - The manager name +// scheduleGroup - The schedule group to be created +// options - BackupScheduleGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupScheduleGroupsClient.BeginCreateOrUpdate +// method. +func (client *BackupScheduleGroupsClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, scheduleGroup BackupScheduleGroup, options *BackupScheduleGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BackupScheduleGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, scheduleGroupName, resourceGroupName, managerName, scheduleGroup, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[BackupScheduleGroupsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[BackupScheduleGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or Updates the backup schedule Group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *BackupScheduleGroupsClient) createOrUpdate(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, scheduleGroup BackupScheduleGroup, options *BackupScheduleGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, scheduleGroupName, resourceGroupName, managerName, scheduleGroup, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BackupScheduleGroupsClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, scheduleGroup BackupScheduleGroup, options *BackupScheduleGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if scheduleGroupName == "" { + return nil, errors.New("parameter scheduleGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleGroupName}", url.PathEscape(scheduleGroupName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, scheduleGroup) +} + +// BeginDelete - Deletes the backup schedule group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// scheduleGroupName - The name of the schedule group. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupScheduleGroupsClientBeginDeleteOptions contains the optional parameters for the BackupScheduleGroupsClient.BeginDelete +// method. +func (client *BackupScheduleGroupsClient) BeginDelete(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientBeginDeleteOptions) (*runtime.Poller[BackupScheduleGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, scheduleGroupName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[BackupScheduleGroupsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[BackupScheduleGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the backup schedule group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *BackupScheduleGroupsClient) deleteOperation(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, scheduleGroupName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BackupScheduleGroupsClient) deleteCreateRequest(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if scheduleGroupName == "" { + return nil, errors.New("parameter scheduleGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleGroupName}", url.PathEscape(scheduleGroupName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified backup schedule group name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// scheduleGroupName - The name of the schedule group. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupScheduleGroupsClientGetOptions contains the optional parameters for the BackupScheduleGroupsClient.Get +// method. +func (client *BackupScheduleGroupsClient) Get(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientGetOptions) (BackupScheduleGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, scheduleGroupName, resourceGroupName, managerName, options) + if err != nil { + return BackupScheduleGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupScheduleGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupScheduleGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BackupScheduleGroupsClient) getCreateRequest(ctx context.Context, deviceName string, scheduleGroupName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if scheduleGroupName == "" { + return nil, errors.New("parameter scheduleGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleGroupName}", url.PathEscape(scheduleGroupName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupScheduleGroupsClient) getHandleResponse(resp *http.Response) (BackupScheduleGroupsClientGetResponse, error) { + result := BackupScheduleGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupScheduleGroup); err != nil { + return BackupScheduleGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the backup schedule groups in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - BackupScheduleGroupsClientListByDeviceOptions contains the optional parameters for the BackupScheduleGroupsClient.ListByDevice +// method. +func (client *BackupScheduleGroupsClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientListByDeviceOptions) *runtime.Pager[BackupScheduleGroupsClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupScheduleGroupsClientListByDeviceResponse]{ + More: func(page BackupScheduleGroupsClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *BackupScheduleGroupsClientListByDeviceResponse) (BackupScheduleGroupsClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return BackupScheduleGroupsClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupScheduleGroupsClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupScheduleGroupsClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *BackupScheduleGroupsClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *BackupScheduleGroupsClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *BackupScheduleGroupsClient) listByDeviceHandleResponse(resp *http.Response) (BackupScheduleGroupsClientListByDeviceResponse, error) { + result := BackupScheduleGroupsClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupScheduleGroupList); err != nil { + return BackupScheduleGroupsClientListByDeviceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_chapsettings_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_chapsettings_client.go new file mode 100644 index 000000000000..b4d1b752e941 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_chapsettings_client.go @@ -0,0 +1,337 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// ChapSettingsClient contains the methods for the ChapSettings group. +// Don't use this type directly, use NewChapSettingsClient() instead. +type ChapSettingsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewChapSettingsClient creates a new instance of ChapSettingsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewChapSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChapSettingsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ChapSettingsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the chap setting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// chapUserName - The chap user name. +// resourceGroupName - The resource group name +// managerName - The manager name +// chapSetting - The chap setting to be added or updated. +// options - ChapSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ChapSettingsClient.BeginCreateOrUpdate +// method. +func (client *ChapSettingsClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, chapSetting ChapSettings, options *ChapSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ChapSettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, chapUserName, resourceGroupName, managerName, chapSetting, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ChapSettingsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ChapSettingsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the chap setting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *ChapSettingsClient) createOrUpdate(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, chapSetting ChapSettings, options *ChapSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, chapUserName, resourceGroupName, managerName, chapSetting, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ChapSettingsClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, chapSetting ChapSettings, options *ChapSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if chapUserName == "" { + return nil, errors.New("parameter chapUserName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chapUserName}", url.PathEscape(chapUserName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, chapSetting) +} + +// BeginDelete - Deletes the chap setting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// chapUserName - The chap user name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ChapSettingsClientBeginDeleteOptions contains the optional parameters for the ChapSettingsClient.BeginDelete +// method. +func (client *ChapSettingsClient) BeginDelete(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, options *ChapSettingsClientBeginDeleteOptions) (*runtime.Poller[ChapSettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, chapUserName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ChapSettingsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ChapSettingsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the chap setting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *ChapSettingsClient) deleteOperation(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, options *ChapSettingsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, chapUserName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ChapSettingsClient) deleteCreateRequest(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, options *ChapSettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if chapUserName == "" { + return nil, errors.New("parameter chapUserName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chapUserName}", url.PathEscape(chapUserName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified chap setting name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// chapUserName - The user name of chap to be fetched. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ChapSettingsClientGetOptions contains the optional parameters for the ChapSettingsClient.Get method. +func (client *ChapSettingsClient) Get(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, options *ChapSettingsClientGetOptions) (ChapSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, chapUserName, resourceGroupName, managerName, options) + if err != nil { + return ChapSettingsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ChapSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChapSettingsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ChapSettingsClient) getCreateRequest(ctx context.Context, deviceName string, chapUserName string, resourceGroupName string, managerName string, options *ChapSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if chapUserName == "" { + return nil, errors.New("parameter chapUserName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chapUserName}", url.PathEscape(chapUserName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ChapSettingsClient) getHandleResponse(resp *http.Response) (ChapSettingsClientGetResponse, error) { + result := ChapSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChapSettings); err != nil { + return ChapSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the chap settings in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ChapSettingsClientListByDeviceOptions contains the optional parameters for the ChapSettingsClient.ListByDevice +// method. +func (client *ChapSettingsClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *ChapSettingsClientListByDeviceOptions) *runtime.Pager[ChapSettingsClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[ChapSettingsClientListByDeviceResponse]{ + More: func(page ChapSettingsClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ChapSettingsClientListByDeviceResponse) (ChapSettingsClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return ChapSettingsClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ChapSettingsClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChapSettingsClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *ChapSettingsClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *ChapSettingsClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *ChapSettingsClient) listByDeviceHandleResponse(resp *http.Response) (ChapSettingsClientListByDeviceResponse, error) { + result := ChapSettingsClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChapSettingsList); err != nil { + return ChapSettingsClientListByDeviceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_constants.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_constants.go new file mode 100644 index 000000000000..54a5f4a6c9a0 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_constants.go @@ -0,0 +1,679 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +const ( + moduleName = "armstorsimple1200series" + moduleVersion = "v1.0.0" +) + +// AlertEmailNotificationStatus - Value indicating whether user/admins will receive emails when an alert condition occurs +// on the system +type AlertEmailNotificationStatus string + +const ( + AlertEmailNotificationStatusEnabled AlertEmailNotificationStatus = "Enabled" + AlertEmailNotificationStatusDisabled AlertEmailNotificationStatus = "Disabled" +) + +// PossibleAlertEmailNotificationStatusValues returns the possible values for the AlertEmailNotificationStatus const type. +func PossibleAlertEmailNotificationStatusValues() []AlertEmailNotificationStatus { + return []AlertEmailNotificationStatus{ + AlertEmailNotificationStatusEnabled, + AlertEmailNotificationStatusDisabled, + } +} + +// AlertScope - Device or Resource alert +type AlertScope string + +const ( + AlertScopeResource AlertScope = "Resource" + AlertScopeDevice AlertScope = "Device" +) + +// PossibleAlertScopeValues returns the possible values for the AlertScope const type. +func PossibleAlertScopeValues() []AlertScope { + return []AlertScope{ + AlertScopeResource, + AlertScopeDevice, + } +} + +// AlertSeverity - Severity of the alert +type AlertSeverity string + +const ( + AlertSeverityInformational AlertSeverity = "Informational" + AlertSeverityWarning AlertSeverity = "Warning" + AlertSeverityCritical AlertSeverity = "Critical" +) + +// PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type. +func PossibleAlertSeverityValues() []AlertSeverity { + return []AlertSeverity{ + AlertSeverityInformational, + AlertSeverityWarning, + AlertSeverityCritical, + } +} + +// AlertSourceType - Source of the alert +type AlertSourceType string + +const ( + AlertSourceTypeResource AlertSourceType = "Resource" + AlertSourceTypeDevice AlertSourceType = "Device" +) + +// PossibleAlertSourceTypeValues returns the possible values for the AlertSourceType const type. +func PossibleAlertSourceTypeValues() []AlertSourceType { + return []AlertSourceType{ + AlertSourceTypeResource, + AlertSourceTypeDevice, + } +} + +// AlertStatus - Status of the alert +type AlertStatus string + +const ( + AlertStatusActive AlertStatus = "Active" + AlertStatusCleared AlertStatus = "Cleared" +) + +// PossibleAlertStatusValues returns the possible values for the AlertStatus const type. +func PossibleAlertStatusValues() []AlertStatus { + return []AlertStatus{ + AlertStatusActive, + AlertStatusCleared, + } +} + +// AuthType - Specify the Authentication type +type AuthType string + +const ( + AuthTypeInvalid AuthType = "Invalid" + AuthTypeAccessControlService AuthType = "AccessControlService" + AuthTypeAzureActiveDirectory AuthType = "AzureActiveDirectory" +) + +// PossibleAuthTypeValues returns the possible values for the AuthType const type. +func PossibleAuthTypeValues() []AuthType { + return []AuthType{ + AuthTypeInvalid, + AuthTypeAccessControlService, + AuthTypeAzureActiveDirectory, + } +} + +// CloudType - The cloud service provider +type CloudType string + +const ( + CloudTypeAzure CloudType = "Azure" + CloudTypeS3 CloudType = "S3" + CloudTypeS3RRS CloudType = "S3_RRS" + CloudTypeOpenStack CloudType = "OpenStack" + CloudTypeHP CloudType = "HP" +) + +// PossibleCloudTypeValues returns the possible values for the CloudType const type. +func PossibleCloudTypeValues() []CloudType { + return []CloudType{ + CloudTypeAzure, + CloudTypeS3, + CloudTypeS3RRS, + CloudTypeOpenStack, + CloudTypeHP, + } +} + +// ContractVersions - Gets ContractVersion +type ContractVersions string + +const ( + ContractVersionsInvalidVersion ContractVersions = "InvalidVersion" + ContractVersionsV201109 ContractVersions = "V2011_09" + ContractVersionsV201202 ContractVersions = "V2012_02" + ContractVersionsV201205 ContractVersions = "V2012_05" + ContractVersionsV201212 ContractVersions = "V2012_12" + ContractVersionsV201304 ContractVersions = "V2013_04" + ContractVersionsV201310 ContractVersions = "V2013_10" + ContractVersionsV201311 ContractVersions = "V2013_11" + ContractVersionsV201404 ContractVersions = "V2014_04" + ContractVersionsV201406 ContractVersions = "V2014_06" + ContractVersionsV201407 ContractVersions = "V2014_07" + ContractVersionsV201409 ContractVersions = "V2014_09" + ContractVersionsV201410 ContractVersions = "V2014_10" + ContractVersionsV201412 ContractVersions = "V2014_12" + ContractVersionsV201501 ContractVersions = "V2015_01" + ContractVersionsV201502 ContractVersions = "V2015_02" + ContractVersionsV201504 ContractVersions = "V2015_04" + ContractVersionsV201505 ContractVersions = "V2015_05" + ContractVersionsV201506 ContractVersions = "V2015_06" + ContractVersionsV201507 ContractVersions = "V2015_07" + ContractVersionsV201508 ContractVersions = "V2015_08" + ContractVersionsV201510 ContractVersions = "V2015_10" + ContractVersionsV201512 ContractVersions = "V2015_12" + ContractVersionsV201601 ContractVersions = "V2016_01" + ContractVersionsV201602 ContractVersions = "V2016_02" + ContractVersionsV201604 ContractVersions = "V2016_04" + ContractVersionsV201605 ContractVersions = "V2016_05" + ContractVersionsV201607 ContractVersions = "V2016_07" + ContractVersionsV201608 ContractVersions = "V2016_08" +) + +// PossibleContractVersionsValues returns the possible values for the ContractVersions const type. +func PossibleContractVersionsValues() []ContractVersions { + return []ContractVersions{ + ContractVersionsInvalidVersion, + ContractVersionsV201109, + ContractVersionsV201202, + ContractVersionsV201205, + ContractVersionsV201212, + ContractVersionsV201304, + ContractVersionsV201310, + ContractVersionsV201311, + ContractVersionsV201404, + ContractVersionsV201406, + ContractVersionsV201407, + ContractVersionsV201409, + ContractVersionsV201410, + ContractVersionsV201412, + ContractVersionsV201501, + ContractVersionsV201502, + ContractVersionsV201504, + ContractVersionsV201505, + ContractVersionsV201506, + ContractVersionsV201507, + ContractVersionsV201508, + ContractVersionsV201510, + ContractVersionsV201512, + ContractVersionsV201601, + ContractVersionsV201602, + ContractVersionsV201604, + ContractVersionsV201605, + ContractVersionsV201607, + ContractVersionsV201608, + } +} + +// DataPolicy - The data policy of backed up endpoint. +type DataPolicy string + +const ( + DataPolicyInvalid DataPolicy = "Invalid" + DataPolicyLocal DataPolicy = "Local" + DataPolicyTiered DataPolicy = "Tiered" + DataPolicyCloud DataPolicy = "Cloud" +) + +// PossibleDataPolicyValues returns the possible values for the DataPolicy const type. +func PossibleDataPolicyValues() []DataPolicy { + return []DataPolicy{ + DataPolicyInvalid, + DataPolicyLocal, + DataPolicyTiered, + DataPolicyCloud, + } +} + +// DeviceConfigurationStatus - "Complete" if the device has been successfully registered as File/IscsiServer and the creation +// of share/volume is complete, "Pending" if the device is only registered but the creation of share/volume +// is complete is still pending +type DeviceConfigurationStatus string + +const ( + DeviceConfigurationStatusComplete DeviceConfigurationStatus = "Complete" + DeviceConfigurationStatusPending DeviceConfigurationStatus = "Pending" +) + +// PossibleDeviceConfigurationStatusValues returns the possible values for the DeviceConfigurationStatus const type. +func PossibleDeviceConfigurationStatusValues() []DeviceConfigurationStatus { + return []DeviceConfigurationStatus{ + DeviceConfigurationStatusComplete, + DeviceConfigurationStatusPending, + } +} + +type DeviceOperation string + +const ( + DeviceOperationNone DeviceOperation = "None" + DeviceOperationDelete DeviceOperation = "Delete" + DeviceOperationDeleteWithWarning DeviceOperation = "DeleteWithWarning" + DeviceOperationDRSource DeviceOperation = "DRSource" + DeviceOperationDRTarget DeviceOperation = "DRTarget" + DeviceOperationBrowsable DeviceOperation = "Browsable" + DeviceOperationReadOnlyForDR DeviceOperation = "ReadOnlyForDR" + DeviceOperationDeactivate DeviceOperation = "Deactivate" +) + +// PossibleDeviceOperationValues returns the possible values for the DeviceOperation const type. +func PossibleDeviceOperationValues() []DeviceOperation { + return []DeviceOperation{ + DeviceOperationNone, + DeviceOperationDelete, + DeviceOperationDeleteWithWarning, + DeviceOperationDRSource, + DeviceOperationDRTarget, + DeviceOperationBrowsable, + DeviceOperationReadOnlyForDR, + DeviceOperationDeactivate, + } +} + +// DeviceStatus - Current status of the device +type DeviceStatus string + +const ( + DeviceStatusUnknown DeviceStatus = "Unknown" + DeviceStatusOnline DeviceStatus = "Online" + DeviceStatusOffline DeviceStatus = "Offline" + DeviceStatusRequiresAttention DeviceStatus = "RequiresAttention" + DeviceStatusMaintenanceMode DeviceStatus = "MaintenanceMode" + DeviceStatusCreating DeviceStatus = "Creating" + DeviceStatusProvisioning DeviceStatus = "Provisioning" + DeviceStatusDeleted DeviceStatus = "Deleted" + DeviceStatusReadyToSetup DeviceStatus = "ReadyToSetup" + DeviceStatusDeactivated DeviceStatus = "Deactivated" + DeviceStatusDeactivating DeviceStatus = "Deactivating" +) + +// PossibleDeviceStatusValues returns the possible values for the DeviceStatus const type. +func PossibleDeviceStatusValues() []DeviceStatus { + return []DeviceStatus{ + DeviceStatusUnknown, + DeviceStatusOnline, + DeviceStatusOffline, + DeviceStatusRequiresAttention, + DeviceStatusMaintenanceMode, + DeviceStatusCreating, + DeviceStatusProvisioning, + DeviceStatusDeleted, + DeviceStatusReadyToSetup, + DeviceStatusDeactivated, + DeviceStatusDeactivating, + } +} + +// DeviceType - Type of the device +type DeviceType string + +const ( + DeviceTypeInvalid DeviceType = "Invalid" + DeviceTypeAppliance DeviceType = "Appliance" + DeviceTypeVirtualAppliance DeviceType = "VirtualAppliance" + DeviceTypeSeries9000OnPremVirtualAppliance DeviceType = "Series9000OnPremVirtualAppliance" + DeviceTypeSeries9000VirtualAppliance DeviceType = "Series9000VirtualAppliance" + DeviceTypeSeries9000PhysicalAppliance DeviceType = "Series9000PhysicalAppliance" +) + +// PossibleDeviceTypeValues returns the possible values for the DeviceType const type. +func PossibleDeviceTypeValues() []DeviceType { + return []DeviceType{ + DeviceTypeInvalid, + DeviceTypeAppliance, + DeviceTypeVirtualAppliance, + DeviceTypeSeries9000OnPremVirtualAppliance, + DeviceTypeSeries9000VirtualAppliance, + DeviceTypeSeries9000PhysicalAppliance, + } +} + +// DhcpStatus - Represents state of DHCP. +type DhcpStatus string + +const ( + DhcpStatusEnabled DhcpStatus = "Enabled" + DhcpStatusDisabled DhcpStatus = "Disabled" +) + +// PossibleDhcpStatusValues returns the possible values for the DhcpStatus const type. +func PossibleDhcpStatusValues() []DhcpStatus { + return []DhcpStatus{ + DhcpStatusEnabled, + DhcpStatusDisabled, + } +} + +// DiskStatus - The disk status. +type DiskStatus string + +const ( + DiskStatusOnline DiskStatus = "Online" + DiskStatusOffline DiskStatus = "Offline" +) + +// PossibleDiskStatusValues returns the possible values for the DiskStatus const type. +func PossibleDiskStatusValues() []DiskStatus { + return []DiskStatus{ + DiskStatusOnline, + DiskStatusOffline, + } +} + +// DownloadPhase - The download phase. +type DownloadPhase string + +const ( + DownloadPhaseUnknown DownloadPhase = "Unknown" + DownloadPhaseInitializing DownloadPhase = "Initializing" + DownloadPhaseDownloading DownloadPhase = "Downloading" + DownloadPhaseVerifying DownloadPhase = "Verifying" +) + +// PossibleDownloadPhaseValues returns the possible values for the DownloadPhase const type. +func PossibleDownloadPhaseValues() []DownloadPhase { + return []DownloadPhase{ + DownloadPhaseUnknown, + DownloadPhaseInitializing, + DownloadPhaseDownloading, + DownloadPhaseVerifying, + } +} + +// EncryptionAlgorithm - Algorithm used to encrypt "Value" +type EncryptionAlgorithm string + +const ( + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" + EncryptionAlgorithmRSAESPKCS1V15 EncryptionAlgorithm = "RSAES_PKCS1_v_1_5" +) + +// PossibleEncryptionAlgorithmValues returns the possible values for the EncryptionAlgorithm const type. +func PossibleEncryptionAlgorithmValues() []EncryptionAlgorithm { + return []EncryptionAlgorithm{ + EncryptionAlgorithmNone, + EncryptionAlgorithmAES256, + EncryptionAlgorithmRSAESPKCS1V15, + } +} + +// EncryptionStatus - The encryption status which indicates if encryption is enabled or not. +type EncryptionStatus string + +const ( + EncryptionStatusEnabled EncryptionStatus = "Enabled" + EncryptionStatusDisabled EncryptionStatus = "Disabled" +) + +// PossibleEncryptionStatusValues returns the possible values for the EncryptionStatus const type. +func PossibleEncryptionStatusValues() []EncryptionStatus { + return []EncryptionStatus{ + EncryptionStatusEnabled, + EncryptionStatusDisabled, + } +} + +// InitiatedBy - Gets or sets InitiatedBy +type InitiatedBy string + +const ( + InitiatedByManual InitiatedBy = "Manual" + InitiatedByScheduled InitiatedBy = "Scheduled" +) + +// PossibleInitiatedByValues returns the possible values for the InitiatedBy const type. +func PossibleInitiatedByValues() []InitiatedBy { + return []InitiatedBy{ + InitiatedByManual, + InitiatedByScheduled, + } +} + +// JobStatus - Current status of the job +type JobStatus string + +const ( + JobStatusInvalid JobStatus = "Invalid" + JobStatusRunning JobStatus = "Running" + JobStatusSucceeded JobStatus = "Succeeded" + JobStatusFailed JobStatus = "Failed" + JobStatusCanceled JobStatus = "Canceled" + JobStatusPaused JobStatus = "Paused" + JobStatusScheduled JobStatus = "Scheduled" +) + +// PossibleJobStatusValues returns the possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{ + JobStatusInvalid, + JobStatusRunning, + JobStatusSucceeded, + JobStatusFailed, + JobStatusCanceled, + JobStatusPaused, + JobStatusScheduled, + } +} + +// JobType - The job type. +type JobType string + +const ( + JobTypeBackup JobType = "Backup" + JobTypeClone JobType = "Clone" + JobTypeFailover JobType = "Failover" + JobTypeDownloadUpdates JobType = "DownloadUpdates" + JobTypeInstallUpdates JobType = "InstallUpdates" +) + +// PossibleJobTypeValues returns the possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{ + JobTypeBackup, + JobTypeClone, + JobTypeFailover, + JobTypeDownloadUpdates, + JobTypeInstallUpdates, + } +} + +// KeyRolloverStatus - The key rollover status which indicates if key rollover is required or not. If secrets encryption has +// been upgraded, then it requires key rollover. +type KeyRolloverStatus string + +const ( + KeyRolloverStatusRequired KeyRolloverStatus = "Required" + KeyRolloverStatusNotRequired KeyRolloverStatus = "NotRequired" +) + +// PossibleKeyRolloverStatusValues returns the possible values for the KeyRolloverStatus const type. +func PossibleKeyRolloverStatusValues() []KeyRolloverStatus { + return []KeyRolloverStatus{ + KeyRolloverStatusRequired, + KeyRolloverStatusNotRequired, + } +} + +// ManagerType - Refers to the type of the StorSimple Manager +type ManagerType string + +const ( + ManagerTypeGardaV1 ManagerType = "GardaV1" + ManagerTypeHelsinkiV1 ManagerType = "HelsinkiV1" +) + +// PossibleManagerTypeValues returns the possible values for the ManagerType const type. +func PossibleManagerTypeValues() []ManagerType { + return []ManagerType{ + ManagerTypeGardaV1, + ManagerTypeHelsinkiV1, + } +} + +// MetricAggregationType - The metric aggregation type +type MetricAggregationType string + +const ( + MetricAggregationTypeAverage MetricAggregationType = "Average" + MetricAggregationTypeLast MetricAggregationType = "Last" + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + MetricAggregationTypeNone MetricAggregationType = "None" + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{ + MetricAggregationTypeAverage, + MetricAggregationTypeLast, + MetricAggregationTypeMaximum, + MetricAggregationTypeMinimum, + MetricAggregationTypeNone, + MetricAggregationTypeTotal, + } +} + +// MetricUnit - The metric unit +type MetricUnit string + +const ( + MetricUnitBytes MetricUnit = "Bytes" + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + MetricUnitCount MetricUnit = "Count" + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + 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, + MetricUnitPercent, + MetricUnitSeconds, + } +} + +// MonitoringStatus - The monitoring status +type MonitoringStatus string + +const ( + MonitoringStatusEnabled MonitoringStatus = "Enabled" + MonitoringStatusDisabled MonitoringStatus = "Disabled" +) + +// PossibleMonitoringStatusValues returns the possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{ + MonitoringStatusEnabled, + MonitoringStatusDisabled, + } +} + +// SSLStatus - SSL needs to be enabled or not +type SSLStatus string + +const ( + SSLStatusEnabled SSLStatus = "Enabled" + SSLStatusDisabled SSLStatus = "Disabled" +) + +// PossibleSSLStatusValues returns the possible values for the SSLStatus const type. +func PossibleSSLStatusValues() []SSLStatus { + return []SSLStatus{ + SSLStatusEnabled, + SSLStatusDisabled, + } +} + +// ServiceOwnersAlertNotificationStatus - Value indicating whether service owners will receive emails when an alert condition +// occurs on the system. Applicable only if emailNotification flag is Enabled. +type ServiceOwnersAlertNotificationStatus string + +const ( + ServiceOwnersAlertNotificationStatusEnabled ServiceOwnersAlertNotificationStatus = "Enabled" + ServiceOwnersAlertNotificationStatusDisabled ServiceOwnersAlertNotificationStatus = "Disabled" +) + +// PossibleServiceOwnersAlertNotificationStatusValues returns the possible values for the ServiceOwnersAlertNotificationStatus const type. +func PossibleServiceOwnersAlertNotificationStatusValues() []ServiceOwnersAlertNotificationStatus { + return []ServiceOwnersAlertNotificationStatus{ + ServiceOwnersAlertNotificationStatusEnabled, + ServiceOwnersAlertNotificationStatusDisabled, + } +} + +// ShareStatus - The Share Status +type ShareStatus string + +const ( + ShareStatusOnline ShareStatus = "Online" + ShareStatusOffline ShareStatus = "Offline" +) + +// PossibleShareStatusValues returns the possible values for the ShareStatus const type. +func PossibleShareStatusValues() []ShareStatus { + return []ShareStatus{ + ShareStatusOnline, + ShareStatusOffline, + } +} + +type SupportedDeviceCapabilities string + +const ( + SupportedDeviceCapabilitiesInvalid SupportedDeviceCapabilities = "Invalid" + SupportedDeviceCapabilitiesFileServer SupportedDeviceCapabilities = "FileServer" + SupportedDeviceCapabilitiesIscsiServer SupportedDeviceCapabilities = "IscsiServer" +) + +// PossibleSupportedDeviceCapabilitiesValues returns the possible values for the SupportedDeviceCapabilities const type. +func PossibleSupportedDeviceCapabilitiesValues() []SupportedDeviceCapabilities { + return []SupportedDeviceCapabilities{ + SupportedDeviceCapabilitiesInvalid, + SupportedDeviceCapabilitiesFileServer, + SupportedDeviceCapabilitiesIscsiServer, + } +} + +// TargetType - The target type of the backup. +type TargetType string + +const ( + TargetTypeFileServer TargetType = "FileServer" + TargetTypeDiskServer TargetType = "DiskServer" +) + +// PossibleTargetTypeValues returns the possible values for the TargetType const type. +func PossibleTargetTypeValues() []TargetType { + return []TargetType{ + TargetTypeFileServer, + TargetTypeDiskServer, + } +} + +// UpdateOperation - The current update operation. +type UpdateOperation string + +const ( + UpdateOperationIdle UpdateOperation = "Idle" + UpdateOperationScanning UpdateOperation = "Scanning" + UpdateOperationDownloading UpdateOperation = "Downloading" + UpdateOperationInstalling UpdateOperation = "Installing" +) + +// PossibleUpdateOperationValues returns the possible values for the UpdateOperation const type. +func PossibleUpdateOperationValues() []UpdateOperation { + return []UpdateOperation{ + UpdateOperationIdle, + UpdateOperationScanning, + UpdateOperationDownloading, + UpdateOperationInstalling, + } +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_devices_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_devices_client.go new file mode 100644 index 000000000000..a6756544ba26 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_devices_client.go @@ -0,0 +1,1256 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDevicesClient creates a new instance of DevicesClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDevicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DevicesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdateAlertSettings - Creates or updates the alert settings +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// alertSettings - The alert settings. +// options - DevicesClientBeginCreateOrUpdateAlertSettingsOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdateAlertSettings +// method. +func (client *DevicesClient) BeginCreateOrUpdateAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, alertSettings AlertSettings, options *DevicesClientBeginCreateOrUpdateAlertSettingsOptions) (*runtime.Poller[DevicesClientCreateOrUpdateAlertSettingsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateAlertSettings(ctx, deviceName, resourceGroupName, managerName, alertSettings, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientCreateOrUpdateAlertSettingsResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientCreateOrUpdateAlertSettingsResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateAlertSettings - Creates or updates the alert settings +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) createOrUpdateAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, alertSettings AlertSettings, options *DevicesClientBeginCreateOrUpdateAlertSettingsOptions) (*http.Response, error) { + req, err := client.createOrUpdateAlertSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, alertSettings, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateAlertSettingsCreateRequest creates the CreateOrUpdateAlertSettings request. +func (client *DevicesClient) createOrUpdateAlertSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, alertSettings AlertSettings, options *DevicesClientBeginCreateOrUpdateAlertSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, alertSettings) +} + +// BeginCreateOrUpdateSecuritySettings - Creates or updates the security settings. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// securitySettings - The security settings. +// options - DevicesClientBeginCreateOrUpdateSecuritySettingsOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdateSecuritySettings +// method. +func (client *DevicesClient) BeginCreateOrUpdateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, securitySettings SecuritySettings, options *DevicesClientBeginCreateOrUpdateSecuritySettingsOptions) (*runtime.Poller[DevicesClientCreateOrUpdateSecuritySettingsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateSecuritySettings(ctx, deviceName, resourceGroupName, managerName, securitySettings, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientCreateOrUpdateSecuritySettingsResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientCreateOrUpdateSecuritySettingsResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateSecuritySettings - Creates or updates the security settings. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) createOrUpdateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, securitySettings SecuritySettings, options *DevicesClientBeginCreateOrUpdateSecuritySettingsOptions) (*http.Response, error) { + req, err := client.createOrUpdateSecuritySettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateSecuritySettingsCreateRequest creates the CreateOrUpdateSecuritySettings request. +func (client *DevicesClient) createOrUpdateSecuritySettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, securitySettings SecuritySettings, options *DevicesClientBeginCreateOrUpdateSecuritySettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, securitySettings) +} + +// BeginDeactivate - Deactivates the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientBeginDeactivateOptions contains the optional parameters for the DevicesClient.BeginDeactivate method. +func (client *DevicesClient) BeginDeactivate(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeactivateOptions) (*runtime.Poller[DevicesClientDeactivateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deactivate(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientDeactivateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientDeactivateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Deactivate - Deactivates the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) deactivate(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeactivateOptions) (*http.Response, error) { + req, err := client.deactivateCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deactivateCreateRequest creates the Deactivate request. +func (client *DevicesClient) deactivateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeactivateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/deactivate" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Deletes the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientBeginDeleteOptions contains the optional parameters for the DevicesClient.BeginDelete method. +func (client *DevicesClient) BeginDelete(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeleteOptions) (*runtime.Poller[DevicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) deleteOperation(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DevicesClient) deleteCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDownloadUpdates - Downloads updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientBeginDownloadUpdatesOptions contains the optional parameters for the DevicesClient.BeginDownloadUpdates +// method. +func (client *DevicesClient) BeginDownloadUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDownloadUpdatesOptions) (*runtime.Poller[DevicesClientDownloadUpdatesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.downloadUpdates(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientDownloadUpdatesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientDownloadUpdatesResponse](options.ResumeToken, client.pl, nil) + } +} + +// DownloadUpdates - Downloads updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) downloadUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDownloadUpdatesOptions) (*http.Response, error) { + req, err := client.downloadUpdatesCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// downloadUpdatesCreateRequest creates the DownloadUpdates request. +func (client *DevicesClient) downloadUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginDownloadUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/download" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginFailover - Fails over the device to another device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// failoverRequest - The failover request. +// options - DevicesClientBeginFailoverOptions contains the optional parameters for the DevicesClient.BeginFailover method. +func (client *DevicesClient) BeginFailover(ctx context.Context, deviceName string, resourceGroupName string, managerName string, failoverRequest FailoverRequest, options *DevicesClientBeginFailoverOptions) (*runtime.Poller[DevicesClientFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.failover(ctx, deviceName, resourceGroupName, managerName, failoverRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientFailoverResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientFailoverResponse](options.ResumeToken, client.pl, nil) + } +} + +// Failover - Fails over the device to another device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) failover(ctx context.Context, deviceName string, resourceGroupName string, managerName string, failoverRequest FailoverRequest, options *DevicesClientBeginFailoverOptions) (*http.Response, error) { + req, err := client.failoverCreateRequest(ctx, deviceName, resourceGroupName, managerName, failoverRequest, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// failoverCreateRequest creates the Failover request. +func (client *DevicesClient) failoverCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, failoverRequest FailoverRequest, options *DevicesClientBeginFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/failover" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, failoverRequest) +} + +// Get - Returns the properties of the specified device name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. +func (client *DevicesClient) Get(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetOptions) (DevicesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DevicesClient) getCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DevicesClient) getHandleResponse(resp *http.Response) (DevicesClientGetResponse, error) { + result := DevicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Device); err != nil { + return DevicesClientGetResponse{}, err + } + return result, nil +} + +// GetAlertSettings - Returns the alert settings of the specified device name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientGetAlertSettingsOptions contains the optional parameters for the DevicesClient.GetAlertSettings +// method. +func (client *DevicesClient) GetAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetAlertSettingsOptions) (DevicesClientGetAlertSettingsResponse, error) { + req, err := client.getAlertSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientGetAlertSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientGetAlertSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientGetAlertSettingsResponse{}, runtime.NewResponseError(resp) + } + return client.getAlertSettingsHandleResponse(resp) +} + +// getAlertSettingsCreateRequest creates the GetAlertSettings request. +func (client *DevicesClient) getAlertSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetAlertSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAlertSettingsHandleResponse handles the GetAlertSettings response. +func (client *DevicesClient) getAlertSettingsHandleResponse(resp *http.Response) (DevicesClientGetAlertSettingsResponse, error) { + result := DevicesClientGetAlertSettingsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertSettings); err != nil { + return DevicesClientGetAlertSettingsResponse{}, err + } + return result, nil +} + +// GetNetworkSettings - Returns the network settings of the specified device name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientGetNetworkSettingsOptions contains the optional parameters for the DevicesClient.GetNetworkSettings +// method. +func (client *DevicesClient) GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetNetworkSettingsOptions) (DevicesClientGetNetworkSettingsResponse, error) { + req, err := client.getNetworkSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientGetNetworkSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientGetNetworkSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientGetNetworkSettingsResponse{}, runtime.NewResponseError(resp) + } + return client.getNetworkSettingsHandleResponse(resp) +} + +// getNetworkSettingsCreateRequest creates the GetNetworkSettings request. +func (client *DevicesClient) getNetworkSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetNetworkSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNetworkSettingsHandleResponse handles the GetNetworkSettings response. +func (client *DevicesClient) getNetworkSettingsHandleResponse(resp *http.Response) (DevicesClientGetNetworkSettingsResponse, error) { + result := DevicesClientGetNetworkSettingsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSettings); err != nil { + return DevicesClientGetNetworkSettingsResponse{}, err + } + return result, nil +} + +// GetTimeSettings - Returns the time settings of the specified device name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientGetTimeSettingsOptions contains the optional parameters for the DevicesClient.GetTimeSettings method. +func (client *DevicesClient) GetTimeSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetTimeSettingsOptions) (DevicesClientGetTimeSettingsResponse, error) { + req, err := client.getTimeSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientGetTimeSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientGetTimeSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientGetTimeSettingsResponse{}, runtime.NewResponseError(resp) + } + return client.getTimeSettingsHandleResponse(resp) +} + +// getTimeSettingsCreateRequest creates the GetTimeSettings request. +func (client *DevicesClient) getTimeSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetTimeSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getTimeSettingsHandleResponse handles the GetTimeSettings response. +func (client *DevicesClient) getTimeSettingsHandleResponse(resp *http.Response) (DevicesClientGetTimeSettingsResponse, error) { + result := DevicesClientGetTimeSettingsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TimeSettings); err != nil { + return DevicesClientGetTimeSettingsResponse{}, err + } + return result, nil +} + +// GetUpdateSummary - Returns the update summary of the specified device name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientGetUpdateSummaryOptions contains the optional parameters for the DevicesClient.GetUpdateSummary +// method. +func (client *DevicesClient) GetUpdateSummary(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetUpdateSummaryOptions) (DevicesClientGetUpdateSummaryResponse, error) { + req, err := client.getUpdateSummaryCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientGetUpdateSummaryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientGetUpdateSummaryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientGetUpdateSummaryResponse{}, runtime.NewResponseError(resp) + } + return client.getUpdateSummaryHandleResponse(resp) +} + +// getUpdateSummaryCreateRequest creates the GetUpdateSummary request. +func (client *DevicesClient) getUpdateSummaryCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientGetUpdateSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpdateSummaryHandleResponse handles the GetUpdateSummary response. +func (client *DevicesClient) getUpdateSummaryHandleResponse(resp *http.Response) (DevicesClientGetUpdateSummaryResponse, error) { + result := DevicesClientGetUpdateSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Updates); err != nil { + return DevicesClientGetUpdateSummaryResponse{}, err + } + return result, nil +} + +// BeginInstallUpdates - Installs the updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientBeginInstallUpdatesOptions contains the optional parameters for the DevicesClient.BeginInstallUpdates +// method. +func (client *DevicesClient) BeginInstallUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginInstallUpdatesOptions) (*runtime.Poller[DevicesClientInstallUpdatesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.installUpdates(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientInstallUpdatesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientInstallUpdatesResponse](options.ResumeToken, client.pl, nil) + } +} + +// InstallUpdates - Installs the updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) installUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginInstallUpdatesOptions) (*http.Response, error) { + req, err := client.installUpdatesCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// installUpdatesCreateRequest creates the InstallUpdates request. +func (client *DevicesClient) installUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginInstallUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/install" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByManagerPager - Retrieves all the devices in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientListByManagerOptions contains the optional parameters for the DevicesClient.ListByManager method. +func (client *DevicesClient) NewListByManagerPager(resourceGroupName string, managerName string, options *DevicesClientListByManagerOptions) *runtime.Pager[DevicesClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[DevicesClientListByManagerResponse]{ + More: func(page DevicesClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DevicesClientListByManagerResponse) (DevicesClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *DevicesClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *DevicesClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *DevicesClient) listByManagerHandleResponse(resp *http.Response) (DevicesClientListByManagerResponse, error) { + result := DevicesClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeviceList); err != nil { + return DevicesClientListByManagerResponse{}, err + } + return result, nil +} + +// NewListFailoverTargetPager - Retrieves all the devices which can be used as failover targets for the given device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientListFailoverTargetOptions contains the optional parameters for the DevicesClient.ListFailoverTarget +// method. +func (client *DevicesClient) NewListFailoverTargetPager(deviceName string, resourceGroupName string, managerName string, options *DevicesClientListFailoverTargetOptions) *runtime.Pager[DevicesClientListFailoverTargetResponse] { + return runtime.NewPager(runtime.PagingHandler[DevicesClientListFailoverTargetResponse]{ + More: func(page DevicesClientListFailoverTargetResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DevicesClientListFailoverTargetResponse) (DevicesClientListFailoverTargetResponse, error) { + req, err := client.listFailoverTargetCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientListFailoverTargetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientListFailoverTargetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientListFailoverTargetResponse{}, runtime.NewResponseError(resp) + } + return client.listFailoverTargetHandleResponse(resp) + }, + }) +} + +// listFailoverTargetCreateRequest creates the ListFailoverTarget request. +func (client *DevicesClient) listFailoverTargetCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientListFailoverTargetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/failoverTargets" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listFailoverTargetHandleResponse handles the ListFailoverTarget response. +func (client *DevicesClient) listFailoverTargetHandleResponse(resp *http.Response) (DevicesClientListFailoverTargetResponse, error) { + result := DevicesClientListFailoverTargetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeviceList); err != nil { + return DevicesClientListFailoverTargetResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definition of all metrics aggregated at device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the appliance. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientListMetricDefinitionOptions contains the optional parameters for the DevicesClient.ListMetricDefinition +// method. +func (client *DevicesClient) NewListMetricDefinitionPager(deviceName string, resourceGroupName string, managerName string, options *DevicesClientListMetricDefinitionOptions) *runtime.Pager[DevicesClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[DevicesClientListMetricDefinitionResponse]{ + More: func(page DevicesClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DevicesClientListMetricDefinitionResponse) (DevicesClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *DevicesClient) listMetricDefinitionCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/metricsDefinitions" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *DevicesClient) listMetricDefinitionHandleResponse(resp *http.Response) (DevicesClientListMetricDefinitionResponse, error) { + result := DevicesClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return DevicesClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Retrieves the device metrics. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the appliance. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientListMetricsOptions contains the optional parameters for the DevicesClient.ListMetrics method. +func (client *DevicesClient) NewListMetricsPager(deviceName string, resourceGroupName string, managerName string, options *DevicesClientListMetricsOptions) *runtime.Pager[DevicesClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[DevicesClientListMetricsResponse]{ + More: func(page DevicesClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DevicesClientListMetricsResponse) (DevicesClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return DevicesClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *DevicesClient) listMetricsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/metrics" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *DevicesClient) listMetricsHandleResponse(resp *http.Response) (DevicesClientListMetricsResponse, error) { + result := DevicesClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return DevicesClientListMetricsResponse{}, err + } + return result, nil +} + +// BeginPatch - Patches the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device Name. +// resourceGroupName - The resource group name +// managerName - The manager name +// devicePatch - Patch representation of the device. +// options - DevicesClientBeginPatchOptions contains the optional parameters for the DevicesClient.BeginPatch method. +func (client *DevicesClient) BeginPatch(ctx context.Context, deviceName string, resourceGroupName string, managerName string, devicePatch DevicePatch, options *DevicesClientBeginPatchOptions) (*runtime.Poller[DevicesClientPatchResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.patch(ctx, deviceName, resourceGroupName, managerName, devicePatch, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientPatchResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientPatchResponse](options.ResumeToken, client.pl, nil) + } +} + +// Patch - Patches the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) patch(ctx context.Context, deviceName string, resourceGroupName string, managerName string, devicePatch DevicePatch, options *DevicesClientBeginPatchOptions) (*http.Response, error) { + req, err := client.patchCreateRequest(ctx, deviceName, resourceGroupName, managerName, devicePatch, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// patchCreateRequest creates the Patch request. +func (client *DevicesClient) patchCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, devicePatch DevicePatch, options *DevicesClientBeginPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, devicePatch) +} + +// BeginScanForUpdates - Scans for updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - DevicesClientBeginScanForUpdatesOptions contains the optional parameters for the DevicesClient.BeginScanForUpdates +// method. +func (client *DevicesClient) BeginScanForUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginScanForUpdatesOptions) (*runtime.Poller[DevicesClientScanForUpdatesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.scanForUpdates(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DevicesClientScanForUpdatesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DevicesClientScanForUpdatesResponse](options.ResumeToken, client.pl, nil) + } +} + +// ScanForUpdates - Scans for updates on the device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *DevicesClient) scanForUpdates(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginScanForUpdatesOptions) (*http.Response, error) { + req, err := client.scanForUpdatesCreateRequest(ctx, deviceName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// scanForUpdatesCreateRequest creates the ScanForUpdates request. +func (client *DevicesClient) scanForUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginScanForUpdatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileservers_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileservers_client.go new file mode 100644 index 000000000000..c06cd7b0c130 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileservers_client.go @@ -0,0 +1,623 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// FileServersClient contains the methods for the FileServers group. +// Don't use this type directly, use NewFileServersClient() instead. +type FileServersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFileServersClient creates a new instance of FileServersClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFileServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileServersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FileServersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginBackupNow - Backup the file server now. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientBeginBackupNowOptions contains the optional parameters for the FileServersClient.BeginBackupNow +// method. +func (client *FileServersClient) BeginBackupNow(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginBackupNowOptions) (*runtime.Poller[FileServersClientBackupNowResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.backupNow(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FileServersClientBackupNowResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FileServersClientBackupNowResponse](options.ResumeToken, client.pl, nil) + } +} + +// BackupNow - Backup the file server now. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *FileServersClient) backupNow(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginBackupNowOptions) (*http.Response, error) { + req, err := client.backupNowCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// backupNowCreateRequest creates the BackupNow request. +func (client *FileServersClient) backupNowCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginBackupNowOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/backup" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates the file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// fileServer - The file server. +// options - FileServersClientBeginCreateOrUpdateOptions contains the optional parameters for the FileServersClient.BeginCreateOrUpdate +// method. +func (client *FileServersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, fileServer FileServer, options *FileServersClientBeginCreateOrUpdateOptions) (*runtime.Poller[FileServersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, fileServerName, resourceGroupName, managerName, fileServer, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FileServersClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FileServersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *FileServersClient) createOrUpdate(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, fileServer FileServer, options *FileServersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, fileServer, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FileServersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, fileServer FileServer, options *FileServersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, fileServer) +} + +// BeginDelete - Deletes the file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientBeginDeleteOptions contains the optional parameters for the FileServersClient.BeginDelete method. +func (client *FileServersClient) BeginDelete(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginDeleteOptions) (*runtime.Poller[FileServersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FileServersClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FileServersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *FileServersClient) deleteOperation(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FileServersClient) deleteCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified file server name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientGetOptions contains the optional parameters for the FileServersClient.Get method. +func (client *FileServersClient) Get(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientGetOptions) (FileServersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return FileServersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileServersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileServersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FileServersClient) getCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileServersClient) getHandleResponse(resp *http.Response) (FileServersClientGetResponse, error) { + result := FileServersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServer); err != nil { + return FileServersClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the file servers in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientListByDeviceOptions contains the optional parameters for the FileServersClient.ListByDevice +// method. +func (client *FileServersClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *FileServersClientListByDeviceOptions) *runtime.Pager[FileServersClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[FileServersClientListByDeviceResponse]{ + More: func(page FileServersClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileServersClientListByDeviceResponse) (FileServersClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return FileServersClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileServersClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileServersClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *FileServersClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *FileServersClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *FileServersClient) listByDeviceHandleResponse(resp *http.Response) (FileServersClientListByDeviceResponse, error) { + result := FileServersClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServerList); err != nil { + return FileServersClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the file servers in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientListByManagerOptions contains the optional parameters for the FileServersClient.ListByManager +// method. +func (client *FileServersClient) NewListByManagerPager(resourceGroupName string, managerName string, options *FileServersClientListByManagerOptions) *runtime.Pager[FileServersClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[FileServersClientListByManagerResponse]{ + More: func(page FileServersClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileServersClientListByManagerResponse) (FileServersClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return FileServersClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileServersClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileServersClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *FileServersClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *FileServersClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/fileservers" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *FileServersClient) listByManagerHandleResponse(resp *http.Response) (FileServersClientListByManagerResponse, error) { + result := FileServersClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServerList); err != nil { + return FileServersClientListByManagerResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definitions of all metrics aggregated at the file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// fileServerName - The name of the file server. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientListMetricDefinitionOptions contains the optional parameters for the FileServersClient.ListMetricDefinition +// method. +func (client *FileServersClient) NewListMetricDefinitionPager(deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientListMetricDefinitionOptions) *runtime.Pager[FileServersClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[FileServersClientListMetricDefinitionResponse]{ + More: func(page FileServersClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileServersClientListMetricDefinitionResponse) (FileServersClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return FileServersClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileServersClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileServersClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *FileServersClient) listMetricDefinitionCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metricsDefinitions" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *FileServersClient) listMetricDefinitionHandleResponse(resp *http.Response) (FileServersClientListMetricDefinitionResponse, error) { + result := FileServersClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return FileServersClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Gets the file server metrics. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The name of the device. +// fileServerName - The name of the file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileServersClientListMetricsOptions contains the optional parameters for the FileServersClient.ListMetrics method. +func (client *FileServersClient) NewListMetricsPager(deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientListMetricsOptions) *runtime.Pager[FileServersClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[FileServersClientListMetricsResponse]{ + More: func(page FileServersClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileServersClientListMetricsResponse) (FileServersClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return FileServersClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileServersClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileServersClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *FileServersClient) listMetricsCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileServersClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metrics" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *FileServersClient) listMetricsHandleResponse(resp *http.Response) (FileServersClientListMetricsResponse, error) { + result := FileServersClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return FileServersClientListMetricsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileshares_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileshares_client.go new file mode 100644 index 000000000000..4d101043cafa --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_fileshares_client.go @@ -0,0 +1,584 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// FileSharesClient contains the methods for the FileShares group. +// Don't use this type directly, use NewFileSharesClient() instead. +type FileSharesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFileSharesClient creates a new instance of FileSharesClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileSharesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FileSharesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the file share. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// shareName - The file share name. +// resourceGroupName - The resource group name +// managerName - The manager name +// fileShare - The file share. +// options - FileSharesClientBeginCreateOrUpdateOptions contains the optional parameters for the FileSharesClient.BeginCreateOrUpdate +// method. +func (client *FileSharesClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, fileShare FileShare, options *FileSharesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FileSharesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, fileShare, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FileSharesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FileSharesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the file share. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *FileSharesClient) createOrUpdate(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, fileShare FileShare, options *FileSharesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, fileShare, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FileSharesClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, fileShare FileShare, options *FileSharesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, fileShare) +} + +// BeginDelete - Deletes the file share. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// shareName - The file share Name +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientBeginDeleteOptions contains the optional parameters for the FileSharesClient.BeginDelete method. +func (client *FileSharesClient) BeginDelete(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientBeginDeleteOptions) (*runtime.Poller[FileSharesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FileSharesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FileSharesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the file share. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *FileSharesClient) deleteOperation(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified file share name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// shareName - The file share name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method. +func (client *FileSharesClient) Get(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientGetOptions) (FileSharesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, options) + if err != nil { + return FileSharesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSharesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSharesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FileSharesClient) getCreateRequest(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileSharesClientGetResponse, error) { + result := FileSharesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { + return FileSharesClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the file shares in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientListByDeviceOptions contains the optional parameters for the FileSharesClient.ListByDevice method. +func (client *FileSharesClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *FileSharesClientListByDeviceOptions) *runtime.Pager[FileSharesClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[FileSharesClientListByDeviceResponse]{ + More: func(page FileSharesClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileSharesClientListByDeviceResponse) (FileSharesClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return FileSharesClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSharesClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSharesClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *FileSharesClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *FileSharesClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *FileSharesClient) listByDeviceHandleResponse(resp *http.Response) (FileSharesClientListByDeviceResponse, error) { + result := FileSharesClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShareList); err != nil { + return FileSharesClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByFileServerPager - Retrieves all the file shares in a file server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientListByFileServerOptions contains the optional parameters for the FileSharesClient.ListByFileServer +// method. +func (client *FileSharesClient) NewListByFileServerPager(deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileSharesClientListByFileServerOptions) *runtime.Pager[FileSharesClientListByFileServerResponse] { + return runtime.NewPager(runtime.PagingHandler[FileSharesClientListByFileServerResponse]{ + More: func(page FileSharesClientListByFileServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileSharesClientListByFileServerResponse) (FileSharesClientListByFileServerResponse, error) { + req, err := client.listByFileServerCreateRequest(ctx, deviceName, fileServerName, resourceGroupName, managerName, options) + if err != nil { + return FileSharesClientListByFileServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSharesClientListByFileServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSharesClientListByFileServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByFileServerHandleResponse(resp) + }, + }) +} + +// listByFileServerCreateRequest creates the ListByFileServer request. +func (client *FileSharesClient) listByFileServerCreateRequest(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, options *FileSharesClientListByFileServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFileServerHandleResponse handles the ListByFileServer response. +func (client *FileSharesClient) listByFileServerHandleResponse(resp *http.Response) (FileSharesClientListByFileServerResponse, error) { + result := FileSharesClientListByFileServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShareList); err != nil { + return FileSharesClientListByFileServerResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definitions of all metrics aggregated at the file share. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// shareName - The file share name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientListMetricDefinitionOptions contains the optional parameters for the FileSharesClient.ListMetricDefinition +// method. +func (client *FileSharesClient) NewListMetricDefinitionPager(deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientListMetricDefinitionOptions) *runtime.Pager[FileSharesClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[FileSharesClientListMetricDefinitionResponse]{ + More: func(page FileSharesClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileSharesClientListMetricDefinitionResponse) (FileSharesClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, options) + if err != nil { + return FileSharesClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSharesClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSharesClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *FileSharesClient) listMetricDefinitionCreateRequest(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}/metricsDefinitions" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *FileSharesClient) listMetricDefinitionHandleResponse(resp *http.Response) (FileSharesClientListMetricDefinitionResponse, error) { + result := FileSharesClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return FileSharesClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Gets the file share metrics +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// fileServerName - The file server name. +// shareName - The file share name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - FileSharesClientListMetricsOptions contains the optional parameters for the FileSharesClient.ListMetrics method. +func (client *FileSharesClient) NewListMetricsPager(deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientListMetricsOptions) *runtime.Pager[FileSharesClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[FileSharesClientListMetricsResponse]{ + More: func(page FileSharesClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *FileSharesClientListMetricsResponse) (FileSharesClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, deviceName, fileServerName, shareName, resourceGroupName, managerName, options) + if err != nil { + return FileSharesClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSharesClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSharesClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *FileSharesClient) listMetricsCreateRequest(ctx context.Context, deviceName string, fileServerName string, shareName string, resourceGroupName string, managerName string, options *FileSharesClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}/metrics" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if fileServerName == "" { + return nil, errors.New("parameter fileServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileServerName}", url.PathEscape(fileServerName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *FileSharesClient) listMetricsHandleResponse(resp *http.Response) (FileSharesClientListMetricsResponse, error) { + result := FileSharesClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return FileSharesClientListMetricsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsidisks_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsidisks_client.go new file mode 100644 index 000000000000..a003d78fcb9c --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsidisks_client.go @@ -0,0 +1,584 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// IscsiDisksClient contains the methods for the IscsiDisks group. +// Don't use this type directly, use NewIscsiDisksClient() instead. +type IscsiDisksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewIscsiDisksClient creates a new instance of IscsiDisksClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewIscsiDisksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IscsiDisksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &IscsiDisksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the iSCSI disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// diskName - The disk name. +// resourceGroupName - The resource group name +// managerName - The manager name +// iscsiDisk - The iSCSI disk. +// options - IscsiDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the IscsiDisksClient.BeginCreateOrUpdate +// method. +func (client *IscsiDisksClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, iscsiDisk ISCSIDisk, options *IscsiDisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[IscsiDisksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, iscsiDisk, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[IscsiDisksClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[IscsiDisksClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the iSCSI disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *IscsiDisksClient) createOrUpdate(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, iscsiDisk ISCSIDisk, options *IscsiDisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, iscsiDisk, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IscsiDisksClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, iscsiDisk ISCSIDisk, options *IscsiDisksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, iscsiDisk) +} + +// BeginDelete - Deletes the iSCSI disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// diskName - The disk name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientBeginDeleteOptions contains the optional parameters for the IscsiDisksClient.BeginDelete method. +func (client *IscsiDisksClient) BeginDelete(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientBeginDeleteOptions) (*runtime.Poller[IscsiDisksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[IscsiDisksClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[IscsiDisksClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the iSCSI disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *IscsiDisksClient) deleteOperation(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IscsiDisksClient) deleteCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified iSCSI disk name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// diskName - The disk name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientGetOptions contains the optional parameters for the IscsiDisksClient.Get method. +func (client *IscsiDisksClient) Get(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientGetOptions) (IscsiDisksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, options) + if err != nil { + return IscsiDisksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiDisksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiDisksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IscsiDisksClient) getCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IscsiDisksClient) getHandleResponse(resp *http.Response) (IscsiDisksClientGetResponse, error) { + result := IscsiDisksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIDisk); err != nil { + return IscsiDisksClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the iSCSI disks in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientListByDeviceOptions contains the optional parameters for the IscsiDisksClient.ListByDevice method. +func (client *IscsiDisksClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *IscsiDisksClientListByDeviceOptions) *runtime.Pager[IscsiDisksClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiDisksClientListByDeviceResponse]{ + More: func(page IscsiDisksClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiDisksClientListByDeviceResponse) (IscsiDisksClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return IscsiDisksClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiDisksClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiDisksClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *IscsiDisksClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *IscsiDisksClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/disks" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *IscsiDisksClient) listByDeviceHandleResponse(resp *http.Response) (IscsiDisksClientListByDeviceResponse, error) { + result := IscsiDisksClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIDiskList); err != nil { + return IscsiDisksClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByIscsiServerPager - Retrieves all the disks in a iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientListByIscsiServerOptions contains the optional parameters for the IscsiDisksClient.ListByIscsiServer +// method. +func (client *IscsiDisksClient) NewListByIscsiServerPager(deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiDisksClientListByIscsiServerOptions) *runtime.Pager[IscsiDisksClientListByIscsiServerResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiDisksClientListByIscsiServerResponse]{ + More: func(page IscsiDisksClientListByIscsiServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiDisksClientListByIscsiServerResponse) (IscsiDisksClientListByIscsiServerResponse, error) { + req, err := client.listByIscsiServerCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return IscsiDisksClientListByIscsiServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiDisksClientListByIscsiServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiDisksClientListByIscsiServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByIscsiServerHandleResponse(resp) + }, + }) +} + +// listByIscsiServerCreateRequest creates the ListByIscsiServer request. +func (client *IscsiDisksClient) listByIscsiServerCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiDisksClientListByIscsiServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByIscsiServerHandleResponse handles the ListByIscsiServer response. +func (client *IscsiDisksClient) listByIscsiServerHandleResponse(resp *http.Response) (IscsiDisksClientListByIscsiServerResponse, error) { + result := IscsiDisksClientListByIscsiServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIDiskList); err != nil { + return IscsiDisksClientListByIscsiServerResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definitions for all metric aggregated at the iSCSI disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// diskName - The iSCSI disk name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientListMetricDefinitionOptions contains the optional parameters for the IscsiDisksClient.ListMetricDefinition +// method. +func (client *IscsiDisksClient) NewListMetricDefinitionPager(deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientListMetricDefinitionOptions) *runtime.Pager[IscsiDisksClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiDisksClientListMetricDefinitionResponse]{ + More: func(page IscsiDisksClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiDisksClientListMetricDefinitionResponse) (IscsiDisksClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, options) + if err != nil { + return IscsiDisksClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiDisksClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiDisksClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *IscsiDisksClient) listMetricDefinitionCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}/metricsDefinitions" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *IscsiDisksClient) listMetricDefinitionHandleResponse(resp *http.Response) (IscsiDisksClientListMetricDefinitionResponse, error) { + result := IscsiDisksClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return IscsiDisksClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Gets the iSCSI disk metrics +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// diskName - The iSCSI disk name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiDisksClientListMetricsOptions contains the optional parameters for the IscsiDisksClient.ListMetrics method. +func (client *IscsiDisksClient) NewListMetricsPager(deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientListMetricsOptions) *runtime.Pager[IscsiDisksClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiDisksClientListMetricsResponse]{ + More: func(page IscsiDisksClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiDisksClientListMetricsResponse) (IscsiDisksClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, deviceName, iscsiServerName, diskName, resourceGroupName, managerName, options) + if err != nil { + return IscsiDisksClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiDisksClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiDisksClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *IscsiDisksClient) listMetricsCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, diskName string, resourceGroupName string, managerName string, options *IscsiDisksClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}/metrics" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *IscsiDisksClient) listMetricsHandleResponse(resp *http.Response) (IscsiDisksClientListMetricsResponse, error) { + result := IscsiDisksClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return IscsiDisksClientListMetricsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsiservers_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsiservers_client.go new file mode 100644 index 000000000000..a96da29e5546 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_iscsiservers_client.go @@ -0,0 +1,625 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// IscsiServersClient contains the methods for the IscsiServers group. +// Don't use this type directly, use NewIscsiServersClient() instead. +type IscsiServersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewIscsiServersClient creates a new instance of IscsiServersClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewIscsiServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IscsiServersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &IscsiServersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginBackupNow - Backup the iSCSI server now. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientBeginBackupNowOptions contains the optional parameters for the IscsiServersClient.BeginBackupNow +// method. +func (client *IscsiServersClient) BeginBackupNow(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginBackupNowOptions) (*runtime.Poller[IscsiServersClientBackupNowResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.backupNow(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[IscsiServersClientBackupNowResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[IscsiServersClientBackupNowResponse](options.ResumeToken, client.pl, nil) + } +} + +// BackupNow - Backup the iSCSI server now. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *IscsiServersClient) backupNow(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginBackupNowOptions) (*http.Response, error) { + req, err := client.backupNowCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// backupNowCreateRequest creates the BackupNow request. +func (client *IscsiServersClient) backupNowCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginBackupNowOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/backup" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates the iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// iscsiServer - The iSCSI server. +// options - IscsiServersClientBeginCreateOrUpdateOptions contains the optional parameters for the IscsiServersClient.BeginCreateOrUpdate +// method. +func (client *IscsiServersClient) BeginCreateOrUpdate(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, iscsiServer ISCSIServer, options *IscsiServersClientBeginCreateOrUpdateOptions) (*runtime.Poller[IscsiServersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, iscsiServer, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[IscsiServersClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[IscsiServersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *IscsiServersClient) createOrUpdate(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, iscsiServer ISCSIServer, options *IscsiServersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, iscsiServer, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IscsiServersClient) createOrUpdateCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, iscsiServer ISCSIServer, options *IscsiServersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, iscsiServer) +} + +// BeginDelete - Deletes the iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientBeginDeleteOptions contains the optional parameters for the IscsiServersClient.BeginDelete +// method. +func (client *IscsiServersClient) BeginDelete(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginDeleteOptions) (*runtime.Poller[IscsiServersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[IscsiServersClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[IscsiServersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *IscsiServersClient) deleteOperation(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IscsiServersClient) deleteCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified iSCSI server name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientGetOptions contains the optional parameters for the IscsiServersClient.Get method. +func (client *IscsiServersClient) Get(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientGetOptions) (IscsiServersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return IscsiServersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiServersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiServersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IscsiServersClient) getCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IscsiServersClient) getHandleResponse(resp *http.Response) (IscsiServersClientGetResponse, error) { + result := IscsiServersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIServer); err != nil { + return IscsiServersClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the iSCSI in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientListByDeviceOptions contains the optional parameters for the IscsiServersClient.ListByDevice +// method. +func (client *IscsiServersClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *IscsiServersClientListByDeviceOptions) *runtime.Pager[IscsiServersClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiServersClientListByDeviceResponse]{ + More: func(page IscsiServersClientListByDeviceResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiServersClientListByDeviceResponse) (IscsiServersClientListByDeviceResponse, error) { + req, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + if err != nil { + return IscsiServersClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiServersClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiServersClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *IscsiServersClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *IscsiServersClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *IscsiServersClient) listByDeviceHandleResponse(resp *http.Response) (IscsiServersClientListByDeviceResponse, error) { + result := IscsiServersClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIServerList); err != nil { + return IscsiServersClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the iSCSI servers in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientListByManagerOptions contains the optional parameters for the IscsiServersClient.ListByManager +// method. +func (client *IscsiServersClient) NewListByManagerPager(resourceGroupName string, managerName string, options *IscsiServersClientListByManagerOptions) *runtime.Pager[IscsiServersClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiServersClientListByManagerResponse]{ + More: func(page IscsiServersClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiServersClientListByManagerResponse) (IscsiServersClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return IscsiServersClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiServersClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiServersClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *IscsiServersClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *IscsiServersClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/iscsiservers" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *IscsiServersClient) listByManagerHandleResponse(resp *http.Response) (IscsiServersClientListByManagerResponse, error) { + result := IscsiServersClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ISCSIServerList); err != nil { + return IscsiServersClientListByManagerResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definitions for all metrics aggregated at iSCSI server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientListMetricDefinitionOptions contains the optional parameters for the IscsiServersClient.ListMetricDefinition +// method. +func (client *IscsiServersClient) NewListMetricDefinitionPager(deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientListMetricDefinitionOptions) *runtime.Pager[IscsiServersClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiServersClientListMetricDefinitionResponse]{ + More: func(page IscsiServersClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiServersClientListMetricDefinitionResponse) (IscsiServersClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return IscsiServersClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiServersClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiServersClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *IscsiServersClient) listMetricDefinitionCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/metricsDefinitions" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *IscsiServersClient) listMetricDefinitionHandleResponse(resp *http.Response) (IscsiServersClientListMetricDefinitionResponse, error) { + result := IscsiServersClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return IscsiServersClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Gets the iSCSI server metrics +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// iscsiServerName - The iSCSI server name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - IscsiServersClientListMetricsOptions contains the optional parameters for the IscsiServersClient.ListMetrics +// method. +func (client *IscsiServersClient) NewListMetricsPager(deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientListMetricsOptions) *runtime.Pager[IscsiServersClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[IscsiServersClientListMetricsResponse]{ + More: func(page IscsiServersClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *IscsiServersClientListMetricsResponse) (IscsiServersClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, deviceName, iscsiServerName, resourceGroupName, managerName, options) + if err != nil { + return IscsiServersClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IscsiServersClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IscsiServersClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *IscsiServersClient) listMetricsCreateRequest(ctx context.Context, deviceName string, iscsiServerName string, resourceGroupName string, managerName string, options *IscsiServersClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/metrics" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if iscsiServerName == "" { + return nil, errors.New("parameter iscsiServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iscsiServerName}", url.PathEscape(iscsiServerName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *IscsiServersClient) listMetricsHandleResponse(resp *http.Response) (IscsiServersClientListMetricsResponse, error) { + result := IscsiServersClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return IscsiServersClientListMetricsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_jobs_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_jobs_client.go new file mode 100644 index 000000000000..d5634732d246 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_jobs_client.go @@ -0,0 +1,270 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewJobsClient creates a new instance of JobsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &JobsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Returns the properties of the specified job name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// jobName - The job name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +func (client *JobsClient) Get(ctx context.Context, deviceName string, jobName string, resourceGroupName string, managerName string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, deviceName, jobName, resourceGroupName, managerName, options) + if err != nil { + return JobsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *JobsClient) getCreateRequest(ctx context.Context, deviceName string, jobName string, resourceGroupName string, managerName string, options *JobsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs/{jobName}" + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetResponse, error) { + result := JobsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevicePager - Retrieves all the jobs in a device. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// deviceName - The device name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - JobsClientListByDeviceOptions contains the optional parameters for the JobsClient.ListByDevice method. +func (client *JobsClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *JobsClientListByDeviceOptions) *runtime.Pager[JobsClientListByDeviceResponse] { + return runtime.NewPager(runtime.PagingHandler[JobsClientListByDeviceResponse]{ + More: func(page JobsClientListByDeviceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JobsClientListByDeviceResponse) (JobsClientListByDeviceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsClientListByDeviceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsClientListByDeviceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListByDeviceResponse{}, runtime.NewResponseError(resp) + } + return client.listByDeviceHandleResponse(resp) + }, + }) +} + +// listByDeviceCreateRequest creates the ListByDevice request. +func (client *JobsClient) listByDeviceCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *JobsClientListByDeviceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeviceHandleResponse handles the ListByDevice response. +func (client *JobsClient) listByDeviceHandleResponse(resp *http.Response) (JobsClientListByDeviceResponse, error) { + result := JobsClientListByDeviceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobList); err != nil { + return JobsClientListByDeviceResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the jobs in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - JobsClientListByManagerOptions contains the optional parameters for the JobsClient.ListByManager method. +func (client *JobsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *JobsClientListByManagerOptions) *runtime.Pager[JobsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[JobsClientListByManagerResponse]{ + More: func(page JobsClientListByManagerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JobsClientListByManagerResponse) (JobsClientListByManagerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *JobsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *JobsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/jobs" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *JobsClient) listByManagerHandleResponse(resp *http.Response) (JobsClientListByManagerResponse, error) { + result := JobsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobList); err != nil { + return JobsClientListByManagerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_managers_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_managers_client.go new file mode 100644 index 000000000000..7c00e55e524b --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_managers_client.go @@ -0,0 +1,914 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// ManagersClient contains the methods for the Managers group. +// Don't use this type directly, use NewManagersClient() instead. +type ManagersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagersClient creates a new instance of ManagersClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateExtendedInfo - Creates the extended info of the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// managerExtendedInfo - The manager extended information. +// options - ManagersClientCreateExtendedInfoOptions contains the optional parameters for the ManagersClient.CreateExtendedInfo +// method. +func (client *ManagersClient) CreateExtendedInfo(ctx context.Context, resourceGroupName string, managerName string, managerExtendedInfo ManagerExtendedInfo, options *ManagersClientCreateExtendedInfoOptions) (ManagersClientCreateExtendedInfoResponse, error) { + req, err := client.createExtendedInfoCreateRequest(ctx, resourceGroupName, managerName, managerExtendedInfo, options) + if err != nil { + return ManagersClientCreateExtendedInfoResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientCreateExtendedInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientCreateExtendedInfoResponse{}, runtime.NewResponseError(resp) + } + return client.createExtendedInfoHandleResponse(resp) +} + +// createExtendedInfoCreateRequest creates the CreateExtendedInfo request. +func (client *ManagersClient) createExtendedInfoCreateRequest(ctx context.Context, resourceGroupName string, managerName string, managerExtendedInfo ManagerExtendedInfo, options *ManagersClientCreateExtendedInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, managerExtendedInfo) +} + +// createExtendedInfoHandleResponse handles the CreateExtendedInfo response. +func (client *ManagersClient) createExtendedInfoHandleResponse(resp *http.Response) (ManagersClientCreateExtendedInfoResponse, error) { + result := ManagersClientCreateExtendedInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerExtendedInfo); err != nil { + return ManagersClientCreateExtendedInfoResponse{}, err + } + return result, nil +} + +// CreateOrUpdate - Creates or updates the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// manager - The manager. +// options - ManagersClientCreateOrUpdateOptions contains the optional parameters for the ManagersClient.CreateOrUpdate method. +func (client *ManagersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managerName string, manager Manager, options *ManagersClientCreateOrUpdateOptions) (ManagersClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managerName, manager, options) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ManagersClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managerName string, manager Manager, options *ManagersClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, manager) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagersClient) createOrUpdateHandleResponse(resp *http.Response) (ManagersClientCreateOrUpdateResponse, error) { + result := ManagersClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientDeleteOptions contains the optional parameters for the ManagersClient.Delete method. +func (client *ManagersClient) Delete(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientDeleteOptions) (ManagersClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ManagersClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ManagersClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteExtendedInfo - Deletes the extended info of the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientDeleteExtendedInfoOptions contains the optional parameters for the ManagersClient.DeleteExtendedInfo +// method. +func (client *ManagersClient) DeleteExtendedInfo(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientDeleteExtendedInfoOptions) (ManagersClientDeleteExtendedInfoResponse, error) { + req, err := client.deleteExtendedInfoCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientDeleteExtendedInfoResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientDeleteExtendedInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ManagersClientDeleteExtendedInfoResponse{}, runtime.NewResponseError(resp) + } + return ManagersClientDeleteExtendedInfoResponse{}, nil +} + +// deleteExtendedInfoCreateRequest creates the DeleteExtendedInfo request. +func (client *ManagersClient) deleteExtendedInfoCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientDeleteExtendedInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified manager name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientGetOptions contains the optional parameters for the ManagersClient.Get method. +func (client *ManagersClient) Get(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetOptions) (ManagersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagersClient) getCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagersClient) getHandleResponse(resp *http.Response) (ManagersClientGetResponse, error) { + result := ManagersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientGetResponse{}, err + } + return result, nil +} + +// GetEncryptionKey - Returns the symmetric encryption key of the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientGetEncryptionKeyOptions contains the optional parameters for the ManagersClient.GetEncryptionKey +// method. +func (client *ManagersClient) GetEncryptionKey(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetEncryptionKeyOptions) (ManagersClientGetEncryptionKeyResponse, error) { + req, err := client.getEncryptionKeyCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientGetEncryptionKeyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientGetEncryptionKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientGetEncryptionKeyResponse{}, runtime.NewResponseError(resp) + } + return client.getEncryptionKeyHandleResponse(resp) +} + +// getEncryptionKeyCreateRequest creates the GetEncryptionKey request. +func (client *ManagersClient) getEncryptionKeyCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetEncryptionKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/getEncryptionKey" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEncryptionKeyHandleResponse handles the GetEncryptionKey response. +func (client *ManagersClient) getEncryptionKeyHandleResponse(resp *http.Response) (ManagersClientGetEncryptionKeyResponse, error) { + result := ManagersClientGetEncryptionKeyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SymmetricEncryptedSecret); err != nil { + return ManagersClientGetEncryptionKeyResponse{}, err + } + return result, nil +} + +// GetEncryptionSettings - Returns the encryption settings of the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientGetEncryptionSettingsOptions contains the optional parameters for the ManagersClient.GetEncryptionSettings +// method. +func (client *ManagersClient) GetEncryptionSettings(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetEncryptionSettingsOptions) (ManagersClientGetEncryptionSettingsResponse, error) { + req, err := client.getEncryptionSettingsCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientGetEncryptionSettingsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientGetEncryptionSettingsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientGetEncryptionSettingsResponse{}, runtime.NewResponseError(resp) + } + return client.getEncryptionSettingsHandleResponse(resp) +} + +// getEncryptionSettingsCreateRequest creates the GetEncryptionSettings request. +func (client *ManagersClient) getEncryptionSettingsCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetEncryptionSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/encryptionSettings/default" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEncryptionSettingsHandleResponse handles the GetEncryptionSettings response. +func (client *ManagersClient) getEncryptionSettingsHandleResponse(resp *http.Response) (ManagersClientGetEncryptionSettingsResponse, error) { + result := ManagersClientGetEncryptionSettingsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionSettings); err != nil { + return ManagersClientGetEncryptionSettingsResponse{}, err + } + return result, nil +} + +// GetExtendedInfo - Returns the extended information of the specified manager name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientGetExtendedInfoOptions contains the optional parameters for the ManagersClient.GetExtendedInfo +// method. +func (client *ManagersClient) GetExtendedInfo(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetExtendedInfoOptions) (ManagersClientGetExtendedInfoResponse, error) { + req, err := client.getExtendedInfoCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientGetExtendedInfoResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientGetExtendedInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientGetExtendedInfoResponse{}, runtime.NewResponseError(resp) + } + return client.getExtendedInfoHandleResponse(resp) +} + +// getExtendedInfoCreateRequest creates the GetExtendedInfo request. +func (client *ManagersClient) getExtendedInfoCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientGetExtendedInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getExtendedInfoHandleResponse handles the GetExtendedInfo response. +func (client *ManagersClient) getExtendedInfoHandleResponse(resp *http.Response) (ManagersClientGetExtendedInfoResponse, error) { + result := ManagersClientGetExtendedInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerExtendedInfo); err != nil { + return ManagersClientGetExtendedInfoResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves all the managers in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// options - ManagersClientListOptions contains the optional parameters for the ManagersClient.List method. +func (client *ManagersClient) NewListPager(options *ManagersClientListOptions) *runtime.Pager[ManagersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListResponse]{ + More: func(page ManagersClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ManagersClientListResponse) (ManagersClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ManagersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagersClient) listCreateRequest(ctx context.Context, options *ManagersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StorSimple/managers" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagersClient) listHandleResponse(resp *http.Response) (ManagersClientListResponse, error) { + result := ManagersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerList); err != nil { + return ManagersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Retrieves all the managers in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// options - ManagersClientListByResourceGroupOptions contains the optional parameters for the ManagersClient.ListByResourceGroup +// method. +func (client *ManagersClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagersClientListByResourceGroupOptions) *runtime.Pager[ManagersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListByResourceGroupResponse]{ + More: func(page ManagersClientListByResourceGroupResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ManagersClientListByResourceGroupResponse) (ManagersClientListByResourceGroupResponse, error) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ManagersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ManagersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ManagersClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagersClientListByResourceGroupResponse, error) { + result := ManagersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerList); err != nil { + return ManagersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListMetricDefinitionPager - Retrieves metric definition of all metrics aggregated at manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientListMetricDefinitionOptions contains the optional parameters for the ManagersClient.ListMetricDefinition +// method. +func (client *ManagersClient) NewListMetricDefinitionPager(resourceGroupName string, managerName string, options *ManagersClientListMetricDefinitionOptions) *runtime.Pager[ManagersClientListMetricDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListMetricDefinitionResponse]{ + More: func(page ManagersClientListMetricDefinitionResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ManagersClientListMetricDefinitionResponse) (ManagersClientListMetricDefinitionResponse, error) { + req, err := client.listMetricDefinitionCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientListMetricDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListMetricDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListMetricDefinitionResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricDefinitionHandleResponse(resp) + }, + }) +} + +// listMetricDefinitionCreateRequest creates the ListMetricDefinition request. +func (client *ManagersClient) listMetricDefinitionCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientListMetricDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metricsDefinitions" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricDefinitionHandleResponse handles the ListMetricDefinition response. +func (client *ManagersClient) listMetricDefinitionHandleResponse(resp *http.Response) (ManagersClientListMetricDefinitionResponse, error) { + result := ManagersClientListMetricDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionList); err != nil { + return ManagersClientListMetricDefinitionResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Gets the manager metrics +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - ManagersClientListMetricsOptions contains the optional parameters for the ManagersClient.ListMetrics method. +func (client *ManagersClient) NewListMetricsPager(resourceGroupName string, managerName string, options *ManagersClientListMetricsOptions) *runtime.Pager[ManagersClientListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListMetricsResponse]{ + More: func(page ManagersClientListMetricsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ManagersClientListMetricsResponse) (ManagersClientListMetricsResponse, error) { + req, err := client.listMetricsCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return ManagersClientListMetricsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.listMetricsHandleResponse(resp) + }, + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *ManagersClient) listMetricsCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *ManagersClientListMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metrics" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *ManagersClient) listMetricsHandleResponse(resp *http.Response) (ManagersClientListMetricsResponse, error) { + result := ManagersClientListMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetricList); err != nil { + return ManagersClientListMetricsResponse{}, err + } + return result, nil +} + +// Update - Updates the StorSimple Manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// parameters - The manager update parameters. +// options - ManagersClientUpdateOptions contains the optional parameters for the ManagersClient.Update method. +func (client *ManagersClient) Update(ctx context.Context, resourceGroupName string, managerName string, parameters ManagerPatch, options *ManagersClientUpdateOptions) (ManagersClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, managerName, parameters, options) + if err != nil { + return ManagersClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ManagersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managerName string, parameters ManagerPatch, options *ManagersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *ManagersClient) updateHandleResponse(resp *http.Response) (ManagersClientUpdateResponse, error) { + result := ManagersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientUpdateResponse{}, err + } + return result, nil +} + +// UpdateExtendedInfo - Updates the extended info of the manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// ifMatch - Pass the ETag of ExtendedInfo fetched from GET call +// managerExtendedInfo - The manager extended information. +// options - ManagersClientUpdateExtendedInfoOptions contains the optional parameters for the ManagersClient.UpdateExtendedInfo +// method. +func (client *ManagersClient) UpdateExtendedInfo(ctx context.Context, resourceGroupName string, managerName string, ifMatch string, managerExtendedInfo ManagerExtendedInfo, options *ManagersClientUpdateExtendedInfoOptions) (ManagersClientUpdateExtendedInfoResponse, error) { + req, err := client.updateExtendedInfoCreateRequest(ctx, resourceGroupName, managerName, ifMatch, managerExtendedInfo, options) + if err != nil { + return ManagersClientUpdateExtendedInfoResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientUpdateExtendedInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientUpdateExtendedInfoResponse{}, runtime.NewResponseError(resp) + } + return client.updateExtendedInfoHandleResponse(resp) +} + +// updateExtendedInfoCreateRequest creates the UpdateExtendedInfo request. +func (client *ManagersClient) updateExtendedInfoCreateRequest(ctx context.Context, resourceGroupName string, managerName string, ifMatch string, managerExtendedInfo ManagerExtendedInfo, options *ManagersClientUpdateExtendedInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, managerExtendedInfo) +} + +// updateExtendedInfoHandleResponse handles the UpdateExtendedInfo response. +func (client *ManagersClient) updateExtendedInfoHandleResponse(resp *http.Response) (ManagersClientUpdateExtendedInfoResponse, error) { + result := ManagersClientUpdateExtendedInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerExtendedInfo); err != nil { + return ManagersClientUpdateExtendedInfoResponse{}, err + } + return result, nil +} + +// UploadRegistrationCertificate - Upload Vault Cred Certificate. Returns UploadCertificateResponse +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// certificateName - Certificate Name +// resourceGroupName - The resource group name +// managerName - The manager name +// uploadCertificateRequestrequest - UploadCertificateRequest Request +// options - ManagersClientUploadRegistrationCertificateOptions contains the optional parameters for the ManagersClient.UploadRegistrationCertificate +// method. +func (client *ManagersClient) UploadRegistrationCertificate(ctx context.Context, certificateName string, resourceGroupName string, managerName string, uploadCertificateRequestrequest UploadCertificateRequest, options *ManagersClientUploadRegistrationCertificateOptions) (ManagersClientUploadRegistrationCertificateResponse, error) { + req, err := client.uploadRegistrationCertificateCreateRequest(ctx, certificateName, resourceGroupName, managerName, uploadCertificateRequestrequest, options) + if err != nil { + return ManagersClientUploadRegistrationCertificateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientUploadRegistrationCertificateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientUploadRegistrationCertificateResponse{}, runtime.NewResponseError(resp) + } + return client.uploadRegistrationCertificateHandleResponse(resp) +} + +// uploadRegistrationCertificateCreateRequest creates the UploadRegistrationCertificate request. +func (client *ManagersClient) uploadRegistrationCertificateCreateRequest(ctx context.Context, certificateName string, resourceGroupName string, managerName string, uploadCertificateRequestrequest UploadCertificateRequest, options *ManagersClientUploadRegistrationCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/certificates/{certificateName}" + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, uploadCertificateRequestrequest) +} + +// uploadRegistrationCertificateHandleResponse handles the UploadRegistrationCertificate response. +func (client *ManagersClient) uploadRegistrationCertificateHandleResponse(resp *http.Response) (ManagersClientUploadRegistrationCertificateResponse, error) { + result := ManagersClientUploadRegistrationCertificateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UploadCertificateResponse); err != nil { + return ManagersClientUploadRegistrationCertificateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models.go new file mode 100644 index 000000000000..678e5bd5d38b --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models.go @@ -0,0 +1,2104 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import "time" + +// AccessControlRecord - The access control record +type AccessControlRecord struct { + // REQUIRED; Properties of AccessControlRecord + Properties *AccessControlRecordProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AccessControlRecordList - Collection of AccessControlRecords +type AccessControlRecordList struct { + // REQUIRED; The value. + Value []*AccessControlRecord `json:"value,omitempty"` +} + +// AccessControlRecordProperties - Properties of access control record +type AccessControlRecordProperties struct { + // REQUIRED; The Iscsi initiator name (IQN) + InitiatorName *string `json:"initiatorName,omitempty"` +} + +// AccessControlRecordsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccessControlRecordsClient.BeginCreateOrUpdate +// method. +type AccessControlRecordsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccessControlRecordsClientBeginDeleteOptions contains the optional parameters for the AccessControlRecordsClient.BeginDelete +// method. +type AccessControlRecordsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccessControlRecordsClientGetOptions contains the optional parameters for the AccessControlRecordsClient.Get method. +type AccessControlRecordsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccessControlRecordsClientListByManagerOptions contains the optional parameters for the AccessControlRecordsClient.ListByManager +// method. +type AccessControlRecordsClientListByManagerOptions struct { + // placeholder for future optional parameters +} + +// Alert class +type Alert struct { + // REQUIRED; Properties of alert + Properties *AlertProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AlertErrorDetails - Error details for the alert +type AlertErrorDetails struct { + // Error code. + ErrorCode *string `json:"errorCode,omitempty"` + + // Error Message + ErrorMessage *string `json:"errorMessage,omitempty"` + + // Number of occurrences. + Occurences *int32 `json:"occurences,omitempty"` +} + +// AlertFilter - Filters that can be specified on the alert +type AlertFilter struct { + // UTC time on which the alert appeared + AppearedOnTime *time.Time `json:"appearedOnTime,omitempty"` + + // Severity of the alert + Severity *AlertSeverity `json:"severity,omitempty"` + + // Source name of the alert + SourceName *string `json:"sourceName,omitempty"` + + // Source of the alert + SourceType *AlertSourceType `json:"sourceType,omitempty"` + + // Status of the alert + Status *AlertStatus `json:"status,omitempty"` +} + +// AlertList - Collection of Alerts +type AlertList struct { + // REQUIRED; The value. + Value []*Alert `json:"value,omitempty"` + + // Id of the next page of alerts + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertProperties - Properties of alert +type AlertProperties struct { + // REQUIRED; Type of the alert + AlertType *string `json:"alertType,omitempty"` + + // REQUIRED; UTC time at which the alert appeared on the source + AppearedAtSourceTime *time.Time `json:"appearedAtSourceTime,omitempty"` + + // REQUIRED; UTC time at which the alert appeared + AppearedAtTime *time.Time `json:"appearedAtTime,omitempty"` + + // REQUIRED; Device or Resource alert + Scope *AlertScope `json:"scope,omitempty"` + + // REQUIRED; Severity of the alert + Severity *AlertSeverity `json:"severity,omitempty"` + + // REQUIRED; Source at which the alert was cleared + Source *AlertSource `json:"source,omitempty"` + + // REQUIRED; Current status of the alert + Status *AlertStatus `json:"status,omitempty"` + + // REQUIRED; Title of the alert + Title *string `json:"title,omitempty"` + + // UTC time at which the alert was cleared on the source + ClearedAtSourceTime *time.Time `json:"clearedAtSourceTime,omitempty"` + + // UTC time at which the alert got cleared + ClearedAtTime *time.Time `json:"clearedAtTime,omitempty"` + + // Other information about the alert + DetailedInformation map[string]*string `json:"detailedInformation,omitempty"` + + // ErrorDetails of the alert + ErrorDetails *AlertErrorDetails `json:"errorDetails,omitempty"` + + // Recommendation for acting on the alert + Recommendation *string `json:"recommendation,omitempty"` + + // Reason for resolving the alert + ResolutionReason *string `json:"resolutionReason,omitempty"` +} + +// AlertSettings on the device which represents how alerts will be processed +type AlertSettings struct { + // REQUIRED; Properties of AlertSettings + Properties *AlertSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AlertSettingsProperties - Class containing the properties of AlertSettings +type AlertSettingsProperties struct { + // REQUIRED; Culture setting to be used while building alert emails. For eg: "en-US" + AlertNotificationCulture *string `json:"alertNotificationCulture,omitempty"` + + // REQUIRED; Value indicating whether user/admins will receive emails when an alert condition occurs on the system + EmailNotification *AlertEmailNotificationStatus `json:"emailNotification,omitempty"` + + // REQUIRED; Value indicating whether service owners will receive emails when an alert condition occurs on the system. Applicable + // only if emailNotification flag is Enabled. + NotificationToServiceOwners *ServiceOwnersAlertNotificationStatus `json:"notificationToServiceOwners,omitempty"` + + // List of email addresses (apart from admin/co-admin of subscription) to whom the alert emails need to be sent + AdditionalRecipientEmailList []*string `json:"additionalRecipientEmailList,omitempty"` +} + +// AlertSource - source at which the alert can be raised +type AlertSource struct { + // Source type of the alert. + AlertSourceType *AlertSourceType `json:"alertSourceType,omitempty"` + + // Name of the source. + Name *string `json:"name,omitempty"` + + // The time zone. + TimeZone *string `json:"timeZone,omitempty"` +} + +// AlertsClientClearOptions contains the optional parameters for the AlertsClient.Clear method. +type AlertsClientClearOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientListByManagerOptions contains the optional parameters for the AlertsClient.ListByManager method. +type AlertsClientListByManagerOptions struct { + // OData Filter options + Filter *string +} + +// AlertsClientSendTestEmailOptions contains the optional parameters for the AlertsClient.SendTestEmail method. +type AlertsClientSendTestEmailOptions struct { + // placeholder for future optional parameters +} + +// AsymmetricEncryptedSecret - This class can be used as the Type for any secret entity represented as Password, CertThumbprint, +// Algorithm. This class is intended to be used when the secret is encrypted with an asymmetric key pair. +// The encryptionAlgorithm field is mainly for future usage to potentially allow different entities encrypted using different +// algorithms. +type AsymmetricEncryptedSecret struct { + // REQUIRED; Algorithm used to encrypt "Value" + EncryptionAlgorithm *EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + + // REQUIRED; The value of the secret itself. If the secret is in plaintext then EncryptionAlgorithm will be none and EncryptionCertThumbprint + // will be null. + Value *string `json:"value,omitempty"` + + // Thumbprint certificate that was used to encrypt "Value" + EncryptionCertificateThumbprint *string `json:"encryptionCertificateThumbprint,omitempty"` +} + +// AvailableProviderOperation - Class represents provider operation +type AvailableProviderOperation struct { + // Gets or sets Display information Contains the localized display information for this particular operation/action + Display *AvailableProviderOperationDisplay `json:"display,omitempty"` + + // Gets or sets the name of the operation being performed on this particular object Return value format: "{resourceProviderNamespace}/{resourceType}/{read|write|deletion|action}" + // Eg: + // Microsoft.StorSimple/managers/devices/fileServers/read Microsoft.StorSimple/managers/devices/alerts/clearAlerts/action + Name *string `json:"name,omitempty"` + + // Gets or sets Origin The intended executor of the operation; governs the display of the operation in the RBAC UX and the + // audit logs UX. Default value is “user,system” + Origin *string `json:"origin,omitempty"` + + // Gets or sets Properties Reserved for future use + Properties interface{} `json:"properties,omitempty"` +} + +// AvailableProviderOperationDisplay - Contains the localized display information for this particular operation / action. +// These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for +// the event service; and (3) audit history / records for management operations. +type AvailableProviderOperationDisplay struct { + // Gets or sets Description The localized friendly description for the operation, as it should be shown to the user. It should + // be thorough, yet concise – it will be used in tool tips and detailed views. + Description *string `json:"description,omitempty"` + + // Gets or sets Operation The localized friendly name for the operation, as it should be shown to the user. It should be concise + // (to fit in drop downs) but clear (i.e. self-documenting). It should use + // Title Casing and include the entity/resource to which it applies. + Operation *string `json:"operation,omitempty"` + + // Gets or sets Provider The localized friendly form of the resource provider name – it is expected to also include the publisher/company + // responsible. It should use Title Casing and begin with + // “Microsoft” for 1st party services. + Provider *string `json:"provider,omitempty"` + + // Gets or sets Resource The localized friendly form of the resource type related to this action/operation – it should match + // the public documentation for the resource provider. It should use Title Casing + // – for examples, please refer to the “name” section. + Resource *string `json:"resource,omitempty"` +} + +// AvailableProviderOperations - Class for set of operations used for discovery of available provider operations. +type AvailableProviderOperations struct { + // REQUIRED; The value. + Value []*AvailableProviderOperation `json:"value,omitempty"` + + // The NextLink. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableProviderOperationsClientListOptions contains the optional parameters for the AvailableProviderOperationsClient.List +// method. +type AvailableProviderOperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// Backup - The backup. +type Backup struct { + // REQUIRED; Properties of backup + Properties *BackupProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BackupElement - Class represents BackupElement +type BackupElement struct { + // REQUIRED; The Properties of backup element + Properties *BackupElementProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BackupElementProperties - The backup element properties +type BackupElementProperties struct { + // REQUIRED; The data policy of backed up endpoint. + DataPolicy *DataPolicy `json:"dataPolicy,omitempty"` + + // REQUIRED; The name of the endpoint. + EndpointName *string `json:"endpointName,omitempty"` + + // REQUIRED; The size in bytes. + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` +} + +// BackupFilter - Backup OData filter class +type BackupFilter struct { + // Gets or sets CreatedTime + CreatedTime *time.Time `json:"createdTime,omitempty"` + + // Gets or sets InitiatedBy + InitiatedBy *InitiatedBy `json:"initiatedBy,omitempty"` +} + +// BackupList - Collection of backups +type BackupList struct { + // REQUIRED; The value. + Value []*Backup `json:"value,omitempty"` + + // The NextLink. + NextLink *string `json:"nextLink,omitempty"` +} + +// BackupProperties - Class represents Backup properties +type BackupProperties struct { + // REQUIRED; The Device Identifier. + DeviceID *string `json:"deviceId,omitempty"` + + // REQUIRED; The backup elements. + Elements []*BackupElement `json:"elements,omitempty"` + + // REQUIRED; Indicates how the backup was initiated "Manual | Scheduled". + InitiatedBy *InitiatedBy `json:"initiatedBy,omitempty"` + + // REQUIRED; The backup size in bytes. + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + + // The time when the backup was created. + CreatedTime *time.Time `json:"createdTime,omitempty"` + + // The time when the backup will expire. + ExpirationTime *time.Time `json:"expirationTime,omitempty"` + + // The path id of the target FileServer or IscsiServer for which the backup was taken. + TargetID *string `json:"targetId,omitempty"` + + // Type of target, FileServer or IscsiServer + TargetType *string `json:"targetType,omitempty"` +} + +// BackupScheduleGroup - The Backup Schedule Group +type BackupScheduleGroup struct { + // REQUIRED; Properties of BackupScheduleGroup + Properties *BackupScheduleGroupProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BackupScheduleGroupList - The list response of backup schedule groups +type BackupScheduleGroupList struct { + // REQUIRED; The value. + Value []*BackupScheduleGroup `json:"value,omitempty"` +} + +// BackupScheduleGroupProperties - The Backup Schedule Group Properties +type BackupScheduleGroupProperties struct { + // REQUIRED; The start time. When this field is specified we will generate Default GrandFather Father Son Backup Schedules. + StartTime *Time `json:"startTime,omitempty"` +} + +// BackupScheduleGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupScheduleGroupsClient.BeginCreateOrUpdate +// method. +type BackupScheduleGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupScheduleGroupsClientBeginDeleteOptions contains the optional parameters for the BackupScheduleGroupsClient.BeginDelete +// method. +type BackupScheduleGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupScheduleGroupsClientGetOptions contains the optional parameters for the BackupScheduleGroupsClient.Get method. +type BackupScheduleGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupScheduleGroupsClientListByDeviceOptions contains the optional parameters for the BackupScheduleGroupsClient.ListByDevice +// method. +type BackupScheduleGroupsClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientBeginCloneOptions contains the optional parameters for the BackupsClient.BeginClone method. +type BackupsClientBeginCloneOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsClientBeginDeleteOptions contains the optional parameters for the BackupsClient.BeginDelete method. +type BackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsClientListByDeviceOptions contains the optional parameters for the BackupsClient.ListByDevice method. +type BackupsClientListByDeviceOptions struct { + // OData Filter options + Filter *string + // Set to true if you need backups which can be used for failover. + ForFailover *bool +} + +// BackupsClientListByManagerOptions contains the optional parameters for the BackupsClient.ListByManager method. +type BackupsClientListByManagerOptions struct { + // OData Filter options + Filter *string +} + +// BaseModel - Base class for models +type BaseModel struct { + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ChapProperties - Chap properties +type ChapProperties struct { + // REQUIRED; The chap password. + Password *AsymmetricEncryptedSecret `json:"password,omitempty"` +} + +// ChapSettings - Challenge-Handshake Authentication Protocol (CHAP) setting +type ChapSettings struct { + // REQUIRED; Chap properties + Properties *ChapProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ChapSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ChapSettingsClient.BeginCreateOrUpdate +// method. +type ChapSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ChapSettingsClientBeginDeleteOptions contains the optional parameters for the ChapSettingsClient.BeginDelete method. +type ChapSettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ChapSettingsClientGetOptions contains the optional parameters for the ChapSettingsClient.Get method. +type ChapSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ChapSettingsClientListByDeviceOptions contains the optional parameters for the ChapSettingsClient.ListByDevice method. +type ChapSettingsClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// ChapSettingsList - Collection of Chap setting entities +type ChapSettingsList struct { + // REQUIRED; The chap settings entity collection + Value []*ChapSettings `json:"value,omitempty"` +} + +// ClearAlertRequest - Request for clearing the alert +type ClearAlertRequest struct { + // REQUIRED; List of alert Ids to be cleared + Alerts []*string `json:"alerts,omitempty"` + + // Resolution message while clearing the request + ResolutionMessage *string `json:"resolutionMessage,omitempty"` +} + +// CloneRequest - Clone Job Request Model. +type CloneRequest struct { + // REQUIRED; CloneJob Properties are encapsulated in this object. + Properties *CloneRequestProperties `json:"properties,omitempty"` +} + +// CloneRequestProperties - Properties of CloneRequest +type CloneRequestProperties struct { + // REQUIRED; Name of new endpoint which will created as part of clone job. + NewEndpointName *string `json:"newEndpointName,omitempty"` + + // REQUIRED; Access point Id on which clone job will performed. + TargetAccessPointID *string `json:"targetAccessPointId,omitempty"` + + // REQUIRED; DeviceId of the device which will act as the Clone target + TargetDeviceID *string `json:"targetDeviceId,omitempty"` + + // Disk Object + Disk *ISCSIDisk `json:"disk,omitempty"` + + // Share Object. + Share *FileShare `json:"share,omitempty"` +} + +// Device - Represents a StorSimple device object along with its properties +type Device struct { + // Collection of properties for the device + Properties *DeviceProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DeviceDetails - Class containing more granular details about the device +type DeviceDetails struct { + // Local pending storage available on the device in bytes + AvailableLocalStorageInBytes *int64 `json:"availableLocalStorageInBytes,omitempty"` + + // Total pending available storage on the device in bytes + AvailableStorageInBytes *int64 `json:"availableStorageInBytes,omitempty"` + + // Total number of endpoints that are currently on the device ( i.e. number of shares on FileServer or number of volumes on + // IscsiServer) + EndpointCount *int32 `json:"endpointCount,omitempty"` + + // Storage in bytes that has been provisioned locally on the device + ProvisionedLocalStorageInBytes *int64 `json:"provisionedLocalStorageInBytes,omitempty"` + + // Storage in bytes that has been provisioned on the device including both local and cloud + ProvisionedStorageInBytes *int64 `json:"provisionedStorageInBytes,omitempty"` + + // Total size taken up by backups in bytes + TotalBackupSizeInBytes *int64 `json:"totalBackupSizeInBytes,omitempty"` + + // Total local storage capacity in device in bytes. + TotalLocalStorageInBytes *int64 `json:"totalLocalStorageInBytes,omitempty"` + + // Total storage available on the device in bytes. + TotalStorageInBytes *int64 `json:"totalStorageInBytes,omitempty"` + + // Local Storage that is being currently used in bytes + UsingLocalStorageInBytes *int64 `json:"usingLocalStorageInBytes,omitempty"` + + // Storage that is being currently used in bytes including both local and cloud + UsingStorageInBytes *int64 `json:"usingStorageInBytes,omitempty"` +} + +// DeviceList - Collection of Devices +type DeviceList struct { + // REQUIRED; The value. + Value []*Device `json:"value,omitempty"` +} + +// DevicePatch - Class that represents the Input for the PATCH call on Device. Currently the only patchable property on device +// is "DeviceDescription" +type DevicePatch struct { + // Short description given for the device + DeviceDescription *string `json:"deviceDescription,omitempty"` +} + +// DeviceProperties - Encases all the properties of the Device +type DeviceProperties struct { + // The UTC time at which the device was activated + ActivationTime *time.Time `json:"activationTime,omitempty"` + + // Operations that are allowed on the device based on its current state + AllowedDeviceOperations []*DeviceOperation `json:"allowedDeviceOperations,omitempty"` + + // Language culture setting on the device. For eg: "en-US" + Culture *string `json:"culture,omitempty"` + + // subclass containing more storage-related information about the device. This field will be populated only if the get call + // is made with $expand = details. + Details *DeviceDetails `json:"details,omitempty"` + + // Device can be configured either as FileServer or IscsiServer + DeviceCapabilities []*SupportedDeviceCapabilities `json:"deviceCapabilities,omitempty"` + + // "Complete" if the device has been successfully registered as File/IscsiServer and the creation of share/volume is complete, + // "Pending" if the device is only registered but the creation of share/volume + // is complete is still pending + DeviceConfigurationStatus *DeviceConfigurationStatus `json:"deviceConfigurationStatus,omitempty"` + + // Short description given for the device + DeviceDescription *string `json:"deviceDescription,omitempty"` + + // Version number of the software running on the device + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty"` + + // Fully qualified name of the domain to which the device is attached + DomainName *string `json:"domainName,omitempty"` + + // Friendly name for the software version + FriendlySoftwareName *string `json:"friendlySoftwareName,omitempty"` + + // Name of the device model + ModelDescription *string `json:"modelDescription,omitempty"` + + // Current status of the device + Status *DeviceStatus `json:"status,omitempty"` + + // Type of the device + Type *DeviceType `json:"type,omitempty"` +} + +// DevicesClientBeginCreateOrUpdateAlertSettingsOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdateAlertSettings +// method. +type DevicesClientBeginCreateOrUpdateAlertSettingsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginCreateOrUpdateSecuritySettingsOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdateSecuritySettings +// method. +type DevicesClientBeginCreateOrUpdateSecuritySettingsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginDeactivateOptions contains the optional parameters for the DevicesClient.BeginDeactivate method. +type DevicesClientBeginDeactivateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginDeleteOptions contains the optional parameters for the DevicesClient.BeginDelete method. +type DevicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginDownloadUpdatesOptions contains the optional parameters for the DevicesClient.BeginDownloadUpdates method. +type DevicesClientBeginDownloadUpdatesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginFailoverOptions contains the optional parameters for the DevicesClient.BeginFailover method. +type DevicesClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginInstallUpdatesOptions contains the optional parameters for the DevicesClient.BeginInstallUpdates method. +type DevicesClientBeginInstallUpdatesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginPatchOptions contains the optional parameters for the DevicesClient.BeginPatch method. +type DevicesClientBeginPatchOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginScanForUpdatesOptions contains the optional parameters for the DevicesClient.BeginScanForUpdates method. +type DevicesClientBeginScanForUpdatesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientGetAlertSettingsOptions contains the optional parameters for the DevicesClient.GetAlertSettings method. +type DevicesClientGetAlertSettingsOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientGetNetworkSettingsOptions contains the optional parameters for the DevicesClient.GetNetworkSettings method. +type DevicesClientGetNetworkSettingsOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. +type DevicesClientGetOptions struct { + // Specify $expand=details to populate additional fields related to the device. + Expand *string +} + +// DevicesClientGetTimeSettingsOptions contains the optional parameters for the DevicesClient.GetTimeSettings method. +type DevicesClientGetTimeSettingsOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientGetUpdateSummaryOptions contains the optional parameters for the DevicesClient.GetUpdateSummary method. +type DevicesClientGetUpdateSummaryOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientListByManagerOptions contains the optional parameters for the DevicesClient.ListByManager method. +type DevicesClientListByManagerOptions struct { + // Specify $expand=details to populate additional fields related to the device. + Expand *string +} + +// DevicesClientListFailoverTargetOptions contains the optional parameters for the DevicesClient.ListFailoverTarget method. +type DevicesClientListFailoverTargetOptions struct { + // Specify $expand=details to populate additional fields related to the device. + Expand *string +} + +// DevicesClientListMetricDefinitionOptions contains the optional parameters for the DevicesClient.ListMetricDefinition method. +type DevicesClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientListMetricsOptions contains the optional parameters for the DevicesClient.ListMetrics method. +type DevicesClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +// EncryptionSettings - The EncryptionSettings +type EncryptionSettings struct { + // REQUIRED; Properties of the EncryptionSettings. + Properties *EncryptionSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// EncryptionSettingsProperties - The properties of EncryptionSettings +type EncryptionSettingsProperties struct { + // REQUIRED; The encryption status which indicates if encryption is enabled or not. + EncryptionStatus *EncryptionStatus `json:"encryptionStatus,omitempty"` + + // REQUIRED; The key rollover status which indicates if key rollover is required or not. If secrets encryption has been upgraded, + // then it requires key rollover. + KeyRolloverStatus *KeyRolloverStatus `json:"keyRolloverStatus,omitempty"` +} + +type Error struct { + // REQUIRED + ErrorCode *string `json:"errorCode,omitempty"` + + // REQUIRED + Message *Message `json:"message,omitempty"` + Values []*Item `json:"values,omitempty"` +} + +// FailoverRequest - The Failover request object. +type FailoverRequest struct { + AccesspointIDs []*string `json:"accesspointIds,omitempty"` + KeepSourceDevice *bool `json:"keepSourceDevice,omitempty"` + SkipValidation *bool `json:"skipValidation,omitempty"` + TargetDeviceID *string `json:"targetDeviceId,omitempty"` +} + +// FileServer - The file server. +type FileServer struct { + // REQUIRED; The properties. + Properties *FileServerProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FileServerList - Collection of file servers +type FileServerList struct { + // REQUIRED; The value. + Value []*FileServer `json:"value,omitempty"` +} + +// FileServerProperties - The file server properties. +type FileServerProperties struct { + // REQUIRED; The backup policy id. + BackupScheduleGroupID *string `json:"backupScheduleGroupId,omitempty"` + + // REQUIRED; Domain of the file server + DomainName *string `json:"domainName,omitempty"` + + // REQUIRED; The storage domain id. + StorageDomainID *string `json:"storageDomainId,omitempty"` + + // The description of the file server + Description *string `json:"description,omitempty"` +} + +// FileServersClientBeginBackupNowOptions contains the optional parameters for the FileServersClient.BeginBackupNow method. +type FileServersClientBeginBackupNowOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileServersClientBeginCreateOrUpdateOptions contains the optional parameters for the FileServersClient.BeginCreateOrUpdate +// method. +type FileServersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileServersClientBeginDeleteOptions contains the optional parameters for the FileServersClient.BeginDelete method. +type FileServersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileServersClientGetOptions contains the optional parameters for the FileServersClient.Get method. +type FileServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// FileServersClientListByDeviceOptions contains the optional parameters for the FileServersClient.ListByDevice method. +type FileServersClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// FileServersClientListByManagerOptions contains the optional parameters for the FileServersClient.ListByManager method. +type FileServersClientListByManagerOptions struct { + // placeholder for future optional parameters +} + +// FileServersClientListMetricDefinitionOptions contains the optional parameters for the FileServersClient.ListMetricDefinition +// method. +type FileServersClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// FileServersClientListMetricsOptions contains the optional parameters for the FileServersClient.ListMetrics method. +type FileServersClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +// FileShare - The File Share. +type FileShare struct { + // REQUIRED; The properties. + Properties *FileShareProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FileShareList - Collection of file shares +type FileShareList struct { + // REQUIRED; The value. + Value []*FileShare `json:"value,omitempty"` +} + +// FileShareProperties - The File Share. +type FileShareProperties struct { + // REQUIRED; The user/group who will have full permission in this share. Active directory email address. Example: xyz@contoso.com + // or Contoso\xyz. + AdminUser *string `json:"adminUser,omitempty"` + + // REQUIRED; The data policy + DataPolicy *DataPolicy `json:"dataPolicy,omitempty"` + + // REQUIRED; The monitoring status + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty"` + + // REQUIRED; The total provisioned capacity in Bytes + ProvisionedCapacityInBytes *int64 `json:"provisionedCapacityInBytes,omitempty"` + + // REQUIRED; The Share Status + ShareStatus *ShareStatus `json:"shareStatus,omitempty"` + + // Description for file share + Description *string `json:"description,omitempty"` + + // READ-ONLY; The local used capacity in Bytes. + LocalUsedCapacityInBytes *int64 `json:"localUsedCapacityInBytes,omitempty" azure:"ro"` + + // READ-ONLY; The used capacity in Bytes. + UsedCapacityInBytes *int64 `json:"usedCapacityInBytes,omitempty" azure:"ro"` +} + +// FileSharesClientBeginCreateOrUpdateOptions contains the optional parameters for the FileSharesClient.BeginCreateOrUpdate +// method. +type FileSharesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileSharesClientBeginDeleteOptions contains the optional parameters for the FileSharesClient.BeginDelete method. +type FileSharesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method. +type FileSharesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientListByDeviceOptions contains the optional parameters for the FileSharesClient.ListByDevice method. +type FileSharesClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientListByFileServerOptions contains the optional parameters for the FileSharesClient.ListByFileServer method. +type FileSharesClientListByFileServerOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientListMetricDefinitionOptions contains the optional parameters for the FileSharesClient.ListMetricDefinition +// method. +type FileSharesClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientListMetricsOptions contains the optional parameters for the FileSharesClient.ListMetrics method. +type FileSharesClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +// IPConfig - Details related to the IP address configuration +type IPConfig struct { + // REQUIRED; The gateway of the network adapter. + Gateway *string `json:"gateway,omitempty"` + + // REQUIRED; The IP address of the network adapter, either ipv4 or ipv6. + IPAddress *string `json:"ipAddress,omitempty"` + + // The prefix length of the network adapter. + PrefixLength *int32 `json:"prefixLength,omitempty"` +} + +// ISCSIDisk - The iSCSI disk. +type ISCSIDisk struct { + // REQUIRED; The properties. + Properties *ISCSIDiskProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ISCSIDiskList - Collection of Iscsi disk +type ISCSIDiskList struct { + // REQUIRED; The value. + Value []*ISCSIDisk `json:"value,omitempty"` +} + +// ISCSIDiskProperties - The iSCSI disk properties. +type ISCSIDiskProperties struct { + // REQUIRED; The access control records. + AccessControlRecords []*string `json:"accessControlRecords,omitempty"` + + // REQUIRED; The data policy. + DataPolicy *DataPolicy `json:"dataPolicy,omitempty"` + + // REQUIRED; The disk status. + DiskStatus *DiskStatus `json:"diskStatus,omitempty"` + + // REQUIRED; The monitoring. + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty"` + + // REQUIRED; The provisioned capacity in bytes. + ProvisionedCapacityInBytes *int64 `json:"provisionedCapacityInBytes,omitempty"` + + // The description. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The local used capacity in bytes. + LocalUsedCapacityInBytes *int64 `json:"localUsedCapacityInBytes,omitempty" azure:"ro"` + + // READ-ONLY; The used capacity in bytes. + UsedCapacityInBytes *int64 `json:"usedCapacityInBytes,omitempty" azure:"ro"` +} + +// ISCSIServer - The iSCSI server. +type ISCSIServer struct { + // REQUIRED; The properties. + Properties *ISCSIServerProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ISCSIServerList - Collection of Iscsi servers +type ISCSIServerList struct { + // REQUIRED; The value. + Value []*ISCSIServer `json:"value,omitempty"` +} + +// ISCSIServerProperties - The iSCSI server properties. +type ISCSIServerProperties struct { + // REQUIRED; The backup policy id. + BackupScheduleGroupID *string `json:"backupScheduleGroupId,omitempty"` + + // REQUIRED; The storage domain id. + StorageDomainID *string `json:"storageDomainId,omitempty"` + + // The chap id. + ChapID *string `json:"chapId,omitempty"` + + // The description. + Description *string `json:"description,omitempty"` + + // The reverse chap id. + ReverseChapID *string `json:"reverseChapId,omitempty"` +} + +// IscsiDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the IscsiDisksClient.BeginCreateOrUpdate +// method. +type IscsiDisksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IscsiDisksClientBeginDeleteOptions contains the optional parameters for the IscsiDisksClient.BeginDelete method. +type IscsiDisksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IscsiDisksClientGetOptions contains the optional parameters for the IscsiDisksClient.Get method. +type IscsiDisksClientGetOptions struct { + // placeholder for future optional parameters +} + +// IscsiDisksClientListByDeviceOptions contains the optional parameters for the IscsiDisksClient.ListByDevice method. +type IscsiDisksClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// IscsiDisksClientListByIscsiServerOptions contains the optional parameters for the IscsiDisksClient.ListByIscsiServer method. +type IscsiDisksClientListByIscsiServerOptions struct { + // placeholder for future optional parameters +} + +// IscsiDisksClientListMetricDefinitionOptions contains the optional parameters for the IscsiDisksClient.ListMetricDefinition +// method. +type IscsiDisksClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// IscsiDisksClientListMetricsOptions contains the optional parameters for the IscsiDisksClient.ListMetrics method. +type IscsiDisksClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +// IscsiServersClientBeginBackupNowOptions contains the optional parameters for the IscsiServersClient.BeginBackupNow method. +type IscsiServersClientBeginBackupNowOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IscsiServersClientBeginCreateOrUpdateOptions contains the optional parameters for the IscsiServersClient.BeginCreateOrUpdate +// method. +type IscsiServersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IscsiServersClientBeginDeleteOptions contains the optional parameters for the IscsiServersClient.BeginDelete method. +type IscsiServersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IscsiServersClientGetOptions contains the optional parameters for the IscsiServersClient.Get method. +type IscsiServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// IscsiServersClientListByDeviceOptions contains the optional parameters for the IscsiServersClient.ListByDevice method. +type IscsiServersClientListByDeviceOptions struct { + // placeholder for future optional parameters +} + +// IscsiServersClientListByManagerOptions contains the optional parameters for the IscsiServersClient.ListByManager method. +type IscsiServersClientListByManagerOptions struct { + // placeholder for future optional parameters +} + +// IscsiServersClientListMetricDefinitionOptions contains the optional parameters for the IscsiServersClient.ListMetricDefinition +// method. +type IscsiServersClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// IscsiServersClientListMetricsOptions contains the optional parameters for the IscsiServersClient.ListMetrics method. +type IscsiServersClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +type Item struct { + // REQUIRED + Key *string `json:"key,omitempty"` + + // REQUIRED + Value *string `json:"value,omitempty"` +} + +// Job - The Job. +type Job struct { + // REQUIRED; The percentage of the job that is already complete + PercentComplete *int32 `json:"percentComplete,omitempty"` + + // REQUIRED; Current status of the job + Status *JobStatus `json:"status,omitempty"` + + // The UTC time at which the job completed + EndTime *time.Time `json:"endTime,omitempty"` + + // The Error details. + Error *JobErrorDetails `json:"error,omitempty"` + + // Other properties of the job + Properties *JobProperties `json:"properties,omitempty"` + + // The UTC time at which the job was started + StartTime *time.Time `json:"startTime,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// JobErrorDetails - The job error information containing List of JobErrorItem. +type JobErrorDetails struct { + // REQUIRED; The code intended for programmatic access + Code *string `json:"code,omitempty"` + + // REQUIRED; The message intended to describe the error in detail + Message *string `json:"message,omitempty"` + + // The error details. + ErrorDetails []*JobErrorItem `json:"errorDetails,omitempty"` +} + +// JobErrorItem - The job error items. +type JobErrorItem struct { + // REQUIRED; The code intended for programmatic access + Code *string `json:"code,omitempty"` + + // REQUIRED; The message intended to describe the error in detail + Message *string `json:"message,omitempty"` + + // The recommended actions. + Recommendations []*string `json:"recommendations,omitempty"` +} + +// JobFilter - Filters that can be specified for the job +type JobFilter struct { + // REQUIRED; The job type. + JobType *JobType `json:"jobType,omitempty"` + + // REQUIRED; The job status. + Status *JobStatus `json:"status,omitempty"` + + // The start time of the job. + StartTime *time.Time `json:"startTime,omitempty"` +} + +// JobList - Collection of jobs +type JobList struct { + // REQUIRED; The value. + Value []*Job `json:"value,omitempty"` + + // The NextLink. + NextLink *string `json:"nextLink,omitempty"` +} + +// JobProperties - properties for the job +type JobProperties struct { + // REQUIRED; Type of the job + JobType *JobType `json:"jobType,omitempty"` + + // The time of the backup used for the failover. + BackupPointInTime *time.Time `json:"backupPointInTime,omitempty"` + + // The device id in which the job is currently running + DeviceID *string `json:"deviceId,omitempty"` + + // The download progress. + DownloadProgress *UpdateDownloadProgress `json:"downloadProgress,omitempty"` + + // The entity identifier for which the job ran. + EntityID *string `json:"entityId,omitempty"` + + // The entity type for which the job ran. + EntityType *string `json:"entityType,omitempty"` + + // The install progress. + InstallProgress *UpdateInstallProgress `json:"installProgress,omitempty"` + + // Represents whether the job is cancellable or not + IsCancellable *bool `json:"isCancellable,omitempty"` + + // The job stages. + JobStages []*JobStage `json:"jobStages,omitempty"` + + // The source device identifier of the failover job. + SourceDeviceID *string `json:"sourceDeviceId,omitempty"` + + // stats properties for the job + Stats *JobStats `json:"stats,omitempty"` + + // Id of the object that is created by the job + TargetID *string `json:"targetId,omitempty"` + + // The target type of the backup. + TargetType *TargetType `json:"targetType,omitempty"` +} + +// JobStage - Contains details about the multiple job stages of a job +type JobStage struct { + // REQUIRED; The stage status. + StageStatus *JobStatus `json:"stageStatus,omitempty"` + + // The details of the stage. + Detail *string `json:"detail,omitempty"` + + // The error code of the stage if any. + ErrorCode *string `json:"errorCode,omitempty"` + + // The message of the job stage. + Message *string `json:"message,omitempty"` +} + +// JobStats - Stats that are available for all jobs in common +type JobStats struct { + // Completed work item count. + CompletedWorkItemCount *int32 `json:"completedWorkItemCount,omitempty"` + + // The estimated time remaining. + EstimatedTimeRemaining *int32 `json:"estimatedTimeRemaining,omitempty"` + + // Total work item count. + TotalWorkItemCount *int32 `json:"totalWorkItemCount,omitempty"` +} + +// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +type JobsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobsClientListByDeviceOptions contains the optional parameters for the JobsClient.ListByDevice method. +type JobsClientListByDeviceOptions struct { + // OData Filter options + Filter *string +} + +// JobsClientListByManagerOptions contains the optional parameters for the JobsClient.ListByManager method. +type JobsClientListByManagerOptions struct { + // OData Filter options + Filter *string +} + +// Manager - The StorSimple Manager +type Manager struct { + // REQUIRED; The Geo location of the Manager + Location *string `json:"location,omitempty"` + + // ETag of the Manager + Etag *string `json:"etag,omitempty"` + + // List of properties of the Manager + Properties *ManagerProperties `json:"properties,omitempty"` + + // Tags attached to the Manager + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The Resource Name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagerExtendedInfo - The extended info of the manager. +type ManagerExtendedInfo struct { + // REQUIRED; The extended info properties. + Properties *ManagerExtendedInfoProperties `json:"properties,omitempty"` + + // ETag of the Resource + Etag *string `json:"etag,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagerExtendedInfoProperties - Properties of the ManagerExtendedInfo +type ManagerExtendedInfoProperties struct { + // REQUIRED; Represents the encryption algorithm used to encrypt the other keys. None - if EncryptionKey is saved in plain + // text format. AlgorithmName - if encryption is used + Algorithm *string `json:"algorithm,omitempty"` + + // REQUIRED; Represents the CIK of the resource + IntegrityKey *string `json:"integrityKey,omitempty"` + + // Represents the CEK of the resource + EncryptionKey *string `json:"encryptionKey,omitempty"` + + // Represents the Cert thumbprint that was used to encrypt the CEK + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + + // Represents the portal thumbprint which can be used optionally to encrypt the entire data before storing it. + PortalCertificateThumbprint *string `json:"portalCertificateThumbprint,omitempty"` + + // Represents the version of the ExtendedInfo object being persisted + Version *string `json:"version,omitempty"` +} + +// ManagerIntrinsicSettings - Intrinsic settings which refers to the type of the StorSimple manager +type ManagerIntrinsicSettings struct { + // REQUIRED; Refers to the type of the StorSimple Manager + Type *ManagerType `json:"type,omitempty"` +} + +// ManagerList - List of StorSimple Managers under a particular resourceGroup +type ManagerList struct { + // REQUIRED; List of Managers + Value []*Manager `json:"value,omitempty"` +} + +// ManagerPatch - The StorSimple Manager patch. +type ManagerPatch struct { + // The tags attached to the StorSimple Manager. + Tags map[string]*string `json:"tags,omitempty"` +} + +// ManagerProperties - The properties of the Manager +type ManagerProperties struct { + // Specifies if the Manager is Garda or Helsinki + CisIntrinsicSettings *ManagerIntrinsicSettings `json:"cisIntrinsicSettings,omitempty"` + + // Specifies the Sku + SKU *ManagerSKU `json:"sku,omitempty"` + + // READ-ONLY; Specifies the state of the resource as it is getting provisioned. Value of "Succeeded" means the Manager was + // successfully created + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// ManagerSKU - The Sku. +type ManagerSKU struct { + // REQUIRED; Refers to the sku name which should be "Standard" + Name *string `json:"name,omitempty"` +} + +// ManagersClientCreateExtendedInfoOptions contains the optional parameters for the ManagersClient.CreateExtendedInfo method. +type ManagersClientCreateExtendedInfoOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientCreateOrUpdateOptions contains the optional parameters for the ManagersClient.CreateOrUpdate method. +type ManagersClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientDeleteExtendedInfoOptions contains the optional parameters for the ManagersClient.DeleteExtendedInfo method. +type ManagersClientDeleteExtendedInfoOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientDeleteOptions contains the optional parameters for the ManagersClient.Delete method. +type ManagersClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientGetEncryptionKeyOptions contains the optional parameters for the ManagersClient.GetEncryptionKey method. +type ManagersClientGetEncryptionKeyOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientGetEncryptionSettingsOptions contains the optional parameters for the ManagersClient.GetEncryptionSettings +// method. +type ManagersClientGetEncryptionSettingsOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientGetExtendedInfoOptions contains the optional parameters for the ManagersClient.GetExtendedInfo method. +type ManagersClientGetExtendedInfoOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientGetOptions contains the optional parameters for the ManagersClient.Get method. +type ManagersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientListByResourceGroupOptions contains the optional parameters for the ManagersClient.ListByResourceGroup method. +type ManagersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientListMetricDefinitionOptions contains the optional parameters for the ManagersClient.ListMetricDefinition +// method. +type ManagersClientListMetricDefinitionOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientListMetricsOptions contains the optional parameters for the ManagersClient.ListMetrics method. +type ManagersClientListMetricsOptions struct { + // OData Filter options + Filter *string +} + +// ManagersClientListOptions contains the optional parameters for the ManagersClient.List method. +type ManagersClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientUpdateExtendedInfoOptions contains the optional parameters for the ManagersClient.UpdateExtendedInfo method. +type ManagersClientUpdateExtendedInfoOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientUpdateOptions contains the optional parameters for the ManagersClient.Update method. +type ManagersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientUploadRegistrationCertificateOptions contains the optional parameters for the ManagersClient.UploadRegistrationCertificate +// method. +type ManagersClientUploadRegistrationCertificateOptions struct { + // placeholder for future optional parameters +} + +type Message struct { + Language *string `json:"language,omitempty"` + Value *string `json:"value,omitempty"` +} + +// MetricAvailablity - Metric availability specifies the time grain (aggregation interval or frequency) and the retention +// period for that time grain +type MetricAvailablity struct { + // REQUIRED; The retention period for the metric at the specified timegrain + Retention *string `json:"retention,omitempty"` + + // REQUIRED; The time grain, specifies the aggregation interval for the metric. + TimeGrain *string `json:"timeGrain,omitempty"` +} + +// MetricData - The metric data. +type MetricData struct { + // REQUIRED; The average of all sample for the given instance + Average *float64 `json:"average,omitempty"` + + // REQUIRED; The count of samples of the metric data available for the given instance + Count *int32 `json:"count,omitempty"` + + // REQUIRED; The maximum of all samples available + Maximum *float64 `json:"maximum,omitempty"` + + // REQUIRED; The minimum of all samples available + Minimum *float64 `json:"minimum,omitempty"` + + // REQUIRED; The sum of all the samples available in the given instance of time for the specific metric data + Sum *float64 `json:"sum,omitempty"` + + // REQUIRED; The time when the metric data is fetched + TimeStamp *time.Time `json:"timeStamp,omitempty"` +} + +// MetricDefinition - Monitoring metric definition represents the metadata of the metrics. +type MetricDefinition struct { + // REQUIRED; The supported dimensions + Dimensions []*MetricDimension `json:"dimensions,omitempty"` + + // REQUIRED; The available metric granularities + MetricAvailabilities []*MetricAvailablity `json:"metricAvailabilities,omitempty"` + + // REQUIRED; The metric name + Name *MetricName `json:"name,omitempty"` + + // REQUIRED; The metric aggregation type + PrimaryAggregationType *MetricAggregationType `json:"primaryAggregationType,omitempty"` + + // REQUIRED; The metric source id + ResourceID *string `json:"resourceId,omitempty"` + + // REQUIRED; The metric definition type + Type *string `json:"type,omitempty"` + + // REQUIRED; The metric unit + Unit *MetricUnit `json:"unit,omitempty"` +} + +// MetricDefinitionList - List of metric definition +type MetricDefinitionList struct { + // REQUIRED; The list of metric definition + Value []*MetricDefinition `json:"value,omitempty"` +} + +// MetricDimension - Metric dimension +type MetricDimension struct { + // REQUIRED; Metric dimension name + Name *string `json:"name,omitempty"` + + // REQUIRED; Metric dimension values + Value *string `json:"value,omitempty"` +} + +// MetricFilter - class representing the filters to be passed while fetching metrics +type MetricFilter struct { + // endtime for fetching metrics + EndTime *time.Time `json:"endTime,omitempty"` + + // filter for name property + Name *MetricNameFilter `json:"name,omitempty"` + + // starttime for fetching metrics + StartTime *time.Time `json:"startTime,omitempty"` + + // timegrain of the metrics + TimeGrain *string `json:"timeGrain,omitempty"` +} + +// MetricList - Collection of metrics +type MetricList struct { + // REQUIRED; The value. + Value []*Metrics `json:"value,omitempty"` +} + +// MetricName - The name of the metric +type MetricName struct { + // REQUIRED; Localized name of the metric + LocalizedValue *string `json:"localizedValue,omitempty"` + + // REQUIRED; Name of the metric + Value *string `json:"value,omitempty"` +} + +// MetricNameFilter - Class representing the name filter to be passed while fetching metrics +type MetricNameFilter struct { + // The value. + Value *string `json:"value,omitempty"` +} + +// Metrics - Monitoring metric +type Metrics struct { + // REQUIRED; The Metric dimension which indicates the source of the metric + Dimensions []*MetricDimension `json:"dimensions,omitempty"` + + // REQUIRED; The metric end time + EndTime *time.Time `json:"endTime,omitempty"` + + // REQUIRED; The name of the metrics + Name *MetricName `json:"name,omitempty"` + + // REQUIRED; The metric aggregation type + PrimaryAggregation *MetricAggregationType `json:"primaryAggregation,omitempty"` + + // REQUIRED; The id of metric source + ResourceID *string `json:"resourceId,omitempty"` + + // REQUIRED; The metric start time + StartTime *time.Time `json:"startTime,omitempty"` + + // REQUIRED; The time grain, time grain indicates frequency of the metric data + TimeGrain *string `json:"timeGrain,omitempty"` + + // REQUIRED; The Type of the metric data + Type *string `json:"type,omitempty"` + + // REQUIRED; The unit of the metric data + Unit *MetricUnit `json:"unit,omitempty"` + + // REQUIRED; The metric data + Values []*MetricData `json:"values,omitempty"` +} + +// NetworkAdapter - Represents a networkAdapter in a particular node. +type NetworkAdapter struct { + // REQUIRED; Represents state of DHCP. + DhcpStatus *DhcpStatus `json:"dhcpStatus,omitempty"` + + // REQUIRED; The name of the network adapter. + NetworkAdapterName *string `json:"networkAdapterName,omitempty"` + + // The ipv4 configuration of the network adapter. + IPv4Info *IPConfig `json:"iPv4Info,omitempty"` + + // The ipv6 configuration of the network adapter. + IPv6Info *IPConfig `json:"iPv6Info,omitempty"` + + // The speed of the network adapter. + LinkSpeed *int64 `json:"linkSpeed,omitempty"` +} + +// NetworkSettings - The NetworkSettings of a device +type NetworkSettings struct { + // REQUIRED; Properties of the given NetworkSettings. + Properties *NetworkSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// NetworkSettingsProperties - The properties of NetworkSettings +type NetworkSettingsProperties struct { + // REQUIRED; The NetworkAdapters under each node of the device. + NodeNetworks []*NodeNetwork `json:"nodeNetworks,omitempty"` + + // REQUIRED; The Primary DNS server for the device + PrimaryDNSServer *string `json:"primaryDnsServer,omitempty"` + + // The secondary DNS server for the device + SecondaryDNSServer *string `json:"secondaryDnsServer,omitempty"` +} + +// NodeNetwork - Represents a single node in a device. +type NodeNetwork struct { + // REQUIRED; The array of network adapters in the node. + NetworkAdapters []*NetworkAdapter `json:"networkAdapters,omitempty"` +} + +// RawCertificateData - Raw Certificate Data From IDM +type RawCertificateData struct { + // REQUIRED; Gets or sets the base64 encoded certificate raw data string + Certificate *string `json:"certificate,omitempty"` + + // Specify the Authentication type + AuthType *AuthType `json:"authType,omitempty"` +} + +// Resource - The Azure Resource. +type Resource struct { + // REQUIRED; The Geo location of the Manager + Location *string `json:"location,omitempty"` + + // Tags attached to the Manager + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The Resource Name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceCertificateAndAADDetails - Resource Certificate And AAD Details from IDM +type ResourceCertificateAndAADDetails struct { + // REQUIRED; AAD tenant authority + AADAuthority *string `json:"aadAuthority,omitempty"` + + // REQUIRED; AAD tenant Id + AADTenantID *string `json:"aadTenantId,omitempty"` + + // REQUIRED; Azure Management Endpoint Audience + AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"` + + // REQUIRED; Gets or sets the base64 encoded certificate raw data string + Certificate *string `json:"certificate,omitempty"` + + // REQUIRED; Certificate friendly name + FriendlyName *string `json:"friendlyName,omitempty"` + + // REQUIRED; Certificate issuer + Issuer *string `json:"issuer,omitempty"` + + // REQUIRED; Gets or Sets the ResourceId + ResourceID *int64 `json:"resourceId,omitempty"` + + // REQUIRED; AAD service principal clientId + ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty"` + + // REQUIRED; AAD service principal ObjectId + ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty"` + + // REQUIRED; Certificate Subject Name + Subject *string `json:"subject,omitempty"` + + // REQUIRED; Certificate thumbprint + Thumbprint *string `json:"thumbprint,omitempty"` + + // REQUIRED; Certificate Validity start Date time + ValidFrom *time.Time `json:"validFrom,omitempty"` + + // REQUIRED; Certificate Validity End Date time + ValidTo *time.Time `json:"validTo,omitempty"` + + // Specify the Authentication type + AuthType *AuthType `json:"authType,omitempty"` +} + +// SecuritySettings - The SecuritySettings of a device +type SecuritySettings struct { + // REQUIRED; Properties of the SecuritySettings. + Properties *SecuritySettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SecuritySettingsProperties - The properties of SecuritySettings +type SecuritySettingsProperties struct { + // REQUIRED; Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to log into the local + // web UI of the device. Actual password could have at least 8 characters that are a + // combination of uppercase, lowercase, numeric, and special characters + DeviceAdminPassword *AsymmetricEncryptedSecret `json:"deviceAdminPassword,omitempty"` +} + +// SendTestAlertEmailRequest - Request for sending test alert email +type SendTestAlertEmailRequest struct { + // REQUIRED; List of emails to send the test alerts + EmailList []*string `json:"emailList,omitempty"` +} + +// StorageAccountCredential - The storage account credential +type StorageAccountCredential struct { + // REQUIRED; Credential properties + Properties *StorageAccountCredentialProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// StorageAccountCredentialList - Collection of Storage account credential entities +type StorageAccountCredentialList struct { + // REQUIRED; The value. + Value []*StorageAccountCredential `json:"value,omitempty"` +} + +// StorageAccountCredentialProperties - Storage account properties +type StorageAccountCredentialProperties struct { + // REQUIRED; The cloud service provider + CloudType *CloudType `json:"cloudType,omitempty"` + + // REQUIRED; SSL needs to be enabled or not + EnableSSL *SSLStatus `json:"enableSSL,omitempty"` + + // REQUIRED; The storage endpoint + EndPoint *string `json:"endPoint,omitempty"` + + // REQUIRED; The storage account login + Login *string `json:"login,omitempty"` + + // The details of the storage account password + AccessKey *AsymmetricEncryptedSecret `json:"accessKey,omitempty"` + + // The storage account's geo location + Location *string `json:"location,omitempty"` +} + +// StorageAccountCredentialsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageAccountCredentialsClient.BeginCreateOrUpdate +// method. +type StorageAccountCredentialsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageAccountCredentialsClientBeginDeleteOptions contains the optional parameters for the StorageAccountCredentialsClient.BeginDelete +// method. +type StorageAccountCredentialsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageAccountCredentialsClientGetOptions contains the optional parameters for the StorageAccountCredentialsClient.Get +// method. +type StorageAccountCredentialsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StorageAccountCredentialsClientListByManagerOptions contains the optional parameters for the StorageAccountCredentialsClient.ListByManager +// method. +type StorageAccountCredentialsClientListByManagerOptions struct { + // placeholder for future optional parameters +} + +// StorageDomain - The storage domain. +type StorageDomain struct { + // REQUIRED; The properties. + Properties *StorageDomainProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// StorageDomainList - Collection of storage domains +type StorageDomainList struct { + // REQUIRED; The value. + Value []*StorageDomain `json:"value,omitempty"` +} + +// StorageDomainProperties - The storage domain properties. +type StorageDomainProperties struct { + // REQUIRED; The encryption status "Enabled | Disabled". + EncryptionStatus *EncryptionStatus `json:"encryptionStatus,omitempty"` + + // REQUIRED; The storage account credentials. + StorageAccountCredentialIDs []*string `json:"storageAccountCredentialIds,omitempty"` + + // The encryption key used to encrypt the data. This is a user secret. + EncryptionKey *AsymmetricEncryptedSecret `json:"encryptionKey,omitempty"` +} + +// StorageDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageDomainsClient.BeginCreateOrUpdate +// method. +type StorageDomainsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageDomainsClientBeginDeleteOptions contains the optional parameters for the StorageDomainsClient.BeginDelete method. +type StorageDomainsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// StorageDomainsClientGetOptions contains the optional parameters for the StorageDomainsClient.Get method. +type StorageDomainsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StorageDomainsClientListByManagerOptions contains the optional parameters for the StorageDomainsClient.ListByManager method. +type StorageDomainsClientListByManagerOptions struct { + // placeholder for future optional parameters +} + +// SymmetricEncryptedSecret - This class can be used as the Type for any secret entity represented as Value, ValueCertificateThumbprint, +// EncryptionAlgorithm. In this case, "Value" is a secret and the "valueThumbprint" represents +// the certificate thumbprint of the value. The algorithm field is mainly for future usage to potentially allow different +// entities encrypted using different algorithms. +type SymmetricEncryptedSecret struct { + // REQUIRED; Algorithm used to encrypt "Value" + EncryptionAlgorithm *EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + + // REQUIRED; The value of the secret itself. If the secret is in plaintext or null then EncryptionAlgorithm will be none + Value *string `json:"value,omitempty"` + + // Thumbprint cert that was used to encrypt "Value" + ValueCertificateThumbprint *string `json:"valueCertificateThumbprint,omitempty"` +} + +// Time - The Time. +type Time struct { + // REQUIRED; The hour. + Hour *int32 `json:"hour,omitempty"` + + // REQUIRED; The minute. + Minute *int32 `json:"minute,omitempty"` +} + +// TimeSettings - The TimeSettings of a device +type TimeSettings struct { + // REQUIRED; Properties of the TimeSettings. + Properties *TimeSettingsProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// TimeSettingsProperties - The properties of TimeSettings +type TimeSettingsProperties struct { + // REQUIRED; The primary Network Time Protocol (NTP) server name, like 'time.windows.com'. + PrimaryTimeServer *string `json:"primaryTimeServer,omitempty"` + + // REQUIRED; The timezone of device, like '(UTC -06:00) Central America' + TimeZone *string `json:"timeZone,omitempty"` + + // The secondary Network Time Protocol (NTP) server name, like 'time.contoso.com'. It's optional. + SecondaryTimeServer *string `json:"secondaryTimeServer,omitempty"` +} + +// UpdateDownloadProgress - details available during the download +type UpdateDownloadProgress struct { + // The download phase. + DownloadPhase *DownloadPhase `json:"downloadPhase,omitempty"` + + // Number of updates downloaded. + NumberOfUpdatesDownloaded *int32 `json:"numberOfUpdatesDownloaded,omitempty"` + + // Number of updates to download. + NumberOfUpdatesToDownload *int32 `json:"numberOfUpdatesToDownload,omitempty"` + + // Percentage of completion. + PercentComplete *int32 `json:"percentComplete,omitempty"` + + // Total bytes downloaded. + TotalBytesDownloaded *float64 `json:"totalBytesDownloaded,omitempty"` + + // Total bytes to download. + TotalBytesToDownload *float64 `json:"totalBytesToDownload,omitempty"` +} + +// UpdateInstallProgress - Class representing the progress during installation of updates +type UpdateInstallProgress struct { + // Number of updates installed. + NumberOfUpdatesInstalled *int32 `json:"numberOfUpdatesInstalled,omitempty"` + + // Number of updates to install. + NumberOfUpdatesToInstall *int32 `json:"numberOfUpdatesToInstall,omitempty"` + + // Percentage of completion. + PercentComplete *int32 `json:"percentComplete,omitempty"` +} + +// Updates - The updates profile +type Updates struct { + // Update properties. + Properties *UpdatesProperties `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UpdatesProperties - Properties of the update profile +type UpdatesProperties struct { + // The last time when the device did an update scan. + DeviceLastScannedTime *time.Time `json:"deviceLastScannedTime,omitempty"` + + // The current Device version. + DeviceVersion *string `json:"deviceVersion,omitempty"` + + // If a download is in progress, this field contains the JobId of that particular download job + InProgressDownloadJobID *string `json:"inProgressDownloadJobId,omitempty"` + + // The time when the currently running download (if any) started + InProgressDownloadJobStartedTime *time.Time `json:"inProgressDownloadJobStartedTime,omitempty"` + + // If an install is in progress, this field contains the JobId of that particular install job + InProgressInstallJobID *string `json:"inProgressInstallJobId,omitempty"` + + // The time when the currently running install (if any) started + InProgressInstallJobStartedTime *time.Time `json:"inProgressInstallJobStartedTime,omitempty"` + + // The time when the currently running scan (if any) started + InProgressScanStartedTime *time.Time `json:"inProgressScanStartedTime,omitempty"` + + // The time when the last Download job was completed (success|cancelled|failed) on the device. + LastCompletedDownloadJobTime *time.Time `json:"lastCompletedDownloadJobTime,omitempty"` + + // The time when the last Install job was completed (success|cancelled|failed) on the device. + LastCompletedInstallJobTime *time.Time `json:"lastCompletedInstallJobTime,omitempty"` + + // The time when the last scan job was completed (success|cancelled|failed) on the device. + LastCompletedScanTime *time.Time `json:"lastCompletedScanTime,omitempty"` + + // Set to true if RegularUpdatesAvailable is true and if at least one of the updateItems detected has needs a reboot to install. + RebootRequiredForInstall *bool `json:"rebootRequiredForInstall,omitempty"` + + // Set to true if regular updates were detected for the current version of the device. + RegularUpdatesAvailable *bool `json:"regularUpdatesAvailable,omitempty"` + + // The current update operation. + Status *UpdateOperation `json:"status,omitempty"` + + // The total number of items pending for download. + TotalItemsPendingForDownload *int32 `json:"totalItemsPendingForDownload,omitempty"` + + // The total number of items pending for install. + TotalItemsPendingForInstall *int32 `json:"totalItemsPendingForInstall,omitempty"` +} + +// UploadCertificateRequest - Upload Certificate Request to IDM +type UploadCertificateRequest struct { + // REQUIRED; Raw Certificate Data From IDM + Properties *RawCertificateData `json:"properties,omitempty"` + + // READ-ONLY; Gets ContractVersion + ContractVersion *ContractVersions `json:"contractVersion,omitempty" azure:"ro"` +} + +// UploadCertificateResponse - Upload Certificate Response from IDM +type UploadCertificateResponse struct { + // REQUIRED; Resource Certificate And AAD Details from IDM + Properties *ResourceCertificateAndAADDetails `json:"properties,omitempty"` + + // READ-ONLY; The identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type. + Type *string `json:"type,omitempty" azure:"ro"` +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models_serde.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models_serde.go new file mode 100644 index 000000000000..296d644eda2e --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_models_serde.go @@ -0,0 +1,874 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertFilter. +func (a *AlertFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appearedOnTime": + err = unpopulateTimeRFC3339(val, "AppearedOnTime", &a.AppearedOnTime) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "sourceName": + err = unpopulate(val, "SourceName", &a.SourceName) + delete(rawMsg, key) + case "sourceType": + err = unpopulate(val, "SourceType", &a.SourceType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// 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, "appearedAtSourceTime", a.AppearedAtSourceTime) + populateTimeRFC3339(objectMap, "appearedAtTime", a.AppearedAtTime) + populateTimeRFC3339(objectMap, "clearedAtSourceTime", a.ClearedAtSourceTime) + populateTimeRFC3339(objectMap, "clearedAtTime", a.ClearedAtTime) + populate(objectMap, "detailedInformation", a.DetailedInformation) + populate(objectMap, "errorDetails", a.ErrorDetails) + populate(objectMap, "recommendation", a.Recommendation) + populate(objectMap, "resolutionReason", a.ResolutionReason) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "source", a.Source) + populate(objectMap, "status", a.Status) + 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 fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, "AlertType", &a.AlertType) + delete(rawMsg, key) + case "appearedAtSourceTime": + err = unpopulateTimeRFC3339(val, "AppearedAtSourceTime", &a.AppearedAtSourceTime) + delete(rawMsg, key) + case "appearedAtTime": + err = unpopulateTimeRFC3339(val, "AppearedAtTime", &a.AppearedAtTime) + delete(rawMsg, key) + case "clearedAtSourceTime": + err = unpopulateTimeRFC3339(val, "ClearedAtSourceTime", &a.ClearedAtSourceTime) + delete(rawMsg, key) + case "clearedAtTime": + err = unpopulateTimeRFC3339(val, "ClearedAtTime", &a.ClearedAtTime) + delete(rawMsg, key) + case "detailedInformation": + err = unpopulate(val, "DetailedInformation", &a.DetailedInformation) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) + delete(rawMsg, key) + case "recommendation": + err = unpopulate(val, "Recommendation", &a.Recommendation) + delete(rawMsg, key) + case "resolutionReason": + err = unpopulate(val, "ResolutionReason", &a.ResolutionReason) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertSettingsProperties. +func (a AlertSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalRecipientEmailList", a.AdditionalRecipientEmailList) + populate(objectMap, "alertNotificationCulture", a.AlertNotificationCulture) + populate(objectMap, "emailNotification", a.EmailNotification) + populate(objectMap, "notificationToServiceOwners", a.NotificationToServiceOwners) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupFilter. +func (b *BackupFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &b.CreatedTime) + delete(rawMsg, key) + case "initiatedBy": + err = unpopulate(val, "InitiatedBy", &b.InitiatedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupProperties. +func (b BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdTime", b.CreatedTime) + populate(objectMap, "deviceId", b.DeviceID) + populate(objectMap, "elements", b.Elements) + populateTimeRFC3339(objectMap, "expirationTime", b.ExpirationTime) + populate(objectMap, "initiatedBy", b.InitiatedBy) + populate(objectMap, "sizeInBytes", b.SizeInBytes) + populate(objectMap, "targetId", b.TargetID) + populate(objectMap, "targetType", b.TargetType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties. +func (b *BackupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &b.CreatedTime) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &b.DeviceID) + delete(rawMsg, key) + case "elements": + err = unpopulate(val, "Elements", &b.Elements) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, "ExpirationTime", &b.ExpirationTime) + delete(rawMsg, key) + case "initiatedBy": + err = unpopulate(val, "InitiatedBy", &b.InitiatedBy) + delete(rawMsg, key) + case "sizeInBytes": + err = unpopulate(val, "SizeInBytes", &b.SizeInBytes) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &b.TargetID) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &b.TargetType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClearAlertRequest. +func (c ClearAlertRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alerts", c.Alerts) + populate(objectMap, "resolutionMessage", c.ResolutionMessage) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DevicePatch. +func (d DevicePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceDescription", d.DeviceDescription) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DeviceProperties. +func (d DeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "activationTime", d.ActivationTime) + populate(objectMap, "allowedDeviceOperations", d.AllowedDeviceOperations) + populate(objectMap, "culture", d.Culture) + populate(objectMap, "details", d.Details) + populate(objectMap, "deviceCapabilities", d.DeviceCapabilities) + populate(objectMap, "deviceConfigurationStatus", d.DeviceConfigurationStatus) + populate(objectMap, "deviceDescription", d.DeviceDescription) + populate(objectMap, "deviceSoftwareVersion", d.DeviceSoftwareVersion) + populate(objectMap, "domainName", d.DomainName) + populate(objectMap, "friendlySoftwareName", d.FriendlySoftwareName) + populate(objectMap, "modelDescription", d.ModelDescription) + populate(objectMap, "status", d.Status) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceProperties. +func (d *DeviceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activationTime": + err = unpopulateTimeRFC3339(val, "ActivationTime", &d.ActivationTime) + delete(rawMsg, key) + case "allowedDeviceOperations": + err = unpopulate(val, "AllowedDeviceOperations", &d.AllowedDeviceOperations) + delete(rawMsg, key) + case "culture": + err = unpopulate(val, "Culture", &d.Culture) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &d.Details) + delete(rawMsg, key) + case "deviceCapabilities": + err = unpopulate(val, "DeviceCapabilities", &d.DeviceCapabilities) + delete(rawMsg, key) + case "deviceConfigurationStatus": + err = unpopulate(val, "DeviceConfigurationStatus", &d.DeviceConfigurationStatus) + delete(rawMsg, key) + case "deviceDescription": + err = unpopulate(val, "DeviceDescription", &d.DeviceDescription) + delete(rawMsg, key) + case "deviceSoftwareVersion": + err = unpopulate(val, "DeviceSoftwareVersion", &d.DeviceSoftwareVersion) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &d.DomainName) + delete(rawMsg, key) + case "friendlySoftwareName": + err = unpopulate(val, "FriendlySoftwareName", &d.FriendlySoftwareName) + delete(rawMsg, key) + case "modelDescription": + err = unpopulate(val, "ModelDescription", &d.ModelDescription) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FailoverRequest. +func (f FailoverRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accesspointIds", f.AccesspointIDs) + populate(objectMap, "keepSourceDevice", f.KeepSourceDevice) + populate(objectMap, "skipValidation", f.SkipValidation) + populate(objectMap, "targetDeviceId", f.TargetDeviceID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ISCSIDiskProperties. +func (i ISCSIDiskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControlRecords", i.AccessControlRecords) + populate(objectMap, "dataPolicy", i.DataPolicy) + populate(objectMap, "description", i.Description) + populate(objectMap, "diskStatus", i.DiskStatus) + populate(objectMap, "localUsedCapacityInBytes", i.LocalUsedCapacityInBytes) + populate(objectMap, "monitoringStatus", i.MonitoringStatus) + populate(objectMap, "provisionedCapacityInBytes", i.ProvisionedCapacityInBytes) + populate(objectMap, "usedCapacityInBytes", i.UsedCapacityInBytes) + return json.Marshal(objectMap) +} + +// 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 fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &j.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &j.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// 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) +} + +// 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobFilter. +func (j *JobFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "jobType": + err = unpopulate(val, "JobType", &j.JobType) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "backupPointInTime", j.BackupPointInTime) + populate(objectMap, "deviceId", j.DeviceID) + populate(objectMap, "downloadProgress", j.DownloadProgress) + populate(objectMap, "entityId", j.EntityID) + populate(objectMap, "entityType", j.EntityType) + populate(objectMap, "installProgress", j.InstallProgress) + populate(objectMap, "isCancellable", j.IsCancellable) + populate(objectMap, "jobStages", j.JobStages) + populate(objectMap, "jobType", j.JobType) + populate(objectMap, "sourceDeviceId", j.SourceDeviceID) + populate(objectMap, "stats", j.Stats) + populate(objectMap, "targetId", j.TargetID) + populate(objectMap, "targetType", j.TargetType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. +func (j *JobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupPointInTime": + err = unpopulateTimeRFC3339(val, "BackupPointInTime", &j.BackupPointInTime) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &j.DeviceID) + delete(rawMsg, key) + case "downloadProgress": + err = unpopulate(val, "DownloadProgress", &j.DownloadProgress) + delete(rawMsg, key) + case "entityId": + err = unpopulate(val, "EntityID", &j.EntityID) + delete(rawMsg, key) + case "entityType": + err = unpopulate(val, "EntityType", &j.EntityType) + delete(rawMsg, key) + case "installProgress": + err = unpopulate(val, "InstallProgress", &j.InstallProgress) + delete(rawMsg, key) + case "isCancellable": + err = unpopulate(val, "IsCancellable", &j.IsCancellable) + delete(rawMsg, key) + case "jobStages": + err = unpopulate(val, "JobStages", &j.JobStages) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &j.JobType) + delete(rawMsg, key) + case "sourceDeviceId": + err = unpopulate(val, "SourceDeviceID", &j.SourceDeviceID) + delete(rawMsg, key) + case "stats": + err = unpopulate(val, "Stats", &j.Stats) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &j.TargetID) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &j.TargetType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Manager. +func (m Manager) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerExtendedInfo. +func (m ManagerExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerPatch. +func (m ManagerPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricData. +func (m *MetricData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "average": + err = unpopulate(val, "Average", &m.Average) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &m.Count) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &m.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &m.Minimum) + delete(rawMsg, key) + case "sum": + err = unpopulate(val, "Sum", &m.Sum) + delete(rawMsg, key) + case "timeStamp": + err = unpopulateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricFilter. +func (m *MetricFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &m.EndTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &m.TimeGrain) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Metrics. +func (m *Metrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &m.EndTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "primaryAggregation": + err = unpopulate(val, "PrimaryAggregation", &m.PrimaryAggregation) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &m.TimeGrain) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &m.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSettingsProperties. +func (n NetworkSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nodeNetworks", n.NodeNetworks) + populate(objectMap, "primaryDnsServer", n.PrimaryDNSServer) + populate(objectMap, "secondaryDnsServer", n.SecondaryDNSServer) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NodeNetwork. +func (n NodeNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkAdapters", n.NetworkAdapters) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceCertificateAndAADDetails. +func (r ResourceCertificateAndAADDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadAuthority", r.AADAuthority) + populate(objectMap, "aadTenantId", r.AADTenantID) + populate(objectMap, "authType", r.AuthType) + populate(objectMap, "azureManagementEndpointAudience", r.AzureManagementEndpointAudience) + populate(objectMap, "certificate", r.Certificate) + populate(objectMap, "friendlyName", r.FriendlyName) + populate(objectMap, "issuer", r.Issuer) + populate(objectMap, "resourceId", r.ResourceID) + populate(objectMap, "servicePrincipalClientId", r.ServicePrincipalClientID) + populate(objectMap, "servicePrincipalObjectId", r.ServicePrincipalObjectID) + populate(objectMap, "subject", r.Subject) + populate(objectMap, "thumbprint", r.Thumbprint) + populateTimeRFC3339(objectMap, "validFrom", r.ValidFrom) + populateTimeRFC3339(objectMap, "validTo", r.ValidTo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceCertificateAndAADDetails. +func (r *ResourceCertificateAndAADDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadAuthority": + err = unpopulate(val, "AADAuthority", &r.AADAuthority) + delete(rawMsg, key) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &r.AADTenantID) + delete(rawMsg, key) + case "authType": + err = unpopulate(val, "AuthType", &r.AuthType) + delete(rawMsg, key) + case "azureManagementEndpointAudience": + err = unpopulate(val, "AzureManagementEndpointAudience", &r.AzureManagementEndpointAudience) + delete(rawMsg, key) + case "certificate": + err = unpopulate(val, "Certificate", &r.Certificate) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &r.FriendlyName) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, "Issuer", &r.Issuer) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + delete(rawMsg, key) + case "servicePrincipalClientId": + err = unpopulate(val, "ServicePrincipalClientID", &r.ServicePrincipalClientID) + delete(rawMsg, key) + case "servicePrincipalObjectId": + err = unpopulate(val, "ServicePrincipalObjectID", &r.ServicePrincipalObjectID) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &r.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &r.Thumbprint) + delete(rawMsg, key) + case "validFrom": + err = unpopulateTimeRFC3339(val, "ValidFrom", &r.ValidFrom) + delete(rawMsg, key) + case "validTo": + err = unpopulateTimeRFC3339(val, "ValidTo", &r.ValidTo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SendTestAlertEmailRequest. +func (s SendTestAlertEmailRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "emailList", s.EmailList) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type StorageDomainProperties. +func (s StorageDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionKey", s.EncryptionKey) + populate(objectMap, "encryptionStatus", s.EncryptionStatus) + populate(objectMap, "storageAccountCredentialIds", s.StorageAccountCredentialIDs) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type UpdatesProperties. +func (u UpdatesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "deviceLastScannedTime", u.DeviceLastScannedTime) + populate(objectMap, "deviceVersion", u.DeviceVersion) + populate(objectMap, "inProgressDownloadJobId", u.InProgressDownloadJobID) + populateTimeRFC3339(objectMap, "inProgressDownloadJobStartedTime", u.InProgressDownloadJobStartedTime) + populate(objectMap, "inProgressInstallJobId", u.InProgressInstallJobID) + populateTimeRFC3339(objectMap, "inProgressInstallJobStartedTime", u.InProgressInstallJobStartedTime) + populateTimeRFC3339(objectMap, "inProgressScanStartedTime", u.InProgressScanStartedTime) + populateTimeRFC3339(objectMap, "lastCompletedDownloadJobTime", u.LastCompletedDownloadJobTime) + populateTimeRFC3339(objectMap, "lastCompletedInstallJobTime", u.LastCompletedInstallJobTime) + populateTimeRFC3339(objectMap, "lastCompletedScanTime", u.LastCompletedScanTime) + populate(objectMap, "rebootRequiredForInstall", u.RebootRequiredForInstall) + populate(objectMap, "regularUpdatesAvailable", u.RegularUpdatesAvailable) + populate(objectMap, "status", u.Status) + populate(objectMap, "totalItemsPendingForDownload", u.TotalItemsPendingForDownload) + populate(objectMap, "totalItemsPendingForInstall", u.TotalItemsPendingForInstall) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdatesProperties. +func (u *UpdatesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceLastScannedTime": + err = unpopulateTimeRFC3339(val, "DeviceLastScannedTime", &u.DeviceLastScannedTime) + delete(rawMsg, key) + case "deviceVersion": + err = unpopulate(val, "DeviceVersion", &u.DeviceVersion) + delete(rawMsg, key) + case "inProgressDownloadJobId": + err = unpopulate(val, "InProgressDownloadJobID", &u.InProgressDownloadJobID) + delete(rawMsg, key) + case "inProgressDownloadJobStartedTime": + err = unpopulateTimeRFC3339(val, "InProgressDownloadJobStartedTime", &u.InProgressDownloadJobStartedTime) + delete(rawMsg, key) + case "inProgressInstallJobId": + err = unpopulate(val, "InProgressInstallJobID", &u.InProgressInstallJobID) + delete(rawMsg, key) + case "inProgressInstallJobStartedTime": + err = unpopulateTimeRFC3339(val, "InProgressInstallJobStartedTime", &u.InProgressInstallJobStartedTime) + delete(rawMsg, key) + case "inProgressScanStartedTime": + err = unpopulateTimeRFC3339(val, "InProgressScanStartedTime", &u.InProgressScanStartedTime) + delete(rawMsg, key) + case "lastCompletedDownloadJobTime": + err = unpopulateTimeRFC3339(val, "LastCompletedDownloadJobTime", &u.LastCompletedDownloadJobTime) + delete(rawMsg, key) + case "lastCompletedInstallJobTime": + err = unpopulateTimeRFC3339(val, "LastCompletedInstallJobTime", &u.LastCompletedInstallJobTime) + delete(rawMsg, key) + case "lastCompletedScanTime": + err = unpopulateTimeRFC3339(val, "LastCompletedScanTime", &u.LastCompletedScanTime) + delete(rawMsg, key) + case "rebootRequiredForInstall": + err = unpopulate(val, "RebootRequiredForInstall", &u.RebootRequiredForInstall) + delete(rawMsg, key) + case "regularUpdatesAvailable": + err = unpopulate(val, "RegularUpdatesAvailable", &u.RegularUpdatesAvailable) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &u.Status) + delete(rawMsg, key) + case "totalItemsPendingForDownload": + err = unpopulate(val, "TotalItemsPendingForDownload", &u.TotalItemsPendingForDownload) + delete(rawMsg, key) + case "totalItemsPendingForInstall": + err = unpopulate(val, "TotalItemsPendingForInstall", &u.TotalItemsPendingForInstall) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +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, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_response_types.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_response_types.go new file mode 100644 index 000000000000..eab5147639ad --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_response_types.go @@ -0,0 +1,479 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +// AccessControlRecordsClientCreateOrUpdateResponse contains the response from method AccessControlRecordsClient.CreateOrUpdate. +type AccessControlRecordsClientCreateOrUpdateResponse struct { + AccessControlRecord +} + +// AccessControlRecordsClientDeleteResponse contains the response from method AccessControlRecordsClient.Delete. +type AccessControlRecordsClientDeleteResponse struct { + // placeholder for future response values +} + +// AccessControlRecordsClientGetResponse contains the response from method AccessControlRecordsClient.Get. +type AccessControlRecordsClientGetResponse struct { + AccessControlRecord +} + +// AccessControlRecordsClientListByManagerResponse contains the response from method AccessControlRecordsClient.ListByManager. +type AccessControlRecordsClientListByManagerResponse struct { + AccessControlRecordList +} + +// AlertsClientClearResponse contains the response from method AlertsClient.Clear. +type AlertsClientClearResponse struct { + // placeholder for future response values +} + +// AlertsClientListByManagerResponse contains the response from method AlertsClient.ListByManager. +type AlertsClientListByManagerResponse struct { + AlertList +} + +// AlertsClientSendTestEmailResponse contains the response from method AlertsClient.SendTestEmail. +type AlertsClientSendTestEmailResponse struct { + // placeholder for future response values +} + +// AvailableProviderOperationsClientListResponse contains the response from method AvailableProviderOperationsClient.List. +type AvailableProviderOperationsClientListResponse struct { + AvailableProviderOperations +} + +// BackupScheduleGroupsClientCreateOrUpdateResponse contains the response from method BackupScheduleGroupsClient.CreateOrUpdate. +type BackupScheduleGroupsClientCreateOrUpdateResponse struct { + BackupScheduleGroup +} + +// BackupScheduleGroupsClientDeleteResponse contains the response from method BackupScheduleGroupsClient.Delete. +type BackupScheduleGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// BackupScheduleGroupsClientGetResponse contains the response from method BackupScheduleGroupsClient.Get. +type BackupScheduleGroupsClientGetResponse struct { + BackupScheduleGroup +} + +// BackupScheduleGroupsClientListByDeviceResponse contains the response from method BackupScheduleGroupsClient.ListByDevice. +type BackupScheduleGroupsClientListByDeviceResponse struct { + BackupScheduleGroupList +} + +// BackupsClientCloneResponse contains the response from method BackupsClient.Clone. +type BackupsClientCloneResponse struct { + // placeholder for future response values +} + +// BackupsClientDeleteResponse contains the response from method BackupsClient.Delete. +type BackupsClientDeleteResponse struct { + // placeholder for future response values +} + +// BackupsClientListByDeviceResponse contains the response from method BackupsClient.ListByDevice. +type BackupsClientListByDeviceResponse struct { + BackupList +} + +// BackupsClientListByManagerResponse contains the response from method BackupsClient.ListByManager. +type BackupsClientListByManagerResponse struct { + BackupList +} + +// ChapSettingsClientCreateOrUpdateResponse contains the response from method ChapSettingsClient.CreateOrUpdate. +type ChapSettingsClientCreateOrUpdateResponse struct { + ChapSettings +} + +// ChapSettingsClientDeleteResponse contains the response from method ChapSettingsClient.Delete. +type ChapSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// ChapSettingsClientGetResponse contains the response from method ChapSettingsClient.Get. +type ChapSettingsClientGetResponse struct { + ChapSettings +} + +// ChapSettingsClientListByDeviceResponse contains the response from method ChapSettingsClient.ListByDevice. +type ChapSettingsClientListByDeviceResponse struct { + ChapSettingsList +} + +// DevicesClientCreateOrUpdateAlertSettingsResponse contains the response from method DevicesClient.CreateOrUpdateAlertSettings. +type DevicesClientCreateOrUpdateAlertSettingsResponse struct { + AlertSettings +} + +// DevicesClientCreateOrUpdateSecuritySettingsResponse contains the response from method DevicesClient.CreateOrUpdateSecuritySettings. +type DevicesClientCreateOrUpdateSecuritySettingsResponse struct { + // placeholder for future response values +} + +// DevicesClientDeactivateResponse contains the response from method DevicesClient.Deactivate. +type DevicesClientDeactivateResponse struct { + // placeholder for future response values +} + +// DevicesClientDeleteResponse contains the response from method DevicesClient.Delete. +type DevicesClientDeleteResponse struct { + // placeholder for future response values +} + +// DevicesClientDownloadUpdatesResponse contains the response from method DevicesClient.DownloadUpdates. +type DevicesClientDownloadUpdatesResponse struct { + // placeholder for future response values +} + +// DevicesClientFailoverResponse contains the response from method DevicesClient.Failover. +type DevicesClientFailoverResponse struct { + // placeholder for future response values +} + +// DevicesClientGetAlertSettingsResponse contains the response from method DevicesClient.GetAlertSettings. +type DevicesClientGetAlertSettingsResponse struct { + AlertSettings +} + +// DevicesClientGetNetworkSettingsResponse contains the response from method DevicesClient.GetNetworkSettings. +type DevicesClientGetNetworkSettingsResponse struct { + NetworkSettings +} + +// DevicesClientGetResponse contains the response from method DevicesClient.Get. +type DevicesClientGetResponse struct { + Device +} + +// DevicesClientGetTimeSettingsResponse contains the response from method DevicesClient.GetTimeSettings. +type DevicesClientGetTimeSettingsResponse struct { + TimeSettings +} + +// DevicesClientGetUpdateSummaryResponse contains the response from method DevicesClient.GetUpdateSummary. +type DevicesClientGetUpdateSummaryResponse struct { + Updates +} + +// DevicesClientInstallUpdatesResponse contains the response from method DevicesClient.InstallUpdates. +type DevicesClientInstallUpdatesResponse struct { + // placeholder for future response values +} + +// DevicesClientListByManagerResponse contains the response from method DevicesClient.ListByManager. +type DevicesClientListByManagerResponse struct { + DeviceList +} + +// DevicesClientListFailoverTargetResponse contains the response from method DevicesClient.ListFailoverTarget. +type DevicesClientListFailoverTargetResponse struct { + DeviceList +} + +// DevicesClientListMetricDefinitionResponse contains the response from method DevicesClient.ListMetricDefinition. +type DevicesClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// DevicesClientListMetricsResponse contains the response from method DevicesClient.ListMetrics. +type DevicesClientListMetricsResponse struct { + MetricList +} + +// DevicesClientPatchResponse contains the response from method DevicesClient.Patch. +type DevicesClientPatchResponse struct { + Device +} + +// DevicesClientScanForUpdatesResponse contains the response from method DevicesClient.ScanForUpdates. +type DevicesClientScanForUpdatesResponse struct { + // placeholder for future response values +} + +// FileServersClientBackupNowResponse contains the response from method FileServersClient.BackupNow. +type FileServersClientBackupNowResponse struct { + // placeholder for future response values +} + +// FileServersClientCreateOrUpdateResponse contains the response from method FileServersClient.CreateOrUpdate. +type FileServersClientCreateOrUpdateResponse struct { + FileServer +} + +// FileServersClientDeleteResponse contains the response from method FileServersClient.Delete. +type FileServersClientDeleteResponse struct { + // placeholder for future response values +} + +// FileServersClientGetResponse contains the response from method FileServersClient.Get. +type FileServersClientGetResponse struct { + FileServer +} + +// FileServersClientListByDeviceResponse contains the response from method FileServersClient.ListByDevice. +type FileServersClientListByDeviceResponse struct { + FileServerList +} + +// FileServersClientListByManagerResponse contains the response from method FileServersClient.ListByManager. +type FileServersClientListByManagerResponse struct { + FileServerList +} + +// FileServersClientListMetricDefinitionResponse contains the response from method FileServersClient.ListMetricDefinition. +type FileServersClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// FileServersClientListMetricsResponse contains the response from method FileServersClient.ListMetrics. +type FileServersClientListMetricsResponse struct { + MetricList +} + +// FileSharesClientCreateOrUpdateResponse contains the response from method FileSharesClient.CreateOrUpdate. +type FileSharesClientCreateOrUpdateResponse struct { + FileShare +} + +// FileSharesClientDeleteResponse contains the response from method FileSharesClient.Delete. +type FileSharesClientDeleteResponse struct { + // placeholder for future response values +} + +// FileSharesClientGetResponse contains the response from method FileSharesClient.Get. +type FileSharesClientGetResponse struct { + FileShare +} + +// FileSharesClientListByDeviceResponse contains the response from method FileSharesClient.ListByDevice. +type FileSharesClientListByDeviceResponse struct { + FileShareList +} + +// FileSharesClientListByFileServerResponse contains the response from method FileSharesClient.ListByFileServer. +type FileSharesClientListByFileServerResponse struct { + FileShareList +} + +// FileSharesClientListMetricDefinitionResponse contains the response from method FileSharesClient.ListMetricDefinition. +type FileSharesClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// FileSharesClientListMetricsResponse contains the response from method FileSharesClient.ListMetrics. +type FileSharesClientListMetricsResponse struct { + MetricList +} + +// IscsiDisksClientCreateOrUpdateResponse contains the response from method IscsiDisksClient.CreateOrUpdate. +type IscsiDisksClientCreateOrUpdateResponse struct { + ISCSIDisk +} + +// IscsiDisksClientDeleteResponse contains the response from method IscsiDisksClient.Delete. +type IscsiDisksClientDeleteResponse struct { + // placeholder for future response values +} + +// IscsiDisksClientGetResponse contains the response from method IscsiDisksClient.Get. +type IscsiDisksClientGetResponse struct { + ISCSIDisk +} + +// IscsiDisksClientListByDeviceResponse contains the response from method IscsiDisksClient.ListByDevice. +type IscsiDisksClientListByDeviceResponse struct { + ISCSIDiskList +} + +// IscsiDisksClientListByIscsiServerResponse contains the response from method IscsiDisksClient.ListByIscsiServer. +type IscsiDisksClientListByIscsiServerResponse struct { + ISCSIDiskList +} + +// IscsiDisksClientListMetricDefinitionResponse contains the response from method IscsiDisksClient.ListMetricDefinition. +type IscsiDisksClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// IscsiDisksClientListMetricsResponse contains the response from method IscsiDisksClient.ListMetrics. +type IscsiDisksClientListMetricsResponse struct { + MetricList +} + +// IscsiServersClientBackupNowResponse contains the response from method IscsiServersClient.BackupNow. +type IscsiServersClientBackupNowResponse struct { + // placeholder for future response values +} + +// IscsiServersClientCreateOrUpdateResponse contains the response from method IscsiServersClient.CreateOrUpdate. +type IscsiServersClientCreateOrUpdateResponse struct { + ISCSIServer +} + +// IscsiServersClientDeleteResponse contains the response from method IscsiServersClient.Delete. +type IscsiServersClientDeleteResponse struct { + // placeholder for future response values +} + +// IscsiServersClientGetResponse contains the response from method IscsiServersClient.Get. +type IscsiServersClientGetResponse struct { + ISCSIServer +} + +// IscsiServersClientListByDeviceResponse contains the response from method IscsiServersClient.ListByDevice. +type IscsiServersClientListByDeviceResponse struct { + ISCSIServerList +} + +// IscsiServersClientListByManagerResponse contains the response from method IscsiServersClient.ListByManager. +type IscsiServersClientListByManagerResponse struct { + ISCSIServerList +} + +// IscsiServersClientListMetricDefinitionResponse contains the response from method IscsiServersClient.ListMetricDefinition. +type IscsiServersClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// IscsiServersClientListMetricsResponse contains the response from method IscsiServersClient.ListMetrics. +type IscsiServersClientListMetricsResponse struct { + MetricList +} + +// JobsClientGetResponse contains the response from method JobsClient.Get. +type JobsClientGetResponse struct { + Job +} + +// JobsClientListByDeviceResponse contains the response from method JobsClient.ListByDevice. +type JobsClientListByDeviceResponse struct { + JobList +} + +// JobsClientListByManagerResponse contains the response from method JobsClient.ListByManager. +type JobsClientListByManagerResponse struct { + JobList +} + +// ManagersClientCreateExtendedInfoResponse contains the response from method ManagersClient.CreateExtendedInfo. +type ManagersClientCreateExtendedInfoResponse struct { + ManagerExtendedInfo +} + +// ManagersClientCreateOrUpdateResponse contains the response from method ManagersClient.CreateOrUpdate. +type ManagersClientCreateOrUpdateResponse struct { + Manager +} + +// ManagersClientDeleteExtendedInfoResponse contains the response from method ManagersClient.DeleteExtendedInfo. +type ManagersClientDeleteExtendedInfoResponse struct { + // placeholder for future response values +} + +// ManagersClientDeleteResponse contains the response from method ManagersClient.Delete. +type ManagersClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagersClientGetEncryptionKeyResponse contains the response from method ManagersClient.GetEncryptionKey. +type ManagersClientGetEncryptionKeyResponse struct { + SymmetricEncryptedSecret +} + +// ManagersClientGetEncryptionSettingsResponse contains the response from method ManagersClient.GetEncryptionSettings. +type ManagersClientGetEncryptionSettingsResponse struct { + EncryptionSettings +} + +// ManagersClientGetExtendedInfoResponse contains the response from method ManagersClient.GetExtendedInfo. +type ManagersClientGetExtendedInfoResponse struct { + ManagerExtendedInfo +} + +// ManagersClientGetResponse contains the response from method ManagersClient.Get. +type ManagersClientGetResponse struct { + Manager +} + +// ManagersClientListByResourceGroupResponse contains the response from method ManagersClient.ListByResourceGroup. +type ManagersClientListByResourceGroupResponse struct { + ManagerList +} + +// ManagersClientListMetricDefinitionResponse contains the response from method ManagersClient.ListMetricDefinition. +type ManagersClientListMetricDefinitionResponse struct { + MetricDefinitionList +} + +// ManagersClientListMetricsResponse contains the response from method ManagersClient.ListMetrics. +type ManagersClientListMetricsResponse struct { + MetricList +} + +// ManagersClientListResponse contains the response from method ManagersClient.List. +type ManagersClientListResponse struct { + ManagerList +} + +// ManagersClientUpdateExtendedInfoResponse contains the response from method ManagersClient.UpdateExtendedInfo. +type ManagersClientUpdateExtendedInfoResponse struct { + ManagerExtendedInfo +} + +// ManagersClientUpdateResponse contains the response from method ManagersClient.Update. +type ManagersClientUpdateResponse struct { + Manager +} + +// ManagersClientUploadRegistrationCertificateResponse contains the response from method ManagersClient.UploadRegistrationCertificate. +type ManagersClientUploadRegistrationCertificateResponse struct { + UploadCertificateResponse +} + +// StorageAccountCredentialsClientCreateOrUpdateResponse contains the response from method StorageAccountCredentialsClient.CreateOrUpdate. +type StorageAccountCredentialsClientCreateOrUpdateResponse struct { + StorageAccountCredential +} + +// StorageAccountCredentialsClientDeleteResponse contains the response from method StorageAccountCredentialsClient.Delete. +type StorageAccountCredentialsClientDeleteResponse struct { + // placeholder for future response values +} + +// StorageAccountCredentialsClientGetResponse contains the response from method StorageAccountCredentialsClient.Get. +type StorageAccountCredentialsClientGetResponse struct { + StorageAccountCredential +} + +// StorageAccountCredentialsClientListByManagerResponse contains the response from method StorageAccountCredentialsClient.ListByManager. +type StorageAccountCredentialsClientListByManagerResponse struct { + StorageAccountCredentialList +} + +// StorageDomainsClientCreateOrUpdateResponse contains the response from method StorageDomainsClient.CreateOrUpdate. +type StorageDomainsClientCreateOrUpdateResponse struct { + StorageDomain +} + +// StorageDomainsClientDeleteResponse contains the response from method StorageDomainsClient.Delete. +type StorageDomainsClientDeleteResponse struct { + // placeholder for future response values +} + +// StorageDomainsClientGetResponse contains the response from method StorageDomainsClient.Get. +type StorageDomainsClientGetResponse struct { + StorageDomain +} + +// StorageDomainsClientListByManagerResponse contains the response from method StorageDomainsClient.ListByManager. +type StorageDomainsClientListByManagerResponse struct { + StorageDomainList +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storageaccountcredentials_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storageaccountcredentials_client.go new file mode 100644 index 000000000000..50ca75d95741 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storageaccountcredentials_client.go @@ -0,0 +1,318 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewStorageAccountCredentialsClient creates a new instance of StorageAccountCredentialsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewStorageAccountCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageAccountCredentialsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &StorageAccountCredentialsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the storage account credential +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// credentialName - The credential name. +// resourceGroupName - The resource group name +// managerName - The manager name +// storageAccount - The storage account credential to be added or updated. +// options - StorageAccountCredentialsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageAccountCredentialsClient.BeginCreateOrUpdate +// method. +func (client *StorageAccountCredentialsClient) BeginCreateOrUpdate(ctx context.Context, credentialName string, resourceGroupName string, managerName string, storageAccount StorageAccountCredential, options *StorageAccountCredentialsClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageAccountCredentialsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, credentialName, resourceGroupName, managerName, storageAccount, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[StorageAccountCredentialsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[StorageAccountCredentialsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the storage account credential +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *StorageAccountCredentialsClient) createOrUpdate(ctx context.Context, credentialName string, resourceGroupName string, managerName string, storageAccount StorageAccountCredential, options *StorageAccountCredentialsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, credentialName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StorageAccountCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, credentialName string, resourceGroupName string, managerName string, storageAccount StorageAccountCredential, options *StorageAccountCredentialsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}" + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, storageAccount) +} + +// BeginDelete - Deletes the storage account credential +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// credentialName - The name of the storage account credential. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageAccountCredentialsClientBeginDeleteOptions contains the optional parameters for the StorageAccountCredentialsClient.BeginDelete +// method. +func (client *StorageAccountCredentialsClient) BeginDelete(ctx context.Context, credentialName string, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientBeginDeleteOptions) (*runtime.Poller[StorageAccountCredentialsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, credentialName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[StorageAccountCredentialsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[StorageAccountCredentialsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the storage account credential +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *StorageAccountCredentialsClient) deleteOperation(ctx context.Context, credentialName string, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, credentialName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StorageAccountCredentialsClient) deleteCreateRequest(ctx context.Context, credentialName string, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}" + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified storage account credential name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// credentialName - The name of storage account credential to be fetched. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageAccountCredentialsClientGetOptions contains the optional parameters for the StorageAccountCredentialsClient.Get +// method. +func (client *StorageAccountCredentialsClient) Get(ctx context.Context, credentialName string, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientGetOptions) (StorageAccountCredentialsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, credentialName, resourceGroupName, managerName, options) + if err != nil { + return StorageAccountCredentialsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageAccountCredentialsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageAccountCredentialsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StorageAccountCredentialsClient) getCreateRequest(ctx context.Context, credentialName string, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}" + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StorageAccountCredentialsClient) getHandleResponse(resp *http.Response) (StorageAccountCredentialsClientGetResponse, error) { + result := StorageAccountCredentialsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountCredential); err != nil { + return StorageAccountCredentialsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the storage account credentials in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageAccountCredentialsClientListByManagerOptions contains the optional parameters for the StorageAccountCredentialsClient.ListByManager +// method. +func (client *StorageAccountCredentialsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *StorageAccountCredentialsClientListByManagerOptions) *runtime.Pager[StorageAccountCredentialsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[StorageAccountCredentialsClientListByManagerResponse]{ + More: func(page StorageAccountCredentialsClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *StorageAccountCredentialsClientListByManagerResponse) (StorageAccountCredentialsClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return StorageAccountCredentialsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageAccountCredentialsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageAccountCredentialsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *StorageAccountCredentialsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *StorageAccountCredentialsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *StorageAccountCredentialsClient) listByManagerHandleResponse(resp *http.Response) (StorageAccountCredentialsClientListByManagerResponse, error) { + result := StorageAccountCredentialsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountCredentialList); err != nil { + return StorageAccountCredentialsClientListByManagerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storagedomains_client.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storagedomains_client.go new file mode 100644 index 000000000000..44ffef8942c7 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_storagedomains_client.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// StorageDomainsClient contains the methods for the StorageDomains group. +// Don't use this type directly, use NewStorageDomainsClient() instead. +type StorageDomainsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewStorageDomainsClient creates a new instance of StorageDomainsClient with the specified values. +// subscriptionID - The subscription id +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewStorageDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageDomainsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &StorageDomainsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the storage domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// storageDomainName - The storage domain name. +// resourceGroupName - The resource group name +// managerName - The manager name +// storageDomain - The storageDomain. +// options - StorageDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageDomainsClient.BeginCreateOrUpdate +// method. +func (client *StorageDomainsClient) BeginCreateOrUpdate(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, storageDomain StorageDomain, options *StorageDomainsClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageDomainsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, storageDomainName, resourceGroupName, managerName, storageDomain, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[StorageDomainsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[StorageDomainsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the storage domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *StorageDomainsClient) createOrUpdate(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, storageDomain StorageDomain, options *StorageDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, storageDomainName, resourceGroupName, managerName, storageDomain, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StorageDomainsClient) createOrUpdateCreateRequest(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, storageDomain StorageDomain, options *StorageDomainsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}" + if storageDomainName == "" { + return nil, errors.New("parameter storageDomainName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageDomainName}", url.PathEscape(storageDomainName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, storageDomain) +} + +// BeginDelete - Deletes the storage domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// storageDomainName - The storage domain name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageDomainsClientBeginDeleteOptions contains the optional parameters for the StorageDomainsClient.BeginDelete +// method. +func (client *StorageDomainsClient) BeginDelete(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, options *StorageDomainsClientBeginDeleteOptions) (*runtime.Poller[StorageDomainsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, storageDomainName, resourceGroupName, managerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[StorageDomainsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[StorageDomainsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the storage domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +func (client *StorageDomainsClient) deleteOperation(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, options *StorageDomainsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, storageDomainName, resourceGroupName, managerName, 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, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StorageDomainsClient) deleteCreateRequest(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, options *StorageDomainsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}" + if storageDomainName == "" { + return nil, errors.New("parameter storageDomainName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageDomainName}", url.PathEscape(storageDomainName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the properties of the specified storage domain name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// storageDomainName - The storage domain name. +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageDomainsClientGetOptions contains the optional parameters for the StorageDomainsClient.Get method. +func (client *StorageDomainsClient) Get(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, options *StorageDomainsClientGetOptions) (StorageDomainsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, storageDomainName, resourceGroupName, managerName, options) + if err != nil { + return StorageDomainsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageDomainsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageDomainsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StorageDomainsClient) getCreateRequest(ctx context.Context, storageDomainName string, resourceGroupName string, managerName string, options *StorageDomainsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}" + if storageDomainName == "" { + return nil, errors.New("parameter storageDomainName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageDomainName}", url.PathEscape(storageDomainName)) + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StorageDomainsClient) getHandleResponse(resp *http.Response) (StorageDomainsClientGetResponse, error) { + result := StorageDomainsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageDomain); err != nil { + return StorageDomainsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagerPager - Retrieves all the storage domains in a manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2016-10-01 +// resourceGroupName - The resource group name +// managerName - The manager name +// options - StorageDomainsClientListByManagerOptions contains the optional parameters for the StorageDomainsClient.ListByManager +// method. +func (client *StorageDomainsClient) NewListByManagerPager(resourceGroupName string, managerName string, options *StorageDomainsClientListByManagerOptions) *runtime.Pager[StorageDomainsClientListByManagerResponse] { + return runtime.NewPager(runtime.PagingHandler[StorageDomainsClientListByManagerResponse]{ + More: func(page StorageDomainsClientListByManagerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *StorageDomainsClientListByManagerResponse) (StorageDomainsClientListByManagerResponse, error) { + req, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options) + if err != nil { + return StorageDomainsClientListByManagerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StorageDomainsClientListByManagerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StorageDomainsClientListByManagerResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagerHandleResponse(resp) + }, + }) +} + +// listByManagerCreateRequest creates the ListByManager request. +func (client *StorageDomainsClient) listByManagerCreateRequest(ctx context.Context, resourceGroupName string, managerName string, options *StorageDomainsClientListByManagerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains" + 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)) + if managerName == "" { + return nil, errors.New("parameter managerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managerName}", url.PathEscape(managerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2016-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagerHandleResponse handles the ListByManager response. +func (client *StorageDomainsClient) listByManagerHandleResponse(resp *http.Response) (StorageDomainsClientListByManagerResponse, error) { + result := StorageDomainsClientListByManagerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageDomainList); err != nil { + return StorageDomainsClientListByManagerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_time_rfc3339.go b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..7a895a89f1a8 --- /dev/null +++ b/sdk/resourcemanager/storsimple1200series/armstorsimple1200series/zz_generated_time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// 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 armstorsimple1200series + +import ( + "encoding/json" + "fmt" + "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, fn string, 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 fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}