Release sdk/resourcemanager/redisenterprise/armredisenterprise/0.1.0 (#16520)

* [Release] sdk/resourcemanager/redisenterprise/armredisenterprise/0.1.0 generation from spec commit: e260efc341b22e018718d1c2e85107db5af52802

* update release date
This commit is contained in:
Jiahui Peng 2021-12-09 14:07:26 +08:00 коммит произвёл GitHub
Родитель 48075102da
Коммит 31ecf4ddbc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
25 изменённых файлов: 4983 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 0.1.0 (2021-12-09)
- Init release.

Просмотреть файл

@ -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.

Просмотреть файл

@ -0,0 +1,75 @@
# Azure Redis Enterprise Module for Go
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise)
The `armredisenterprise` module provides operations for working with Azure Redis Enterprise.
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/redisenterprise/armredisenterprise)
# Getting started
## Prerequisites
- an [Azure subscription](https://azure.microsoft.com/free/)
- Go 1.13 or above
## Install the package
This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management.
Install the Azure Redis Enterprise module:
```sh
go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise
```
## Authorization
When creating a client, you will need to provide a credential for authenticating with Azure Redis Enterprise. 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 Redis Enterprise 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 := armredisenterprise.NewDatabasesClient(<subscription ID>, cred, nil)
```
You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore).
```go
options = arm.ClientOptions{
Host: arm.AzureChina,
}
client := armredisenterprise.NewDatabasesClient(<subscription ID>, 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 `Redis Enterprise` 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.

Просмотреть файл

@ -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/e260efc341b22e018718d1c2e85107db5af52802/specification/redisenterprise/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/e260efc341b22e018718d1c2e85107db5af52802/specification/redisenterprise/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 0.1.0
```

Просмотреть файл

@ -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/redisenterprise/armredisenterprise
package armredisenterprise

Просмотреть файл

@ -0,0 +1,27 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/resourcemanager/redisenterprise/armredisenterprise/
pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/resourcemanager/redisenterprise/armredisenterprise/
stages:
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
ServiceDirectory: 'resourcemanager/redisenterprise/armredisenterprise'

Просмотреть файл

@ -0,0 +1,9 @@
module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise
go 1.16
require (
github.com/Azure/azure-sdk-for-go v60.0.0+incompatible
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0
)

Просмотреть файл

@ -0,0 +1,45 @@
github.com/Azure/azure-sdk-for-go v60.0.0+incompatible h1:vVRJhSSTwhIHQTzTjqoZCItFJeBwfdNSqHcgGV10FHQ=
github.com/Azure/azure-sdk-for-go v60.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 h1:VBvHGLJbaY0+c66NZHdS9cgjHVYSH6DDa0XJMyrblsI=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0/go.mod h1:GJzjM4SR9T0KyX5gKCVyz1ytD8FeWeUPCwtFCt1AyfE=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

Просмотреть файл

@ -0,0 +1,13 @@
//go:build modhack
// +build modhack
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of
// the resultant binary.
package armredisenterprise
// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/azure-sdk-for-go"

Просмотреть файл

@ -0,0 +1,257 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise_test
import (
"context"
"log"
"time"
"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/redisenterprise/armredisenterprise"
)
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesListByCluster.json
func ExampleDatabasesClient_ListByCluster() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
pager := client.ListByCluster("<resource-group-name>",
"<cluster-name>",
nil)
for pager.NextPage(ctx) {
if err := pager.Err(); err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range pager.PageResponse().Value {
log.Printf("Database.ID: %s\n", *v.ID)
}
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesCreate.json
func ExampleDatabasesClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginCreate(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
armredisenterprise.Database{
Properties: &armredisenterprise.DatabaseProperties{
ClientProtocol: armredisenterprise.ProtocolEncrypted.ToPtr(),
ClusteringPolicy: armredisenterprise.ClusteringPolicyEnterpriseCluster.ToPtr(),
EvictionPolicy: armredisenterprise.EvictionPolicyAllKeysLRU.ToPtr(),
Modules: []*armredisenterprise.Module{
{
Name: to.StringPtr("<name>"),
Args: to.StringPtr("<args>"),
},
{
Name: to.StringPtr("<name>"),
Args: to.StringPtr("<args>"),
},
{
Name: to.StringPtr("<name>"),
}},
Persistence: &armredisenterprise.Persistence{
AofEnabled: to.BoolPtr(true),
AofFrequency: armredisenterprise.AofFrequencyOneS.ToPtr(),
},
Port: to.Int32Ptr(10000),
},
},
nil)
if err != nil {
log.Fatal(err)
}
res, err := poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
log.Printf("Database.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesUpdate.json
func ExampleDatabasesClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginUpdate(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
armredisenterprise.DatabaseUpdate{
Properties: &armredisenterprise.DatabaseProperties{
ClientProtocol: armredisenterprise.ProtocolEncrypted.ToPtr(),
EvictionPolicy: armredisenterprise.EvictionPolicyAllKeysLRU.ToPtr(),
Persistence: &armredisenterprise.Persistence{
RdbEnabled: to.BoolPtr(true),
RdbFrequency: armredisenterprise.RdbFrequencyTwelveH.ToPtr(),
},
},
},
nil)
if err != nil {
log.Fatal(err)
}
res, err := poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
log.Printf("Database.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesGet.json
func ExampleDatabasesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
res, err := client.Get(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
nil)
if err != nil {
log.Fatal(err)
}
log.Printf("Database.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesDelete.json
func ExampleDatabasesClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginDelete(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
nil)
if err != nil {
log.Fatal(err)
}
_, err = poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesListKeys.json
func ExampleDatabasesClient_ListKeys() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
_, err = client.ListKeys(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
nil)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesRegenerateKey.json
func ExampleDatabasesClient_BeginRegenerateKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginRegenerateKey(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
armredisenterprise.RegenerateKeyParameters{
KeyType: armredisenterprise.AccessKeyTypePrimary.ToPtr(),
},
nil)
if err != nil {
log.Fatal(err)
}
_, err = poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesImport.json
func ExampleDatabasesClient_BeginImport() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginImport(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
armredisenterprise.ImportClusterParameters{
SasUris: []*string{
to.StringPtr("https://contosostorage.blob.core.window.net/urltoBlobFile1?sasKeyParameters"),
to.StringPtr("https://contosostorage.blob.core.window.net/urltoBlobFile2?sasKeyParameters")},
},
nil)
if err != nil {
log.Fatal(err)
}
_, err = poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDatabasesExport.json
func ExampleDatabasesClient_BeginExport() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewDatabasesClient("<subscription-id>", cred, nil)
poller, err := client.BeginExport(ctx,
"<resource-group-name>",
"<cluster-name>",
"<database-name>",
armredisenterprise.ExportClusterParameters{
SasURI: to.StringPtr("<sas-uri>"),
},
nil)
if err != nil {
log.Fatal(err)
}
_, err = poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
}

Просмотреть файл

@ -0,0 +1,35 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise"
)
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/OperationsStatusGet.json
func ExampleOperationsStatusClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewOperationsStatusClient("<subscription-id>", cred, nil)
res, err := client.Get(ctx,
"<location>",
"<operation-id>",
nil)
if err != nil {
log.Fatal(err)
}
log.Printf("OperationStatus.ID: %s\n", *res.ID)
}

Просмотреть файл

@ -0,0 +1,105 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise_test
import (
"context"
"log"
"time"
"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/redisenterprise/armredisenterprise"
)
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseListPrivateEndpointConnections.json
func ExamplePrivateEndpointConnectionsClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil)
_, err = client.List(ctx,
"<resource-group-name>",
"<cluster-name>",
nil)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseGetPrivateEndpointConnection.json
func ExamplePrivateEndpointConnectionsClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil)
res, err := client.Get(ctx,
"<resource-group-name>",
"<cluster-name>",
"<private-endpoint-connection-name>",
nil)
if err != nil {
log.Fatal(err)
}
log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterprisePutPrivateEndpointConnection.json
func ExamplePrivateEndpointConnectionsClient_BeginPut() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil)
poller, err := client.BeginPut(ctx,
"<resource-group-name>",
"<cluster-name>",
"<private-endpoint-connection-name>",
armredisenterprise.PrivateEndpointConnection{
Properties: &armredisenterprise.PrivateEndpointConnectionProperties{
PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{
Description: to.StringPtr("<description>"),
Status: armredisenterprise.PrivateEndpointServiceConnectionStatusApproved.ToPtr(),
},
},
},
nil)
if err != nil {
log.Fatal(err)
}
res, err := poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDeletePrivateEndpointConnection.json
func ExamplePrivateEndpointConnectionsClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil)
_, err = client.Delete(ctx,
"<resource-group-name>",
"<cluster-name>",
"<private-endpoint-connection-name>",
nil)
if err != nil {
log.Fatal(err)
}
}

Просмотреть файл

@ -0,0 +1,34 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise"
)
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseListPrivateLinkResources.json
func ExamplePrivateLinkResourcesClient_ListByCluster() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil)
_, err = client.ListByCluster(ctx,
"<resource-group-name>",
"<cluster-name>",
nil)
if err != nil {
log.Fatal(err)
}
}

Просмотреть файл

@ -0,0 +1,173 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise_test
import (
"context"
"log"
"time"
"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/redisenterprise/armredisenterprise"
)
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseCreate.json
func ExampleRedisEnterpriseClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
poller, err := client.BeginCreate(ctx,
"<resource-group-name>",
"<cluster-name>",
armredisenterprise.Cluster{
TrackedResource: armredisenterprise.TrackedResource{
Location: to.StringPtr("<location>"),
Tags: map[string]*string{
"tag1": to.StringPtr("value1"),
},
},
Properties: &armredisenterprise.ClusterProperties{
MinimumTLSVersion: armredisenterprise.TLSVersionOne2.ToPtr(),
},
SKU: &armredisenterprise.SKU{
Name: armredisenterprise.SKUNameEnterpriseFlashF300.ToPtr(),
Capacity: to.Int32Ptr(3),
},
Zones: []*string{
to.StringPtr("1"),
to.StringPtr("2"),
to.StringPtr("3")},
},
nil)
if err != nil {
log.Fatal(err)
}
res, err := poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
log.Printf("Cluster.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseUpdate.json
func ExampleRedisEnterpriseClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
poller, err := client.BeginUpdate(ctx,
"<resource-group-name>",
"<cluster-name>",
armredisenterprise.ClusterUpdate{
Properties: &armredisenterprise.ClusterProperties{
MinimumTLSVersion: armredisenterprise.TLSVersionOne2.ToPtr(),
},
SKU: &armredisenterprise.SKU{
Name: armredisenterprise.SKUNameEnterpriseFlashF300.ToPtr(),
Capacity: to.Int32Ptr(9),
},
Tags: map[string]*string{
"tag1": to.StringPtr("value1"),
},
},
nil)
if err != nil {
log.Fatal(err)
}
res, err := poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
log.Printf("Cluster.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseDelete.json
func ExampleRedisEnterpriseClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
poller, err := client.BeginDelete(ctx,
"<resource-group-name>",
"<cluster-name>",
nil)
if err != nil {
log.Fatal(err)
}
_, err = poller.PollUntilDone(ctx, 30*time.Second)
if err != nil {
log.Fatal(err)
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseGet.json
func ExampleRedisEnterpriseClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
res, err := client.Get(ctx,
"<resource-group-name>",
"<cluster-name>",
nil)
if err != nil {
log.Fatal(err)
}
log.Printf("Cluster.ID: %s\n", *res.ID)
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseListByResourceGroup.json
func ExampleRedisEnterpriseClient_ListByResourceGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
pager := client.ListByResourceGroup("<resource-group-name>",
nil)
for pager.NextPage(ctx) {
if err := pager.Err(); err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range pager.PageResponse().Value {
log.Printf("Cluster.ID: %s\n", *v.ID)
}
}
}
// x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2021-08-01/examples/RedisEnterpriseList.json
func ExampleRedisEnterpriseClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armredisenterprise.NewRedisEnterpriseClient("<subscription-id>", cred, nil)
pager := client.List(nil)
for pager.NextPage(ctx) {
if err := pager.Err(); err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range pager.PageResponse().Value {
log.Printf("Cluster.ID: %s\n", *v.ID)
}
}
}

Просмотреть файл

@ -0,0 +1,368 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
const (
module = "armredisenterprise"
version = "v0.1.0"
)
// AccessKeyType - Which access key to regenerate.
type AccessKeyType string
const (
AccessKeyTypePrimary AccessKeyType = "Primary"
AccessKeyTypeSecondary AccessKeyType = "Secondary"
)
// PossibleAccessKeyTypeValues returns the possible values for the AccessKeyType const type.
func PossibleAccessKeyTypeValues() []AccessKeyType {
return []AccessKeyType{
AccessKeyTypePrimary,
AccessKeyTypeSecondary,
}
}
// ToPtr returns a *AccessKeyType pointing to the current value.
func (c AccessKeyType) ToPtr() *AccessKeyType {
return &c
}
// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
type ActionType string
const (
ActionTypeInternal ActionType = "Internal"
)
// PossibleActionTypeValues returns the possible values for the ActionType const type.
func PossibleActionTypeValues() []ActionType {
return []ActionType{
ActionTypeInternal,
}
}
// ToPtr returns a *ActionType pointing to the current value.
func (c ActionType) ToPtr() *ActionType {
return &c
}
// AofFrequency - Sets the frequency at which data is written to disk.
type AofFrequency string
const (
AofFrequencyAlways AofFrequency = "always"
AofFrequencyOneS AofFrequency = "1s"
)
// PossibleAofFrequencyValues returns the possible values for the AofFrequency const type.
func PossibleAofFrequencyValues() []AofFrequency {
return []AofFrequency{
AofFrequencyAlways,
AofFrequencyOneS,
}
}
// ToPtr returns a *AofFrequency pointing to the current value.
func (c AofFrequency) ToPtr() *AofFrequency {
return &c
}
// ClusteringPolicy - Clustering policy - default is OSSCluster. Specified at create time.
type ClusteringPolicy string
const (
ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster"
ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster"
)
// PossibleClusteringPolicyValues returns the possible values for the ClusteringPolicy const type.
func PossibleClusteringPolicyValues() []ClusteringPolicy {
return []ClusteringPolicy{
ClusteringPolicyEnterpriseCluster,
ClusteringPolicyOSSCluster,
}
}
// ToPtr returns a *ClusteringPolicy pointing to the current value.
func (c ClusteringPolicy) ToPtr() *ClusteringPolicy {
return &c
}
// EvictionPolicy - Redis eviction policy - default is VolatileLRU
type EvictionPolicy string
const (
EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU"
EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU"
EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom"
EvictionPolicyNoEviction EvictionPolicy = "NoEviction"
EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU"
EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU"
EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom"
EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL"
)
// PossibleEvictionPolicyValues returns the possible values for the EvictionPolicy const type.
func PossibleEvictionPolicyValues() []EvictionPolicy {
return []EvictionPolicy{
EvictionPolicyAllKeysLFU,
EvictionPolicyAllKeysLRU,
EvictionPolicyAllKeysRandom,
EvictionPolicyNoEviction,
EvictionPolicyVolatileLFU,
EvictionPolicyVolatileLRU,
EvictionPolicyVolatileRandom,
EvictionPolicyVolatileTTL,
}
}
// ToPtr returns a *EvictionPolicy pointing to the current value.
func (c EvictionPolicy) ToPtr() *EvictionPolicy {
return &c
}
// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
type Origin string
const (
OriginSystem Origin = "system"
OriginUser Origin = "user"
OriginUserSystem Origin = "user,system"
)
// PossibleOriginValues returns the possible values for the Origin const type.
func PossibleOriginValues() []Origin {
return []Origin{
OriginSystem,
OriginUser,
OriginUserSystem,
}
}
// ToPtr returns a *Origin pointing to the current value.
func (c Origin) ToPtr() *Origin {
return &c
}
// PrivateEndpointConnectionProvisioningState - The current provisioning state.
type PrivateEndpointConnectionProvisioningState string
const (
PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating"
PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting"
PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed"
PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded"
)
// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type.
func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState {
return []PrivateEndpointConnectionProvisioningState{
PrivateEndpointConnectionProvisioningStateCreating,
PrivateEndpointConnectionProvisioningStateDeleting,
PrivateEndpointConnectionProvisioningStateFailed,
PrivateEndpointConnectionProvisioningStateSucceeded,
}
}
// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value.
func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState {
return &c
}
// PrivateEndpointServiceConnectionStatus - The private endpoint connection status.
type PrivateEndpointServiceConnectionStatus string
const (
PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved"
PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending"
PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected"
)
// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type.
func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus {
return []PrivateEndpointServiceConnectionStatus{
PrivateEndpointServiceConnectionStatusApproved,
PrivateEndpointServiceConnectionStatusPending,
PrivateEndpointServiceConnectionStatusRejected,
}
}
// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value.
func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus {
return &c
}
// Protocol - Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted.
type Protocol string
const (
ProtocolEncrypted Protocol = "Encrypted"
ProtocolPlaintext Protocol = "Plaintext"
)
// PossibleProtocolValues returns the possible values for the Protocol const type.
func PossibleProtocolValues() []Protocol {
return []Protocol{
ProtocolEncrypted,
ProtocolPlaintext,
}
}
// ToPtr returns a *Protocol pointing to the current value.
func (c Protocol) ToPtr() *Protocol {
return &c
}
// ProvisioningState - Current provisioning status
type ProvisioningState string
const (
ProvisioningStateCanceled ProvisioningState = "Canceled"
ProvisioningStateCreating ProvisioningState = "Creating"
ProvisioningStateDeleting ProvisioningState = "Deleting"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
ProvisioningStateUpdating ProvisioningState = "Updating"
)
// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{
ProvisioningStateCanceled,
ProvisioningStateCreating,
ProvisioningStateDeleting,
ProvisioningStateFailed,
ProvisioningStateSucceeded,
ProvisioningStateUpdating,
}
}
// ToPtr returns a *ProvisioningState pointing to the current value.
func (c ProvisioningState) ToPtr() *ProvisioningState {
return &c
}
// RdbFrequency - Sets the frequency at which a snapshot of the database is created.
type RdbFrequency string
const (
RdbFrequencyOneH RdbFrequency = "1h"
RdbFrequencySixH RdbFrequency = "6h"
RdbFrequencyTwelveH RdbFrequency = "12h"
)
// PossibleRdbFrequencyValues returns the possible values for the RdbFrequency const type.
func PossibleRdbFrequencyValues() []RdbFrequency {
return []RdbFrequency{
RdbFrequencyOneH,
RdbFrequencySixH,
RdbFrequencyTwelveH,
}
}
// ToPtr returns a *RdbFrequency pointing to the current value.
func (c RdbFrequency) ToPtr() *RdbFrequency {
return &c
}
// ResourceState - Current resource status
type ResourceState string
const (
ResourceStateCreateFailed ResourceState = "CreateFailed"
ResourceStateCreating ResourceState = "Creating"
ResourceStateDeleteFailed ResourceState = "DeleteFailed"
ResourceStateDeleting ResourceState = "Deleting"
ResourceStateDisableFailed ResourceState = "DisableFailed"
ResourceStateDisabled ResourceState = "Disabled"
ResourceStateDisabling ResourceState = "Disabling"
ResourceStateEnableFailed ResourceState = "EnableFailed"
ResourceStateEnabling ResourceState = "Enabling"
ResourceStateRunning ResourceState = "Running"
ResourceStateUpdateFailed ResourceState = "UpdateFailed"
ResourceStateUpdating ResourceState = "Updating"
)
// PossibleResourceStateValues returns the possible values for the ResourceState const type.
func PossibleResourceStateValues() []ResourceState {
return []ResourceState{
ResourceStateCreateFailed,
ResourceStateCreating,
ResourceStateDeleteFailed,
ResourceStateDeleting,
ResourceStateDisableFailed,
ResourceStateDisabled,
ResourceStateDisabling,
ResourceStateEnableFailed,
ResourceStateEnabling,
ResourceStateRunning,
ResourceStateUpdateFailed,
ResourceStateUpdating,
}
}
// ToPtr returns a *ResourceState pointing to the current value.
func (c ResourceState) ToPtr() *ResourceState {
return &c
}
// SKUName - The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.)
type SKUName string
const (
SKUNameEnterpriseE10 SKUName = "Enterprise_E10"
SKUNameEnterpriseE100 SKUName = "Enterprise_E100"
SKUNameEnterpriseE20 SKUName = "Enterprise_E20"
SKUNameEnterpriseE50 SKUName = "Enterprise_E50"
SKUNameEnterpriseFlashF1500 SKUName = "EnterpriseFlash_F1500"
SKUNameEnterpriseFlashF300 SKUName = "EnterpriseFlash_F300"
SKUNameEnterpriseFlashF700 SKUName = "EnterpriseFlash_F700"
)
// PossibleSKUNameValues returns the possible values for the SKUName const type.
func PossibleSKUNameValues() []SKUName {
return []SKUName{
SKUNameEnterpriseE10,
SKUNameEnterpriseE100,
SKUNameEnterpriseE20,
SKUNameEnterpriseE50,
SKUNameEnterpriseFlashF1500,
SKUNameEnterpriseFlashF300,
SKUNameEnterpriseFlashF700,
}
}
// ToPtr returns a *SKUName pointing to the current value.
func (c SKUName) ToPtr() *SKUName {
return &c
}
// TLSVersion - The minimum TLS version for the cluster to support, e.g. '1.2'
type TLSVersion string
const (
TLSVersionOne0 TLSVersion = "1.0"
TLSVersionOne1 TLSVersion = "1.1"
TLSVersionOne2 TLSVersion = "1.2"
)
// PossibleTLSVersionValues returns the possible values for the TLSVersion const type.
func PossibleTLSVersionValues() []TLSVersion {
return []TLSVersion{
TLSVersionOne0,
TLSVersionOne1,
TLSVersionOne2,
}
}
// ToPtr returns a *TLSVersion pointing to the current value.
func (c TLSVersion) ToPtr() *TLSVersion {
return &c
}

Просмотреть файл

@ -0,0 +1,723 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// DatabasesClient contains the methods for the Databases group.
// Don't use this type directly, use NewDatabasesClient() instead.
type DatabasesClient struct {
ep string
pl runtime.Pipeline
subscriptionID string
}
// NewDatabasesClient creates a new instance of DatabasesClient with the specified values.
func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// BeginCreate - Creates a database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database, options *DatabasesBeginCreateOptions) (DatabasesCreatePollerResponse, error) {
resp, err := client.create(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return DatabasesCreatePollerResponse{}, err
}
result := DatabasesCreatePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.Create", "original-uri", resp, client.pl, client.createHandleError)
if err != nil {
return DatabasesCreatePollerResponse{}, err
}
result.Poller = &DatabasesCreatePoller{
pt: pt,
}
return result, nil
}
// Create - Creates a database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) create(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database, options *DatabasesBeginCreateOptions) (*http.Response, error) {
req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) {
return nil, client.createHandleError(resp)
}
return resp, nil
}
// createCreateRequest creates the Create request.
func (client *DatabasesClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database, options *DatabasesBeginCreateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPut, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// createHandleError handles the Create error response.
func (client *DatabasesClient) createHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginDelete - Deletes a single database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesBeginDeleteOptions) (DatabasesDeletePollerResponse, error) {
resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, databaseName, options)
if err != nil {
return DatabasesDeletePollerResponse{}, err
}
result := DatabasesDeletePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.Delete", "azure-async-operation", resp, client.pl, client.deleteHandleError)
if err != nil {
return DatabasesDeletePollerResponse{}, err
}
result.Poller = &DatabasesDeletePoller{
pt: pt,
}
return result, nil
}
// Delete - Deletes a single database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesBeginDeleteOptions) (*http.Response, error) {
req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
return nil, client.deleteHandleError(resp)
}
return resp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// deleteHandleError handles the Delete error response.
func (client *DatabasesClient) deleteHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginExport - Exports a database file from target database.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginExport(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters, options *DatabasesBeginExportOptions) (DatabasesExportPollerResponse, error) {
resp, err := client.export(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return DatabasesExportPollerResponse{}, err
}
result := DatabasesExportPollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.Export", "azure-async-operation", resp, client.pl, client.exportHandleError)
if err != nil {
return DatabasesExportPollerResponse{}, err
}
result.Poller = &DatabasesExportPoller{
pt: pt,
}
return result, nil
}
// Export - Exports a database file from target database.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) export(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters, options *DatabasesBeginExportOptions) (*http.Response, error) {
req, err := client.exportCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {
return nil, client.exportHandleError(resp)
}
return resp, nil
}
// exportCreateRequest creates the Export request.
func (client *DatabasesClient) exportCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters, options *DatabasesBeginExportOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPost, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// exportHandleError handles the Export error response.
func (client *DatabasesClient) exportHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// Get - Gets information about a database in a RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesGetOptions) (DatabasesGetResponse, error) {
req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options)
if err != nil {
return DatabasesGetResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return DatabasesGetResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return DatabasesGetResponse{}, client.getHandleError(resp)
}
return client.getHandleResponse(resp)
}
// getCreateRequest creates the Get request.
func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// getHandleResponse handles the Get response.
func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) {
result := DatabasesGetResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil {
return DatabasesGetResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// getHandleError handles the Get error response.
func (client *DatabasesClient) getHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginImport - Imports database files to target database.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginImport(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters, options *DatabasesBeginImportOptions) (DatabasesImportPollerResponse, error) {
resp, err := client.importOperation(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return DatabasesImportPollerResponse{}, err
}
result := DatabasesImportPollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.Import", "azure-async-operation", resp, client.pl, client.importHandleError)
if err != nil {
return DatabasesImportPollerResponse{}, err
}
result.Poller = &DatabasesImportPoller{
pt: pt,
}
return result, nil
}
// Import - Imports database files to target database.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) importOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters, options *DatabasesBeginImportOptions) (*http.Response, error) {
req, err := client.importCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {
return nil, client.importHandleError(resp)
}
return resp, nil
}
// importCreateRequest creates the Import request.
func (client *DatabasesClient) importCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters, options *DatabasesBeginImportOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPost, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// importHandleError handles the Import error response.
func (client *DatabasesClient) importHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// ListByCluster - Gets all databases in the specified RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) ListByCluster(resourceGroupName string, clusterName string, options *DatabasesListByClusterOptions) *DatabasesListByClusterPager {
return &DatabasesListByClusterPager{
client: client,
requester: func(ctx context.Context) (*policy.Request, error) {
return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options)
},
advancer: func(ctx context.Context, resp DatabasesListByClusterResponse) (*policy.Request, error) {
return runtime.NewRequest(ctx, http.MethodGet, *resp.DatabaseList.NextLink)
},
}
}
// listByClusterCreateRequest creates the ListByCluster request.
func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *DatabasesListByClusterOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases"
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 clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listByClusterHandleResponse handles the ListByCluster response.
func (client *DatabasesClient) listByClusterHandleResponse(resp *http.Response) (DatabasesListByClusterResponse, error) {
result := DatabasesListByClusterResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseList); err != nil {
return DatabasesListByClusterResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listByClusterHandleError handles the ListByCluster error response.
func (client *DatabasesClient) listByClusterHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// ListKeys - Retrieves the access keys for the RedisEnterprise database.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) ListKeys(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesListKeysOptions) (DatabasesListKeysResponse, error) {
req, err := client.listKeysCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options)
if err != nil {
return DatabasesListKeysResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return DatabasesListKeysResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return DatabasesListKeysResponse{}, client.listKeysHandleError(resp)
}
return client.listKeysHandleResponse(resp)
}
// listKeysCreateRequest creates the ListKeys request.
func (client *DatabasesClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesListKeysOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/listKeys"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPost, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listKeysHandleResponse handles the ListKeys response.
func (client *DatabasesClient) listKeysHandleResponse(resp *http.Response) (DatabasesListKeysResponse, error) {
result := DatabasesListKeysResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil {
return DatabasesListKeysResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listKeysHandleError handles the ListKeys error response.
func (client *DatabasesClient) listKeysHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginRegenerateKey - Regenerates the RedisEnterprise database's access keys.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginRegenerateKey(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters, options *DatabasesBeginRegenerateKeyOptions) (DatabasesRegenerateKeyPollerResponse, error) {
resp, err := client.regenerateKey(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return DatabasesRegenerateKeyPollerResponse{}, err
}
result := DatabasesRegenerateKeyPollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.RegenerateKey", "azure-async-operation", resp, client.pl, client.regenerateKeyHandleError)
if err != nil {
return DatabasesRegenerateKeyPollerResponse{}, err
}
result.Poller = &DatabasesRegenerateKeyPoller{
pt: pt,
}
return result, nil
}
// RegenerateKey - Regenerates the RedisEnterprise database's access keys.
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) regenerateKey(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters, options *DatabasesBeginRegenerateKeyOptions) (*http.Response, error) {
req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {
return nil, client.regenerateKeyHandleError(resp)
}
return resp, nil
}
// regenerateKeyCreateRequest creates the RegenerateKey request.
func (client *DatabasesClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters, options *DatabasesBeginRegenerateKeyOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPost, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// regenerateKeyHandleError handles the RegenerateKey error response.
func (client *DatabasesClient) regenerateKeyHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginUpdate - Updates a database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate, options *DatabasesBeginUpdateOptions) (DatabasesUpdatePollerResponse, error) {
resp, err := client.update(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return DatabasesUpdatePollerResponse{}, err
}
result := DatabasesUpdatePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("DatabasesClient.Update", "azure-async-operation", resp, client.pl, client.updateHandleError)
if err != nil {
return DatabasesUpdatePollerResponse{}, err
}
result.Poller = &DatabasesUpdatePoller{
pt: pt,
}
return result, nil
}
// Update - Updates a database
// If the operation fails it returns the *ErrorResponse error type.
func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate, options *DatabasesBeginUpdateOptions) (*http.Response, error) {
req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {
return nil, client.updateHandleError(resp)
}
return resp, nil
}
// updateCreateRequest creates the Update request.
func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate, options *DatabasesBeginUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if databaseName == "" {
return nil, errors.New("parameter databaseName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName))
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.MethodPatch, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// updateHandleError handles the Update error response.
func (client *DatabasesClient) updateHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,675 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"encoding/json"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// AccessKeys - The secret access keys used for authenticating connections to redis
type AccessKeys struct {
// READ-ONLY; The current primary key that clients can use to authenticate
PrimaryKey *string `json:"primaryKey,omitempty" azure:"ro"`
// READ-ONLY; The current secondary key that clients can use to authenticate
SecondaryKey *string `json:"secondaryKey,omitempty" azure:"ro"`
}
// Cluster - Describes the RedisEnterprise cluster
type Cluster struct {
TrackedResource
// REQUIRED; The SKU to create, which affects price, performance, and features.
SKU *SKU `json:"sku,omitempty"`
// Other properties of the cluster.
Properties *ClusterProperties `json:"properties,omitempty"`
// The Availability Zones where this cluster will be deployed.
Zones []*string `json:"zones,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type Cluster.
func (c Cluster) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
c.TrackedResource.marshalInternal(objectMap)
populate(objectMap, "properties", c.Properties)
populate(objectMap, "sku", c.SKU)
populate(objectMap, "zones", c.Zones)
return json.Marshal(objectMap)
}
// ClusterList - The response of a list-all operation.
type ClusterList struct {
// List of clusters.
Value []*Cluster `json:"value,omitempty"`
// READ-ONLY; The URI to fetch the next page of results.
NextLink *string `json:"nextLink,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type ClusterList.
func (c ClusterList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", c.NextLink)
populate(objectMap, "value", c.Value)
return json.Marshal(objectMap)
}
// ClusterProperties - Properties of RedisEnterprise clusters, as opposed to general resource properties like location, tags
type ClusterProperties struct {
// The minimum TLS version for the cluster to support, e.g. '1.2'
MinimumTLSVersion *TLSVersion `json:"minimumTlsVersion,omitempty"`
// READ-ONLY; DNS name of the cluster endpoint
HostName *string `json:"hostName,omitempty" azure:"ro"`
// READ-ONLY; List of private endpoint connections associated with the specified RedisEnterprise cluster
PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"`
// READ-ONLY; Current provisioning status of the cluster
ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"`
// READ-ONLY; Version of redis the cluster supports, e.g. '6'
RedisVersion *string `json:"redisVersion,omitempty" azure:"ro"`
// READ-ONLY; Current resource status of the cluster
ResourceState *ResourceState `json:"resourceState,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type ClusterProperties.
func (c ClusterProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "hostName", c.HostName)
populate(objectMap, "minimumTlsVersion", c.MinimumTLSVersion)
populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections)
populate(objectMap, "provisioningState", c.ProvisioningState)
populate(objectMap, "redisVersion", c.RedisVersion)
populate(objectMap, "resourceState", c.ResourceState)
return json.Marshal(objectMap)
}
// ClusterUpdate - A partial update to the RedisEnterprise cluster
type ClusterUpdate struct {
// Other properties of the cluster.
Properties *ClusterProperties `json:"properties,omitempty"`
// The SKU to create, which affects price, performance, and features.
SKU *SKU `json:"sku,omitempty"`
// Resource tags.
Tags map[string]*string `json:"tags,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type ClusterUpdate.
func (c ClusterUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "properties", c.Properties)
populate(objectMap, "sku", c.SKU)
populate(objectMap, "tags", c.Tags)
return json.Marshal(objectMap)
}
// Database - Describes a database on the RedisEnterprise cluster
type Database struct {
ProxyResource
// Other properties of the database.
Properties *DatabaseProperties `json:"properties,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type Database.
func (d Database) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
d.ProxyResource.marshalInternal(objectMap)
populate(objectMap, "properties", d.Properties)
return json.Marshal(objectMap)
}
// DatabaseList - The response of a list-all operation.
type DatabaseList struct {
// List of databases
Value []*Database `json:"value,omitempty"`
// READ-ONLY; The URI to fetch the next page of results.
NextLink *string `json:"nextLink,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type DatabaseList.
func (d DatabaseList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", d.NextLink)
populate(objectMap, "value", d.Value)
return json.Marshal(objectMap)
}
// DatabaseProperties - Properties of RedisEnterprise databases, as opposed to general resource properties like location, tags
type DatabaseProperties struct {
// Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted.
ClientProtocol *Protocol `json:"clientProtocol,omitempty"`
// Clustering policy - default is OSSCluster. Specified at create time.
ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"`
// Redis eviction policy - default is VolatileLRU
EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"`
// Optional set of redis modules to enable in this database - modules can only be added at creation time.
Modules []*Module `json:"modules,omitempty"`
// Persistence settings
Persistence *Persistence `json:"persistence,omitempty"`
// TCP port of the database endpoint. Specified at create time. Defaults to an available port.
Port *int32 `json:"port,omitempty"`
// READ-ONLY; Current provisioning status of the database
ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"`
// READ-ONLY; Current resource status of the database
ResourceState *ResourceState `json:"resourceState,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type DatabaseProperties.
func (d DatabaseProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "clientProtocol", d.ClientProtocol)
populate(objectMap, "clusteringPolicy", d.ClusteringPolicy)
populate(objectMap, "evictionPolicy", d.EvictionPolicy)
populate(objectMap, "modules", d.Modules)
populate(objectMap, "persistence", d.Persistence)
populate(objectMap, "port", d.Port)
populate(objectMap, "provisioningState", d.ProvisioningState)
populate(objectMap, "resourceState", d.ResourceState)
return json.Marshal(objectMap)
}
// DatabaseUpdate - A partial update to the RedisEnterprise database
type DatabaseUpdate struct {
// Properties of the database.
Properties *DatabaseProperties `json:"properties,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type DatabaseUpdate.
func (d DatabaseUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "properties", d.Properties)
return json.Marshal(objectMap)
}
// DatabasesBeginCreateOptions contains the optional parameters for the Databases.BeginCreate method.
type DatabasesBeginCreateOptions struct {
// placeholder for future optional parameters
}
// DatabasesBeginDeleteOptions contains the optional parameters for the Databases.BeginDelete method.
type DatabasesBeginDeleteOptions struct {
// placeholder for future optional parameters
}
// DatabasesBeginExportOptions contains the optional parameters for the Databases.BeginExport method.
type DatabasesBeginExportOptions struct {
// placeholder for future optional parameters
}
// DatabasesBeginImportOptions contains the optional parameters for the Databases.BeginImport method.
type DatabasesBeginImportOptions struct {
// placeholder for future optional parameters
}
// DatabasesBeginRegenerateKeyOptions contains the optional parameters for the Databases.BeginRegenerateKey method.
type DatabasesBeginRegenerateKeyOptions struct {
// placeholder for future optional parameters
}
// DatabasesBeginUpdateOptions contains the optional parameters for the Databases.BeginUpdate method.
type DatabasesBeginUpdateOptions struct {
// placeholder for future optional parameters
}
// DatabasesGetOptions contains the optional parameters for the Databases.Get method.
type DatabasesGetOptions struct {
// placeholder for future optional parameters
}
// DatabasesListByClusterOptions contains the optional parameters for the Databases.ListByCluster method.
type DatabasesListByClusterOptions struct {
// placeholder for future optional parameters
}
// DatabasesListKeysOptions contains the optional parameters for the Databases.ListKeys method.
type DatabasesListKeysOptions struct {
// placeholder for future optional parameters
}
// ErrorAdditionalInfo - The resource management error additional info.
type ErrorAdditionalInfo struct {
// READ-ONLY; The additional info.
Info map[string]interface{} `json:"info,omitempty" azure:"ro"`
// READ-ONLY; The additional info type.
Type *string `json:"type,omitempty" azure:"ro"`
}
// ErrorDetail - The error detail.
type ErrorDetail struct {
// READ-ONLY; The error additional info.
AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`
// READ-ONLY; The error code.
Code *string `json:"code,omitempty" azure:"ro"`
// READ-ONLY; The error details.
Details []*ErrorDetail `json:"details,omitempty" azure:"ro"`
// READ-ONLY; The error message.
Message *string `json:"message,omitempty" azure:"ro"`
// READ-ONLY; The error target.
Target *string `json:"target,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type ErrorDetail.
func (e ErrorDetail) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "additionalInfo", e.AdditionalInfo)
populate(objectMap, "code", e.Code)
populate(objectMap, "details", e.Details)
populate(objectMap, "message", e.Message)
populate(objectMap, "target", e.Target)
return json.Marshal(objectMap)
}
// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData
// error response format.).
// Implements the error and azcore.HTTPResponse interfaces.
type ErrorResponse struct {
raw string
// The error object.
InnerError *ErrorDetail `json:"error,omitempty"`
}
// Error implements the error interface for type ErrorResponse.
// The contents of the error text are not contractual and subject to change.
func (e ErrorResponse) Error() string {
return e.raw
}
// ExportClusterParameters - Parameters for a Redis Enterprise export operation.
type ExportClusterParameters struct {
// REQUIRED; SAS URI for the target directory to export to
SasURI *string `json:"sasUri,omitempty"`
}
// ImportClusterParameters - Parameters for a Redis Enterprise import operation.
type ImportClusterParameters struct {
// REQUIRED; SAS URIs for the target blobs to import from
SasUris []*string `json:"sasUris,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type ImportClusterParameters.
func (i ImportClusterParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "sasUris", i.SasUris)
return json.Marshal(objectMap)
}
// Module - Specifies configuration of a redis module
type Module struct {
// REQUIRED; The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries'
Name *string `json:"name,omitempty"`
// Configuration options for the module, e.g. 'ERRORRATE 0.00 INITIALSIZE 400'.
Args *string `json:"args,omitempty"`
// READ-ONLY; The version of the module, e.g. '1.0'.
Version *string `json:"version,omitempty" azure:"ro"`
}
// Operation - Details of a REST API operation, returned from the Resource Provider Operations API
type Operation struct {
// Localized display information for this particular operation.
Display *OperationDisplay `json:"display,omitempty"`
// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
ActionType *ActionType `json:"actionType,omitempty" azure:"ro"`
// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations.
IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"`
// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
Name *string `json:"name,omitempty" azure:"ro"`
// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
Origin *Origin `json:"origin,omitempty" azure:"ro"`
}
// OperationDisplay - Localized display information for this particular operation.
type OperationDisplay struct {
// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
Description *string `json:"description,omitempty" azure:"ro"`
// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual
// Machine".
Operation *string `json:"operation,omitempty" azure:"ro"`
// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute".
Provider *string `json:"provider,omitempty" azure:"ro"`
// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections".
Resource *string `json:"resource,omitempty" azure:"ro"`
}
// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
type OperationListResult struct {
// READ-ONLY; URL to get the next set of operation list results (if there are any).
NextLink *string `json:"nextLink,omitempty" azure:"ro"`
// READ-ONLY; List of operations supported by the resource provider
Value []*Operation `json:"value,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// OperationStatus - The status of a long-running operation.
type OperationStatus struct {
// The end time of the operation.
EndTime *string `json:"endTime,omitempty"`
// Error response describing why the operation failed.
Error *ErrorResponse `json:"error,omitempty"`
// The operation's unique id.
ID *string `json:"id,omitempty"`
// The operation's name.
Name *string `json:"name,omitempty"`
// The start time of the operation.
StartTime *string `json:"startTime,omitempty"`
// The current status of the operation.
Status *string `json:"status,omitempty"`
}
// OperationsListOptions contains the optional parameters for the Operations.List method.
type OperationsListOptions struct {
// placeholder for future optional parameters
}
// OperationsStatusGetOptions contains the optional parameters for the OperationsStatus.Get method.
type OperationsStatusGetOptions struct {
// placeholder for future optional parameters
}
// Persistence-related configuration for the RedisEnterprise database
type Persistence struct {
// Sets whether AOF is enabled.
AofEnabled *bool `json:"aofEnabled,omitempty"`
// Sets the frequency at which data is written to disk.
AofFrequency *AofFrequency `json:"aofFrequency,omitempty"`
// Sets whether RDB is enabled.
RdbEnabled *bool `json:"rdbEnabled,omitempty"`
// Sets the frequency at which a snapshot of the database is created.
RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"`
}
// PrivateEndpoint - The Private Endpoint resource.
type PrivateEndpoint struct {
// READ-ONLY; The ARM identifier for Private Endpoint
ID *string `json:"id,omitempty" azure:"ro"`
}
// PrivateEndpointConnection - The Private Endpoint Connection resource.
type PrivateEndpointConnection struct {
Resource
// Resource properties.
Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection.
func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
p.Resource.marshalInternal(objectMap)
populate(objectMap, "properties", p.Properties)
return json.Marshal(objectMap)
}
// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account
type PrivateEndpointConnectionListResult struct {
// Array of private endpoint connections
Value []*PrivateEndpointConnection `json:"value,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult.
func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "value", p.Value)
return json.Marshal(objectMap)
}
// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties.
type PrivateEndpointConnectionProperties struct {
// REQUIRED; A collection of information about the state of the connection between service consumer and provider.
PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"`
// The resource of private end point.
PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"`
// READ-ONLY; The provisioning state of the private endpoint connection resource.
ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"`
}
// PrivateEndpointConnectionsBeginPutOptions contains the optional parameters for the PrivateEndpointConnections.BeginPut method.
type PrivateEndpointConnectionsBeginPutOptions struct {
// placeholder for future optional parameters
}
// PrivateEndpointConnectionsDeleteOptions contains the optional parameters for the PrivateEndpointConnections.Delete method.
type PrivateEndpointConnectionsDeleteOptions struct {
// placeholder for future optional parameters
}
// PrivateEndpointConnectionsGetOptions contains the optional parameters for the PrivateEndpointConnections.Get method.
type PrivateEndpointConnectionsGetOptions struct {
// placeholder for future optional parameters
}
// PrivateEndpointConnectionsListOptions contains the optional parameters for the PrivateEndpointConnections.List method.
type PrivateEndpointConnectionsListOptions struct {
// placeholder for future optional parameters
}
// PrivateLinkResource - A private link resource
type PrivateLinkResource struct {
Resource
// Resource properties.
Properties *PrivateLinkResourceProperties `json:"properties,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource.
func (p PrivateLinkResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
p.Resource.marshalInternal(objectMap)
populate(objectMap, "properties", p.Properties)
return json.Marshal(objectMap)
}
// PrivateLinkResourceListResult - A list of private link resources
type PrivateLinkResourceListResult struct {
// Array of private link resources
Value []*PrivateLinkResource `json:"value,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult.
func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "value", p.Value)
return json.Marshal(objectMap)
}
// PrivateLinkResourceProperties - Properties of a private link resource.
type PrivateLinkResourceProperties struct {
// The private link resource Private link DNS zone name.
RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"`
// READ-ONLY; The private link resource group id.
GroupID *string `json:"groupId,omitempty" azure:"ro"`
// READ-ONLY; The private link resource required member names.
RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties.
func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "groupId", p.GroupID)
populate(objectMap, "requiredMembers", p.RequiredMembers)
populate(objectMap, "requiredZoneNames", p.RequiredZoneNames)
return json.Marshal(objectMap)
}
// PrivateLinkResourcesListByClusterOptions contains the optional parameters for the PrivateLinkResources.ListByCluster method.
type PrivateLinkResourcesListByClusterOptions struct {
// placeholder for future optional parameters
}
// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider.
type PrivateLinkServiceConnectionState struct {
// A message indicating if changes on the service provider require any updates on the consumer.
ActionsRequired *string `json:"actionsRequired,omitempty"`
// The reason for approval/rejection of the connection.
Description *string `json:"description,omitempty"`
// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"`
}
// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location
type ProxyResource struct {
Resource
}
func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) {
p.Resource.marshalInternal(objectMap)
}
// RedisEnterpriseBeginCreateOptions contains the optional parameters for the RedisEnterprise.BeginCreate method.
type RedisEnterpriseBeginCreateOptions struct {
// placeholder for future optional parameters
}
// RedisEnterpriseBeginDeleteOptions contains the optional parameters for the RedisEnterprise.BeginDelete method.
type RedisEnterpriseBeginDeleteOptions struct {
// placeholder for future optional parameters
}
// RedisEnterpriseBeginUpdateOptions contains the optional parameters for the RedisEnterprise.BeginUpdate method.
type RedisEnterpriseBeginUpdateOptions struct {
// placeholder for future optional parameters
}
// RedisEnterpriseGetOptions contains the optional parameters for the RedisEnterprise.Get method.
type RedisEnterpriseGetOptions struct {
// placeholder for future optional parameters
}
// RedisEnterpriseListByResourceGroupOptions contains the optional parameters for the RedisEnterprise.ListByResourceGroup method.
type RedisEnterpriseListByResourceGroupOptions struct {
// placeholder for future optional parameters
}
// RedisEnterpriseListOptions contains the optional parameters for the RedisEnterprise.List method.
type RedisEnterpriseListOptions struct {
// placeholder for future optional parameters
}
// RegenerateKeyParameters - Specifies which access keys to reset to a new random value.
type RegenerateKeyParameters struct {
// REQUIRED; Which access key to regenerate.
KeyType *AccessKeyType `json:"keyType,omitempty"`
}
// Resource - Common fields that are returned in the response for all Azure Resource Manager resources
type Resource struct {
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string `json:"id,omitempty" azure:"ro"`
// READ-ONLY; The name of the resource
Name *string `json:"name,omitempty" azure:"ro"`
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string `json:"type,omitempty" azure:"ro"`
}
// MarshalJSON implements the json.Marshaller interface for type Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
r.marshalInternal(objectMap)
return json.Marshal(objectMap)
}
func (r Resource) marshalInternal(objectMap map[string]interface{}) {
populate(objectMap, "id", r.ID)
populate(objectMap, "name", r.Name)
populate(objectMap, "type", r.Type)
}
// SKU parameters supplied to the create RedisEnterprise operation.
type SKU struct {
// REQUIRED; The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.)
Name *SKUName `json:"name,omitempty"`
// The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, …) for Enterprise SKUs and (3, 9, 15, …) for
// Flash SKUs.
Capacity *int32 `json:"capacity,omitempty"`
}
// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'
type TrackedResource struct {
Resource
// REQUIRED; The geo-location where the resource lives
Location *string `json:"location,omitempty"`
// Resource tags.
Tags map[string]*string `json:"tags,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type TrackedResource.
func (t TrackedResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
t.marshalInternal(objectMap)
return json.Marshal(objectMap)
}
func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) {
t.Resource.marshalInternal(objectMap)
populate(objectMap, "location", t.Location)
populate(objectMap, "tags", t.Tags)
}
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
}
}

Просмотреть файл

@ -0,0 +1,89 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
)
// OperationsClient contains the methods for the Operations group.
// Don't use this type directly, use NewOperationsClient() instead.
type OperationsClient struct {
ep string
pl runtime.Pipeline
}
// NewOperationsClient creates a new instance of OperationsClient with the specified values.
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// List - Lists all of the available REST API operations of the Microsoft.Cache provider.
// If the operation fails it returns the *ErrorResponse error type.
func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager {
return &OperationsListPager{
client: client,
requester: func(ctx context.Context) (*policy.Request, error) {
return client.listCreateRequest(ctx, options)
},
advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) {
return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink)
},
}
}
// listCreateRequest creates the List request.
func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) {
urlPath := "/providers/Microsoft.Cache/operations"
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listHandleResponse handles the List response.
func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) {
result := OperationsListResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil {
return OperationsListResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listHandleError handles the List error response.
func (client *OperationsClient) listHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,108 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// OperationsStatusClient contains the methods for the OperationsStatus group.
// Don't use this type directly, use NewOperationsStatusClient() instead.
type OperationsStatusClient struct {
ep string
pl runtime.Pipeline
subscriptionID string
}
// NewOperationsStatusClient creates a new instance of OperationsStatusClient with the specified values.
func NewOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsStatusClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &OperationsStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// Get - Gets the status of operation.
// If the operation fails it returns the *ErrorResponse error type.
func (client *OperationsStatusClient) Get(ctx context.Context, location string, operationID string, options *OperationsStatusGetOptions) (OperationsStatusGetResponse, error) {
req, err := client.getCreateRequest(ctx, location, operationID, options)
if err != nil {
return OperationsStatusGetResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return OperationsStatusGetResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return OperationsStatusGetResponse{}, client.getHandleError(resp)
}
return client.getHandleResponse(resp)
}
// getCreateRequest creates the Get request.
func (client *OperationsStatusClient) getCreateRequest(ctx context.Context, location string, operationID string, options *OperationsStatusGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId}"
if location == "" {
return nil, errors.New("parameter location cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location))
if operationID == "" {
return nil, errors.New("parameter operationID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// getHandleResponse handles the Get response.
func (client *OperationsStatusClient) getHandleResponse(resp *http.Response) (OperationsStatusGetResponse, error) {
result := OperationsStatusGetResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil {
return OperationsStatusGetResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// getHandleError handles the Get error response.
func (client *OperationsStatusClient) getHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,233 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"reflect"
)
// DatabasesListByClusterPager provides operations for iterating over paged responses.
type DatabasesListByClusterPager struct {
client *DatabasesClient
current DatabasesListByClusterResponse
err error
requester func(context.Context) (*policy.Request, error)
advancer func(context.Context, DatabasesListByClusterResponse) (*policy.Request, error)
}
// Err returns the last error encountered while paging.
func (p *DatabasesListByClusterPager) Err() error {
return p.err
}
// NextPage returns true if the pager advanced to the next page.
// Returns false if there are no more pages or an error occurred.
func (p *DatabasesListByClusterPager) NextPage(ctx context.Context) bool {
var req *policy.Request
var err error
if !reflect.ValueOf(p.current).IsZero() {
if p.current.DatabaseList.NextLink == nil || len(*p.current.DatabaseList.NextLink) == 0 {
return false
}
req, err = p.advancer(ctx, p.current)
} else {
req, err = p.requester(ctx)
}
if err != nil {
p.err = err
return false
}
resp, err := p.client.pl.Do(req)
if err != nil {
p.err = err
return false
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
p.err = p.client.listByClusterHandleError(resp)
return false
}
result, err := p.client.listByClusterHandleResponse(resp)
if err != nil {
p.err = err
return false
}
p.current = result
return true
}
// PageResponse returns the current DatabasesListByClusterResponse page.
func (p *DatabasesListByClusterPager) PageResponse() DatabasesListByClusterResponse {
return p.current
}
// OperationsListPager provides operations for iterating over paged responses.
type OperationsListPager struct {
client *OperationsClient
current OperationsListResponse
err error
requester func(context.Context) (*policy.Request, error)
advancer func(context.Context, OperationsListResponse) (*policy.Request, error)
}
// Err returns the last error encountered while paging.
func (p *OperationsListPager) Err() error {
return p.err
}
// NextPage returns true if the pager advanced to the next page.
// Returns false if there are no more pages or an error occurred.
func (p *OperationsListPager) NextPage(ctx context.Context) bool {
var req *policy.Request
var err error
if !reflect.ValueOf(p.current).IsZero() {
if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.NextLink) == 0 {
return false
}
req, err = p.advancer(ctx, p.current)
} else {
req, err = p.requester(ctx)
}
if err != nil {
p.err = err
return false
}
resp, err := p.client.pl.Do(req)
if err != nil {
p.err = err
return false
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
p.err = p.client.listHandleError(resp)
return false
}
result, err := p.client.listHandleResponse(resp)
if err != nil {
p.err = err
return false
}
p.current = result
return true
}
// PageResponse returns the current OperationsListResponse page.
func (p *OperationsListPager) PageResponse() OperationsListResponse {
return p.current
}
// RedisEnterpriseListByResourceGroupPager provides operations for iterating over paged responses.
type RedisEnterpriseListByResourceGroupPager struct {
client *RedisEnterpriseClient
current RedisEnterpriseListByResourceGroupResponse
err error
requester func(context.Context) (*policy.Request, error)
advancer func(context.Context, RedisEnterpriseListByResourceGroupResponse) (*policy.Request, error)
}
// Err returns the last error encountered while paging.
func (p *RedisEnterpriseListByResourceGroupPager) Err() error {
return p.err
}
// NextPage returns true if the pager advanced to the next page.
// Returns false if there are no more pages or an error occurred.
func (p *RedisEnterpriseListByResourceGroupPager) NextPage(ctx context.Context) bool {
var req *policy.Request
var err error
if !reflect.ValueOf(p.current).IsZero() {
if p.current.ClusterList.NextLink == nil || len(*p.current.ClusterList.NextLink) == 0 {
return false
}
req, err = p.advancer(ctx, p.current)
} else {
req, err = p.requester(ctx)
}
if err != nil {
p.err = err
return false
}
resp, err := p.client.pl.Do(req)
if err != nil {
p.err = err
return false
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
p.err = p.client.listByResourceGroupHandleError(resp)
return false
}
result, err := p.client.listByResourceGroupHandleResponse(resp)
if err != nil {
p.err = err
return false
}
p.current = result
return true
}
// PageResponse returns the current RedisEnterpriseListByResourceGroupResponse page.
func (p *RedisEnterpriseListByResourceGroupPager) PageResponse() RedisEnterpriseListByResourceGroupResponse {
return p.current
}
// RedisEnterpriseListPager provides operations for iterating over paged responses.
type RedisEnterpriseListPager struct {
client *RedisEnterpriseClient
current RedisEnterpriseListResponse
err error
requester func(context.Context) (*policy.Request, error)
advancer func(context.Context, RedisEnterpriseListResponse) (*policy.Request, error)
}
// Err returns the last error encountered while paging.
func (p *RedisEnterpriseListPager) Err() error {
return p.err
}
// NextPage returns true if the pager advanced to the next page.
// Returns false if there are no more pages or an error occurred.
func (p *RedisEnterpriseListPager) NextPage(ctx context.Context) bool {
var req *policy.Request
var err error
if !reflect.ValueOf(p.current).IsZero() {
if p.current.ClusterList.NextLink == nil || len(*p.current.ClusterList.NextLink) == 0 {
return false
}
req, err = p.advancer(ctx, p.current)
} else {
req, err = p.requester(ctx)
}
if err != nil {
p.err = err
return false
}
resp, err := p.client.pl.Do(req)
if err != nil {
p.err = err
return false
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
p.err = p.client.listHandleError(resp)
return false
}
result, err := p.client.listHandleResponse(resp)
if err != nil {
p.err = err
return false
}
p.current = result
return true
}
// PageResponse returns the current RedisEnterpriseListResponse page.
func (p *RedisEnterpriseListPager) PageResponse() RedisEnterpriseListResponse {
return p.current
}

Просмотреть файл

@ -0,0 +1,445 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"net/http"
)
// DatabasesCreatePoller provides polling facilities until the operation reaches a terminal state.
type DatabasesCreatePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesCreatePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesCreatePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesCreateResponse will be returned.
func (p *DatabasesCreatePoller) FinalResponse(ctx context.Context) (DatabasesCreateResponse, error) {
respType := DatabasesCreateResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.Database)
if err != nil {
return DatabasesCreateResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesCreatePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// DatabasesDeletePoller provides polling facilities until the operation reaches a terminal state.
type DatabasesDeletePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesDeletePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesDeletePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesDeleteResponse will be returned.
func (p *DatabasesDeletePoller) FinalResponse(ctx context.Context) (DatabasesDeleteResponse, error) {
respType := DatabasesDeleteResponse{}
resp, err := p.pt.FinalResponse(ctx, nil)
if err != nil {
return DatabasesDeleteResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesDeletePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// DatabasesExportPoller provides polling facilities until the operation reaches a terminal state.
type DatabasesExportPoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesExportPoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesExportPoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesExportResponse will be returned.
func (p *DatabasesExportPoller) FinalResponse(ctx context.Context) (DatabasesExportResponse, error) {
respType := DatabasesExportResponse{}
resp, err := p.pt.FinalResponse(ctx, nil)
if err != nil {
return DatabasesExportResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesExportPoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// DatabasesImportPoller provides polling facilities until the operation reaches a terminal state.
type DatabasesImportPoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesImportPoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesImportPoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesImportResponse will be returned.
func (p *DatabasesImportPoller) FinalResponse(ctx context.Context) (DatabasesImportResponse, error) {
respType := DatabasesImportResponse{}
resp, err := p.pt.FinalResponse(ctx, nil)
if err != nil {
return DatabasesImportResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesImportPoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// DatabasesRegenerateKeyPoller provides polling facilities until the operation reaches a terminal state.
type DatabasesRegenerateKeyPoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesRegenerateKeyPoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesRegenerateKeyPoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesRegenerateKeyResponse will be returned.
func (p *DatabasesRegenerateKeyPoller) FinalResponse(ctx context.Context) (DatabasesRegenerateKeyResponse, error) {
respType := DatabasesRegenerateKeyResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.AccessKeys)
if err != nil {
return DatabasesRegenerateKeyResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesRegenerateKeyPoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// DatabasesUpdatePoller provides polling facilities until the operation reaches a terminal state.
type DatabasesUpdatePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *DatabasesUpdatePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *DatabasesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final DatabasesUpdateResponse will be returned.
func (p *DatabasesUpdatePoller) FinalResponse(ctx context.Context) (DatabasesUpdateResponse, error) {
respType := DatabasesUpdateResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.Database)
if err != nil {
return DatabasesUpdateResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *DatabasesUpdatePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// PrivateEndpointConnectionsPutPoller provides polling facilities until the operation reaches a terminal state.
type PrivateEndpointConnectionsPutPoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *PrivateEndpointConnectionsPutPoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *PrivateEndpointConnectionsPutPoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final PrivateEndpointConnectionsPutResponse will be returned.
func (p *PrivateEndpointConnectionsPutPoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsPutResponse, error) {
respType := PrivateEndpointConnectionsPutResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection)
if err != nil {
return PrivateEndpointConnectionsPutResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *PrivateEndpointConnectionsPutPoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// RedisEnterpriseCreatePoller provides polling facilities until the operation reaches a terminal state.
type RedisEnterpriseCreatePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *RedisEnterpriseCreatePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *RedisEnterpriseCreatePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final RedisEnterpriseCreateResponse will be returned.
func (p *RedisEnterpriseCreatePoller) FinalResponse(ctx context.Context) (RedisEnterpriseCreateResponse, error) {
respType := RedisEnterpriseCreateResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.Cluster)
if err != nil {
return RedisEnterpriseCreateResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *RedisEnterpriseCreatePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// RedisEnterpriseDeletePoller provides polling facilities until the operation reaches a terminal state.
type RedisEnterpriseDeletePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *RedisEnterpriseDeletePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *RedisEnterpriseDeletePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final RedisEnterpriseDeleteResponse will be returned.
func (p *RedisEnterpriseDeletePoller) FinalResponse(ctx context.Context) (RedisEnterpriseDeleteResponse, error) {
respType := RedisEnterpriseDeleteResponse{}
resp, err := p.pt.FinalResponse(ctx, nil)
if err != nil {
return RedisEnterpriseDeleteResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *RedisEnterpriseDeletePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}
// RedisEnterpriseUpdatePoller provides polling facilities until the operation reaches a terminal state.
type RedisEnterpriseUpdatePoller struct {
pt *azcore.Poller
}
// Done returns true if the LRO has reached a terminal state.
func (p *RedisEnterpriseUpdatePoller) Done() bool {
return p.pt.Done()
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
// If the LRO has completed successfully, the poller's state is updated and the HTTP
// response is returned.
// If the LRO has completed with failure or was cancelled, the poller's state is
// updated and the error is returned.
// If the LRO has not reached a terminal state, the poller's state is updated and
// the latest HTTP response is returned.
// If Poll fails, the poller's state is unmodified and the error is returned.
// Calling Poll on an LRO that has reached a terminal state will return the final
// HTTP response or error.
func (p *RedisEnterpriseUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {
return p.pt.Poll(ctx)
}
// FinalResponse performs a final GET to the service and returns the final response
// for the polling operation. If there is an error performing the final GET then an error is returned.
// If the final GET succeeded then the final RedisEnterpriseUpdateResponse will be returned.
func (p *RedisEnterpriseUpdatePoller) FinalResponse(ctx context.Context) (RedisEnterpriseUpdateResponse, error) {
respType := RedisEnterpriseUpdateResponse{}
resp, err := p.pt.FinalResponse(ctx, &respType.Cluster)
if err != nil {
return RedisEnterpriseUpdateResponse{}, err
}
respType.RawResponse = resp
return respType, nil
}
// ResumeToken returns a value representing the poller that can be used to resume
// the LRO at a later time. ResumeTokens are unique per service operation.
func (p *RedisEnterpriseUpdatePoller) ResumeToken() (string, error) {
return p.pt.ResumeToken()
}

Просмотреть файл

@ -0,0 +1,317 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group.
// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead.
type PrivateEndpointConnectionsClient struct {
ep string
pl runtime.Pipeline
subscriptionID string
}
// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values.
func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// Delete - Deletes the specified private endpoint connection associated with the RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsDeleteOptions) (PrivateEndpointConnectionsDeleteResponse, error) {
req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options)
if err != nil {
return PrivateEndpointConnectionsDeleteResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateEndpointConnectionsDeleteResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) {
return PrivateEndpointConnectionsDeleteResponse{}, client.deleteHandleError(resp)
}
return PrivateEndpointConnectionsDeleteResponse{RawResponse: resp}, nil
}
// deleteCreateRequest creates the Delete request.
func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// deleteHandleError handles the Delete error response.
func (client *PrivateEndpointConnectionsClient) deleteHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// Get - Gets the specified private endpoint connection associated with the RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (PrivateEndpointConnectionsGetResponse, error) {
req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options)
if err != nil {
return PrivateEndpointConnectionsGetResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateEndpointConnectionsGetResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return PrivateEndpointConnectionsGetResponse{}, client.getHandleError(resp)
}
return client.getHandleResponse(resp)
}
// getCreateRequest creates the Get request.
func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// getHandleResponse handles the Get response.
func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) {
result := PrivateEndpointConnectionsGetResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil {
return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// getHandleError handles the Get error response.
func (client *PrivateEndpointConnectionsClient) getHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// List - Lists all the private endpoint connections associated with the RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsListOptions) (PrivateEndpointConnectionsListResponse, error) {
req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, options)
if err != nil {
return PrivateEndpointConnectionsListResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateEndpointConnectionsListResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return PrivateEndpointConnectionsListResponse{}, client.listHandleError(resp)
}
return client.listHandleResponse(resp)
}
// listCreateRequest creates the List request.
func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsListOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listHandleResponse handles the List response.
func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) {
result := PrivateEndpointConnectionsListResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil {
return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listHandleError handles the List error response.
func (client *PrivateEndpointConnectionsClient) listHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginPut - Updates the state of the specified private endpoint connection associated with the RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateEndpointConnectionsClient) BeginPut(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginPutOptions) (PrivateEndpointConnectionsPutPollerResponse, error) {
resp, err := client.put(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, properties, options)
if err != nil {
return PrivateEndpointConnectionsPutPollerResponse{}, err
}
result := PrivateEndpointConnectionsPutPollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.Put", "", resp, client.pl, client.putHandleError)
if err != nil {
return PrivateEndpointConnectionsPutPollerResponse{}, err
}
result.Poller = &PrivateEndpointConnectionsPutPoller{
pt: pt,
}
return result, nil
}
// Put - Updates the state of the specified private endpoint connection associated with the RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateEndpointConnectionsClient) put(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginPutOptions) (*http.Response, error) {
req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, properties, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusCreated) {
return nil, client.putHandleError(resp)
}
return resp, nil
}
// putCreateRequest creates the Put request.
func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginPutOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, properties)
}
// putHandleError handles the Put error response.
func (client *PrivateEndpointConnectionsClient) putHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,108 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group.
// Don't use this type directly, use NewPrivateLinkResourcesClient() instead.
type PrivateLinkResourcesClient struct {
ep string
pl runtime.Pipeline
subscriptionID string
}
// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values.
func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// ListByCluster - Gets the private link resources that need to be created for a RedisEnterprise cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *PrivateLinkResourcesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateLinkResourcesListByClusterOptions) (PrivateLinkResourcesListByClusterResponse, error) {
req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options)
if err != nil {
return PrivateLinkResourcesListByClusterResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateLinkResourcesListByClusterResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return PrivateLinkResourcesListByClusterResponse{}, client.listByClusterHandleError(resp)
}
return client.listByClusterHandleResponse(resp)
}
// listByClusterCreateRequest creates the ListByCluster request.
func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateLinkResourcesListByClusterOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateLinkResources"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listByClusterHandleResponse handles the ListByCluster response.
func (client *PrivateLinkResourcesClient) listByClusterHandleResponse(resp *http.Response) (PrivateLinkResourcesListByClusterResponse, error) {
result := PrivateLinkResourcesListByClusterResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil {
return PrivateLinkResourcesListByClusterResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listByClusterHandleError handles the ListByCluster error response.
func (client *PrivateLinkResourcesClient) listByClusterHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,448 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// RedisEnterpriseClient contains the methods for the RedisEnterprise group.
// Don't use this type directly, use NewRedisEnterpriseClient() instead.
type RedisEnterpriseClient struct {
ep string
pl runtime.Pipeline
subscriptionID string
}
// NewRedisEnterpriseClient creates a new instance of RedisEnterpriseClient with the specified values.
func NewRedisEnterpriseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RedisEnterpriseClient {
cp := arm.ClientOptions{}
if options != nil {
cp = *options
}
if len(cp.Host) == 0 {
cp.Host = arm.AzurePublicCloud
}
return &RedisEnterpriseClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}
}
// BeginCreate - Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *RedisEnterpriseBeginCreateOptions) (RedisEnterpriseCreatePollerResponse, error) {
resp, err := client.create(ctx, resourceGroupName, clusterName, parameters, options)
if err != nil {
return RedisEnterpriseCreatePollerResponse{}, err
}
result := RedisEnterpriseCreatePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("RedisEnterpriseClient.Create", "original-uri", resp, client.pl, client.createHandleError)
if err != nil {
return RedisEnterpriseCreatePollerResponse{}, err
}
result.Poller = &RedisEnterpriseCreatePoller{
pt: pt,
}
return result, nil
}
// Create - Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) create(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *RedisEnterpriseBeginCreateOptions) (*http.Response, error) {
req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) {
return nil, client.createHandleError(resp)
}
return resp, nil
}
// createCreateRequest creates the Create request.
func (client *RedisEnterpriseClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *RedisEnterpriseBeginCreateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
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.MethodPut, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// createHandleError handles the Create error response.
func (client *RedisEnterpriseClient) createHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginDelete - Deletes a RedisEnterprise cache cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *RedisEnterpriseBeginDeleteOptions) (RedisEnterpriseDeletePollerResponse, error) {
resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options)
if err != nil {
return RedisEnterpriseDeletePollerResponse{}, err
}
result := RedisEnterpriseDeletePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("RedisEnterpriseClient.Delete", "azure-async-operation", resp, client.pl, client.deleteHandleError)
if err != nil {
return RedisEnterpriseDeletePollerResponse{}, err
}
result.Poller = &RedisEnterpriseDeletePoller{
pt: pt,
}
return result, nil
}
// Delete - Deletes a RedisEnterprise cache cluster.
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *RedisEnterpriseBeginDeleteOptions) (*http.Response, error) {
req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
return nil, client.deleteHandleError(resp)
}
return resp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *RedisEnterpriseClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *RedisEnterpriseBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
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.MethodDelete, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// deleteHandleError handles the Delete error response.
func (client *RedisEnterpriseClient) deleteHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// Get - Gets information about a RedisEnterprise cluster
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *RedisEnterpriseGetOptions) (RedisEnterpriseGetResponse, error) {
req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options)
if err != nil {
return RedisEnterpriseGetResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return RedisEnterpriseGetResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return RedisEnterpriseGetResponse{}, client.getHandleError(resp)
}
return client.getHandleResponse(resp)
}
// getCreateRequest creates the Get request.
func (client *RedisEnterpriseClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *RedisEnterpriseGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// getHandleResponse handles the Get response.
func (client *RedisEnterpriseClient) getHandleResponse(resp *http.Response) (RedisEnterpriseGetResponse, error) {
result := RedisEnterpriseGetResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil {
return RedisEnterpriseGetResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// getHandleError handles the Get error response.
func (client *RedisEnterpriseClient) getHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// List - Gets all RedisEnterprise clusters in the specified subscription.
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) List(options *RedisEnterpriseListOptions) *RedisEnterpriseListPager {
return &RedisEnterpriseListPager{
client: client,
requester: func(ctx context.Context) (*policy.Request, error) {
return client.listCreateRequest(ctx, options)
},
advancer: func(ctx context.Context, resp RedisEnterpriseListResponse) (*policy.Request, error) {
return runtime.NewRequest(ctx, http.MethodGet, *resp.ClusterList.NextLink)
},
}
}
// listCreateRequest creates the List request.
func (client *RedisEnterpriseClient) listCreateRequest(ctx context.Context, options *RedisEnterpriseListOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listHandleResponse handles the List response.
func (client *RedisEnterpriseClient) listHandleResponse(resp *http.Response) (RedisEnterpriseListResponse, error) {
result := RedisEnterpriseListResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil {
return RedisEnterpriseListResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listHandleError handles the List error response.
func (client *RedisEnterpriseClient) listHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// ListByResourceGroup - Lists all RedisEnterprise clusters in a resource group.
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) ListByResourceGroup(resourceGroupName string, options *RedisEnterpriseListByResourceGroupOptions) *RedisEnterpriseListByResourceGroupPager {
return &RedisEnterpriseListByResourceGroupPager{
client: client,
requester: func(ctx context.Context) (*policy.Request, error) {
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)
},
advancer: func(ctx context.Context, resp RedisEnterpriseListByResourceGroupResponse) (*policy.Request, error) {
return runtime.NewRequest(ctx, http.MethodGet, *resp.ClusterList.NextLink)
},
}
}
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
func (client *RedisEnterpriseClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RedisEnterpriseListByResourceGroupOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, nil
}
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
func (client *RedisEnterpriseClient) listByResourceGroupHandleResponse(resp *http.Response) (RedisEnterpriseListByResourceGroupResponse, error) {
result := RedisEnterpriseListByResourceGroupResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil {
return RedisEnterpriseListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)
}
return result, nil
}
// listByResourceGroupHandleError handles the ListByResourceGroup error response.
func (client *RedisEnterpriseClient) listByResourceGroupHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}
// BeginUpdate - Updates an existing RedisEnterprise cluster
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *RedisEnterpriseBeginUpdateOptions) (RedisEnterpriseUpdatePollerResponse, error) {
resp, err := client.update(ctx, resourceGroupName, clusterName, parameters, options)
if err != nil {
return RedisEnterpriseUpdatePollerResponse{}, err
}
result := RedisEnterpriseUpdatePollerResponse{
RawResponse: resp,
}
pt, err := armruntime.NewPoller("RedisEnterpriseClient.Update", "azure-async-operation", resp, client.pl, client.updateHandleError)
if err != nil {
return RedisEnterpriseUpdatePollerResponse{}, err
}
result.Poller = &RedisEnterpriseUpdatePoller{
pt: pt,
}
return result, nil
}
// Update - Updates an existing RedisEnterprise cluster
// If the operation fails it returns the *ErrorResponse error type.
func (client *RedisEnterpriseClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *RedisEnterpriseBeginUpdateOptions) (*http.Response, error) {
req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {
return nil, client.updateHandleError(resp)
}
return resp, nil
}
// updateCreateRequest creates the Update request.
func (client *RedisEnterpriseClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *RedisEnterpriseBeginUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if clusterName == "" {
return nil, errors.New("parameter clusterName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
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.MethodPatch, runtime.JoinPaths(client.ep, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-08-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header.Set("Accept", "application/json")
return req, runtime.MarshalAsJSON(req, parameters)
}
// updateHandleError handles the Update error response.
func (client *RedisEnterpriseClient) updateHandleError(resp *http.Response) error {
body, err := runtime.Payload(resp)
if err != nil {
return runtime.NewResponseError(err, resp)
}
errType := ErrorResponse{raw: string(body)}
if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
}
return runtime.NewResponseError(&errType, resp)
}

Просмотреть файл

@ -0,0 +1,650 @@
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armredisenterprise
import (
"context"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"net/http"
"time"
)
// DatabasesCreatePollerResponse contains the response from method Databases.Create.
type DatabasesCreatePollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesCreatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateResponse, error) {
respType := DatabasesCreateResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesCreatePollerResponse from the provided client and resume token.
func (l *DatabasesCreatePollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Create", token, client.pl, client.createHandleError)
if err != nil {
return err
}
poller := &DatabasesCreatePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesCreateResponse contains the response from method Databases.Create.
type DatabasesCreateResponse struct {
DatabasesCreateResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesCreateResult contains the result from method Databases.Create.
type DatabasesCreateResult struct {
Database
}
// DatabasesDeletePollerResponse contains the response from method Databases.Delete.
type DatabasesDeletePollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesDeletePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) {
respType := DatabasesDeleteResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesDeletePollerResponse from the provided client and resume token.
func (l *DatabasesDeletePollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Delete", token, client.pl, client.deleteHandleError)
if err != nil {
return err
}
poller := &DatabasesDeletePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesDeleteResponse contains the response from method Databases.Delete.
type DatabasesDeleteResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesExportPollerResponse contains the response from method Databases.Export.
type DatabasesExportPollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesExportPoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesExportPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesExportResponse, error) {
respType := DatabasesExportResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesExportPollerResponse from the provided client and resume token.
func (l *DatabasesExportPollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Export", token, client.pl, client.exportHandleError)
if err != nil {
return err
}
poller := &DatabasesExportPoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesExportResponse contains the response from method Databases.Export.
type DatabasesExportResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesGetResponse contains the response from method Databases.Get.
type DatabasesGetResponse struct {
DatabasesGetResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesGetResult contains the result from method Databases.Get.
type DatabasesGetResult struct {
Database
}
// DatabasesImportPollerResponse contains the response from method Databases.Import.
type DatabasesImportPollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesImportPoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesImportPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesImportResponse, error) {
respType := DatabasesImportResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesImportPollerResponse from the provided client and resume token.
func (l *DatabasesImportPollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Import", token, client.pl, client.importHandleError)
if err != nil {
return err
}
poller := &DatabasesImportPoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesImportResponse contains the response from method Databases.Import.
type DatabasesImportResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesListByClusterResponse contains the response from method Databases.ListByCluster.
type DatabasesListByClusterResponse struct {
DatabasesListByClusterResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesListByClusterResult contains the result from method Databases.ListByCluster.
type DatabasesListByClusterResult struct {
DatabaseList
}
// DatabasesListKeysResponse contains the response from method Databases.ListKeys.
type DatabasesListKeysResponse struct {
DatabasesListKeysResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesListKeysResult contains the result from method Databases.ListKeys.
type DatabasesListKeysResult struct {
AccessKeys
}
// DatabasesRegenerateKeyPollerResponse contains the response from method Databases.RegenerateKey.
type DatabasesRegenerateKeyPollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesRegenerateKeyPoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesRegenerateKeyResponse, error) {
respType := DatabasesRegenerateKeyResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessKeys)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesRegenerateKeyPollerResponse from the provided client and resume token.
func (l *DatabasesRegenerateKeyPollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.RegenerateKey", token, client.pl, client.regenerateKeyHandleError)
if err != nil {
return err
}
poller := &DatabasesRegenerateKeyPoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesRegenerateKeyResponse contains the response from method Databases.RegenerateKey.
type DatabasesRegenerateKeyResponse struct {
DatabasesRegenerateKeyResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesRegenerateKeyResult contains the result from method Databases.RegenerateKey.
type DatabasesRegenerateKeyResult struct {
AccessKeys
}
// DatabasesUpdatePollerResponse contains the response from method Databases.Update.
type DatabasesUpdatePollerResponse struct {
// Poller contains an initialized poller.
Poller *DatabasesUpdatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l DatabasesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesUpdateResponse, error) {
respType := DatabasesUpdateResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a DatabasesUpdatePollerResponse from the provided client and resume token.
func (l *DatabasesUpdatePollerResponse) Resume(ctx context.Context, client *DatabasesClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("DatabasesClient.Update", token, client.pl, client.updateHandleError)
if err != nil {
return err
}
poller := &DatabasesUpdatePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// DatabasesUpdateResponse contains the response from method Databases.Update.
type DatabasesUpdateResponse struct {
DatabasesUpdateResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DatabasesUpdateResult contains the result from method Databases.Update.
type DatabasesUpdateResult struct {
Database
}
// OperationsListResponse contains the response from method Operations.List.
type OperationsListResponse struct {
OperationsListResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// OperationsListResult contains the result from method Operations.List.
type OperationsListResult struct {
OperationListResult
}
// OperationsStatusGetResponse contains the response from method OperationsStatus.Get.
type OperationsStatusGetResponse struct {
OperationsStatusGetResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// OperationsStatusGetResult contains the result from method OperationsStatus.Get.
type OperationsStatusGetResult struct {
OperationStatus
}
// PrivateEndpointConnectionsDeleteResponse contains the response from method PrivateEndpointConnections.Delete.
type PrivateEndpointConnectionsDeleteResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PrivateEndpointConnectionsGetResponse contains the response from method PrivateEndpointConnections.Get.
type PrivateEndpointConnectionsGetResponse struct {
PrivateEndpointConnectionsGetResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PrivateEndpointConnectionsGetResult contains the result from method PrivateEndpointConnections.Get.
type PrivateEndpointConnectionsGetResult struct {
PrivateEndpointConnection
}
// PrivateEndpointConnectionsListResponse contains the response from method PrivateEndpointConnections.List.
type PrivateEndpointConnectionsListResponse struct {
PrivateEndpointConnectionsListResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PrivateEndpointConnectionsListResult contains the result from method PrivateEndpointConnections.List.
type PrivateEndpointConnectionsListResult struct {
PrivateEndpointConnectionListResult
}
// PrivateEndpointConnectionsPutPollerResponse contains the response from method PrivateEndpointConnections.Put.
type PrivateEndpointConnectionsPutPollerResponse struct {
// Poller contains an initialized poller.
Poller *PrivateEndpointConnectionsPutPoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l PrivateEndpointConnectionsPutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsPutResponse, error) {
respType := PrivateEndpointConnectionsPutResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a PrivateEndpointConnectionsPutPollerResponse from the provided client and resume token.
func (l *PrivateEndpointConnectionsPutPollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.Put", token, client.pl, client.putHandleError)
if err != nil {
return err
}
poller := &PrivateEndpointConnectionsPutPoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// PrivateEndpointConnectionsPutResponse contains the response from method PrivateEndpointConnections.Put.
type PrivateEndpointConnectionsPutResponse struct {
PrivateEndpointConnectionsPutResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PrivateEndpointConnectionsPutResult contains the result from method PrivateEndpointConnections.Put.
type PrivateEndpointConnectionsPutResult struct {
PrivateEndpointConnection
}
// PrivateLinkResourcesListByClusterResponse contains the response from method PrivateLinkResources.ListByCluster.
type PrivateLinkResourcesListByClusterResponse struct {
PrivateLinkResourcesListByClusterResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PrivateLinkResourcesListByClusterResult contains the result from method PrivateLinkResources.ListByCluster.
type PrivateLinkResourcesListByClusterResult struct {
PrivateLinkResourceListResult
}
// RedisEnterpriseCreatePollerResponse contains the response from method RedisEnterprise.Create.
type RedisEnterpriseCreatePollerResponse struct {
// Poller contains an initialized poller.
Poller *RedisEnterpriseCreatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l RedisEnterpriseCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisEnterpriseCreateResponse, error) {
respType := RedisEnterpriseCreateResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a RedisEnterpriseCreatePollerResponse from the provided client and resume token.
func (l *RedisEnterpriseCreatePollerResponse) Resume(ctx context.Context, client *RedisEnterpriseClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("RedisEnterpriseClient.Create", token, client.pl, client.createHandleError)
if err != nil {
return err
}
poller := &RedisEnterpriseCreatePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// RedisEnterpriseCreateResponse contains the response from method RedisEnterprise.Create.
type RedisEnterpriseCreateResponse struct {
RedisEnterpriseCreateResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseCreateResult contains the result from method RedisEnterprise.Create.
type RedisEnterpriseCreateResult struct {
Cluster
}
// RedisEnterpriseDeletePollerResponse contains the response from method RedisEnterprise.Delete.
type RedisEnterpriseDeletePollerResponse struct {
// Poller contains an initialized poller.
Poller *RedisEnterpriseDeletePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l RedisEnterpriseDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisEnterpriseDeleteResponse, error) {
respType := RedisEnterpriseDeleteResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a RedisEnterpriseDeletePollerResponse from the provided client and resume token.
func (l *RedisEnterpriseDeletePollerResponse) Resume(ctx context.Context, client *RedisEnterpriseClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("RedisEnterpriseClient.Delete", token, client.pl, client.deleteHandleError)
if err != nil {
return err
}
poller := &RedisEnterpriseDeletePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// RedisEnterpriseDeleteResponse contains the response from method RedisEnterprise.Delete.
type RedisEnterpriseDeleteResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseGetResponse contains the response from method RedisEnterprise.Get.
type RedisEnterpriseGetResponse struct {
RedisEnterpriseGetResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseGetResult contains the result from method RedisEnterprise.Get.
type RedisEnterpriseGetResult struct {
Cluster
}
// RedisEnterpriseListByResourceGroupResponse contains the response from method RedisEnterprise.ListByResourceGroup.
type RedisEnterpriseListByResourceGroupResponse struct {
RedisEnterpriseListByResourceGroupResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseListByResourceGroupResult contains the result from method RedisEnterprise.ListByResourceGroup.
type RedisEnterpriseListByResourceGroupResult struct {
ClusterList
}
// RedisEnterpriseListResponse contains the response from method RedisEnterprise.List.
type RedisEnterpriseListResponse struct {
RedisEnterpriseListResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseListResult contains the result from method RedisEnterprise.List.
type RedisEnterpriseListResult struct {
ClusterList
}
// RedisEnterpriseUpdatePollerResponse contains the response from method RedisEnterprise.Update.
type RedisEnterpriseUpdatePollerResponse struct {
// Poller contains an initialized poller.
Poller *RedisEnterpriseUpdatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received.
// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
func (l RedisEnterpriseUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisEnterpriseUpdateResponse, error) {
respType := RedisEnterpriseUpdateResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
}
// Resume rehydrates a RedisEnterpriseUpdatePollerResponse from the provided client and resume token.
func (l *RedisEnterpriseUpdatePollerResponse) Resume(ctx context.Context, client *RedisEnterpriseClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("RedisEnterpriseClient.Update", token, client.pl, client.updateHandleError)
if err != nil {
return err
}
poller := &RedisEnterpriseUpdatePoller{
pt: pt,
}
resp, err := poller.Poll(ctx)
if err != nil {
return err
}
l.Poller = poller
l.RawResponse = resp
return nil
}
// RedisEnterpriseUpdateResponse contains the response from method RedisEnterprise.Update.
type RedisEnterpriseUpdateResponse struct {
RedisEnterpriseUpdateResult
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// RedisEnterpriseUpdateResult contains the result from method RedisEnterprise.Update.
type RedisEnterpriseUpdateResult struct {
Cluster
}