vendor: add github.com/Azure/azure-sdk-for-go and dependencies
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
// Package redis implements the Azure ARM Redis service API version 2016-04-01.
|
||||
//
|
||||
// REST API for Azure Redis Cache Service.
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Redis
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Redis.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(subscriptionID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// FirewallRuleClient is the rEST API for Azure Redis Cache Service.
|
||||
type FirewallRuleClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewFirewallRuleClient creates an instance of the FirewallRuleClient client.
|
||||
func NewFirewallRuleClient(subscriptionID string) FirewallRuleClient {
|
||||
return NewFirewallRuleClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewFirewallRuleClientWithBaseURI creates an instance of the
|
||||
// FirewallRuleClient client.
|
||||
func NewFirewallRuleClientWithBaseURI(baseURI string, subscriptionID string) FirewallRuleClient {
|
||||
return FirewallRuleClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update a redis cache firewall rule
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. cacheName is the name
|
||||
// of the Redis cache. ruleName is the name of the firewall rule. parameters is
|
||||
// parameters supplied to the create or update redis firewall rule operation.
|
||||
func (client FirewallRuleClient) CreateOrUpdate(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (result FirewallRule, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIP", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.FirewallRuleProperties.EndIP", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "redis.FirewallRuleClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, cacheName, ruleName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client FirewallRuleClient) CreateOrUpdatePreparer(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"cacheName": autorest.Encode("path", cacheName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client FirewallRuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client FirewallRuleClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a single firewall rule in a specified redis cache.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. cacheName is the name
|
||||
// of the Redis cache. ruleName is the name of the firewall rule.
|
||||
func (client FirewallRuleClient) Delete(resourceGroupName string, cacheName string, ruleName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, cacheName, ruleName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client FirewallRuleClient) DeletePreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"cacheName": autorest.Encode("path", cacheName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client FirewallRuleClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client FirewallRuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets a single firewall rule in a specified redis cache.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. cacheName is the name
|
||||
// of the Redis cache. ruleName is the name of the firewall rule.
|
||||
func (client FirewallRuleClient) Get(resourceGroupName string, cacheName string, ruleName string) (result FirewallRule, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, cacheName, ruleName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client FirewallRuleClient) GetPreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"cacheName": autorest.Encode("path", cacheName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client FirewallRuleClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client FirewallRuleClient) GetResponder(resp *http.Response) (result FirewallRule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// FirewallRulesClient is the rEST API for Azure Redis Cache Service.
|
||||
type FirewallRulesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewFirewallRulesClient creates an instance of the FirewallRulesClient
|
||||
// client.
|
||||
func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient {
|
||||
return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewFirewallRulesClientWithBaseURI creates an instance of the
|
||||
// FirewallRulesClient client.
|
||||
func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient {
|
||||
return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// List gets all firewall rules in the specified redis cache.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. cacheName is the name
|
||||
// of the Redis cache.
|
||||
func (client FirewallRulesClient) List(resourceGroupName string, cacheName string) (result FirewallRuleListResult, err error) {
|
||||
req, err := client.ListPreparer(resourceGroupName, cacheName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client FirewallRulesClient) ListPreparer(resourceGroupName string, cacheName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"cacheName": autorest.Encode("path", cacheName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client FirewallRulesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client FirewallRulesClient) ListResponder(resp *http.Response) (result FirewallRuleListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client FirewallRulesClient) ListNextResults(lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) {
|
||||
req, err := lastResults.FirewallRuleListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+335
@@ -0,0 +1,335 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DayOfWeek enumerates the values for day of week.
|
||||
type DayOfWeek string
|
||||
|
||||
const (
|
||||
// Everyday specifies the everyday state for day of week.
|
||||
Everyday DayOfWeek = "Everyday"
|
||||
// Friday specifies the friday state for day of week.
|
||||
Friday DayOfWeek = "Friday"
|
||||
// Monday specifies the monday state for day of week.
|
||||
Monday DayOfWeek = "Monday"
|
||||
// Saturday specifies the saturday state for day of week.
|
||||
Saturday DayOfWeek = "Saturday"
|
||||
// Sunday specifies the sunday state for day of week.
|
||||
Sunday DayOfWeek = "Sunday"
|
||||
// Thursday specifies the thursday state for day of week.
|
||||
Thursday DayOfWeek = "Thursday"
|
||||
// Tuesday specifies the tuesday state for day of week.
|
||||
Tuesday DayOfWeek = "Tuesday"
|
||||
// Wednesday specifies the wednesday state for day of week.
|
||||
Wednesday DayOfWeek = "Wednesday"
|
||||
// Weekend specifies the weekend state for day of week.
|
||||
Weekend DayOfWeek = "Weekend"
|
||||
)
|
||||
|
||||
// KeyType enumerates the values for key type.
|
||||
type KeyType string
|
||||
|
||||
const (
|
||||
// Primary specifies the primary state for key type.
|
||||
Primary KeyType = "Primary"
|
||||
// Secondary specifies the secondary state for key type.
|
||||
Secondary KeyType = "Secondary"
|
||||
)
|
||||
|
||||
// RebootType enumerates the values for reboot type.
|
||||
type RebootType string
|
||||
|
||||
const (
|
||||
// AllNodes specifies the all nodes state for reboot type.
|
||||
AllNodes RebootType = "AllNodes"
|
||||
// PrimaryNode specifies the primary node state for reboot type.
|
||||
PrimaryNode RebootType = "PrimaryNode"
|
||||
// SecondaryNode specifies the secondary node state for reboot type.
|
||||
SecondaryNode RebootType = "SecondaryNode"
|
||||
)
|
||||
|
||||
// SkuFamily enumerates the values for sku family.
|
||||
type SkuFamily string
|
||||
|
||||
const (
|
||||
// C specifies the c state for sku family.
|
||||
C SkuFamily = "C"
|
||||
// P specifies the p state for sku family.
|
||||
P SkuFamily = "P"
|
||||
)
|
||||
|
||||
// SkuName enumerates the values for sku name.
|
||||
type SkuName string
|
||||
|
||||
const (
|
||||
// Basic specifies the basic state for sku name.
|
||||
Basic SkuName = "Basic"
|
||||
// Premium specifies the premium state for sku name.
|
||||
Premium SkuName = "Premium"
|
||||
// Standard specifies the standard state for sku name.
|
||||
Standard SkuName = "Standard"
|
||||
)
|
||||
|
||||
// AccessKeys is redis cache access keys.
|
||||
type AccessKeys struct {
|
||||
autorest.Response `json:"-"`
|
||||
PrimaryKey *string `json:"primaryKey,omitempty"`
|
||||
SecondaryKey *string `json:"secondaryKey,omitempty"`
|
||||
}
|
||||
|
||||
// CreateParameters is parameters supplied to the Create Redis operation.
|
||||
type CreateParameters struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*CreateProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProperties is properties supplied to Create Redis operation.
|
||||
type CreateProperties struct {
|
||||
RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"`
|
||||
EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`
|
||||
TenantSettings *map[string]*string `json:"tenantSettings,omitempty"`
|
||||
ShardCount *int32 `json:"shardCount,omitempty"`
|
||||
SubnetID *string `json:"subnetId,omitempty"`
|
||||
StaticIP *string `json:"staticIP,omitempty"`
|
||||
Sku *Sku `json:"sku,omitempty"`
|
||||
}
|
||||
|
||||
// ExportRDBParameters is parameters for Redis export operation.
|
||||
type ExportRDBParameters struct {
|
||||
Format *string `json:"format,omitempty"`
|
||||
Prefix *string `json:"prefix,omitempty"`
|
||||
Container *string `json:"container,omitempty"`
|
||||
}
|
||||
|
||||
// FirewallRule is a firewall rule on a redis cache has a name, and describes a
|
||||
// contiguous range of IP addresses permitted to connect
|
||||
type FirewallRule struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
*FirewallRuleProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// FirewallRuleListResult is the response of list firewall rules Redis
|
||||
// operation.
|
||||
type FirewallRuleListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]FirewallRule `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// FirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client FirewallRuleListResult) FirewallRuleListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// FirewallRuleProperties is specifies a range of IP addresses permitted to
|
||||
// connect to the cache
|
||||
type FirewallRuleProperties struct {
|
||||
StartIP *string `json:"startIP,omitempty"`
|
||||
EndIP *string `json:"endIP,omitempty"`
|
||||
}
|
||||
|
||||
// ForceRebootResponse is response to force reboot for Redis cache.
|
||||
type ForceRebootResponse struct {
|
||||
autorest.Response `json:"-"`
|
||||
Message *string `json:"Message,omitempty"`
|
||||
}
|
||||
|
||||
// ImportRDBParameters is parameters for Redis import operation.
|
||||
type ImportRDBParameters struct {
|
||||
Format *string `json:"format,omitempty"`
|
||||
Files *[]string `json:"files,omitempty"`
|
||||
}
|
||||
|
||||
// ListResult is the response of list Redis operation.
|
||||
type ListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ResourceType `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client ListResult) ListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// Operation is rEST API operation
|
||||
type Operation struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Display *OperationDisplay `json:"display,omitempty"`
|
||||
}
|
||||
|
||||
// OperationDisplay is the object that describes the operation.
|
||||
type OperationDisplay struct {
|
||||
Provider *string `json:"provider,omitempty"`
|
||||
Operation *string `json:"operation,omitempty"`
|
||||
Resource *string `json:"resource,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// OperationListResult is result of the request to list REST API operations. It
|
||||
// contains a list of operations and a URL nextLink to get the next set of
|
||||
// results.
|
||||
type OperationListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Operation `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// PatchSchedule is response to put/get patch schedules for Redis cache.
|
||||
type PatchSchedule struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
*ScheduleEntries `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// Properties is properties supplied to Create or Update Redis operation.
|
||||
type Properties struct {
|
||||
RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"`
|
||||
EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`
|
||||
TenantSettings *map[string]*string `json:"tenantSettings,omitempty"`
|
||||
ShardCount *int32 `json:"shardCount,omitempty"`
|
||||
SubnetID *string `json:"subnetId,omitempty"`
|
||||
StaticIP *string `json:"staticIP,omitempty"`
|
||||
}
|
||||
|
||||
// RebootParameters is specifies which Redis node(s) to reboot.
|
||||
type RebootParameters struct {
|
||||
RebootType RebootType `json:"rebootType,omitempty"`
|
||||
ShardID *int32 `json:"shardId,omitempty"`
|
||||
}
|
||||
|
||||
// RegenerateKeyParameters is specifies which Redis access keys to reset.
|
||||
type RegenerateKeyParameters struct {
|
||||
KeyType KeyType `json:"keyType,omitempty"`
|
||||
}
|
||||
|
||||
// Resource is the Resource definition.
|
||||
type Resource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceProperties is parameters describing a Redis instance.
|
||||
type ResourceProperties struct {
|
||||
RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"`
|
||||
EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`
|
||||
TenantSettings *map[string]*string `json:"tenantSettings,omitempty"`
|
||||
ShardCount *int32 `json:"shardCount,omitempty"`
|
||||
SubnetID *string `json:"subnetId,omitempty"`
|
||||
StaticIP *string `json:"staticIP,omitempty"`
|
||||
Sku *Sku `json:"sku,omitempty"`
|
||||
RedisVersion *string `json:"redisVersion,omitempty"`
|
||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
||||
HostName *string `json:"hostName,omitempty"`
|
||||
Port *int32 `json:"port,omitempty"`
|
||||
SslPort *int32 `json:"sslPort,omitempty"`
|
||||
AccessKeys *AccessKeys `json:"accessKeys,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceType is a single Redis item in List or Get Operation.
|
||||
type ResourceType struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*ResourceProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ScheduleEntries is list of patch schedules for a Redis cache.
|
||||
type ScheduleEntries struct {
|
||||
ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"`
|
||||
}
|
||||
|
||||
// ScheduleEntry is patch schedule entry for a Premium Redis Cache.
|
||||
type ScheduleEntry struct {
|
||||
DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"`
|
||||
StartHourUtc *int32 `json:"startHourUtc,omitempty"`
|
||||
MaintenanceWindow *string `json:"maintenanceWindow,omitempty"`
|
||||
}
|
||||
|
||||
// Sku is sKU parameters supplied to the create Redis operation.
|
||||
type Sku struct {
|
||||
Name SkuName `json:"name,omitempty"`
|
||||
Family SkuFamily `json:"family,omitempty"`
|
||||
Capacity *int32 `json:"capacity,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateParameters is parameters supplied to the Update Redis operation.
|
||||
type UpdateParameters struct {
|
||||
*UpdateProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateProperties is properties supplied to Update Redis operation.
|
||||
type UpdateProperties struct {
|
||||
RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"`
|
||||
EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`
|
||||
TenantSettings *map[string]*string `json:"tenantSettings,omitempty"`
|
||||
ShardCount *int32 `json:"shardCount,omitempty"`
|
||||
SubnetID *string `json:"subnetId,omitempty"`
|
||||
StaticIP *string `json:"staticIP,omitempty"`
|
||||
Sku *Sku `json:"sku,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsClient is the rEST API for Azure Redis Cache Service.
|
||||
type OperationsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewOperationsClient creates an instance of the OperationsClient client.
|
||||
func NewOperationsClient(subscriptionID string) OperationsClient {
|
||||
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient
|
||||
// client.
|
||||
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
||||
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// List lists all of the available REST API operations of the Microsoft.Cache
|
||||
// provider.
|
||||
func (client OperationsClient) List() (result OperationListResult, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client OperationsClient) ListPreparer() (*http.Request, error) {
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/providers/Microsoft.Cache/operations"),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
|
||||
req, err := lastResults.OperationListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// PatchSchedulesClient is the rEST API for Azure Redis Cache Service.
|
||||
type PatchSchedulesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewPatchSchedulesClient creates an instance of the PatchSchedulesClient
|
||||
// client.
|
||||
func NewPatchSchedulesClient(subscriptionID string) PatchSchedulesClient {
|
||||
return NewPatchSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewPatchSchedulesClientWithBaseURI creates an instance of the
|
||||
// PatchSchedulesClient client.
|
||||
func NewPatchSchedulesClientWithBaseURI(baseURI string, subscriptionID string) PatchSchedulesClient {
|
||||
return PatchSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or replace the patching schedule for Redis cache
|
||||
// (requires Premium SKU).
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is parameters to set the patching schedule for Redis
|
||||
// cache.
|
||||
func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client PatchSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters PatchSchedule) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PatchSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result PatchSchedule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the patching schedule of a redis cache (requires Premium
|
||||
// SKU).
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// redis cache.
|
||||
func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, name)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client PatchSchedulesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PatchSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the patching schedule of a redis cache (requires Premium SKU).
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// redis cache.
|
||||
func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, name)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client PatchSchedulesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PatchSchedulesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PatchSchedulesClient) GetResponder(resp *http.Response) (result PatchSchedule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+916
@@ -0,0 +1,916 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GroupClient is the rEST API for Azure Redis Cache Service.
|
||||
type GroupClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewGroupClient creates an instance of the GroupClient client.
|
||||
func NewGroupClient(subscriptionID string) GroupClient {
|
||||
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
|
||||
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
|
||||
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Create create or replace (overwrite/recreate, with potential downtime) an
|
||||
// existing Redis cache. This method may poll for completion. Polling can be
|
||||
// canceled by passing the cancel channel argument. The channel will be used to
|
||||
// cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is parameters supplied to the Create Redis
|
||||
// operation.
|
||||
func (client GroupClient) Create(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (<-chan ResourceType, <-chan error) {
|
||||
resultChan := make(chan ResourceType, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.CreateProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
}}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "Create")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result ResourceType
|
||||
defer func() {
|
||||
resultChan <- result
|
||||
errChan <- err
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) CreateResponder(resp *http.Response) (result ResourceType, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a Redis cache. This method may poll for completion. Polling
|
||||
// can be canceled by passing the cancel channel argument. The channel will be
|
||||
// used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache.
|
||||
func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
resultChan <- result
|
||||
errChan <- err
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(resourceGroupName, name, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ExportData export data from the redis cache to blobs in a container. This
|
||||
// method may poll for completion. Polling can be canceled by passing the
|
||||
// cancel channel argument. The channel will be used to cancel polling and any
|
||||
// outstanding HTTP requests.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is parameters for Redis export operation.
|
||||
func (client GroupClient) ExportData(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.Prefix", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.Container", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ExportData")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
resultChan <- result
|
||||
errChan <- err
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.ExportDataPreparer(resourceGroupName, name, parameters, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ExportDataSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ExportDataResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ExportDataPreparer prepares the ExportData request.
|
||||
func (client GroupClient) ExportDataPreparer(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ExportDataSender sends the ExportData request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ExportDataSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ExportDataResponder handles the response to the ExportData request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ForceReboot reboot specified Redis node(s). This operation requires write
|
||||
// permission to the cache resource. There can be potential data loss.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is specifies which Redis node(s) to reboot.
|
||||
func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result ForceRebootResponse, err error) {
|
||||
req, err := client.ForceRebootPreparer(resourceGroupName, name, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ForceRebootSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ForceRebootResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ForceRebootPreparer prepares the ForceReboot request.
|
||||
func (client GroupClient) ForceRebootPreparer(resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ForceRebootSender sends the ForceReboot request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ForceRebootSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ForceRebootResponder handles the response to the ForceReboot request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ForceRebootResponder(resp *http.Response) (result ForceRebootResponse, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets a Redis cache (resource description).
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache.
|
||||
func (client GroupClient) Get(resourceGroupName string, name string) (result ResourceType, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, name)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ImportData import data into Redis cache. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is parameters for Redis import operation.
|
||||
func (client GroupClient) ImportData(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.Files", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ImportData")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
resultChan <- result
|
||||
errChan <- err
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.ImportDataPreparer(resourceGroupName, name, parameters, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ImportDataSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ImportDataResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ImportDataPreparer prepares the ImportData request.
|
||||
func (client GroupClient) ImportDataPreparer(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ImportDataSender sends the ImportData request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ImportDataSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ImportDataResponder handles the response to the ImportData request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// List gets all Redis caches in the specified subscription.
|
||||
func (client GroupClient) List() (result ListResult, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client GroupClient) ListPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
|
||||
req, err := lastResults.ListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup lists all Redis caches in a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
func (client GroupClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
||||
func (client GroupClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) {
|
||||
req, err := lastResults.ListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListKeys retrieve a Redis cache's access keys. This operation requires write
|
||||
// permission to the cache resource.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache.
|
||||
func (client GroupClient) ListKeys(resourceGroupName string, name string) (result AccessKeys, err error) {
|
||||
req, err := client.ListKeysPreparer(resourceGroupName, name)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListKeysSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListKeysResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListKeysPreparer prepares the ListKeys request.
|
||||
func (client GroupClient) ListKeysPreparer(resourceGroupName string, name string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListKeysSender sends the ListKeys request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListKeysResponder handles the response to the ListKeys request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// RegenerateKey regenerate Redis cache's access keys. This operation requires
|
||||
// write permission to the cache resource.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is specifies which key to regenerate.
|
||||
func (client GroupClient) RegenerateKey(resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) {
|
||||
req, err := client.RegenerateKeyPreparer(resourceGroupName, name, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.RegenerateKeySender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.RegenerateKeyResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// RegenerateKeyPreparer prepares the RegenerateKey request.
|
||||
func (client GroupClient) RegenerateKeyPreparer(resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// RegenerateKeySender sends the RegenerateKey request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Update update an existing Redis cache.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. name is the name of the
|
||||
// Redis cache. parameters is parameters supplied to the Update Redis
|
||||
// operation.
|
||||
func (client GroupClient) Update(resourceGroupName string, name string, parameters UpdateParameters) (result ResourceType, err error) {
|
||||
req, err := client.UpdatePreparer(resourceGroupName, name, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters UpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupClient) UpdateResponder(resp *http.Response) (result ResourceType, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package redis
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return "Azure-SDK-For-Go/v10.1.0-beta arm-redis/2016-04-01"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v10.1.0-beta"
|
||||
}
|
||||
Reference in New Issue
Block a user