vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Package notificationhubs implements the Azure ARM Notificationhubs service
// API version 2017-04-01.
//
// Azure NotificationHub client
package notificationhubs
// 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 1.0.1.0
// 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 Notificationhubs
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Notificationhubs.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+395
View File
@@ -0,0 +1,395 @@
package notificationhubs
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// AccessRights enumerates the values for access rights.
type AccessRights string
const (
// Listen specifies the listen state for access rights.
Listen AccessRights = "Listen"
// Manage specifies the manage state for access rights.
Manage AccessRights = "Manage"
// Send specifies the send state for access rights.
Send AccessRights = "Send"
)
// NamespaceType enumerates the values for namespace type.
type NamespaceType string
const (
// Messaging specifies the messaging state for namespace type.
Messaging NamespaceType = "Messaging"
// NotificationHub specifies the notification hub state for namespace type.
NotificationHub NamespaceType = "NotificationHub"
)
// SkuName enumerates the values for sku name.
type SkuName string
const (
// Basic specifies the basic state for sku name.
Basic SkuName = "Basic"
// Free specifies the free state for sku name.
Free SkuName = "Free"
// Standard specifies the standard state for sku name.
Standard SkuName = "Standard"
)
// AdmCredential is description of a NotificationHub AdmCredential.
type AdmCredential struct {
*AdmCredentialProperties `json:"properties,omitempty"`
}
// AdmCredentialProperties is description of a NotificationHub AdmCredential.
type AdmCredentialProperties struct {
ClientID *string `json:"clientId,omitempty"`
ClientSecret *string `json:"clientSecret,omitempty"`
AuthTokenURL *string `json:"authTokenUrl,omitempty"`
}
// ApnsCredential is description of a NotificationHub ApnsCredential.
type ApnsCredential struct {
*ApnsCredentialProperties `json:"properties,omitempty"`
}
// ApnsCredentialProperties is description of a NotificationHub ApnsCredential.
type ApnsCredentialProperties struct {
ApnsCertificate *string `json:"apnsCertificate,omitempty"`
CertificateKey *string `json:"certificateKey,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
Thumbprint *string `json:"thumbprint,omitempty"`
KeyID *string `json:"keyId,omitempty"`
AppName *string `json:"appName,omitempty"`
AppID *string `json:"appId,omitempty"`
Token *string `json:"token,omitempty"`
}
// BaiduCredential is description of a NotificationHub BaiduCredential.
type BaiduCredential struct {
*BaiduCredentialProperties `json:"properties,omitempty"`
}
// BaiduCredentialProperties is description of a NotificationHub
// BaiduCredential.
type BaiduCredentialProperties struct {
BaiduAPIKey *string `json:"baiduApiKey,omitempty"`
BaiduEndPoint *string `json:"baiduEndPoint,omitempty"`
BaiduSecretKey *string `json:"baiduSecretKey,omitempty"`
}
// CheckAvailabilityParameters is parameters supplied to the Check Name
// Availability for Namespace and NotificationHubs.
type CheckAvailabilityParameters struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
IsAvailiable *bool `json:"isAvailiable,omitempty"`
}
// CheckAvailabilityResult is description of a CheckAvailibility resource.
type CheckAvailabilityResult struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
IsAvailiable *bool `json:"isAvailiable,omitempty"`
}
// CreateOrUpdateParameters is parameters supplied to the CreateOrUpdate
// NotificationHub operation.
type CreateOrUpdateParameters struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*Properties `json:"properties,omitempty"`
}
// GcmCredential is description of a NotificationHub GcmCredential.
type GcmCredential struct {
*GcmCredentialProperties `json:"properties,omitempty"`
}
// GcmCredentialProperties is description of a NotificationHub GcmCredential.
type GcmCredentialProperties struct {
GcmEndpoint *string `json:"gcmEndpoint,omitempty"`
GoogleAPIKey *string `json:"googleApiKey,omitempty"`
}
// ListResult is the response of the List NotificationHub operation.
type ListResult struct {
autorest.Response `json:"-"`
Value *[]ResourceType `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ListResult) ListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MpnsCredential is description of a NotificationHub MpnsCredential.
type MpnsCredential struct {
*MpnsCredentialProperties `json:"properties,omitempty"`
}
// MpnsCredentialProperties is description of a NotificationHub MpnsCredential.
type MpnsCredentialProperties struct {
MpnsCertificate *string `json:"mpnsCertificate,omitempty"`
CertificateKey *string `json:"certificateKey,omitempty"`
Thumbprint *string `json:"thumbprint,omitempty"`
}
// NamespaceCreateOrUpdateParameters is parameters supplied to the
// CreateOrUpdate Namespace operation.
type NamespaceCreateOrUpdateParameters struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*NamespaceProperties `json:"properties,omitempty"`
}
// NamespaceListResult is the response of the List Namespace operation.
type NamespaceListResult struct {
autorest.Response `json:"-"`
Value *[]NamespaceResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// NamespacePatchParameters is parameters supplied to the Patch Namespace
// operation.
type NamespacePatchParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
}
// NamespaceProperties is namespace properties.
type NamespaceProperties struct {
Name *string `json:"name,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
Region *string `json:"region,omitempty"`
Status *string `json:"status,omitempty"`
CreatedAt *date.Time `json:"createdAt,omitempty"`
ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"`
SubscriptionID *string `json:"subscriptionId,omitempty"`
ScaleUnit *string `json:"scaleUnit,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Critical *bool `json:"critical,omitempty"`
NamespaceType NamespaceType `json:"namespaceType,omitempty"`
}
// NamespaceResource is description of a Namespace resource.
type NamespaceResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*NamespaceProperties `json:"properties,omitempty"`
}
// PnsCredentialsProperties is description of a NotificationHub PNS
// Credentials.
type PnsCredentialsProperties struct {
ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"`
WnsCredential *WnsCredential `json:"wnsCredential,omitempty"`
GcmCredential *GcmCredential `json:"gcmCredential,omitempty"`
MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"`
AdmCredential *AdmCredential `json:"admCredential,omitempty"`
BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"`
}
// PnsCredentialsResource is description of a NotificationHub PNS Credentials.
type PnsCredentialsResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*PnsCredentialsProperties `json:"properties,omitempty"`
}
// PolicykeyResource is namespace/NotificationHub Regenerate Keys
type PolicykeyResource struct {
PolicyKey *string `json:"policyKey,omitempty"`
}
// Properties is notificationHub properties.
type Properties struct {
Name *string `json:"name,omitempty"`
RegistrationTTL *string `json:"registrationTtl,omitempty"`
AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"`
ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"`
WnsCredential *WnsCredential `json:"wnsCredential,omitempty"`
GcmCredential *GcmCredential `json:"gcmCredential,omitempty"`
MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"`
AdmCredential *AdmCredential `json:"admCredential,omitempty"`
BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"`
}
// Resource is
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
}
// ResourceListKeys is namespace/NotificationHub Connection String
type ResourceListKeys struct {
autorest.Response `json:"-"`
PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"`
SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"`
PrimaryKey *string `json:"primaryKey,omitempty"`
SecondaryKey *string `json:"secondaryKey,omitempty"`
KeyName *string `json:"keyName,omitempty"`
}
// ResourceType is description of a NotificationHub Resource.
type ResourceType struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*Properties `json:"properties,omitempty"`
}
// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied
// to the CreateOrUpdate Namespace AuthorizationRules.
type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"`
}
// SharedAccessAuthorizationRuleListResult is the response of the List
// Namespace operation.
type SharedAccessAuthorizationRuleListResult struct {
autorest.Response `json:"-"`
Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule
// properties.
type SharedAccessAuthorizationRuleProperties struct {
Rights *[]AccessRights `json:"rights,omitempty"`
}
// SharedAccessAuthorizationRuleResource is description of a Namespace
// AuthorizationRules.
type SharedAccessAuthorizationRuleResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"`
*SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"`
}
// Sku is the Sku description for a namespace
type Sku struct {
Name SkuName `json:"name,omitempty"`
Tier *string `json:"tier,omitempty"`
Size *string `json:"size,omitempty"`
Family *string `json:"family,omitempty"`
Capacity *int32 `json:"capacity,omitempty"`
}
// SubResource is
type SubResource struct {
ID *string `json:"id,omitempty"`
}
// WnsCredential is description of a NotificationHub WnsCredential.
type WnsCredential struct {
*WnsCredentialProperties `json:"properties,omitempty"`
}
// WnsCredentialProperties is description of a NotificationHub WnsCredential.
type WnsCredentialProperties struct {
PackageSid *string `json:"packageSid,omitempty"`
SecretKey *string `json:"secretKey,omitempty"`
WindowsLiveEndpoint *string `json:"windowsLiveEndpoint,omitempty"`
}
File diff suppressed because it is too large Load Diff
+937
View File
@@ -0,0 +1,937 @@
package notificationhubs
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// GroupClient is the azure NotificationHub client
type GroupClient struct {
ManagementClient
}
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CheckAvailability checks the availability of the given notificationHub in a
// namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. parameters is the notificationHub name.
func (client GroupClient) CheckAvailability(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CheckAvailability")
}
req, err := client.CheckAvailabilityPreparer(resourceGroupName, namespaceName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", nil, "Failure preparing request")
return
}
resp, err := client.CheckAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure sending request")
return
}
result, err = client.CheckAvailabilityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure responding to request")
}
return
}
// CheckAvailabilityPreparer prepares the CheckAvailability request.
func (client GroupClient) CheckAvailabilityPreparer(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CheckAvailabilitySender sends the CheckAvailability request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always
// closes the http.Response Body.
func (client GroupClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateOrUpdate creates/Update a NotificationHub in a namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name. parameters
// is parameters supplied to the create/update a NotificationHub Resource.
func (client GroupClient) CreateOrUpdate(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, notificationHubName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, 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
}
// CreateOrUpdateAuthorizationRule creates/Updates an authorization rule for a
// NotificationHub
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
// authorizationRuleName is authorization Rule Name. parameters is the shared
// access authorization rule.
func (client GroupClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule")
}
req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateAuthorizationRuleSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request")
}
return
}
// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request.
func (client GroupClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a notification hub associated with a namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
func (client GroupClient) Delete(resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, namespaceName, notificationHubName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client GroupClient) DeletePreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// DeleteAuthorizationRule deletes a notificationHub authorization rule
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
// authorizationRuleName is authorization Rule Name.
func (client GroupClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) {
req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.DeleteAuthorizationRuleSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.DeleteAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure responding to request")
}
return
}
// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request.
func (client GroupClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always
// closes the http.Response Body.
func (client GroupClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get lists the notification hubs associated with a namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
func (client GroupClient) Get(resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) {
req, err := client.GetPreparer(resourceGroupName, namespaceName, notificationHubName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client GroupClient) GetPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetAuthorizationRule gets an authorization rule for a NotificationHub by
// name.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name notificationHubName is the notification hub name.
// authorizationRuleName is authorization rule name.
func (client GroupClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) {
req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.GetAuthorizationRuleSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.GetAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure responding to request")
}
return
}
// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request.
func (client GroupClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always
// closes the http.Response Body.
func (client GroupClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetPnsCredentials lists the PNS Credentials associated with a notification
// hub .
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
func (client GroupClient) GetPnsCredentials(resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) {
req, err := client.GetPnsCredentialsPreparer(resourceGroupName, namespaceName, notificationHubName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", nil, "Failure preparing request")
return
}
resp, err := client.GetPnsCredentialsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure sending request")
return
}
result, err = client.GetPnsCredentialsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure responding to request")
}
return
}
// GetPnsCredentialsPreparer prepares the GetPnsCredentials request.
func (client GroupClient) GetPnsCredentialsPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always
// closes the http.Response Body.
func (client GroupClient) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, 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 lists the notification hubs associated with a namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name.
func (client GroupClient) List(resourceGroupName string, namespaceName string) (result ListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, namespaceName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client GroupClient) ListPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListAuthorizationRules gets the authorization rules for a NotificationHub.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name notificationHubName is the notification hub name.
func (client GroupClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResult, err error) {
req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, notificationHubName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing request")
return
}
resp, err := client.ListAuthorizationRulesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending request")
return
}
result, err = client.ListAuthorizationRulesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to request")
}
return
}
// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request.
func (client GroupClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always
// closes the http.Response Body.
func (client GroupClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAuthorizationRulesNextResults retrieves the next set of results, if any.
func (client GroupClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) {
req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListAuthorizationRulesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending next results request")
}
result, err = client.ListAuthorizationRulesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to next results request")
}
return
}
// ListKeys gets the Primary and Secondary ConnectionStrings to the
// NotificationHub
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
// authorizationRuleName is the connection string of the NotificationHub for
// the specified authorizationRule.
func (client GroupClient) ListKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) {
req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", nil, "Failure preparing request")
return
}
resp, err := client.ListKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure sending request")
return
}
result, err = client.ListKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure responding to request")
}
return
}
// ListKeysPreparer prepares the ListKeys request.
func (client GroupClient) ListKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListKeysSender sends the ListKeys request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListKeysResponder handles the response to the ListKeys request. The method always
// closes the http.Response Body.
func (client GroupClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub
// Authorization Rule
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. notificationHubName is the notification hub name.
// authorizationRuleName is the connection string of the NotificationHub for
// the specified authorizationRule. parameters is parameters supplied to
// regenerate the NotificationHub Authorization Rule Key.
func (client GroupClient) RegenerateKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) {
req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", nil, "Failure preparing request")
return
}
resp, err := client.RegenerateKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure sending request")
return
}
result, err = client.RegenerateKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure responding to request")
}
return
}
// RegenerateKeysPreparer prepares the RegenerateKeys request.
func (client GroupClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"notificationHubName": autorest.Encode("path", notificationHubName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// RegenerateKeysSender sends the RegenerateKeys request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always
// closes the http.Response Body.
func (client GroupClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+29
View File
@@ -0,0 +1,29 @@
package notificationhubs
// 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 1.0.1.0
// 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/v10.1.0-beta arm-notificationhubs/2017-04-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}