vendor: update all dependencies to latest versions
This commit is contained in:
Generated
Vendored
+118
@@ -0,0 +1,118 @@
|
||||
// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-01-01.
|
||||
//
|
||||
// Azure EventGrid 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 (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BaseClient is the base client for Eventgrid.
|
||||
type BaseClient struct {
|
||||
autorest.Client
|
||||
}
|
||||
|
||||
// New creates an instance of the BaseClient client.
|
||||
func New() BaseClient {
|
||||
return NewWithoutDefaults()
|
||||
}
|
||||
|
||||
// NewWithoutDefaults creates an instance of the BaseClient client.
|
||||
func NewWithoutDefaults() BaseClient {
|
||||
return BaseClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
}
|
||||
}
|
||||
|
||||
// PublishEvents publishes a batch of events to an Azure Event Grid topic.
|
||||
//
|
||||
// topicHostname is the host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net events is an array of events
|
||||
// to be published to Event Grid.
|
||||
func (client BaseClient) PublishEvents(ctx context.Context, topicHostname string, events []Event) (result autorest.Response, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: events,
|
||||
Constraints: []validation.Constraint{{Target: "events", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "eventgrid.BaseClient", "PublishEvents")
|
||||
}
|
||||
|
||||
req, err := client.PublishEventsPreparer(ctx, topicHostname, events)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.BaseClient", "PublishEvents", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.PublishEventsSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.BaseClient", "PublishEvents", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.PublishEventsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.BaseClient", "PublishEvents", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// PublishEventsPreparer prepares the PublishEvents request.
|
||||
func (client BaseClient) PublishEventsPreparer(ctx context.Context, topicHostname string, events []Event) (*http.Request, error) {
|
||||
urlParameters := map[string]interface{}{
|
||||
"topicHostname": topicHostname,
|
||||
}
|
||||
|
||||
const APIVersion = "2018-01-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithCustomBaseURL("https://{topicHostname}", urlParameters),
|
||||
autorest.WithPath("/api/events"),
|
||||
autorest.WithJSON(events),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// PublishEventsSender sends the PublishEvents request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BaseClient) PublishEventsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// PublishEventsResponder handles the response to the PublishEvents request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BaseClient) PublishEventsResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
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/date"
|
||||
)
|
||||
|
||||
// Event properties of an event published to an Event Grid topic.
|
||||
type Event struct {
|
||||
// ID - An unique identifier for the event.
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Topic - The resource path of the event source.
|
||||
Topic *string `json:"topic,omitempty"`
|
||||
// Subject - A resource path relative to the topic path.
|
||||
Subject *string `json:"subject,omitempty"`
|
||||
// Data - Event data specific to the event type.
|
||||
Data *map[string]interface{} `json:"data,omitempty"`
|
||||
// EventType - The type of the event that occurred.
|
||||
EventType *string `json:"eventType,omitempty"`
|
||||
// EventTime - The time (in UTC) the event was generated.
|
||||
EventTime *date.Time `json:"eventTime,omitempty"`
|
||||
// MetadataVersion - The schema version of the event metadata.
|
||||
MetadataVersion *string `json:"metadataVersion,omitempty"`
|
||||
// DataVersion - The schema version of the data object.
|
||||
DataVersion *string `json:"dataVersion,omitempty"`
|
||||
}
|
||||
Generated
Vendored
+28
@@ -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/v12.2.0-beta services"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v12.2.0-beta"
|
||||
}
|
||||
Generated
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// Package eventgrid implements the Azure ARM Eventgrid service API version 2017-06-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"
|
||||
)
|
||||
|
||||
// BaseClient is the base client for Eventgrid.
|
||||
type BaseClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the BaseClient client.
|
||||
func New(subscriptionID string) BaseClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the BaseClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
|
||||
return BaseClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+1011
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+773
@@ -0,0 +1,773 @@
|
||||
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"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// EndpointType enumerates the values for endpoint type.
|
||||
type EndpointType string
|
||||
|
||||
const (
|
||||
// WebHook ...
|
||||
WebHook EndpointType = "WebHook"
|
||||
)
|
||||
|
||||
// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state.
|
||||
type EventSubscriptionProvisioningState string
|
||||
|
||||
const (
|
||||
// Canceled ...
|
||||
Canceled EventSubscriptionProvisioningState = "Canceled"
|
||||
// Creating ...
|
||||
Creating EventSubscriptionProvisioningState = "Creating"
|
||||
// Deleting ...
|
||||
Deleting EventSubscriptionProvisioningState = "Deleting"
|
||||
// Failed ...
|
||||
Failed EventSubscriptionProvisioningState = "Failed"
|
||||
// Succeeded ...
|
||||
Succeeded EventSubscriptionProvisioningState = "Succeeded"
|
||||
// Updating ...
|
||||
Updating EventSubscriptionProvisioningState = "Updating"
|
||||
)
|
||||
|
||||
// OperationOrigin enumerates the values for operation origin.
|
||||
type OperationOrigin string
|
||||
|
||||
const (
|
||||
// System ...
|
||||
System OperationOrigin = "System"
|
||||
// User ...
|
||||
User OperationOrigin = "User"
|
||||
// UserAndSystem ...
|
||||
UserAndSystem OperationOrigin = "UserAndSystem"
|
||||
)
|
||||
|
||||
// ResourceRegionType enumerates the values for resource region type.
|
||||
type ResourceRegionType string
|
||||
|
||||
const (
|
||||
// GlobalResource ...
|
||||
GlobalResource ResourceRegionType = "GlobalResource"
|
||||
// RegionalResource ...
|
||||
RegionalResource ResourceRegionType = "RegionalResource"
|
||||
)
|
||||
|
||||
// TopicProvisioningState enumerates the values for topic provisioning state.
|
||||
type TopicProvisioningState string
|
||||
|
||||
const (
|
||||
// TopicProvisioningStateCanceled ...
|
||||
TopicProvisioningStateCanceled TopicProvisioningState = "Canceled"
|
||||
// TopicProvisioningStateCreating ...
|
||||
TopicProvisioningStateCreating TopicProvisioningState = "Creating"
|
||||
// TopicProvisioningStateDeleting ...
|
||||
TopicProvisioningStateDeleting TopicProvisioningState = "Deleting"
|
||||
// TopicProvisioningStateFailed ...
|
||||
TopicProvisioningStateFailed TopicProvisioningState = "Failed"
|
||||
// TopicProvisioningStateSucceeded ...
|
||||
TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded"
|
||||
// TopicProvisioningStateUpdating ...
|
||||
TopicProvisioningStateUpdating TopicProvisioningState = "Updating"
|
||||
)
|
||||
|
||||
// TopicTypeProvisioningState enumerates the values for topic type provisioning state.
|
||||
type TopicTypeProvisioningState string
|
||||
|
||||
const (
|
||||
// TopicTypeProvisioningStateCanceled ...
|
||||
TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled"
|
||||
// TopicTypeProvisioningStateCreating ...
|
||||
TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating"
|
||||
// TopicTypeProvisioningStateDeleting ...
|
||||
TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting"
|
||||
// TopicTypeProvisioningStateFailed ...
|
||||
TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed"
|
||||
// TopicTypeProvisioningStateSucceeded ...
|
||||
TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded"
|
||||
// TopicTypeProvisioningStateUpdating ...
|
||||
TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating"
|
||||
)
|
||||
|
||||
// EventSubscription event Subscription
|
||||
type EventSubscription struct {
|
||||
autorest.Response `json:"-"`
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
// EventSubscriptionProperties - Properties of the event subscription
|
||||
*EventSubscriptionProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom unmarshaler for EventSubscription struct.
|
||||
func (es *EventSubscription) 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["properties"]
|
||||
if v != nil {
|
||||
var properties EventSubscriptionProperties
|
||||
err = json.Unmarshal(*m["properties"], &properties)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
es.EventSubscriptionProperties = &properties
|
||||
}
|
||||
|
||||
v = m["id"]
|
||||
if v != nil {
|
||||
var ID string
|
||||
err = json.Unmarshal(*m["id"], &ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
es.ID = &ID
|
||||
}
|
||||
|
||||
v = m["name"]
|
||||
if v != nil {
|
||||
var name string
|
||||
err = json.Unmarshal(*m["name"], &name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
es.Name = &name
|
||||
}
|
||||
|
||||
v = m["type"]
|
||||
if v != nil {
|
||||
var typeVar string
|
||||
err = json.Unmarshal(*m["type"], &typeVar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
es.Type = &typeVar
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventSubscriptionDestination information about the destination for an event subscription
|
||||
type EventSubscriptionDestination struct {
|
||||
// EndpointType - Type of the endpoint for the event subscription destination. Possible values include: 'WebHook'
|
||||
EndpointType EndpointType `json:"endpointType,omitempty"`
|
||||
// EventSubscriptionDestinationProperties - Properties of the event subscription destination
|
||||
*EventSubscriptionDestinationProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom unmarshaler for EventSubscriptionDestination struct.
|
||||
func (esd *EventSubscriptionDestination) 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["endpointType"]
|
||||
if v != nil {
|
||||
var endpointType EndpointType
|
||||
err = json.Unmarshal(*m["endpointType"], &endpointType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
esd.EndpointType = endpointType
|
||||
}
|
||||
|
||||
v = m["properties"]
|
||||
if v != nil {
|
||||
var properties EventSubscriptionDestinationProperties
|
||||
err = json.Unmarshal(*m["properties"], &properties)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
esd.EventSubscriptionDestinationProperties = &properties
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventSubscriptionDestinationProperties properties of the event subscription destination
|
||||
type EventSubscriptionDestinationProperties struct {
|
||||
// EndpointURL - The URL that represents the endpoint of the destination of an event subscription.
|
||||
EndpointURL *string `json:"endpointUrl,omitempty"`
|
||||
// EndpointBaseURL - The base URL that represents the endpoint of the destination of an event subscription.
|
||||
EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"`
|
||||
}
|
||||
|
||||
// EventSubscriptionFilter filter for the Event Subscription
|
||||
type EventSubscriptionFilter struct {
|
||||
// SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix.
|
||||
// The format of this depends on the publisher of the events.
|
||||
// Wildcard characters are not supported in this path.
|
||||
SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"`
|
||||
// SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix.
|
||||
// Wildcard characters are not supported in this path.
|
||||
SubjectEndsWith *string `json:"subjectEndsWith,omitempty"`
|
||||
// IncludedEventTypes - A list of applicable event types that need to be part of the event subscription.
|
||||
// If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list.
|
||||
IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"`
|
||||
// IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter
|
||||
// should be compared in a case sensitive manner.
|
||||
IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"`
|
||||
}
|
||||
|
||||
// EventSubscriptionFullURL full endpoint url of an event subscription
|
||||
type EventSubscriptionFullURL struct {
|
||||
autorest.Response `json:"-"`
|
||||
// EndpointURL - The URL that represents the endpoint of the destination of an event subscription.
|
||||
EndpointURL *string `json:"endpointUrl,omitempty"`
|
||||
}
|
||||
|
||||
// EventSubscriptionProperties properties of the Event Subscription
|
||||
type EventSubscriptionProperties struct {
|
||||
// Topic - Name of the topic of the event subscription.
|
||||
Topic *string `json:"topic,omitempty"`
|
||||
// ProvisioningState - Provisioning state of the event subscription. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed'
|
||||
ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"`
|
||||
// Destination - Information about the destination where events have to be delivered for the event subscription.
|
||||
Destination *EventSubscriptionDestination `json:"destination,omitempty"`
|
||||
// Filter - Information about the filter for the event subscription.
|
||||
Filter *EventSubscriptionFilter `json:"filter,omitempty"`
|
||||
// Labels - List of user defined labels.
|
||||
Labels *[]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// EventSubscriptionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
|
||||
type EventSubscriptionsCreateFuture struct {
|
||||
azure.Future
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
// Result returns the result of the asynchronous operation.
|
||||
// If the operation has not completed it will return an error.
|
||||
func (future EventSubscriptionsCreateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) {
|
||||
var done bool
|
||||
done, err = future.Done(client)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !done {
|
||||
return es, autorest.NewError("eventgrid.EventSubscriptionsCreateFuture", "Result", "asynchronous operation has not completed")
|
||||
}
|
||||
if future.PollingMethod() == azure.PollingLocation {
|
||||
es, err = client.CreateResponder(future.Response())
|
||||
return
|
||||
}
|
||||
var resp *http.Response
|
||||
resp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
es, err = client.CreateResponder(resp)
|
||||
return
|
||||
}
|
||||
|
||||
// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
|
||||
type EventSubscriptionsDeleteFuture struct {
|
||||
azure.Future
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
// Result returns the result of the asynchronous operation.
|
||||
// If the operation has not completed it will return an error.
|
||||
func (future EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsClient) (ar autorest.Response, err error) {
|
||||
var done bool
|
||||
done, err = future.Done(client)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !done {
|
||||
return ar, autorest.NewError("eventgrid.EventSubscriptionsDeleteFuture", "Result", "asynchronous operation has not completed")
|
||||
}
|
||||
if future.PollingMethod() == azure.PollingLocation {
|
||||
ar, err = client.DeleteResponder(future.Response())
|
||||
return
|
||||
}
|
||||
var resp *http.Response
|
||||
resp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ar, err = client.DeleteResponder(resp)
|
||||
return
|
||||
}
|
||||
|
||||
// EventSubscriptionsListResult result of the List EventSubscriptions operation
|
||||
type EventSubscriptionsListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Value - A collection of EventSubscriptions
|
||||
Value *[]EventSubscription `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
|
||||
type EventSubscriptionsUpdateFuture struct {
|
||||
azure.Future
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
// Result returns the result of the asynchronous operation.
|
||||
// If the operation has not completed it will return an error.
|
||||
func (future EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) {
|
||||
var done bool
|
||||
done, err = future.Done(client)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !done {
|
||||
return es, autorest.NewError("eventgrid.EventSubscriptionsUpdateFuture", "Result", "asynchronous operation has not completed")
|
||||
}
|
||||
if future.PollingMethod() == azure.PollingLocation {
|
||||
es, err = client.UpdateResponder(future.Response())
|
||||
return
|
||||
}
|
||||
var resp *http.Response
|
||||
resp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
es, err = client.UpdateResponder(resp)
|
||||
return
|
||||
}
|
||||
|
||||
// EventSubscriptionUpdateParameters properties of the Event Subscription update
|
||||
type EventSubscriptionUpdateParameters struct {
|
||||
// Destination - Information about the destination where events have to be delivered for the event subscription.
|
||||
Destination *EventSubscriptionDestination `json:"destination,omitempty"`
|
||||
// Filter - Information about the filter for the event subscription.
|
||||
Filter *EventSubscriptionFilter `json:"filter,omitempty"`
|
||||
// Labels - List of user defined labels.
|
||||
Labels *[]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// EventType event Type for a subject under a topic
|
||||
type EventType struct {
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
// EventTypeProperties - Properties of the event type.
|
||||
*EventTypeProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom unmarshaler for EventType struct.
|
||||
func (et *EventType) 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["properties"]
|
||||
if v != nil {
|
||||
var properties EventTypeProperties
|
||||
err = json.Unmarshal(*m["properties"], &properties)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
et.EventTypeProperties = &properties
|
||||
}
|
||||
|
||||
v = m["id"]
|
||||
if v != nil {
|
||||
var ID string
|
||||
err = json.Unmarshal(*m["id"], &ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
et.ID = &ID
|
||||
}
|
||||
|
||||
v = m["name"]
|
||||
if v != nil {
|
||||
var name string
|
||||
err = json.Unmarshal(*m["name"], &name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
et.Name = &name
|
||||
}
|
||||
|
||||
v = m["type"]
|
||||
if v != nil {
|
||||
var typeVar string
|
||||
err = json.Unmarshal(*m["type"], &typeVar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
et.Type = &typeVar
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventTypeProperties properties of the event type
|
||||
type EventTypeProperties struct {
|
||||
// DisplayName - Display name of the event type.
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
// Description - Description of the event type.
|
||||
Description *string `json:"description,omitempty"`
|
||||
// SchemaURL - Url of the schema for this event type.
|
||||
SchemaURL *string `json:"schemaUrl,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypesListResult result of the List Event Types operation
|
||||
type EventTypesListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Value - A collection of event types
|
||||
Value *[]EventType `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// Operation represents an operation returned by the GetOperations request
|
||||
type Operation struct {
|
||||
// Name - Name of the operation
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Display - Display name of the operation
|
||||
Display *OperationInfo `json:"display,omitempty"`
|
||||
// Origin - Origin of the operation. Possible values include: 'User', 'System', 'UserAndSystem'
|
||||
Origin OperationOrigin `json:"origin,omitempty"`
|
||||
// Properties - Properties of the operation
|
||||
Properties *map[string]interface{} `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// OperationInfo information about an operation
|
||||
type OperationInfo struct {
|
||||
// Provider - Name of the provider
|
||||
Provider *string `json:"provider,omitempty"`
|
||||
// Resource - Name of the resource type
|
||||
Resource *string `json:"resource,omitempty"`
|
||||
// Operation - Name of the operation
|
||||
Operation *string `json:"operation,omitempty"`
|
||||
// Description - Description of the operation
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// OperationsListResult result of the List Operations operation
|
||||
type OperationsListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Value - A collection of operations
|
||||
Value *[]Operation `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// Resource definition of a Resource
|
||||
type Resource struct {
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// Topic eventGrid Topic
|
||||
type Topic struct {
|
||||
autorest.Response `json:"-"`
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
// Location - Location of the resource
|
||||
Location *string `json:"location,omitempty"`
|
||||
// Tags - Tags of the resource
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
// TopicProperties - Properties of the topic
|
||||
*TopicProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom unmarshaler for Topic struct.
|
||||
func (t *Topic) 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["properties"]
|
||||
if v != nil {
|
||||
var properties TopicProperties
|
||||
err = json.Unmarshal(*m["properties"], &properties)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.TopicProperties = &properties
|
||||
}
|
||||
|
||||
v = m["location"]
|
||||
if v != nil {
|
||||
var location string
|
||||
err = json.Unmarshal(*m["location"], &location)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Location = &location
|
||||
}
|
||||
|
||||
v = m["tags"]
|
||||
if v != nil {
|
||||
var tags map[string]*string
|
||||
err = json.Unmarshal(*m["tags"], &tags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Tags = &tags
|
||||
}
|
||||
|
||||
v = m["id"]
|
||||
if v != nil {
|
||||
var ID string
|
||||
err = json.Unmarshal(*m["id"], &ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.ID = &ID
|
||||
}
|
||||
|
||||
v = m["name"]
|
||||
if v != nil {
|
||||
var name string
|
||||
err = json.Unmarshal(*m["name"], &name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Name = &name
|
||||
}
|
||||
|
||||
v = m["type"]
|
||||
if v != nil {
|
||||
var typeVar string
|
||||
err = json.Unmarshal(*m["type"], &typeVar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Type = &typeVar
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TopicProperties properties of the Topic
|
||||
type TopicProperties struct {
|
||||
// ProvisioningState - Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed'
|
||||
ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"`
|
||||
// Endpoint - Endpoint for the topic.
|
||||
Endpoint *string `json:"endpoint,omitempty"`
|
||||
}
|
||||
|
||||
// TopicRegenerateKeyRequest topic regenerate share access key key request
|
||||
type TopicRegenerateKeyRequest struct {
|
||||
// KeyName - Key name to regenerate key1 or key2
|
||||
KeyName *string `json:"keyName,omitempty"`
|
||||
}
|
||||
|
||||
// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
|
||||
type TopicsCreateOrUpdateFuture struct {
|
||||
azure.Future
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
// Result returns the result of the asynchronous operation.
|
||||
// If the operation has not completed it will return an error.
|
||||
func (future TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, err error) {
|
||||
var done bool
|
||||
done, err = future.Done(client)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !done {
|
||||
return t, autorest.NewError("eventgrid.TopicsCreateOrUpdateFuture", "Result", "asynchronous operation has not completed")
|
||||
}
|
||||
if future.PollingMethod() == azure.PollingLocation {
|
||||
t, err = client.CreateOrUpdateResponder(future.Response())
|
||||
return
|
||||
}
|
||||
var resp *http.Response
|
||||
resp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
t, err = client.CreateOrUpdateResponder(resp)
|
||||
return
|
||||
}
|
||||
|
||||
// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
|
||||
type TopicsDeleteFuture struct {
|
||||
azure.Future
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
// Result returns the result of the asynchronous operation.
|
||||
// If the operation has not completed it will return an error.
|
||||
func (future TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Response, err error) {
|
||||
var done bool
|
||||
done, err = future.Done(client)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !done {
|
||||
return ar, autorest.NewError("eventgrid.TopicsDeleteFuture", "Result", "asynchronous operation has not completed")
|
||||
}
|
||||
if future.PollingMethod() == azure.PollingLocation {
|
||||
ar, err = client.DeleteResponder(future.Response())
|
||||
return
|
||||
}
|
||||
var resp *http.Response
|
||||
resp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ar, err = client.DeleteResponder(resp)
|
||||
return
|
||||
}
|
||||
|
||||
// TopicSharedAccessKeys shared access keys of the Topic
|
||||
type TopicSharedAccessKeys struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Key1 - Shared access key1 for the topic.
|
||||
Key1 *string `json:"key1,omitempty"`
|
||||
// Key2 - Shared access key2 for the topic.
|
||||
Key2 *string `json:"key2,omitempty"`
|
||||
}
|
||||
|
||||
// TopicsListResult result of the List Topics operation
|
||||
type TopicsListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Value - A collection of Topics
|
||||
Value *[]Topic `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// TopicTypeInfo properties of a topic type info.
|
||||
type TopicTypeInfo struct {
|
||||
autorest.Response `json:"-"`
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
// TopicTypeProperties - Properties of the topic type info
|
||||
*TopicTypeProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct.
|
||||
func (tti *TopicTypeInfo) 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["properties"]
|
||||
if v != nil {
|
||||
var properties TopicTypeProperties
|
||||
err = json.Unmarshal(*m["properties"], &properties)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tti.TopicTypeProperties = &properties
|
||||
}
|
||||
|
||||
v = m["id"]
|
||||
if v != nil {
|
||||
var ID string
|
||||
err = json.Unmarshal(*m["id"], &ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tti.ID = &ID
|
||||
}
|
||||
|
||||
v = m["name"]
|
||||
if v != nil {
|
||||
var name string
|
||||
err = json.Unmarshal(*m["name"], &name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tti.Name = &name
|
||||
}
|
||||
|
||||
v = m["type"]
|
||||
if v != nil {
|
||||
var typeVar string
|
||||
err = json.Unmarshal(*m["type"], &typeVar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tti.Type = &typeVar
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TopicTypeProperties properties of a topic type.
|
||||
type TopicTypeProperties struct {
|
||||
// Provider - Namespace of the provider of the topic type.
|
||||
Provider *string `json:"provider,omitempty"`
|
||||
// DisplayName - Display Name for the topic type.
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
// Description - Description of the topic type.
|
||||
Description *string `json:"description,omitempty"`
|
||||
// ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource'
|
||||
ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"`
|
||||
// ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed'
|
||||
ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"`
|
||||
}
|
||||
|
||||
// TopicTypesListResult result of the List Topic Types operation
|
||||
type TopicTypesListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
// Value - A collection of topic types
|
||||
Value *[]TopicTypeInfo `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// TrackedResource definition of a Tracked Resource
|
||||
type TrackedResource struct {
|
||||
// ID - Fully qualified identifier of the resource
|
||||
ID *string `json:"id,omitempty"`
|
||||
// Name - Name of the resource
|
||||
Name *string `json:"name,omitempty"`
|
||||
// Type - Type of the resource
|
||||
Type *string `json:"type,omitempty"`
|
||||
// Location - Location of the resource
|
||||
Location *string `json:"location,omitempty"`
|
||||
// Tags - Tags of the resource
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
Generated
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result OperationsListResult, err error) {
|
||||
req, err := client.ListPreparer(ctx)
|
||||
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(ctx context.Context) (*http.Request, error) {
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Generated
Vendored
+582
@@ -0,0 +1,582 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) {
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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) (future TopicsCreateOrUpdateFuture, err error) {
|
||||
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||
future.Future = azure.NewFuture(req)
|
||||
future.req = req
|
||||
_, err = future.Done(sender)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = autorest.Respond(future.Response(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
|
||||
func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) {
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, topicName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteSender(req)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client TopicsClient) DeletePreparer(ctx context.Context, 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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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) (future TopicsDeleteFuture, err error) {
|
||||
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||
future.Future = azure.NewFuture(req)
|
||||
future.req = req
|
||||
_, err = future.Done(sender)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = autorest.Respond(future.Response(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||
return
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) {
|
||||
req, err := client.GetPreparer(ctx, 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(ctx context.Context, 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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(ctx, 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(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result TopicsListResult, err error) {
|
||||
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||
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(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) {
|
||||
req, err := client.ListEventTypesPreparer(ctx, 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(ctx context.Context, 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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) {
|
||||
req, err := client.ListSharedAccessKeysPreparer(ctx, 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(ctx context.Context, 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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, 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(ctx, 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(ctx context.Context, 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-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Generated
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) {
|
||||
req, err := client.GetPreparer(ctx, 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(ctx context.Context, topicTypeName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"topicTypeName": autorest.Encode("path", topicTypeName),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result TopicTypesListResult, err error) {
|
||||
req, err := client.ListPreparer(ctx)
|
||||
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(ctx context.Context) (*http.Request, error) {
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) {
|
||||
req, err := client.ListEventTypesPreparer(ctx, 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(ctx context.Context, topicTypeName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"topicTypeName": autorest.Encode("path", topicTypeName),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Generated
Vendored
+28
@@ -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/v12.2.0-beta services"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v12.2.0-beta"
|
||||
}
|
||||
Generated
Vendored
+51
@@ -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"
|
||||
)
|
||||
|
||||
// BaseClient is the base client for Eventgrid.
|
||||
type BaseClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the BaseClient client.
|
||||
func New(subscriptionID string) BaseClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the BaseClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
|
||||
return BaseClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+1011
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1112
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result OperationsListResult, err error) {
|
||||
req, err := client.ListPreparer(ctx)
|
||||
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(ctx context.Context) (*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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Generated
Vendored
+653
@@ -0,0 +1,653 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) {
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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) (future TopicsCreateOrUpdateFuture, err error) {
|
||||
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||
future.Future = azure.NewFuture(req)
|
||||
future.req = req
|
||||
_, err = future.Done(sender)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = autorest.Respond(future.Response(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
|
||||
func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) {
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, topicName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteSender(req)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client TopicsClient) DeletePreparer(ctx context.Context, 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.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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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) (future TopicsDeleteFuture, err error) {
|
||||
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||
future.Future = azure.NewFuture(req)
|
||||
future.req = req
|
||||
_, err = future.Done(sender)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = autorest.Respond(future.Response(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||
return
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) {
|
||||
req, err := client.GetPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result TopicsListResult, err error) {
|
||||
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||
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(ctx context.Context) (*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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) {
|
||||
req, err := client.ListEventTypesPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) {
|
||||
req, err := client.ListSharedAccessKeysPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, 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(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// Update asynchronously updates a topic with the specified parameters.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the topic
|
||||
// topicUpdateParameters is topic update information
|
||||
func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) {
|
||||
req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateSender(req)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*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.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", pathParameters),
|
||||
autorest.WithJSON(topicUpdateParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, err error) {
|
||||
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||
future.Future = azure.NewFuture(req)
|
||||
future.req = req
|
||||
_, err = future.Done(sender)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = autorest.Respond(future.Response(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client TopicsClient) UpdateResponder(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
|
||||
}
|
||||
Generated
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
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 (
|
||||
"context"
|
||||
"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 {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) {
|
||||
req, err := client.GetPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context) (result TopicTypesListResult, err error) {
|
||||
req, err := client.ListPreparer(ctx)
|
||||
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(ctx context.Context) (*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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) {
|
||||
req, err := client.ListEventTypesPreparer(ctx, 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(ctx context.Context, 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{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// 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,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Generated
Vendored
+28
@@ -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/v12.2.0-beta services"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v12.2.0-beta"
|
||||
}
|
||||
Reference in New Issue
Block a user