vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood
2017-09-30 15:27:27 +01:00
parent 911d121bb9
commit b017fcfe9a
3048 changed files with 537055 additions and 189679 deletions
+51
View File
@@ -0,0 +1,51 @@
// Package eventgrid implements the Azure ARM Eventgrid service API version 2017-09-15-preview.
//
// Azure EventGrid Management Client
package eventgrid
// 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 (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Eventgrid
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Eventgrid.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
File diff suppressed because it is too large Load Diff
+493
View File
@@ -0,0 +1,493 @@
package eventgrid
// 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 (
"encoding/json"
"errors"
"github.com/Azure/go-autorest/autorest"
)
// EndpointType enumerates the values for endpoint type.
type EndpointType string
const (
// EndpointTypeEventHub specifies the endpoint type event hub state for endpoint type.
EndpointTypeEventHub EndpointType = "EventHub"
// EndpointTypeWebHook specifies the endpoint type web hook state for endpoint type.
EndpointTypeWebHook EndpointType = "WebHook"
)
// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state.
type EventSubscriptionProvisioningState string
const (
// Canceled specifies the canceled state for event subscription provisioning state.
Canceled EventSubscriptionProvisioningState = "Canceled"
// Creating specifies the creating state for event subscription provisioning state.
Creating EventSubscriptionProvisioningState = "Creating"
// Deleting specifies the deleting state for event subscription provisioning state.
Deleting EventSubscriptionProvisioningState = "Deleting"
// Failed specifies the failed state for event subscription provisioning state.
Failed EventSubscriptionProvisioningState = "Failed"
// Succeeded specifies the succeeded state for event subscription provisioning state.
Succeeded EventSubscriptionProvisioningState = "Succeeded"
// Updating specifies the updating state for event subscription provisioning state.
Updating EventSubscriptionProvisioningState = "Updating"
)
// OperationOrigin enumerates the values for operation origin.
type OperationOrigin string
const (
// System specifies the system state for operation origin.
System OperationOrigin = "System"
// User specifies the user state for operation origin.
User OperationOrigin = "User"
// UserAndSystem specifies the user and system state for operation origin.
UserAndSystem OperationOrigin = "UserAndSystem"
)
// ResourceRegionType enumerates the values for resource region type.
type ResourceRegionType string
const (
// GlobalResource specifies the global resource state for resource region type.
GlobalResource ResourceRegionType = "GlobalResource"
// RegionalResource specifies the regional resource state for resource region type.
RegionalResource ResourceRegionType = "RegionalResource"
)
// TopicProvisioningState enumerates the values for topic provisioning state.
type TopicProvisioningState string
const (
// TopicProvisioningStateCanceled specifies the topic provisioning state canceled state for topic provisioning state.
TopicProvisioningStateCanceled TopicProvisioningState = "Canceled"
// TopicProvisioningStateCreating specifies the topic provisioning state creating state for topic provisioning state.
TopicProvisioningStateCreating TopicProvisioningState = "Creating"
// TopicProvisioningStateDeleting specifies the topic provisioning state deleting state for topic provisioning state.
TopicProvisioningStateDeleting TopicProvisioningState = "Deleting"
// TopicProvisioningStateFailed specifies the topic provisioning state failed state for topic provisioning state.
TopicProvisioningStateFailed TopicProvisioningState = "Failed"
// TopicProvisioningStateSucceeded specifies the topic provisioning state succeeded state for topic provisioning state.
TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded"
// TopicProvisioningStateUpdating specifies the topic provisioning state updating state for topic provisioning state.
TopicProvisioningStateUpdating TopicProvisioningState = "Updating"
)
// TopicTypeProvisioningState enumerates the values for topic type provisioning state.
type TopicTypeProvisioningState string
const (
// TopicTypeProvisioningStateCanceled specifies the topic type provisioning state canceled state for topic type
// provisioning state.
TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled"
// TopicTypeProvisioningStateCreating specifies the topic type provisioning state creating state for topic type
// provisioning state.
TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating"
// TopicTypeProvisioningStateDeleting specifies the topic type provisioning state deleting state for topic type
// provisioning state.
TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting"
// TopicTypeProvisioningStateFailed specifies the topic type provisioning state failed state for topic type
// provisioning state.
TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed"
// TopicTypeProvisioningStateSucceeded specifies the topic type provisioning state succeeded state for topic type
// provisioning state.
TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded"
// TopicTypeProvisioningStateUpdating specifies the topic type provisioning state updating state for topic type
// provisioning state.
TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating"
)
// EventHubEventSubscriptionDestination is information about the event hub destination for an event subscription
type EventHubEventSubscriptionDestination struct {
EndpointType EndpointType `json:"endpointType,omitempty"`
*EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination.
func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) {
ehesd.EndpointType = EndpointTypeEventHub
type Alias EventHubEventSubscriptionDestination
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(ehesd),
})
}
// AsWebHookEventSubscriptionDestination is the EventSubscriptionDestination implementation for EventHubEventSubscriptionDestination.
func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) {
return nil, false
}
// AsEventHubEventSubscriptionDestination is the EventSubscriptionDestination implementation for EventHubEventSubscriptionDestination.
func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) {
return &ehesd, true
}
// EventHubEventSubscriptionDestinationProperties is the properties for a event hub destination.
type EventHubEventSubscriptionDestinationProperties struct {
ResourceID *string `json:"resourceId,omitempty"`
}
// EventSubscription is event Subscription
type EventSubscription struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*EventSubscriptionProperties `json:"properties,omitempty"`
}
// EventSubscriptionDestination is information about the destination for an event subscription
type EventSubscriptionDestination interface {
AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool)
AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool)
}
func unmarshalEventSubscriptionDestination(body []byte) (EventSubscriptionDestination, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["endpointType"] {
case string(EndpointTypeWebHook):
var whesd WebHookEventSubscriptionDestination
err := json.Unmarshal(body, &whesd)
return whesd, err
case string(EndpointTypeEventHub):
var ehesd EventHubEventSubscriptionDestination
err := json.Unmarshal(body, &ehesd)
return ehesd, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalEventSubscriptionDestinationArray(body []byte) ([]EventSubscriptionDestination, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
esdArray := make([]EventSubscriptionDestination, len(rawMessages))
for index, rawMessage := range rawMessages {
esd, err := unmarshalEventSubscriptionDestination(*rawMessage)
if err != nil {
return nil, err
}
esdArray[index] = esd
}
return esdArray, nil
}
// EventSubscriptionFilter is filter for the Event Subscription
type EventSubscriptionFilter struct {
SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"`
SubjectEndsWith *string `json:"subjectEndsWith,omitempty"`
IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"`
IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"`
}
// EventSubscriptionFullURL is full endpoint url of an event subscription
type EventSubscriptionFullURL struct {
autorest.Response `json:"-"`
EndpointURL *string `json:"endpointUrl,omitempty"`
}
// EventSubscriptionProperties is properties of the Event Subscription
type EventSubscriptionProperties struct {
Topic *string `json:"topic,omitempty"`
ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"`
Destination EventSubscriptionDestination `json:"destination,omitempty"`
Filter *EventSubscriptionFilter `json:"filter,omitempty"`
Labels *[]string `json:"labels,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct.
func (esp *EventSubscriptionProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["topic"]
if v != nil {
var topic string
err = json.Unmarshal(*m["topic"], &topic)
if err != nil {
return err
}
esp.Topic = &topic
}
v = m["provisioningState"]
if v != nil {
var provisioningState EventSubscriptionProvisioningState
err = json.Unmarshal(*m["provisioningState"], &provisioningState)
if err != nil {
return err
}
esp.ProvisioningState = provisioningState
}
v = m["destination"]
if v != nil {
destination, err := unmarshalEventSubscriptionDestination(*m["destination"])
if err != nil {
return err
}
esp.Destination = destination
}
v = m["filter"]
if v != nil {
var filter EventSubscriptionFilter
err = json.Unmarshal(*m["filter"], &filter)
if err != nil {
return err
}
esp.Filter = &filter
}
v = m["labels"]
if v != nil {
var labels []string
err = json.Unmarshal(*m["labels"], &labels)
if err != nil {
return err
}
esp.Labels = &labels
}
return nil
}
// EventSubscriptionsListResult is result of the List EventSubscriptions operation
type EventSubscriptionsListResult struct {
autorest.Response `json:"-"`
Value *[]EventSubscription `json:"value,omitempty"`
}
// EventSubscriptionUpdateParameters is properties of the Event Subscription update
type EventSubscriptionUpdateParameters struct {
Destination EventSubscriptionDestination `json:"destination,omitempty"`
Filter *EventSubscriptionFilter `json:"filter,omitempty"`
Labels *[]string `json:"labels,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct.
func (esup *EventSubscriptionUpdateParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["destination"]
if v != nil {
destination, err := unmarshalEventSubscriptionDestination(*m["destination"])
if err != nil {
return err
}
esup.Destination = destination
}
v = m["filter"]
if v != nil {
var filter EventSubscriptionFilter
err = json.Unmarshal(*m["filter"], &filter)
if err != nil {
return err
}
esup.Filter = &filter
}
v = m["labels"]
if v != nil {
var labels []string
err = json.Unmarshal(*m["labels"], &labels)
if err != nil {
return err
}
esup.Labels = &labels
}
return nil
}
// EventType is event Type for a subject under a topic
type EventType struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*EventTypeProperties `json:"properties,omitempty"`
}
// EventTypeProperties is properties of the event type
type EventTypeProperties struct {
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
SchemaURL *string `json:"schemaUrl,omitempty"`
}
// EventTypesListResult is result of the List Event Types operation
type EventTypesListResult struct {
autorest.Response `json:"-"`
Value *[]EventType `json:"value,omitempty"`
}
// Operation is represents an operation returned by the GetOperations request
type Operation struct {
Name *string `json:"name,omitempty"`
Display *OperationInfo `json:"display,omitempty"`
Origin OperationOrigin `json:"origin,omitempty"`
Properties *map[string]interface{} `json:"properties,omitempty"`
}
// OperationInfo is information about an operation
type OperationInfo struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// OperationsListResult is result of the List Operations operation
type OperationsListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
}
// Resource is definition of a Resource
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// Topic is eventGrid Topic
type Topic 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"`
*TopicProperties `json:"properties,omitempty"`
}
// TopicProperties is properties of the Topic
type TopicProperties struct {
ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
}
// TopicRegenerateKeyRequest is topic regenerate share access key key request
type TopicRegenerateKeyRequest struct {
KeyName *string `json:"keyName,omitempty"`
}
// TopicSharedAccessKeys is shared access keys of the Topic
type TopicSharedAccessKeys struct {
autorest.Response `json:"-"`
Key1 *string `json:"key1,omitempty"`
Key2 *string `json:"key2,omitempty"`
}
// TopicsListResult is result of the List Topics operation
type TopicsListResult struct {
autorest.Response `json:"-"`
Value *[]Topic `json:"value,omitempty"`
}
// TopicTypeInfo is properties of a topic type info.
type TopicTypeInfo struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*TopicTypeProperties `json:"properties,omitempty"`
}
// TopicTypeProperties is properties of a topic type.
type TopicTypeProperties struct {
Provider *string `json:"provider,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"`
ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"`
SupportedLocations *[]string `json:"supportedLocations,omitempty"`
}
// TopicTypesListResult is result of the List Topic Types operation
type TopicTypesListResult struct {
autorest.Response `json:"-"`
Value *[]TopicTypeInfo `json:"value,omitempty"`
}
// TrackedResource is definition of a Tracked Resource
type TrackedResource 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"`
}
// WebHookEventSubscriptionDestination is information about the webhook destination for an event subscription
type WebHookEventSubscriptionDestination struct {
EndpointType EndpointType `json:"endpointType,omitempty"`
*WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination.
func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) {
whesd.EndpointType = EndpointTypeWebHook
type Alias WebHookEventSubscriptionDestination
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(whesd),
})
}
// AsWebHookEventSubscriptionDestination is the EventSubscriptionDestination implementation for WebHookEventSubscriptionDestination.
func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) {
return &whesd, true
}
// AsEventHubEventSubscriptionDestination is the EventSubscriptionDestination implementation for WebHookEventSubscriptionDestination.
func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) {
return nil, false
}
// WebHookEventSubscriptionDestinationProperties is information about the webhook destination properties for an event
// subscription
type WebHookEventSubscriptionDestinationProperties struct {
EndpointURL *string `json:"endpointUrl,omitempty"`
EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"`
}
+96
View File
@@ -0,0 +1,96 @@
package eventgrid
// 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 (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// OperationsClient is the azure EventGrid Management Client
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List list the available operations supported by the Microsoft.EventGrid resource provider
func (client OperationsClient) List() (result OperationsListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.EventGrid/operations"),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+602
View File
@@ -0,0 +1,602 @@
package eventgrid
// 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 (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// TopicsClient is the azure EventGrid Management Client
type TopicsClient struct {
ManagementClient
}
// NewTopicsClient creates an instance of the TopicsClient client.
func NewTopicsClient(subscriptionID string) TopicsClient {
return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewTopicsClientWithBaseURI creates an instance of the TopicsClient client.
func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient {
return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate asynchronously creates a new topic with the specified parameters. 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 within the user's subscription. topicName is name of the topic
// topicInfo is topic information
func (client TopicsClient) CreateOrUpdate(resourceGroupName string, topicName string, topicInfo Topic, cancel <-chan struct{}) (<-chan Topic, <-chan error) {
resultChan := make(chan Topic, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result Topic
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, topicName, topicInfo, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client TopicsClient) CreateOrUpdatePreparer(resourceGroupName string, topicName string, topicInfo Topic, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"topicName": autorest.Encode("path", topicName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", pathParameters),
autorest.WithJSON(topicInfo),
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 TopicsClient) 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete delete existing topic 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 within the user's subscription. topicName is name of the topic
func (client TopicsClient) Delete(resourceGroupName string, topicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, topicName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client TopicsClient) DeletePreparer(resourceGroupName string, topicName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"topicName": autorest.Encode("path", topicName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get get properties of a topic
//
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
func (client TopicsClient) Get(resourceGroupName string, topicName string) (result Topic, err error) {
req, err := client.GetPreparer(resourceGroupName, topicName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client TopicsClient) GetPreparer(resourceGroupName string, topicName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"topicName": autorest.Encode("path", topicName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroup list all the topics under a resource group
//
// resourceGroupName is the name of the resource group within the user's subscription.
func (client TopicsClient) ListByResourceGroup(resourceGroupName string) (result TopicsListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client TopicsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListBySubscription list all the topics under an Azure subscription
func (client TopicsClient) ListBySubscription() (result TopicsListResult, err error) {
req, err := client.ListBySubscriptionPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request")
return
}
resp, err := client.ListBySubscriptionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request")
return
}
result, err = client.ListBySubscriptionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request")
}
return
}
// ListBySubscriptionPreparer prepares the ListBySubscription request.
func (client TopicsClient) ListBySubscriptionPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListEventTypes list event types for a topic
//
// resourceGroupName is the name of the resource group within the user's subscription. providerNamespace is namespace
// of the provider of the topic resourceTypeName is name of the topic type resourceName is name of the topic
func (client TopicsClient) ListEventTypes(resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) {
req, err := client.ListEventTypesPreparer(resourceGroupName, providerNamespace, resourceTypeName, resourceName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request")
return
}
resp, err := client.ListEventTypesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request")
return
}
result, err = client.ListEventTypesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request")
}
return
}
// ListEventTypesPreparer prepares the ListEventTypes request.
func (client TopicsClient) ListEventTypesPreparer(resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"providerNamespace": autorest.Encode("path", providerNamespace),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"resourceName": autorest.Encode("path", resourceName),
"resourceTypeName": autorest.Encode("path", resourceTypeName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListEventTypesSender sends the ListEventTypes request. The method will close the
// http.Response Body if it receives an error.
func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListEventTypesResponder handles the response to the ListEventTypes request. The method always
// closes the http.Response Body.
func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListSharedAccessKeys list the two keys used to publish to a topic
//
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
func (client TopicsClient) ListSharedAccessKeys(resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) {
req, err := client.ListSharedAccessKeysPreparer(resourceGroupName, topicName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request")
return
}
resp, err := client.ListSharedAccessKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request")
return
}
result, err = client.ListSharedAccessKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request")
}
return
}
// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request.
func (client TopicsClient) ListSharedAccessKeysPreparer(resourceGroupName string, topicName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"topicName": autorest.Encode("path", topicName),
}
const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}/listKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the
// http.Response Body if it receives an error.
func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always
// closes the http.Response Body.
func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// RegenerateKey regenerate a shared access key for a topic
//
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
// regenerateKeyRequest is request body to regenerate key
func (client TopicsClient) RegenerateKey(resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: regenerateKeyRequest,
Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "eventgrid.TopicsClient", "RegenerateKey")
}
req, err := client.RegenerateKeyPreparer(resourceGroupName, topicName, regenerateKeyRequest)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request")
return
}
resp, err := client.RegenerateKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request")
return
}
result, err = client.RegenerateKeyResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request")
}
return
}
// RegenerateKeyPreparer prepares the RegenerateKey request.
func (client TopicsClient) RegenerateKeyPreparer(resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"topicName": autorest.Encode("path", topicName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey", pathParameters),
autorest.WithJSON(regenerateKeyRequest),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// RegenerateKeySender sends the RegenerateKey request. The method will close the
// http.Response Body if it receives an error.
func (client TopicsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
// closes the http.Response Body.
func (client TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+222
View File
@@ -0,0 +1,222 @@
package eventgrid
// 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 (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// TopicTypesClient is the azure EventGrid Management Client
type TopicTypesClient struct {
ManagementClient
}
// NewTopicTypesClient creates an instance of the TopicTypesClient client.
func NewTopicTypesClient(subscriptionID string) TopicTypesClient {
return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient client.
func NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient {
return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get get information about a topic type
//
// topicTypeName is name of the topic type
func (client TopicTypesClient) Get(topicTypeName string) (result TopicTypeInfo, err error) {
req, err := client.GetPreparer(topicTypeName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client TopicTypesClient) GetPreparer(topicTypeName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"topicTypeName": autorest.Encode("path", topicTypeName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List list all registered topic types
func (client TopicTypesClient) List() (result TopicTypesListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client TopicTypesClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client TopicTypesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListEventTypes list event types for a topic type
//
// topicTypeName is name of the topic type
func (client TopicTypesClient) ListEventTypes(topicTypeName string) (result EventTypesListResult, err error) {
req, err := client.ListEventTypesPreparer(topicTypeName)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request")
return
}
resp, err := client.ListEventTypesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request")
return
}
result, err = client.ListEventTypesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request")
}
return
}
// ListEventTypesPreparer prepares the ListEventTypes request.
func (client TopicTypesClient) ListEventTypesPreparer(topicTypeName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"topicTypeName": autorest.Encode("path", topicTypeName),
}
const APIVersion = "2017-09-15-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListEventTypesSender sends the ListEventTypes request. The method will close the
// http.Response Body if it receives an error.
func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListEventTypesResponder handles the response to the ListEventTypes request. The method always
// closes the http.Response Body.
func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+28
View File
@@ -0,0 +1,28 @@
package eventgrid
// 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.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v11.0.0-beta arm-eventgrid/2017-09-15-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v11.0.0-beta"
}