From 517d906b9ce30ac53459a11e86acfeea73f02766 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 10 Apr 2019 20:52:55 +0000 Subject: [PATCH] Generated from e71f68ed3742748809be56268abd685f2efbc1ce Update specification/eventhub/resource-manager/Microsoft.EventHub/preview/2018-01-01-preview/EventHub-preview.json Co-Authored-By: FBettati --- .../mgmt/eventhub/eventhubapi/models.go | 1 - .../preview/eventhub/mgmt/eventhub/models.go | 7 - .../2018-01-01-preview/eventhub/cluster.go | 130 ------------------ .../2018-01-01-preview/eventhub/clusters.go | 87 ++++++++++++ .../eventhub/eventhubapi/interfaces.go | 8 +- 5 files changed, 88 insertions(+), 145 deletions(-) delete mode 100644 services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/cluster.go diff --git a/profiles/preview/preview/eventhub/mgmt/eventhub/eventhubapi/models.go b/profiles/preview/preview/eventhub/mgmt/eventhub/eventhubapi/models.go index 5d176580642d..c29612bac4bd 100644 --- a/profiles/preview/preview/eventhub/mgmt/eventhub/eventhubapi/models.go +++ b/profiles/preview/preview/eventhub/mgmt/eventhub/eventhubapi/models.go @@ -21,7 +21,6 @@ package eventhubapi import original "github.com/Azure/azure-sdk-for-go/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/eventhubapi" -type ClusterClientAPI = original.ClusterClientAPI type ClustersClientAPI = original.ClustersClientAPI type ConfigurationClientAPI = original.ConfigurationClientAPI type NamespacesClientAPI = original.NamespacesClientAPI diff --git a/profiles/preview/preview/eventhub/mgmt/eventhub/models.go b/profiles/preview/preview/eventhub/mgmt/eventhub/models.go index ded1f8c9af10..5290fc674c25 100644 --- a/profiles/preview/preview/eventhub/mgmt/eventhub/models.go +++ b/profiles/preview/preview/eventhub/mgmt/eventhub/models.go @@ -65,7 +65,6 @@ const ( type BaseClient = original.BaseClient type Cluster = original.Cluster -type ClusterClient = original.ClusterClient type ClusterListResult = original.ClusterListResult type ClusterListResultIterator = original.ClusterListResultIterator type ClusterListResultPage = original.ClusterListResultPage @@ -115,12 +114,6 @@ type VirtualNetworkRuleProperties = original.VirtualNetworkRuleProperties func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } -func NewClusterClient(subscriptionID string) ClusterClient { - return original.NewClusterClient(subscriptionID) -} -func NewClusterClientWithBaseURI(baseURI string, subscriptionID string) ClusterClient { - return original.NewClusterClientWithBaseURI(baseURI, subscriptionID) -} func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { return original.NewClusterListResultIterator(page) } diff --git a/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/cluster.go b/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/cluster.go deleted file mode 100644 index 86421998e3f5..000000000000 --- a/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/cluster.go +++ /dev/null @@ -1,130 +0,0 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClusterClient is the azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules -// resources. -type ClusterClient struct { - BaseClient -} - -// NewClusterClient creates an instance of the ClusterClient client. -func NewClusterClient(subscriptionID string) ClusterClient { - return NewClusterClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClusterClientWithBaseURI creates an instance of the ClusterClient client. -func NewClusterClientWithBaseURI(baseURI string, subscriptionID string) ClusterClient { - return ClusterClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. -// Parameters: -// resourceGroupName - name of the resource group within the Azure subscription. -// clusterName - the name of the Event Hubs Cluster. -func (client ClusterClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result EHNamespaceIDListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventhub.ClusterClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ClusterClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.ClusterClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ClusterClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ClusterClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClusterClient) ListResponder(resp *http.Response) (result EHNamespaceIDListResult, 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/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/clusters.go b/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/clusters.go index 9b6bd3d092b7..5d23d8ad663b 100644 --- a/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/clusters.go +++ b/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/clusters.go @@ -335,6 +335,93 @@ func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, re return } +// NamespaceList list all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// clusterName - the name of the Event Hubs Cluster. +func (client ClustersClient) NamespaceList(ctx context.Context, resourceGroupName string, clusterName string) (result EHNamespaceIDListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.NamespaceList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: clusterName, + Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "clusterName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventhub.ClustersClient", "NamespaceList", err.Error()) + } + + req, err := client.NamespaceListPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ClustersClient", "NamespaceList", nil, "Failure preparing request") + return + } + + resp, err := client.NamespaceListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.ClustersClient", "NamespaceList", resp, "Failure sending request") + return + } + + result, err = client.NamespaceListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ClustersClient", "NamespaceList", resp, "Failure responding to request") + } + + return +} + +// NamespaceListPreparer prepares the NamespaceList request. +func (client ClustersClient) NamespaceListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// NamespaceListSender sends the NamespaceList request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) NamespaceListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// NamespaceListResponder handles the response to the NamespaceList request. The method always +// closes the http.Response Body. +func (client ClustersClient) NamespaceListResponder(resp *http.Response) (result EHNamespaceIDListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Patch modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. // Parameters: // resourceGroupName - name of the resource group within the Azure subscription. diff --git a/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/eventhubapi/interfaces.go b/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/eventhubapi/interfaces.go index 6d90bb8ee884..411b5b98c23f 100644 --- a/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/eventhubapi/interfaces.go +++ b/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub/eventhubapi/interfaces.go @@ -35,19 +35,13 @@ type ClustersClientAPI interface { Delete(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.ClustersDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.Cluster, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventhub.ClusterListResultPage, err error) + NamespaceList(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.EHNamespaceIDListResult, err error) Patch(ctx context.Context, resourceGroupName string, clusterName string, parameters eventhub.Cluster) (result eventhub.ClustersPatchFuture, err error) Put(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.ClustersPutFuture, err error) } var _ ClustersClientAPI = (*eventhub.ClustersClient)(nil) -// ClusterClientAPI contains the set of methods on the ClusterClient type. -type ClusterClientAPI interface { - List(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.EHNamespaceIDListResult, err error) -} - -var _ ClusterClientAPI = (*eventhub.ClusterClient)(nil) - // ConfigurationClientAPI contains the set of methods on the ConfigurationClient type. type ConfigurationClientAPI interface { Get(ctx context.Context, resourceGroupName string, clusterName string) (result eventhub.ClusterQuotaConfigurationProperties, err error)