Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Find file
Copy path
azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/disasterrecoveryconfigs.go
Find file
Copy path
Fetching contributors…

package eventhub | |
// 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. | |
// Changes may cause incorrect behavior and will be lost if the code is regenerated. | |
import ( | |
"context" | |
"github.com/Azure/go-autorest/autorest" | |
"github.com/Azure/go-autorest/autorest/azure" | |
"github.com/Azure/go-autorest/autorest/validation" | |
"github.com/Azure/go-autorest/tracing" | |
"net/http" | |
) | |
// DisasterRecoveryConfigsClient is the azure Event Hubs client | |
type DisasterRecoveryConfigsClient struct { | |
BaseClient | |
} | |
// NewDisasterRecoveryConfigsClient creates an instance of the DisasterRecoveryConfigsClient client. | |
func NewDisasterRecoveryConfigsClient(subscriptionID string) DisasterRecoveryConfigsClient { | |
return NewDisasterRecoveryConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) | |
} | |
// NewDisasterRecoveryConfigsClientWithBaseURI creates an instance of the DisasterRecoveryConfigsClient client. | |
func NewDisasterRecoveryConfigsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigsClient { | |
return DisasterRecoveryConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} | |
} | |
// BreakPairing this operation disables the Disaster Recovery and stops replicating changes from primary to secondary | |
// namespaces | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
func (client DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.BreakPairing") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "BreakPairing", err.Error()) | |
} | |
req, err := client.BreakPairingPreparer(ctx, resourceGroupName, namespaceName, alias) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.BreakPairingSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure sending request") | |
return | |
} | |
result, err = client.BreakPairingResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure responding to request") | |
} | |
return | |
} | |
// BreakPairingPreparer prepares the BreakPairing request. | |
func (client DisasterRecoveryConfigsClient) BreakPairingPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// BreakPairingSender sends the BreakPairing request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) BreakPairingSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// BreakPairingResponder handles the response to the BreakPairing request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) BreakPairingResponder(resp *http.Response) (result autorest.Response, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByClosing()) | |
result.Response = resp | |
return | |
} | |
// CheckNameAvailability check the give Namespace name availability. | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// parameters - parameters to check availability of the given Alias name | |
func (client DisasterRecoveryConfigsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailabilityParameter) (result CheckNameAvailabilityResult, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CheckNameAvailability") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: parameters, | |
Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "CheckNameAvailability", err.Error()) | |
} | |
req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, namespaceName, parameters) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CheckNameAvailability", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.CheckNameAvailabilitySender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CheckNameAvailability", resp, "Failure sending request") | |
return | |
} | |
result, err = client.CheckNameAvailabilityResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CheckNameAvailability", resp, "Failure responding to request") | |
} | |
return | |
} | |
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. | |
func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailabilityParameter) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-04-01" | |
queryParameters := map[string]interface{}{ | |
"api-version": APIVersion, | |
} | |
preparer := autorest.CreatePreparer( | |
autorest.AsContentType("application/json; charset=utf-8"), | |
autorest.AsPost(), | |
autorest.WithBaseURL(client.BaseURI), | |
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", pathParameters), | |
autorest.WithJSON(parameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByUnmarshallingJSON(&result), | |
autorest.ByClosing()) | |
result.Response = autorest.Response{Response: resp} | |
return | |
} | |
// CreateOrUpdate creates or updates a new Alias(Disaster Recovery configuration) | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
// parameters - parameters required to create an Alias(Disaster Recovery configuration) | |
func (client DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (result ArmDisasterRecovery, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CreateOrUpdate") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "CreateOrUpdate", err.Error()) | |
} | |
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, alias, parameters) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.CreateOrUpdateSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure sending request") | |
return | |
} | |
result, err = client.CreateOrUpdateResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure responding to request") | |
} | |
return | |
} | |
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. | |
func (client DisasterRecoveryConfigsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-04-01" | |
queryParameters := map[string]interface{}{ | |
"api-version": APIVersion, | |
} | |
preparer := autorest.CreatePreparer( | |
autorest.AsContentType("application/json; charset=utf-8"), | |
autorest.AsPut(), | |
autorest.WithBaseURL(client.BaseURI), | |
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), | |
autorest.WithJSON(parameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) CreateOrUpdateResponder(resp *http.Response) (result ArmDisasterRecovery, 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 an Alias(Disaster Recovery configuration) | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
func (client DisasterRecoveryConfigsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Delete") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "Delete", err.Error()) | |
} | |
req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, alias) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.DeleteSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Delete", resp, "Failure sending request") | |
return | |
} | |
result, err = client.DeleteResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Delete", resp, "Failure responding to request") | |
} | |
return | |
} | |
// DeletePreparer prepares the Delete request. | |
func (client DisasterRecoveryConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// DeleteSender sends the Delete request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) DeleteSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// DeleteResponder handles the response to the Delete request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByClosing()) | |
result.Response = resp | |
return | |
} | |
// FailOver invokes GEO DR failover and reconfigure the alias to point to the secondary namespace | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
func (client DisasterRecoveryConfigsClient) FailOver(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.FailOver") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "FailOver", err.Error()) | |
} | |
req, err := client.FailOverPreparer(ctx, resourceGroupName, namespaceName, alias) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.FailOverSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure sending request") | |
return | |
} | |
result, err = client.FailOverResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure responding to request") | |
} | |
return | |
} | |
// FailOverPreparer prepares the FailOver request. | |
func (client DisasterRecoveryConfigsClient) FailOverPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// FailOverSender sends the FailOver request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) FailOverSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// FailOverResponder handles the response to the FailOver request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) FailOverResponder(resp *http.Response) (result autorest.Response, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByClosing()) | |
result.Response = resp | |
return | |
} | |
// Get retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
func (client DisasterRecoveryConfigsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result ArmDisasterRecovery, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Get") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "Get", err.Error()) | |
} | |
req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, alias) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Get", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "Get", resp, "Failure responding to request") | |
} | |
return | |
} | |
// GetPreparer prepares the Get request. | |
func (client DisasterRecoveryConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// GetSender sends the Get request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) GetSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// GetResponder handles the response to the Get request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) GetResponder(resp *http.Response) (result ArmDisasterRecovery, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByUnmarshallingJSON(&result), | |
autorest.ByClosing()) | |
result.Response = autorest.Response{Response: resp} | |
return | |
} | |
// GetAuthorizationRule gets an AuthorizationRule for a Namespace by rule name. | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
// authorizationRuleName - the authorization rule name. | |
func (client DisasterRecoveryConfigsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result AuthorizationRule, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.GetAuthorizationRule") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: authorizationRuleName, | |
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "GetAuthorizationRule", err.Error()) | |
} | |
req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "GetAuthorizationRule", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetAuthorizationRuleSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetAuthorizationRuleResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure responding to request") | |
} | |
return | |
} | |
// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. | |
func (client DisasterRecoveryConfigsClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"authorizationRuleName": autorest.Encode("path", authorizationRuleName), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByUnmarshallingJSON(&result), | |
autorest.ByClosing()) | |
result.Response = autorest.Response{Response: resp} | |
return | |
} | |
// List gets all Alias(Disaster Recovery configurations) | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
func (client DisasterRecoveryConfigsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultPage, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") | |
defer func() { | |
sc := -1 | |
if result.adrlr.Response.Response != nil { | |
sc = result.adrlr.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "List", err.Error()) | |
} | |
result.fn = client.listNextResults | |
req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.ListSender(req) | |
if err != nil { | |
result.adrlr.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "List", resp, "Failure sending request") | |
return | |
} | |
result.adrlr, err = client.ListResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "List", resp, "Failure responding to request") | |
} | |
return | |
} | |
// ListPreparer prepares the List request. | |
func (client DisasterRecoveryConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// ListSender sends the List request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) ListSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// ListResponder handles the response to the List request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) ListResponder(resp *http.Response) (result ArmDisasterRecoveryListResult, 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 DisasterRecoveryConfigsClient) listNextResults(ctx context.Context, lastResults ArmDisasterRecoveryListResult) (result ArmDisasterRecoveryListResult, err error) { | |
req, err := lastResults.armDisasterRecoveryListResultPreparer(ctx) | |
if err != nil { | |
return result, autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listNextResults", nil, "Failure preparing next results request") | |
} | |
if req == nil { | |
return | |
} | |
resp, err := client.ListSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
return result, autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure sending next results request") | |
} | |
result, err = client.ListResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure responding to next results request") | |
} | |
return | |
} | |
// ListComplete enumerates all values, automatically crossing page boundaries as required. | |
func (client DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultIterator, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") | |
defer func() { | |
sc := -1 | |
if result.Response().Response.Response != nil { | |
sc = result.page.Response().Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
result.page, err = client.List(ctx, resourceGroupName, namespaceName) | |
return | |
} | |
// ListAuthorizationRules gets a list of authorization rules for a Namespace. | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
func (client DisasterRecoveryConfigsClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result AuthorizationRuleListResultPage, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") | |
defer func() { | |
sc := -1 | |
if result.arlr.Response.Response != nil { | |
sc = result.arlr.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "ListAuthorizationRules", err.Error()) | |
} | |
result.fn = client.listAuthorizationRulesNextResults | |
req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, alias) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListAuthorizationRules", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.ListAuthorizationRulesSender(req) | |
if err != nil { | |
result.arlr.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure sending request") | |
return | |
} | |
result.arlr, err = client.ListAuthorizationRulesResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure responding to request") | |
} | |
return | |
} | |
// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. | |
func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { | |
err = autorest.Respond( | |
resp, | |
client.ByInspecting(), | |
azure.WithErrorUnlessStatusCode(http.StatusOK), | |
autorest.ByUnmarshallingJSON(&result), | |
autorest.ByClosing()) | |
result.Response = autorest.Response{Response: resp} | |
return | |
} | |
// listAuthorizationRulesNextResults retrieves the next set of results, if any. | |
func (client DisasterRecoveryConfigsClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { | |
req, err := lastResults.authorizationRuleListResultPreparer(ctx) | |
if err != nil { | |
return result, autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") | |
} | |
if req == nil { | |
return | |
} | |
resp, err := client.ListAuthorizationRulesSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
return result, autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") | |
} | |
result, err = client.ListAuthorizationRulesResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") | |
} | |
return | |
} | |
// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. | |
func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result AuthorizationRuleListResultIterator, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") | |
defer func() { | |
sc := -1 | |
if result.Response().Response.Response != nil { | |
sc = result.page.Response().Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, alias) | |
return | |
} | |
// ListKeys gets the primary and secondary connection strings for the Namespace. | |
// Parameters: | |
// resourceGroupName - name of the resource group within the azure subscription. | |
// namespaceName - the Namespace name | |
// alias - the Disaster Recovery configuration name | |
// authorizationRuleName - the authorization rule name. | |
func (client DisasterRecoveryConfigsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result AccessKeys, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListKeys") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: resourceGroupName, | |
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, | |
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: namespaceName, | |
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, | |
{TargetValue: alias, | |
Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, | |
{Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, | |
{TargetValue: authorizationRuleName, | |
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { | |
return result, validation.NewError("eventhub.DisasterRecoveryConfigsClient", "ListKeys", err.Error()) | |
} | |
req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListKeys", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.ListKeysSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure sending request") | |
return | |
} | |
result, err = client.ListKeysResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "eventhub.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure responding to request") | |
} | |
return | |
} | |
// ListKeysPreparer prepares the ListKeys request. | |
func (client DisasterRecoveryConfigsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { | |
pathParameters := map[string]interface{}{ | |
"alias": autorest.Encode("path", alias), | |
"authorizationRuleName": autorest.Encode("path", authorizationRuleName), | |
"namespaceName": autorest.Encode("path", namespaceName), | |
"resourceGroupName": autorest.Encode("path", resourceGroupName), | |
"subscriptionId": autorest.Encode("path", client.SubscriptionID), | |
} | |
const APIVersion = "2017-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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), | |
autorest.WithQueryParameters(queryParameters)) | |
return preparer.Prepare((&http.Request{}).WithContext(ctx)) | |
} | |
// ListKeysSender sends the ListKeys request. The method will close the | |
// http.Response Body if it receives an error. | |
func (client DisasterRecoveryConfigsClient) ListKeysSender(req *http.Request) (*http.Response, error) { | |
sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// ListKeysResponder handles the response to the ListKeys request. The method always | |
// closes the http.Response Body. | |
func (client DisasterRecoveryConfigsClient) 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 | |
} |