From 3930906c4d36c82a9c14439ac57c81c1450b597a Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Sat, 8 Oct 2016 16:18:25 +0200 Subject: [PATCH 01/15] Azure EventHub SDK --- .../azure-sdk-for-go/arm/eventhub/client.go | 58 ++ .../arm/eventhub/consumergroups.go | 340 +++++++ .../arm/eventhub/eventhubs.go | 764 ++++++++++++++++ .../azure-sdk-for-go/arm/eventhub/models.go | 366 ++++++++ .../arm/eventhub/namespaces.go | 839 ++++++++++++++++++ .../azure-sdk-for-go/arm/eventhub/version.go | 43 + vendor/vendor.json | 16 +- 7 files changed, 2424 insertions(+), 2 deletions(-) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go new file mode 100644 index 000000000000..e5bdd8e2d121 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go @@ -0,0 +1,58 @@ +// Package eventhub implements the Azure ARM Eventhub service API version +// 2015-08-01. +// +// Azure EventHub client +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 0.17.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // APIVersion is the version of the Eventhub + APIVersion = "2015-08-01" + + // DefaultBaseURI is the default URI used for the service Eventhub + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Eventhub. +type ManagementClient struct { + autorest.Client + BaseURI string + APIVersion 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, + APIVersion: APIVersion, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go new file mode 100644 index 000000000000..490f0ef27a48 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go @@ -0,0 +1,340 @@ +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 0.17.0.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" +) + +// ConsumerGroupsClient is the azure EventHub client +type ConsumerGroupsClient struct { + ManagementClient +} + +// NewConsumerGroupsClient creates an instance of the ConsumerGroupsClient +// client. +func NewConsumerGroupsClient(subscriptionID string) ConsumerGroupsClient { + return NewConsumerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConsumerGroupsClientWithBaseURI creates an instance of the +// ConsumerGroupsClient client. +func NewConsumerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConsumerGroupsClient { + return ConsumerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates/Updates a consumer group as a nested resource within +// a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. consumerGroupName is +// the Consumer Group name. parameters is parameters supplied to create a +// Consumer Group Resource. +func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (result ConsumerGroupResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", 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 ConsumerGroupsClient) 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 ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ConsumerGroupResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an ConsumerGroup from the specified EventHub and resource +// group. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. consumerGroupName is +// the Consumer Group name. +func (client ConsumerGroupsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConsumerGroupsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", 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 ConsumerGroupsClient) 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 ConsumerGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an Consumer Group description for the specified Consumer Group. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. consumerGroupName is +// the Consumer Group name. +func (client ConsumerGroupsClient) Get(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result ConsumerGroupResource, err error) { + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConsumerGroupsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", 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 ConsumerGroupsClient) 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 ConsumerGroupsClient) GetResponder(resp *http.Response) (result ConsumerGroupResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll enumerates the consumer groups in a namespace. An empty feed is +// returned if no consumer group exists in the namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. +func (client ConsumerGroupsClient) ListAll(resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResult, err error) { + req, err := client.ListAllPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing request") + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ConsumerGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ConsumerGroupsClient) ListAllResponder(resp *http.Response) (result ConsumerGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client ConsumerGroupsClient) ListAllNextResults(lastResults ConsumerGroupListResult) (result ConsumerGroupListResult, err error) { + req, err := lastResults.ConsumerGroupListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go new file mode 100644 index 000000000000..c596d8035b9f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go @@ -0,0 +1,764 @@ +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 0.17.0.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" +) + +// EventHubsClient is the azure EventHub client +type EventHubsClient struct { + ManagementClient +} + +// NewEventHubsClient creates an instance of the EventHubsClient client. +func NewEventHubsClient(subscriptionID string) EventHubsClient { + return NewEventHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventHubsClientWithBaseURI creates an instance of the EventHubsClient +// client. +func NewEventHubsClientWithBaseURI(baseURI string, subscriptionID string) EventHubsClient { + return EventHubsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates/Updates a new Event Hub as a nested resource within +// a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. parameters is +// parameters supplied to create a EventHub Resource. +func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", 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 EventHubsClient) 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 EventHubsClient) CreateOrUpdateResponder(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 +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for the +// specified Event Hub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the Event Hub name. authorizationRuleName +// is aauthorization Rule Name. parameters is the shared access authorization +// rule. +func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Event hub from the specified namespace and resource group. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. +func (client EventHubsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EventHubsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", 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 EventHubsClient) 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 EventHubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a EventHub authorization rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the Eventhub name. authorizationRuleName +// is authorization Rule Name. +func (client EventHubsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result autorest.Response, err error) { + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client EventHubsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an Event Hub description for the specified Event Hub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the EventHub name. +func (client EventHubsClient) Get(resourceGroupName string, namespaceName string, eventHubName string) (result ResourceType, err error) { + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EventHubsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", 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 EventHubsClient) 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 EventHubsClient) 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 +} + +// GetAuthorizationRule authorization rule for a EventHub by name. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name eventHubName is the Event Hub name. authorizationRuleName +// is authorization rule name. +func (client EventHubsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client EventHubsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll enumerates the Event Hubs in a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. +func (client EventHubsClient) ListAll(resourceGroupName string, namespaceName string) (result ListResult, err error) { + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing request") + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client EventHubsClient) ListAllPreparer(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), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListAllResponder(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 +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client EventHubsClient) ListAllNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules authorization rules for a EventHub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// NameSpace name eventHubName is the EventHub name. +func (client EventHubsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, eventHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client EventHubsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, 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 EventHubsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", 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.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys returns the ACS and SAS connection strings for the Event Hub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the event hub name. authorizationRuleName +// is the connection string of the namespace for the specified +// authorizationRule. +func (client EventHubsClient) ListKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", nil, "Failure preparing request") + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure sending request") + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client EventHubsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/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 EventHubsClient) 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 EventHubsClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the ACS and SAS connection strings for the Event +// Hub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. eventHubName is the event hub name. authorizationRuleName +// is the connection string of the EventHub for the specified +// authorizationRule. parameters is parameters supplied to regenerate Auth +// Rule. +func (client EventHubsClient) RegenerateKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", nil, "Failure preparing request") + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure sending request") + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client EventHubsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client EventHubsClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go new file mode 100644 index 000000000000..42347b1ad1d1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go @@ -0,0 +1,366 @@ +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 0.17.0.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/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen specifies the listen state for access rights. + Listen AccessRights = "Listen" + // Manage specifies the manage state for access rights. + Manage AccessRights = "Manage" + // Send specifies the send state for access rights. + Send AccessRights = "Send" +) + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // Active specifies the active state for entity status. + Active EntityStatus = "Active" + // Creating specifies the creating state for entity status. + Creating EntityStatus = "Creating" + // Deleting specifies the deleting state for entity status. + Deleting EntityStatus = "Deleting" + // Disabled specifies the disabled state for entity status. + Disabled EntityStatus = "Disabled" + // ReceiveDisabled specifies the receive disabled state for entity status. + ReceiveDisabled EntityStatus = "ReceiveDisabled" + // Renaming specifies the renaming state for entity status. + Renaming EntityStatus = "Renaming" + // Restoring specifies the restoring state for entity status. + Restoring EntityStatus = "Restoring" + // SendDisabled specifies the send disabled state for entity status. + SendDisabled EntityStatus = "SendDisabled" + // Unknown specifies the unknown state for entity status. + Unknown EntityStatus = "Unknown" +) + +// NamespaceState enumerates the values for namespace state. +type NamespaceState string + +const ( + // NamespaceStateActivating specifies the namespace state activating state + // for namespace state. + NamespaceStateActivating NamespaceState = "Activating" + // NamespaceStateActive specifies the namespace state active state for + // namespace state. + NamespaceStateActive NamespaceState = "Active" + // NamespaceStateCreated specifies the namespace state created state for + // namespace state. + NamespaceStateCreated NamespaceState = "Created" + // NamespaceStateCreating specifies the namespace state creating state for + // namespace state. + NamespaceStateCreating NamespaceState = "Creating" + // NamespaceStateDisabled specifies the namespace state disabled state for + // namespace state. + NamespaceStateDisabled NamespaceState = "Disabled" + // NamespaceStateDisabling specifies the namespace state disabling state + // for namespace state. + NamespaceStateDisabling NamespaceState = "Disabling" + // NamespaceStateEnabling specifies the namespace state enabling state for + // namespace state. + NamespaceStateEnabling NamespaceState = "Enabling" + // NamespaceStateFailed specifies the namespace state failed state for + // namespace state. + NamespaceStateFailed NamespaceState = "Failed" + // NamespaceStateRemoved specifies the namespace state removed state for + // namespace state. + NamespaceStateRemoved NamespaceState = "Removed" + // NamespaceStateRemoving specifies the namespace state removing state for + // namespace state. + NamespaceStateRemoving NamespaceState = "Removing" + // NamespaceStateSoftDeleted specifies the namespace state soft deleted + // state for namespace state. + NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" + // NamespaceStateSoftDeleting specifies the namespace state soft deleting + // state for namespace state. + NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" + // NamespaceStateUnknown specifies the namespace state unknown state for + // namespace state. + NamespaceStateUnknown NamespaceState = "Unknown" +) + +// Policykey enumerates the values for policykey. +type Policykey string + +const ( + // PrimaryKey specifies the primary key state for policykey. + PrimaryKey Policykey = "PrimaryKey" + // SecondaryKey specifies the secondary key state for policykey. + SecondaryKey Policykey = "SecondaryKey" +) + +// 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" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBasic specifies the sku tier basic state for sku tier. + SkuTierBasic SkuTier = "Basic" + // SkuTierPremium specifies the sku tier premium state for sku tier. + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard specifies the sku tier standard state for sku tier. + SkuTierStandard SkuTier = "Standard" +) + +// ConsumerGroupCreateOrUpdateParameters is parameters supplied to the +// CreateOrUpdate Consumer Group operation. +type ConsumerGroupCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConsumerGroupProperties `json:"properties,omitempty"` +} + +// ConsumerGroupListResult is the response of the List Consumer Group +// operation. +type ConsumerGroupListResult struct { + autorest.Response `json:"-"` + Value *[]ConsumerGroupResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConsumerGroupListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConsumerGroupListResult) ConsumerGroupListResultPreparer() (*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))) +} + +// ConsumerGroupProperties is +type ConsumerGroupProperties struct { + CreatedAt *date.Time `json:"createdAt,omitempty"` + EventHubPath *string `json:"eventHubPath,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +// ConsumerGroupResource is description of Consumer Group Resource. +type ConsumerGroupResource 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"` + Properties *ConsumerGroupProperties `json:"properties,omitempty"` +} + +// CreateOrUpdateParameters is parameters supplied to the CreateOrUpdate +// EventHub operation. +type CreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Properties *Properties `json:"properties,omitempty"` +} + +// ListResult is the response of the List EventHub 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))) +} + +// NamespaceCreateOrUpdateParameters is parameters supplied to the +// CreateOrUpdate Namespace operation. +type NamespaceCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceListResult is the response of the List Namespace operation. +type NamespaceListResult struct { + autorest.Response `json:"-"` + Value *[]NamespaceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NamespaceListResult) NamespaceListResultPreparer() (*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))) +} + +// NamespaceProperties is properties of the Namespace. +type NamespaceProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + Status NamespaceState `json:"status,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + CreateACSNamespace *bool `json:"createACSNamespace,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// NamespaceResource is description of a Namespace resource. +type NamespaceResource 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"` + Sku *Sku `json:"sku,omitempty"` + Properties *NamespaceProperties `json:"properties,omitempty"` +} + +// Properties is +type Properties struct { + CreatedAt *date.Time `json:"createdAt,omitempty"` + MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` + PartitionCount *int64 `json:"partitionCount,omitempty"` + PartitionIds *[]int32 `json:"partitionIds,omitempty"` + Status EntityStatus `json:"status,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` +} + +// RegenerateKeysParameters is parameters supplied to the Regenerate Auth Rule. +type RegenerateKeysParameters struct { + Policykey Policykey `json:"Policykey,omitempty"` +} + +// Resource is +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"` +} + +// ResourceListKeys is namespace/EventHub Connection String +type ResourceListKeys struct { + autorest.Response `json:"-"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + KeyName *string `json:"keyName,omitempty"` +} + +// ResourceType is description of EventHub Resource. +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"` + Properties *Properties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters +// supplied to the CreateOrUpdate AuthorizationRules. +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleListResult is the response of the List +// Namespace operation. +type SharedAccessAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*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))) +} + +// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule +// properties. +type SharedAccessAuthorizationRuleProperties struct { + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// SharedAccessAuthorizationRuleResource is description of a Namespace +// AuthorizationRules. +type SharedAccessAuthorizationRuleResource 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"` + Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// Sku is sku of the Namespace. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go new file mode 100644 index 000000000000..a39b0f2a3a67 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go @@ -0,0 +1,839 @@ +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 0.17.0.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" +) + +// NamespacesClient is the azure EventHub client +type NamespacesClient struct { + ManagementClient +} + +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient +// client. +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates Updates namespace. Once created, this namespace's +// resource manifest is immutable. This operation is idempotent. 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. namespaceName is the +// namespace name. parameters is parameters supplied to create a Namespace +// Resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for a +// namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is namespace Aauthorization Rule +// Name. parameters is the shared access authorization rule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing namespace. This operation also removes all +// associated resources under the namespace. 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. namespaceName is the +// namespace name. +func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", 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 NamespacesClient) 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 NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a namespace authorization rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is authorization Rule Name. +func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the description for the specified namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { + req, err := client.GetPreparer(resourceGroupName, namespaceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NamespacesClient) GetPreparer(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), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", 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 NamespacesClient) 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 NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, 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 authorization rule for a namespace by name. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name authorizationRuleName is authorization rule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules authorization rules for a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(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), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, 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 NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", 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.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists the available namespaces within a resourceGroup. +// +// resourceGroupName is the name of the resource group. +func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces", 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 NamespacesClient) 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 NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, 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 NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "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, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription lists all the available namespaces within the +// subscription irrespective of the resourceGroups. +func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys primary and Secondary ConnectionStrings to the namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is the authorizationRule name. +func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", nil, "Failure preparing request") + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure sending request") + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/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 NamespacesClient) 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 NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerats the Primary or Secondary ConnectionStrings to the +// namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is the authorizationRule name. +// parameters is parameters supplied to regenerate Auth Rule. +func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go new file mode 100644 index 000000000000..82207040af99 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go @@ -0,0 +1,43 @@ +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 0.17.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "fmt" +) + +const ( + major = "5" + minor = "0" + patch = "0" + // Always begin a "tag" with a dash (as per http://semver.org) + tag = "-beta" + semVerFormat = "%s.%s.%s%s" + userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s" +) + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return fmt.Sprintf(userAgentFormat, Version(), "eventhub", "2015-08-01") +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return fmt.Sprintf(semVerFormat, major, minor, patch, tag) +} diff --git a/vendor/vendor.json b/vendor/vendor.json index 1ee3768596ef..8982100d55f2 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -21,10 +21,22 @@ "versionExact": "v5.0.0-beta" }, { - "checksumSHA1": "twJBMkI9NiMeQbPFmw4ehZQAPaE=", + "checksumSHA1": "ndoTo9HTATazQPZiPzq5rFYJhHM=", + "comment": "v2.1.1-beta-8-gca4d906", + "path": "github.com/Azure/azure-sdk-for-go/arm/eventhub", + "revision": "91f3d4a4d024e3c0d4d9412916d05cf84504a616", + "revisionTime": "2016-10-05T01:22:46Z", + "version": "v5.0.0-beta", + "versionExact": "v5.0.0-beta" + }, + { + "checksumSHA1": "ndoTo9HTATazQPZiPzq5rFYJhHM=", + "comment": "v2.1.1-beta-8-gca4d906", "path": "github.com/Azure/azure-sdk-for-go/arm/keyvault", "revision": "91f3d4a4d024e3c0d4d9412916d05cf84504a616", - "revisionTime": "2016-10-05T01:22:46Z" + "revisionTime": "2016-10-05T01:22:46Z", + "version": "v5.0.0-beta", + "versionExact": "v5.0.0-beta" }, { "checksumSHA1": "33Eny6aOVU6MjMYlfzufuo9OdCk=", From 0fb25c73a820c9ee2b9eecf1a071485877d76fd4 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Sat, 8 Oct 2016 17:06:09 +0200 Subject: [PATCH 02/15] Documentation for EventHub Namespaces --- .../r/eventhub_namespace.html.markdown | 69 +++++++++++++++++++ website/source/layouts/azurerm.erb | 13 +++- 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 website/source/docs/providers/azurerm/r/eventhub_namespace.html.markdown diff --git a/website/source/docs/providers/azurerm/r/eventhub_namespace.html.markdown b/website/source/docs/providers/azurerm/r/eventhub_namespace.html.markdown new file mode 100644 index 000000000000..ba6faad13799 --- /dev/null +++ b/website/source/docs/providers/azurerm/r/eventhub_namespace.html.markdown @@ -0,0 +1,69 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_eventhub_namespace" +sidebar_current: "docs-azurerm-resource-eventhub-namespace" +description: |- + Create an EventHub Namespace. +--- + +# azurerm\_eventhub\_namespace + +Create an EventHub Namespace. + +## Example Usage + +``` +resource "azurerm_resource_group" "test" { + name = "resourceGroup1" + location = "West US" +} + +resource "azurerm_eventhub_namespace" "test" { + name = "acceptanceTestEventHubNamespace" + location = "West US" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "basic" + capacity = 2 + + tags { + environment = "Production" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the EventHub Namespace resource . Changing this forces a + new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which to + create the namespace. + +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. + +* `sku` - (Required) Defines which tier to use. Options are basic or standard. + +* `capacity` - (Optional) Specifies the capacity of a premium namespace. Can be 1, 2 or 4 + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The EventHub Namespace ID. + +The following attributes are exported only if there is an authorization rule named +`RootManageSharedAccessKey` which is created automatically by Azure. + +* `default_primary_connection_string` - The primary connection string for the authorization + rule `RootManageSharedAccessKey`. + +* `default_secondary_connection_string` - The secondary connection string for the + authorization rule `RootManageSharedAccessKey`. + +* `default_primary_key` - The primary access key for the authorization rule `RootManageSharedAccessKey`. + +* `default_secondary_key` - The secondary access key for the authorization rule `RootManageSharedAccessKey`. diff --git a/website/source/layouts/azurerm.erb b/website/source/layouts/azurerm.erb index 63cd20526cff..5a69870fb039 100644 --- a/website/source/layouts/azurerm.erb +++ b/website/source/layouts/azurerm.erb @@ -83,6 +83,16 @@ + + > + Event Hubs + + + > Key Vault Resources @@ -224,7 +233,7 @@ - + > Storage Resources