From c29babb3ad78eadddcba96dfb5e7c83a0e1493c7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Feb 2018 10:18:36 -0800 Subject: [PATCH] Generated from eccd0ab7c8d44acd1bbb8413573076ebf3f8b74f (#1134) Added the missing API discovered in ARM_RP_Fundamentals to the respective API version swagger and review comments --- .../mgmt/2015-08-01/eventhub/eventhubs.go | 85 ++++++ .../mgmt/2015-08-01/eventhub/version.go | 6 +- .../mgmt/2017-04-01/eventhub/messagingplan.go | 118 ++++++++ .../mgmt/2017-04-01/eventhub/models.go | 270 ++++++++++++++++++ .../mgmt/2017-04-01/eventhub/regions.go | 141 +++++++++ .../mgmt/2017-04-01/eventhub/version.go | 6 +- 6 files changed, 618 insertions(+), 8 deletions(-) create mode 100644 services/eventhub/mgmt/2017-04-01/eventhub/messagingplan.go create mode 100644 services/eventhub/mgmt/2017-04-01/eventhub/regions.go diff --git a/services/eventhub/mgmt/2015-08-01/eventhub/eventhubs.go b/services/eventhub/mgmt/2015-08-01/eventhub/eventhubs.go index 7bb7da6782ad..04667fabe3b6 100644 --- a/services/eventhub/mgmt/2015-08-01/eventhub/eventhubs.go +++ b/services/eventhub/mgmt/2015-08-01/eventhub/eventhubs.go @@ -845,6 +845,91 @@ func (client EventHubsClient) ListKeysResponder(resp *http.Response) (result Res return } +// PosttAuthorizationRule gets an AuthorizationRule for an Event Hub by rule name. +// +// resourceGroupName is name of the resource group within the azure subscription. namespaceName is the Namespace +// name eventHubName is the Event Hub name authorizationRuleName is the authorization rule name. +func (client EventHubsClient) PosttAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventhub.EventHubsClient", "PosttAuthorizationRule", err.Error()) + } + + req, err := client.PosttAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "PosttAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.PosttAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "PosttAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.PosttAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "PosttAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// PosttAuthorizationRulePreparer prepares the PosttAuthorizationRule request. +func (client EventHubsClient) PosttAuthorizationRulePreparer(ctx context.Context, 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), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PosttAuthorizationRuleSender sends the PosttAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) PosttAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PosttAuthorizationRuleResponder handles the response to the PosttAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) PosttAuthorizationRuleResponder(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 +} + // RegenerateKeys regenerates the ACS and SAS connection strings for the Event Hub. // // resourceGroupName is name of the resource group within the azure subscription. namespaceName is the Namespace diff --git a/services/eventhub/mgmt/2015-08-01/eventhub/version.go b/services/eventhub/mgmt/2015-08-01/eventhub/version.go index 123988ecac3a..4d152eb4e0c4 100644 --- a/services/eventhub/mgmt/2015-08-01/eventhub/version.go +++ b/services/eventhub/mgmt/2015-08-01/eventhub/version.go @@ -1,7 +1,5 @@ package eventhub -import "github.com/Azure/azure-sdk-for-go/version" - // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,10 +19,10 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " eventhub/2015-08-01" + return "Azure-SDK-For-Go/latest services" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - return version.Number + return "latest" } diff --git a/services/eventhub/mgmt/2017-04-01/eventhub/messagingplan.go b/services/eventhub/mgmt/2017-04-01/eventhub/messagingplan.go new file mode 100644 index 000000000000..59eababf32d7 --- /dev/null +++ b/services/eventhub/mgmt/2017-04-01/eventhub/messagingplan.go @@ -0,0 +1,118 @@ +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" + "net/http" +) + +// MessagingPlanClient is the azure Event Hubs client +type MessagingPlanClient struct { + BaseClient +} + +// NewMessagingPlanClient creates an instance of the MessagingPlanClient client. +func NewMessagingPlanClient(subscriptionID string) MessagingPlanClient { + return NewMessagingPlanClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMessagingPlanClientWithBaseURI creates an instance of the MessagingPlanClient client. +func NewMessagingPlanClientWithBaseURI(baseURI string, subscriptionID string) MessagingPlanClient { + return MessagingPlanClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a description for the specified namespace. +// +// resourceGroupName is name of the resource group within the azure subscription. namespaceName is the Namespace +// name +func (client MessagingPlanClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result MessagingPlan, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventhub.MessagingPlanClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.MessagingPlanClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.MessagingPlanClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.MessagingPlanClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MessagingPlanClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MessagingPlanClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MessagingPlanClient) GetResponder(resp *http.Response) (result MessagingPlan, 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/eventhub/mgmt/2017-04-01/eventhub/models.go b/services/eventhub/mgmt/2017-04-01/eventhub/models.go index 94d56ed9e47d..98f136e786a7 100644 --- a/services/eventhub/mgmt/2017-04-01/eventhub/models.go +++ b/services/eventhub/mgmt/2017-04-01/eventhub/models.go @@ -1128,6 +1128,276 @@ func (page ListResultPage) Values() []Model { return *page.lr.Value } +// MessagingPlan messaging +type MessagingPlan struct { + autorest.Response `json:"-"` + *MessagingPlanproperties `json:"properties,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MessagingPlan. +func (mp MessagingPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.MessagingPlanproperties != nil { + objectMap["properties"] = mp.MessagingPlanproperties + } + if mp.Location != nil { + objectMap["location"] = mp.Location + } + if mp.Tags != nil { + objectMap["tags"] = mp.Tags + } + if mp.ID != nil { + objectMap["id"] = mp.ID + } + if mp.Name != nil { + objectMap["name"] = mp.Name + } + if mp.Type != nil { + objectMap["type"] = mp.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MessagingPlan struct. +func (mp *MessagingPlan) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var messagingPlanproperties MessagingPlanproperties + err = json.Unmarshal(*v, &messagingPlanproperties) + if err != nil { + return err + } + mp.MessagingPlanproperties = &messagingPlanproperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mp.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mp.Type = &typeVar + } + } + } + + return nil +} + +// MessagingPlanproperties messaging Region +type MessagingPlanproperties struct { + // Sku - Sku type + Sku *int32 `json:"sku,omitempty"` + // SelectedEventHubUnit - Selected event hub unit + SelectedEventHubUnit *int32 `json:"selectedEventHubUnit,omitempty"` + // UpdatedAt - The exact time the messaging plan was updated. + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + // Revision - revision number + Revision *int64 `json:"revision,omitempty"` +} + +// MessagingRegions messaging Region +type MessagingRegions struct { + Properties *MessagingRegionsProperties `json:"properties,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MessagingRegions. +func (mr MessagingRegions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.Properties != nil { + objectMap["properties"] = mr.Properties + } + if mr.Location != nil { + objectMap["location"] = mr.Location + } + if mr.Tags != nil { + objectMap["tags"] = mr.Tags + } + if mr.ID != nil { + objectMap["id"] = mr.ID + } + if mr.Name != nil { + objectMap["name"] = mr.Name + } + if mr.Type != nil { + objectMap["type"] = mr.Type + } + return json.Marshal(objectMap) +} + +// MessagingRegionsListResult the response of the List MessagingRegions operation. +type MessagingRegionsListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List MessagingRegions type. + Value *[]MessagingRegions `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of MessagingRegions. + NextLink *string `json:"nextLink,omitempty"` +} + +// MessagingRegionsListResultIterator provides access to a complete listing of MessagingRegions values. +type MessagingRegionsListResultIterator struct { + i int + page MessagingRegionsListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MessagingRegionsListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MessagingRegionsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MessagingRegionsListResultIterator) Response() MessagingRegionsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MessagingRegionsListResultIterator) Value() MessagingRegions { + if !iter.page.NotDone() { + return MessagingRegions{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MessagingRegionsListResult) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// messagingRegionsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MessagingRegionsListResult) messagingRegionsListResultPreparer() (*http.Request, error) { + if mrlr.NextLink == nil || len(to.String(mrlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MessagingRegionsListResultPage contains a page of MessagingRegions values. +type MessagingRegionsListResultPage struct { + fn func(MessagingRegionsListResult) (MessagingRegionsListResult, error) + mrlr MessagingRegionsListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MessagingRegionsListResultPage) Next() error { + next, err := page.fn(page.mrlr) + if err != nil { + return err + } + page.mrlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MessagingRegionsListResultPage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MessagingRegionsListResultPage) Response() MessagingRegionsListResult { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MessagingRegionsListResultPage) Values() []MessagingRegions { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// MessagingRegionsProperties ... +type MessagingRegionsProperties struct { + // Code - Region code + Code *string `json:"code,omitempty"` + // FullName - Full name of the region + FullName *string `json:"fullName,omitempty"` +} + // Model single item in List or Get Event Hub operation type Model struct { autorest.Response `json:"-"` diff --git a/services/eventhub/mgmt/2017-04-01/eventhub/regions.go b/services/eventhub/mgmt/2017-04-01/eventhub/regions.go new file mode 100644 index 000000000000..118dfd461a49 --- /dev/null +++ b/services/eventhub/mgmt/2017-04-01/eventhub/regions.go @@ -0,0 +1,141 @@ +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" + "net/http" +) + +// RegionsClient is the azure Event Hubs client +type RegionsClient struct { + BaseClient +} + +// NewRegionsClient creates an instance of the RegionsClient client. +func NewRegionsClient(subscriptionID string) RegionsClient { + return NewRegionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRegionsClientWithBaseURI creates an instance of the RegionsClient client. +func NewRegionsClientWithBaseURI(baseURI string, subscriptionID string) RegionsClient { + return RegionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListBySku gets the available Regions for a given sku +// +// sku is the sku type. +func (client RegionsClient) ListBySku(ctx context.Context, sku string) (result MessagingRegionsListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: sku, + Constraints: []validation.Constraint{{Target: "sku", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "sku", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventhub.RegionsClient", "ListBySku", err.Error()) + } + + result.fn = client.listBySkuNextResults + req, err := client.ListBySkuPreparer(ctx, sku) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.RegionsClient", "ListBySku", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySkuSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.RegionsClient", "ListBySku", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListBySkuResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.RegionsClient", "ListBySku", resp, "Failure responding to request") + } + + return +} + +// ListBySkuPreparer prepares the ListBySku request. +func (client RegionsClient) ListBySkuPreparer(ctx context.Context, sku string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sku": autorest.Encode("path", sku), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySkuSender sends the ListBySku request. The method will close the +// http.Response Body if it receives an error. +func (client RegionsClient) ListBySkuSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySkuResponder handles the response to the ListBySku request. The method always +// closes the http.Response Body. +func (client RegionsClient) ListBySkuResponder(resp *http.Response) (result MessagingRegionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySkuNextResults retrieves the next set of results, if any. +func (client RegionsClient) listBySkuNextResults(lastResults MessagingRegionsListResult) (result MessagingRegionsListResult, err error) { + req, err := lastResults.messagingRegionsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.RegionsClient", "listBySkuNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySkuSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.RegionsClient", "listBySkuNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySkuResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.RegionsClient", "listBySkuNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySkuComplete enumerates all values, automatically crossing page boundaries as required. +func (client RegionsClient) ListBySkuComplete(ctx context.Context, sku string) (result MessagingRegionsListResultIterator, err error) { + result.page, err = client.ListBySku(ctx, sku) + return +} diff --git a/services/eventhub/mgmt/2017-04-01/eventhub/version.go b/services/eventhub/mgmt/2017-04-01/eventhub/version.go index 11d960128b5b..4d152eb4e0c4 100644 --- a/services/eventhub/mgmt/2017-04-01/eventhub/version.go +++ b/services/eventhub/mgmt/2017-04-01/eventhub/version.go @@ -1,7 +1,5 @@ package eventhub -import "github.com/Azure/azure-sdk-for-go/version" - // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,10 +19,10 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " eventhub/2017-04-01" + return "Azure-SDK-For-Go/latest services" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - return version.Number + return "latest" }