diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/CHANGELOG.md b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/CHANGELOG.md new file mode 100644 index 000000000000..b1ea6d980d7e --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/CHANGELOG.md @@ -0,0 +1,604 @@ +Generated from https://github.com/Azure/azure-rest-api-specs/tree/3c764635e7d442b3e74caf593029fcd440b3ef82 + +Code generator @microsoft.azure/autorest.go@~2.1.161 + +## Breaking Changes + +- Function `NewVirtualNetworkRuleListResultPage` parameter(s) have been changed from `(func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error))` to `(VirtualNetworkRuleListResult, func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error))` +- Function `NewOperationListResultPage` parameter(s) have been changed from `(func(context.Context, OperationListResult) (OperationListResult, error))` to `(OperationListResult, func(context.Context, OperationListResult) (OperationListResult, error))` +- Function `NewIPFilterRuleListResultPage` parameter(s) have been changed from `(func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error))` to `(IPFilterRuleListResult, func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error))` +- Function `NewSBNamespaceListResultPage` parameter(s) have been changed from `(func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error))` to `(SBNamespaceListResult, func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error))` +- Function `Identity.MarshalJSON` has been removed +- Field `Code` of struct `ErrorResponse` has been removed +- Field `Message` of struct `ErrorResponse` has been removed + +## New Content + +- New const `EntityStatusReceiveDisabled` +- New const `Rejected` +- New const `EventHub` +- New const `Updating` +- New const `PrimaryKey` +- New const `FilterTypeCorrelationFilter` +- New const `Listen` +- New const `None` +- New const `FilterTypeSQLFilter` +- New const `ProvisioningStateDRFailed` +- New const `InvalidName` +- New const `Approved` +- New const `Manage` +- New const `EntityStatusActive` +- New const `AvroDeflate` +- New const `Disconnected` +- New const `Relay` +- New const `SubscriptionIsDisabled` +- New const `EntityStatusCreating` +- New const `Mixed` +- New const `NotificationHub` +- New const `PrimaryNotReplicating` +- New const `Messaging` +- New const `SendEnumValue` +- New const `EntityStatusDisabled` +- New const `Creating` +- New const `NameInLockdown` +- New const `Primary` +- New const `Secondary` +- New const `Canceled` +- New const `EntityStatusRestoring` +- New const `EntityStatusRenaming` +- New const `EntityStatusDeleting` +- New const `ProvisioningStateDRAccepted` +- New const `Failed` +- New const `EntityStatusSendDisabled` +- New const `NameInUse` +- New const `Avro` +- New const `SecondaryKey` +- New const `Pending` +- New const `EntityStatusUnknown` +- New const `Succeeded` +- New const `TooManyNamespaceInCurrentSubscription` +- New const `ProvisioningStateDRSucceeded` +- New const `Deleting` +- New function `TopicsClient.Delete(context.Context, string, string, string) (autorest.Response, error)` +- New function `*SBSubscription.UnmarshalJSON([]byte) error` +- New function `PremiumMessagingRegionsListResult.MarshalJSON() ([]byte, error)` +- New function `PremiumMessagingRegionsClient.ListPreparer(context.Context) (*http.Request, error)` +- New function `SBQueueListResultIterator.NotDone() bool` +- New function `RuleListResult.IsEmpty() bool` +- New function `MigrationConfigsClient.RevertSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.ListPreparer(context.Context, string, string) (*http.Request, error)` +- New function `TopicsClient.ListKeysSender(*http.Request) (*http.Response, error)` +- New function `RegionsClient.ListBySkuPreparer(context.Context, string) (*http.Request, error)` +- New function `*SBTopicListResultPage.Next() error` +- New function `QueuesClient.RegenerateKeysResponder(*http.Response) (AccessKeys, error)` +- New function `SBQueueListResult.IsEmpty() bool` +- New function `QueuesClient.CreateOrUpdate(context.Context, string, string, string, SBQueue) (SBQueue, error)` +- New function `ArmDisasterRecoveryListResultPage.NotDone() bool` +- New function `PrivateEndpointConnectionsClient.GetResponder(*http.Response) (PrivateEndpointConnection, error)` +- New function `NewPremiumMessagingRegionsListResultPage(PremiumMessagingRegionsListResult, func(context.Context, PremiumMessagingRegionsListResult) (PremiumMessagingRegionsListResult, error)) PremiumMessagingRegionsListResultPage` +- New function `DisasterRecoveryConfigsClient.ListAuthorizationRulesPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `*PremiumMessagingRegionsListResultPage.NextWithContext(context.Context) error` +- New function `TopicsClient.ListByNamespaceComplete(context.Context, string, string, *int32, *int32) (SBTopicListResultIterator, error)` +- New function `*MigrationConfigListResultIterator.NextWithContext(context.Context) error` +- New function `NewSBQueueListResultPage(SBQueueListResult, func(context.Context, SBQueueListResult) (SBQueueListResult, error)) SBQueueListResultPage` +- New function `ArmDisasterRecoveryListResultIterator.NotDone() bool` +- New function `QueuesClient.RegenerateKeysPreparer(context.Context, string, string, string, string, RegenerateAccessKeyParameters) (*http.Request, error)` +- New function `QueuesClient.ListAuthorizationRulesResponder(*http.Response) (SBAuthorizationRuleListResult, error)` +- New function `MigrationConfigPropertiesProperties.MarshalJSON() ([]byte, error)` +- New function `*EventHubListResultIterator.NextWithContext(context.Context) error` +- New function `NewSubscriptionsClientWithBaseURI(string, string) SubscriptionsClient` +- New function `PossibleKeyTypeValues() []KeyType` +- New function `TopicsClient.GetAuthorizationRule(context.Context, string, string, string, string) (SBAuthorizationRule, error)` +- New function `PossibleNameSpaceTypeValues() []NameSpaceType` +- New function `QueuesClient.DeleteAuthorizationRule(context.Context, string, string, string, string) (autorest.Response, error)` +- New function `RulesClient.ListBySubscriptionsSender(*http.Request) (*http.Response, error)` +- New function `SBSubscriptionListResultIterator.Response() SBSubscriptionListResult` +- New function `DisasterRecoveryConfigsClient.Delete(context.Context, string, string, string) (autorest.Response, error)` +- New function `TopicsClient.CreateOrUpdateAuthorizationRulePreparer(context.Context, string, string, string, string, SBAuthorizationRule) (*http.Request, error)` +- New function `NewRegionsClient(string) RegionsClient` +- New function `TopicsClient.ListAuthorizationRulesSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.ListKeysSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `MigrationConfigsClient.Get(context.Context, string, string) (MigrationConfigProperties, error)` +- New function `QueuesClient.Delete(context.Context, string, string, string) (autorest.Response, error)` +- New function `QueuesClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `RuleListResultPage.NotDone() bool` +- New function `*MigrationConfigListResultIterator.Next() error` +- New function `SBQueueListResultPage.Values() []SBQueue` +- New function `MigrationConfigListResultPage.Response() MigrationConfigListResult` +- New function `DisasterRecoveryConfigsClient.CreateOrUpdate(context.Context, string, string, string, ArmDisasterRecovery) (ArmDisasterRecovery, error)` +- New function `QueuesClient.ListKeysPreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `NewRuleListResultIterator(RuleListResultPage) RuleListResultIterator` +- New function `QueuesClient.CreateOrUpdateAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.CompleteMigrationSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.Get(context.Context, string, string, string) (SBTopic, error)` +- New function `*SBAuthorizationRule.UnmarshalJSON([]byte) error` +- New function `*MigrationConfigsCreateAndStartMigrationFuture.Result(MigrationConfigsClient) (MigrationConfigProperties, error)` +- New function `SubscriptionsClient.GetPreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `*PremiumMessagingRegionsListResultPage.Next() error` +- New function `Eventhub.MarshalJSON() ([]byte, error)` +- New function `TopicsClient.GetResponder(*http.Response) (SBTopic, error)` +- New function `NewQueuesClient(string) QueuesClient` +- New function `NewSBTopicListResultPage(SBTopicListResult, func(context.Context, SBTopicListResult) (SBTopicListResult, error)) SBTopicListResultPage` +- New function `SBTopicListResultIterator.Value() SBTopic` +- New function `PossibleEntityStatusValues() []EntityStatus` +- New function `RuleListResultPage.Response() RuleListResult` +- New function `TopicsClient.ListByNamespaceSender(*http.Request) (*http.Response, error)` +- New function `NewPrivateEndpointConnectionListResultIterator(PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator` +- New function `MigrationConfigsClient.RevertPreparer(context.Context, string, string) (*http.Request, error)` +- New function `PossibleEncodingCaptureDescriptionValues() []EncodingCaptureDescription` +- New function `*MigrationConfigListResultPage.NextWithContext(context.Context) error` +- New function `TopicsClient.ListAuthorizationRules(context.Context, string, string, string) (SBAuthorizationRuleListResultPage, error)` +- New function `DisasterRecoveryConfigsClient.CreateOrUpdateResponder(*http.Response) (ArmDisasterRecovery, error)` +- New function `SBTopicListResultPage.NotDone() bool` +- New function `EventHubsClient.ListByNamespaceResponder(*http.Response) (EventHubListResult, error)` +- New function `PrivateLinkResourcesClient.Get(context.Context, string, string) (PrivateLinkResourcesListResult, error)` +- New function `*ArmDisasterRecoveryListResultPage.Next() error` +- New function `QueuesClient.GetAuthorizationRulePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `NewEventHubListResultIterator(EventHubListResultPage) EventHubListResultIterator` +- New function `MigrationConfigsClient.ListComplete(context.Context, string, string) (MigrationConfigListResultIterator, error)` +- New function `PossibleRoleDisasterRecoveryValues() []RoleDisasterRecovery` +- New function `DisasterRecoveryConfigsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `PrivateEndpointConnectionListResult.IsEmpty() bool` +- New function `ArmDisasterRecoveryListResult.IsEmpty() bool` +- New function `DisasterRecoveryConfigsClient.BreakPairingResponder(*http.Response) (autorest.Response, error)` +- New function `PrivateEndpointConnectionsClient.ListComplete(context.Context, string, string) (PrivateEndpointConnectionListResultIterator, error)` +- New function `DisasterRecoveryConfigsClient.BreakPairingPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `SBSubscriptionListResultPage.NotDone() bool` +- New function `NamespacesClient.MigrateSender(*http.Request) (*http.Response, error)` +- New function `QueuesClient.ListKeys(context.Context, string, string, string, string) (AccessKeys, error)` +- New function `EventhubProperties.MarshalJSON() ([]byte, error)` +- New function `NamespacesClient.CreateOrUpdateAuthorizationRulePreparer(context.Context, string, string, string, SBAuthorizationRule) (*http.Request, error)` +- New function `PremiumMessagingRegionsClient.ListResponder(*http.Response) (PremiumMessagingRegionsListResult, error)` +- New function `MigrationConfigsClient.CreateAndStartMigrationResponder(*http.Response) (MigrationConfigProperties, error)` +- New function `*SBAuthorizationRuleListResultPage.NextWithContext(context.Context) error` +- New function `PremiumMessagingRegionsListResult.IsEmpty() bool` +- New function `MigrationConfigsClient.RevertResponder(*http.Response) (autorest.Response, error)` +- New function `NamespacesClient.Migrate(context.Context, string, string, SBNamespaceMigrate) (autorest.Response, error)` +- New function `QueuesClient.Get(context.Context, string, string, string) (SBQueue, error)` +- New function `EventHubListResultPage.Values() []Eventhub` +- New function `MigrationConfigsClient.CompleteMigrationResponder(*http.Response) (autorest.Response, error)` +- New function `*PremiumMessagingRegionsListResultIterator.Next() error` +- New function `NewSubscriptionsClient(string) SubscriptionsClient` +- New function `MigrationConfigsClient.List(context.Context, string, string) (MigrationConfigListResultPage, error)` +- New function `*PrivateEndpointConnectionListResultIterator.Next() error` +- New function `DisasterRecoveryConfigsClient.GetAuthorizationRulePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `MigrationConfigsClient.ListPreparer(context.Context, string, string) (*http.Request, error)` +- New function `*SBSubscriptionListResultIterator.NextWithContext(context.Context) error` +- New function `ArmDisasterRecoveryListResultIterator.Value() ArmDisasterRecovery` +- New function `SBQueueListResultIterator.Value() SBQueue` +- New function `RulesClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `SBTopicListResultPage.Response() SBTopicListResult` +- New function `NamespacesClient.CheckNameAvailabilityMethodSender(*http.Request) (*http.Response, error)` +- New function `CorrelationFilter.MarshalJSON() ([]byte, error)` +- New function `TopicsClient.ListAuthorizationRulesResponder(*http.Response) (SBAuthorizationRuleListResult, error)` +- New function `TopicsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `EventHubListResultIterator.Value() Eventhub` +- New function `TopicsClient.ListByNamespace(context.Context, string, string, *int32, *int32) (SBTopicListResultPage, error)` +- New function `SBAuthorizationRule.MarshalJSON() ([]byte, error)` +- New function `Destination.MarshalJSON() ([]byte, error)` +- New function `*PrivateLinkResource.UnmarshalJSON([]byte) error` +- New function `TopicsClient.ListKeysResponder(*http.Response) (AccessKeys, error)` +- New function `PrivateEndpointConnectionsClient.Get(context.Context, string, string, string) (PrivateEndpointConnection, error)` +- New function `EventHubListResultPage.NotDone() bool` +- New function `*ArmDisasterRecovery.UnmarshalJSON([]byte) error` +- New function `SBTopicProperties.MarshalJSON() ([]byte, error)` +- New function `NewSBSubscriptionListResultIterator(SBSubscriptionListResultPage) SBSubscriptionListResultIterator` +- New function `PrivateEndpointConnectionsClient.CreateOrUpdatePreparer(context.Context, string, string, string, PrivateEndpointConnection) (*http.Request, error)` +- New function `*SBQueueListResultPage.Next() error` +- New function `FailoverProperties.MarshalJSON() ([]byte, error)` +- New function `NamespacesClient.ListKeysPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `MigrationConfigListResultIterator.NotDone() bool` +- New function `PremiumMessagingRegionsListResultIterator.NotDone() bool` +- New function `PrivateLinkResource.MarshalJSON() ([]byte, error)` +- New function `*EventHubListResultPage.Next() error` +- New function `DisasterRecoveryConfigsClient.ListAuthorizationRulesSender(*http.Request) (*http.Response, error)` +- New function `ArmDisasterRecoveryProperties.MarshalJSON() ([]byte, error)` +- New function `MigrationConfigsClient.ListResponder(*http.Response) (MigrationConfigListResult, error)` +- New function `EventHubsClient.ListByNamespaceSender(*http.Request) (*http.Response, error)` +- New function `PrivateLinkResourcesClient.GetResponder(*http.Response) (PrivateLinkResourcesListResult, error)` +- New function `PrivateEndpointConnectionsClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `TopicsClient.CreateOrUpdateAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `SubscriptionsClient.Get(context.Context, string, string, string, string) (SBSubscription, error)` +- New function `NamespacesClient.DeleteAuthorizationRule(context.Context, string, string, string) (autorest.Response, error)` +- New function `*SBQueueListResultIterator.NextWithContext(context.Context) error` +- New function `QueuesClient.ListByNamespaceSender(*http.Request) (*http.Response, error)` +- New function `*FailoverProperties.UnmarshalJSON([]byte) error` +- New function `EventHubListResultPage.Response() EventHubListResult` +- New function `TopicsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `SubscriptionsClient.ListByTopicResponder(*http.Response) (SBSubscriptionListResult, error)` +- New function `TopicsClient.GetAuthorizationRulePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `*RuleListResultIterator.NextWithContext(context.Context) error` +- New function `PremiumMessagingRegionsListResultIterator.Response() PremiumMessagingRegionsListResult` +- New function `NamespacesClient.ListKeysResponder(*http.Response) (AccessKeys, error)` +- New function `NewTopicsClientWithBaseURI(string, string) TopicsClient` +- New function `QueuesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `*SBQueueListResultIterator.Next() error` +- New function `SBAuthorizationRuleListResultIterator.Response() SBAuthorizationRuleListResult` +- New function `DisasterRecoveryConfigsClient.ListComplete(context.Context, string, string) (ArmDisasterRecoveryListResultIterator, error)` +- New function `SBSubscriptionListResultIterator.Value() SBSubscription` +- New function `SBSubscriptionListResult.IsEmpty() bool` +- New function `*SBSubscriptionListResultIterator.Next() error` +- New function `RulesClient.ListBySubscriptions(context.Context, string, string, string, string, *int32, *int32) (RuleListResultPage, error)` +- New function `RulesClient.Delete(context.Context, string, string, string, string, string) (autorest.Response, error)` +- New function `SBAuthorizationRuleListResult.IsEmpty() bool` +- New function `EventHubListResultIterator.Response() EventHubListResult` +- New function `PremiumMessagingRegionsClient.ListComplete(context.Context) (PremiumMessagingRegionsListResultIterator, error)` +- New function `PrivateEndpointConnectionListResultPage.Values() []PrivateEndpointConnection` +- New function `EventHubListResultIterator.NotDone() bool` +- New function `TopicsClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `SBTopicListResultIterator.Response() SBTopicListResult` +- New function `DisasterRecoveryConfigsClient.CheckNameAvailabilityMethod(context.Context, string, string, CheckNameAvailability) (CheckNameAvailabilityResult, error)` +- New function `*Eventhub.UnmarshalJSON([]byte) error` +- New function `ArmDisasterRecoveryListResultPage.Response() ArmDisasterRecoveryListResult` +- New function `RulesClient.CreateOrUpdate(context.Context, string, string, string, string, string, Rule) (Rule, error)` +- New function `ArmDisasterRecoveryListResultIterator.Response() ArmDisasterRecoveryListResult` +- New function `NewEventHubListResultPage(EventHubListResult, func(context.Context, EventHubListResult) (EventHubListResult, error)) EventHubListResultPage` +- New function `DisasterRecoveryConfigsClient.ListAuthorizationRulesComplete(context.Context, string, string, string) (SBAuthorizationRuleListResultIterator, error)` +- New function `SBTopicListResultIterator.NotDone() bool` +- New function `TopicsClient.RegenerateKeysSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.ListKeys(context.Context, string, string, string, string) (AccessKeys, error)` +- New function `SubscriptionsClient.ListByTopicComplete(context.Context, string, string, string, *int32, *int32) (SBSubscriptionListResultIterator, error)` +- New function `DisasterRecoveryConfigsClient.ListKeysPreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `QueuesClient.CreateOrUpdateAuthorizationRule(context.Context, string, string, string, string, SBAuthorizationRule) (SBAuthorizationRule, error)` +- New function `NewMigrationConfigsClient(string) MigrationConfigsClient` +- New function `SBQueue.MarshalJSON() ([]byte, error)` +- New function `RegionsClient.ListBySku(context.Context, string) (PremiumMessagingRegionsListResultPage, error)` +- New function `QueuesClient.ListAuthorizationRulesSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.CheckNameAvailabilityMethodPreparer(context.Context, string, string, CheckNameAvailability) (*http.Request, error)` +- New function `PrivateEndpointConnectionListResultIterator.NotDone() bool` +- New function `PrivateLinkResourcesClient.GetPreparer(context.Context, string, string) (*http.Request, error)` +- New function `*PremiumMessagingRegionsListResultIterator.NextWithContext(context.Context) error` +- New function `SubscriptionsClient.CreateOrUpdatePreparer(context.Context, string, string, string, string, SBSubscription) (*http.Request, error)` +- New function `RulesClient.ListBySubscriptionsResponder(*http.Response) (RuleListResult, error)` +- New function `NewRegionsClientWithBaseURI(string, string) RegionsClient` +- New function `DisasterRecoveryConfigsClient.FailOverResponder(*http.Response) (autorest.Response, error)` +- New function `PrivateEndpointConnectionsClient.GetSender(*http.Request) (*http.Response, error)` +- New function `NewMigrationConfigListResultPage(MigrationConfigListResult, func(context.Context, MigrationConfigListResult) (MigrationConfigListResult, error)) MigrationConfigListResultPage` +- New function `NamespacesClient.ListAuthorizationRules(context.Context, string, string) (SBAuthorizationRuleListResultPage, error)` +- New function `TopicsClient.ListAuthorizationRulesComplete(context.Context, string, string, string) (SBAuthorizationRuleListResultIterator, error)` +- New function `TopicsClient.ListAuthorizationRulesPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `RegionsClient.ListBySkuSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.RegenerateKeysResponder(*http.Response) (AccessKeys, error)` +- New function `RuleListResultIterator.Response() RuleListResult` +- New function `EventHubListResult.IsEmpty() bool` +- New function `NamespacesClient.ListKeysSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.GetPreparer(context.Context, string, string) (*http.Request, error)` +- New function `NamespacesClient.GetAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `MigrationConfigsClient.Delete(context.Context, string, string) (autorest.Response, error)` +- New function `DisasterRecoveryConfigsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `MigrationConfigListResultIterator.Value() MigrationConfigProperties` +- New function `NewPrivateLinkResourcesClient(string) PrivateLinkResourcesClient` +- New function `NamespacesClient.CreateOrUpdateAuthorizationRule(context.Context, string, string, string, SBAuthorizationRule) (SBAuthorizationRule, error)` +- New function `RulesClient.ListBySubscriptionsPreparer(context.Context, string, string, string, string, *int32, *int32) (*http.Request, error)` +- New function `DisasterRecoveryConfigsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.CompleteMigrationPreparer(context.Context, string, string) (*http.Request, error)` +- New function `NewPrivateEndpointConnectionsClientWithBaseURI(string, string) PrivateEndpointConnectionsClient` +- New function `PrivateEndpointConnectionsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `SubscriptionsClient.ListByTopicPreparer(context.Context, string, string, string, *int32, *int32) (*http.Request, error)` +- New function `NamespacesClient.GetAuthorizationRule(context.Context, string, string, string) (SBAuthorizationRule, error)` +- New function `MigrationConfigsClient.CreateAndStartMigration(context.Context, string, string, MigrationConfigProperties) (MigrationConfigsCreateAndStartMigrationFuture, error)` +- New function `PrivateEndpointConnectionListResultPage.NotDone() bool` +- New function `NamespacesClient.RegenerateKeysSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.CreateAndStartMigrationSender(*http.Request) (MigrationConfigsCreateAndStartMigrationFuture, error)` +- New function `*SBQueueListResultPage.NextWithContext(context.Context) error` +- New function `PrivateEndpointConnectionListResultIterator.Response() PrivateEndpointConnectionListResult` +- New function `TopicsClient.RegenerateKeys(context.Context, string, string, string, string, RegenerateAccessKeyParameters) (AccessKeys, error)` +- New function `PrivateEndpointConnectionListResultIterator.Value() PrivateEndpointConnection` +- New function `PossibleUnavailableReasonValues() []UnavailableReason` +- New function `PremiumMessagingRegionsClient.List(context.Context) (PremiumMessagingRegionsListResultPage, error)` +- New function `PrivateEndpointConnectionsClient.List(context.Context, string, string) (PrivateEndpointConnectionListResultPage, error)` +- New function `*RuleListResultIterator.Next() error` +- New function `DisasterRecoveryConfigsClient.FailOverPreparer(context.Context, string, string, string, *FailoverProperties) (*http.Request, error)` +- New function `*Rule.UnmarshalJSON([]byte) error` +- New function `NamespacesClient.CreateOrUpdateAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `RuleListResultIterator.Value() Rule` +- New function `*EventHubListResultPage.NextWithContext(context.Context) error` +- New function `ArmDisasterRecoveryListResultPage.Values() []ArmDisasterRecovery` +- New function `NamespacesClient.MigratePreparer(context.Context, string, string, SBNamespaceMigrate) (*http.Request, error)` +- New function `*PrivateEndpointConnectionsDeleteFuture.Result(PrivateEndpointConnectionsClient) (autorest.Response, error)` +- New function `QueuesClient.RegenerateKeysSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.ListResponder(*http.Response) (ArmDisasterRecoveryListResult, error)` +- New function `PrivateEndpointConnectionsClient.Delete(context.Context, string, string, string) (PrivateEndpointConnectionsDeleteFuture, error)` +- New function `RulesClient.GetSender(*http.Request) (*http.Response, error)` +- New function `PrivateEndpointConnectionsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `*SBTopic.UnmarshalJSON([]byte) error` +- New function `PrivateEndpointConnectionsClient.ListSender(*http.Request) (*http.Response, error)` +- New function `CheckNameAvailabilityResult.MarshalJSON() ([]byte, error)` +- New function `DisasterRecoveryConfigsClient.ListKeys(context.Context, string, string, string, string) (AccessKeys, error)` +- New function `NamespacesClient.ListAuthorizationRulesComplete(context.Context, string, string) (SBAuthorizationRuleListResultIterator, error)` +- New function `TopicsClient.DeleteAuthorizationRuleResponder(*http.Response) (autorest.Response, error)` +- New function `RuleListResultPage.Values() []Rule` +- New function `*ArmDisasterRecoveryListResultIterator.NextWithContext(context.Context) error` +- New function `SBQueueListResultIterator.Response() SBQueueListResult` +- New function `QueuesClient.GetResponder(*http.Response) (SBQueue, error)` +- New function `SubscriptionsClient.DeletePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `*EventHubListResultIterator.Next() error` +- New function `NewTopicsClient(string) TopicsClient` +- New function `PrivateEndpointConnectionsClient.CreateOrUpdateResponder(*http.Response) (PrivateEndpointConnection, error)` +- New function `NamespacesClient.MigrateResponder(*http.Response) (autorest.Response, error)` +- New function `TopicsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `PrivateEndpointConnectionListResultPage.Response() PrivateEndpointConnectionListResult` +- New function `PrivateEndpointConnectionsClient.DeleteSender(*http.Request) (PrivateEndpointConnectionsDeleteFuture, error)` +- New function `QueuesClient.DeleteAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.DeleteAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `SBQueueListResultPage.NotDone() bool` +- New function `NewEventHubsClient(string) EventHubsClient` +- New function `*SBSubscriptionListResultPage.NextWithContext(context.Context) error` +- New function `DisasterRecoveryConfigsClient.GetSender(*http.Request) (*http.Response, error)` +- New function `NamespacesClient.RegenerateKeys(context.Context, string, string, string, RegenerateAccessKeyParameters) (AccessKeys, error)` +- New function `DisasterRecoveryConfigsClient.ListKeysResponder(*http.Response) (AccessKeys, error)` +- New function `PremiumMessagingRegionsListResultIterator.Value() PremiumMessagingRegions` +- New function `TopicsClient.GetSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.GetResponder(*http.Response) (MigrationConfigProperties, error)` +- New function `NewPremiumMessagingRegionsListResultIterator(PremiumMessagingRegionsListResultPage) PremiumMessagingRegionsListResultIterator` +- New function `DisasterRecoveryConfigsClient.BreakPairingSender(*http.Request) (*http.Response, error)` +- New function `QueuesClient.DeleteAuthorizationRulePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `SBTopicListResultPage.Values() []SBTopic` +- New function `SubscriptionsClient.GetResponder(*http.Response) (SBSubscription, error)` +- New function `QueuesClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `SubscriptionsClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `NamespacesClient.ListAuthorizationRulesPreparer(context.Context, string, string) (*http.Request, error)` +- New function `MigrationConfigListResultPage.NotDone() bool` +- New function `PremiumMessagingRegions.MarshalJSON() ([]byte, error)` +- New function `*MigrationConfigProperties.UnmarshalJSON([]byte) error` +- New function `DisasterRecoveryConfigsClient.List(context.Context, string, string) (ArmDisasterRecoveryListResultPage, error)` +- New function `QueuesClient.ListByNamespace(context.Context, string, string, *int32, *int32) (SBQueueListResultPage, error)` +- New function `MigrationConfigsClient.CreateAndStartMigrationPreparer(context.Context, string, string, MigrationConfigProperties) (*http.Request, error)` +- New function `TopicsClient.CreateOrUpdateResponder(*http.Response) (SBTopic, error)` +- New function `DisasterRecoveryConfigsClient.FailOver(context.Context, string, string, string, *FailoverProperties) (autorest.Response, error)` +- New function `QueuesClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `QueuesClient.ListKeysResponder(*http.Response) (AccessKeys, error)` +- New function `SBAuthorizationRuleListResultPage.Values() []SBAuthorizationRule` +- New function `QueuesClient.GetSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.CreateOrUpdateAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `SBAuthorizationRuleListResultPage.NotDone() bool` +- New function `NewSBSubscriptionListResultPage(SBSubscriptionListResult, func(context.Context, SBSubscriptionListResult) (SBSubscriptionListResult, error)) SBSubscriptionListResultPage` +- New function `SubscriptionsClient.GetSender(*http.Request) (*http.Response, error)` +- New function `NamespacesClient.ListKeys(context.Context, string, string, string) (AccessKeys, error)` +- New function `SBQueueProperties.MarshalJSON() ([]byte, error)` +- New function `SBSubscription.MarshalJSON() ([]byte, error)` +- New function `QueuesClient.ListAuthorizationRules(context.Context, string, string, string) (SBAuthorizationRuleListResultPage, error)` +- New function `RulesClient.CreateOrUpdatePreparer(context.Context, string, string, string, string, string, Rule) (*http.Request, error)` +- New function `RegionsClient.ListBySkuResponder(*http.Response) (PremiumMessagingRegionsListResult, error)` +- New function `PossibleAccessRightsValues() []AccessRights` +- New function `NamespacesClient.RegenerateKeysResponder(*http.Response) (AccessKeys, error)` +- New function `DisasterRecoveryConfigsClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `QueuesClient.CreateOrUpdatePreparer(context.Context, string, string, string, SBQueue) (*http.Request, error)` +- New function `QueuesClient.GetAuthorizationRule(context.Context, string, string, string, string) (SBAuthorizationRule, error)` +- New function `DisasterRecoveryConfigsClient.GetAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `DisasterRecoveryConfigsClient.GetAuthorizationRule(context.Context, string, string, string, string) (SBAuthorizationRule, error)` +- New function `NewPremiumMessagingRegionsClientWithBaseURI(string, string) PremiumMessagingRegionsClient` +- New function `SubscriptionsClient.ListByTopic(context.Context, string, string, string, *int32, *int32) (SBSubscriptionListResultPage, error)` +- New function `NewSBAuthorizationRuleListResultPage(SBAuthorizationRuleListResult, func(context.Context, SBAuthorizationRuleListResult) (SBAuthorizationRuleListResult, error)) SBAuthorizationRuleListResultPage` +- New function `EventHubListResult.MarshalJSON() ([]byte, error)` +- New function `MigrationConfigListResult.IsEmpty() bool` +- New function `EventHubsClient.ListByNamespace(context.Context, string, string) (EventHubListResultPage, error)` +- New function `DisasterRecoveryConfigsClient.CheckNameAvailabilityMethodSender(*http.Request) (*http.Response, error)` +- New function `TopicsClient.DeleteAuthorizationRule(context.Context, string, string, string, string) (autorest.Response, error)` +- New function `NewSBAuthorizationRuleListResultIterator(SBAuthorizationRuleListResultPage) SBAuthorizationRuleListResultIterator` +- New function `NewMigrationConfigListResultIterator(MigrationConfigListResultPage) MigrationConfigListResultIterator` +- New function `ArmDisasterRecovery.MarshalJSON() ([]byte, error)` +- New function `SBSubscriptionProperties.MarshalJSON() ([]byte, error)` +- New function `Rule.MarshalJSON() ([]byte, error)` +- New function `NamespacesClient.GetAuthorizationRulePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `NewArmDisasterRecoveryListResultPage(ArmDisasterRecoveryListResult, func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)) ArmDisasterRecoveryListResultPage` +- New function `RulesClient.Get(context.Context, string, string, string, string, string) (Rule, error)` +- New function `NamespacesClient.CheckNameAvailabilityMethod(context.Context, CheckNameAvailability) (CheckNameAvailabilityResult, error)` +- New function `RegionsClient.ListBySkuComplete(context.Context, string) (PremiumMessagingRegionsListResultIterator, error)` +- New function `QueuesClient.CreateOrUpdateAuthorizationRulePreparer(context.Context, string, string, string, string, SBAuthorizationRule) (*http.Request, error)` +- New function `SBQueueListResultPage.Response() SBQueueListResult` +- New function `*PrivateEndpointConnection.UnmarshalJSON([]byte) error` +- New function `MigrationConfigsClient.ListSender(*http.Request) (*http.Response, error)` +- New function `PrivateEndpointConnectionsClient.CreateOrUpdate(context.Context, string, string, string, PrivateEndpointConnection) (PrivateEndpointConnection, error)` +- New function `SBSubscriptionListResultIterator.NotDone() bool` +- New function `NewPremiumMessagingRegionsClient(string) PremiumMessagingRegionsClient` +- New function `NewEventHubsClientWithBaseURI(string, string) EventHubsClient` +- New function `PremiumMessagingRegionsListResultPage.Values() []PremiumMessagingRegions` +- New function `PossibleFilterTypeValues() []FilterType` +- New function `SBAuthorizationRuleListResultPage.Response() SBAuthorizationRuleListResult` +- New function `RulesClient.CreateOrUpdateResponder(*http.Response) (Rule, error)` +- New function `MigrationConfigsClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `NewRuleListResultPage(RuleListResult, func(context.Context, RuleListResult) (RuleListResult, error)) RuleListResultPage` +- New function `NamespacesClient.ListAuthorizationRulesResponder(*http.Response) (SBAuthorizationRuleListResult, error)` +- New function `*PrivateEndpointConnectionListResultPage.NextWithContext(context.Context) error` +- New function `TopicsClient.RegenerateKeysPreparer(context.Context, string, string, string, string, RegenerateAccessKeyParameters) (*http.Request, error)` +- New function `NewPrivateEndpointConnectionsClient(string) PrivateEndpointConnectionsClient` +- New function `*SBAuthorizationRuleListResultIterator.Next() error` +- New function `RulesClient.GetPreparer(context.Context, string, string, string, string, string) (*http.Request, error)` +- New function `RulesClient.GetResponder(*http.Response) (Rule, error)` +- New function `NewMigrationConfigsClientWithBaseURI(string, string) MigrationConfigsClient` +- New function `PrivateEndpointConnectionsClient.ListPreparer(context.Context, string, string) (*http.Request, error)` +- New function `QueuesClient.CreateOrUpdateAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `*RuleListResultPage.Next() error` +- New function `ArmDisasterRecoveryListResult.MarshalJSON() ([]byte, error)` +- New function `SubscriptionsClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `TopicsClient.ListKeysPreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `SBAuthorizationRuleListResultIterator.Value() SBAuthorizationRule` +- New function `MigrationConfigsClient.Revert(context.Context, string, string) (autorest.Response, error)` +- New function `NewQueuesClientWithBaseURI(string, string) QueuesClient` +- New function `QueuesClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `PrivateEndpointConnection.MarshalJSON() ([]byte, error)` +- New function `SubscriptionsClient.ListByTopicSender(*http.Request) (*http.Response, error)` +- New function `RulesClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `PremiumMessagingRegionsClient.ListSender(*http.Request) (*http.Response, error)` +- New function `PossibleEndPointProvisioningStateValues() []EndPointProvisioningState` +- New function `NamespacesClient.RegenerateKeysPreparer(context.Context, string, string, string, RegenerateAccessKeyParameters) (*http.Request, error)` +- New function `*ArmDisasterRecoveryListResultIterator.Next() error` +- New function `MigrationConfigsClient.GetSender(*http.Request) (*http.Response, error)` +- New function `NewPrivateLinkResourcesClientWithBaseURI(string, string) PrivateLinkResourcesClient` +- New function `NewDisasterRecoveryConfigsClientWithBaseURI(string, string) DisasterRecoveryConfigsClient` +- New function `DisasterRecoveryConfigsClient.GetAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `SubscriptionsClient.CreateOrUpdateResponder(*http.Response) (SBSubscription, error)` +- New function `QueuesClient.DeleteAuthorizationRuleResponder(*http.Response) (autorest.Response, error)` +- New function `RulesClient.ListBySubscriptionsComplete(context.Context, string, string, string, string, *int32, *int32) (RuleListResultIterator, error)` +- New function `TopicsClient.CreateOrUpdatePreparer(context.Context, string, string, string, SBTopic) (*http.Request, error)` +- New function `DisasterRecoveryConfigsClient.ListSender(*http.Request) (*http.Response, error)` +- New function `DisasterRecoveryConfigsClient.BreakPairing(context.Context, string, string, string) (autorest.Response, error)` +- New function `EventHubsClient.ListByNamespacePreparer(context.Context, string, string) (*http.Request, error)` +- New function `TopicsClient.ListByNamespaceResponder(*http.Response) (SBTopicListResult, error)` +- New function `DisasterRecoveryConfigsClient.FailOverSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigListResult.MarshalJSON() ([]byte, error)` +- New function `NewRulesClient(string) RulesClient` +- New function `SBAuthorizationRuleListResultIterator.NotDone() bool` +- New function `NamespacesClient.DeleteAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `*SBTopicListResultPage.NextWithContext(context.Context) error` +- New function `NamespacesClient.DeleteAuthorizationRuleResponder(*http.Response) (autorest.Response, error)` +- New function `QueuesClient.GetAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `SBSubscriptionListResultPage.Values() []SBSubscription` +- New function `DisasterRecoveryConfigsClient.ListAuthorizationRules(context.Context, string, string, string) (SBAuthorizationRuleListResultPage, error)` +- New function `PrivateLinkResourcesClient.GetSender(*http.Request) (*http.Response, error)` +- New function `*PrivateEndpointConnectionListResultPage.Next() error` +- New function `TopicsClient.CreateOrUpdate(context.Context, string, string, string, SBTopic) (SBTopic, error)` +- New function `SubscriptionsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error)` +- New function `QueuesClient.ListByNamespaceComplete(context.Context, string, string, *int32, *int32) (SBQueueListResultIterator, error)` +- New function `NamespacesClient.CreateOrUpdateAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `QueuesClient.ListAuthorizationRulesComplete(context.Context, string, string, string) (SBAuthorizationRuleListResultIterator, error)` +- New function `NewSBTopicListResultIterator(SBTopicListResultPage) SBTopicListResultIterator` +- New function `*ArmDisasterRecoveryListResultPage.NextWithContext(context.Context) error` +- New function `RulesClient.DeletePreparer(context.Context, string, string, string, string, string) (*http.Request, error)` +- New function `QueuesClient.GetAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `QueuesClient.ListAuthorizationRulesPreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `*SBTopicListResultIterator.Next() error` +- New function `SBTopic.MarshalJSON() ([]byte, error)` +- New function `*SBTopicListResultIterator.NextWithContext(context.Context) error` +- New function `*RuleListResultPage.NextWithContext(context.Context) error` +- New function `TopicsClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigListResultPage.Values() []MigrationConfigProperties` +- New function `PremiumMessagingRegionsListResultPage.Response() PremiumMessagingRegionsListResult` +- New function `PossibleProvisioningStateDRValues() []ProvisioningStateDR` +- New function `NewArmDisasterRecoveryListResultIterator(ArmDisasterRecoveryListResultPage) ArmDisasterRecoveryListResultIterator` +- New function `NamespacesClient.CheckNameAvailabilityMethodPreparer(context.Context, CheckNameAvailability) (*http.Request, error)` +- New function `*SBAuthorizationRuleListResultPage.Next() error` +- New function `*PrivateEndpointConnectionListResultIterator.NextWithContext(context.Context) error` +- New function `SBTopicListResult.IsEmpty() bool` +- New function `QueuesClient.ListByNamespacePreparer(context.Context, string, string, *int32, *int32) (*http.Request, error)` +- New function `RulesClient.DeleteResponder(*http.Response) (autorest.Response, error)` +- New function `PrivateEndpointConnectionsClient.ListResponder(*http.Response) (PrivateEndpointConnectionListResult, error)` +- New function `TopicsClient.GetAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `EventHubsClient.ListByNamespaceComplete(context.Context, string, string) (EventHubListResultIterator, error)` +- New function `PremiumMessagingRegionsListResultPage.NotDone() bool` +- New function `DisasterRecoveryConfigsClient.ListAuthorizationRulesResponder(*http.Response) (SBAuthorizationRuleListResult, error)` +- New function `SubscriptionsClient.Delete(context.Context, string, string, string, string) (autorest.Response, error)` +- New function `TopicsClient.DeleteAuthorizationRulePreparer(context.Context, string, string, string, string) (*http.Request, error)` +- New function `NewSBQueueListResultIterator(SBQueueListResultPage) SBQueueListResultIterator` +- New function `MigrationConfigListResultIterator.Response() MigrationConfigListResult` +- New function `MigrationConfigProperties.MarshalJSON() ([]byte, error)` +- New function `DisasterRecoveryConfigsClient.CheckNameAvailabilityMethodResponder(*http.Response) (CheckNameAvailabilityResult, error)` +- New function `PrivateEndpointConnectionsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `QueuesClient.RegenerateKeys(context.Context, string, string, string, string, RegenerateAccessKeyParameters) (AccessKeys, error)` +- New function `SBSubscriptionListResultPage.Response() SBSubscriptionListResult` +- New function `PossiblePrivateLinkConnectionStatusValues() []PrivateLinkConnectionStatus` +- New function `DisasterRecoveryConfigsClient.CreateOrUpdatePreparer(context.Context, string, string, string, ArmDisasterRecovery) (*http.Request, error)` +- New function `TopicsClient.ListByNamespacePreparer(context.Context, string, string, *int32, *int32) (*http.Request, error)` +- New function `NamespacesClient.CheckNameAvailabilityMethodResponder(*http.Response) (CheckNameAvailabilityResult, error)` +- New function `NewDisasterRecoveryConfigsClient(string) DisasterRecoveryConfigsClient` +- New function `MigrationConfigsClient.CompleteMigration(context.Context, string, string) (autorest.Response, error)` +- New function `NamespacesClient.GetAuthorizationRuleSender(*http.Request) (*http.Response, error)` +- New function `MigrationConfigsClient.DeleteSender(*http.Request) (*http.Response, error)` +- New function `NamespacesClient.ListAuthorizationRulesSender(*http.Request) (*http.Response, error)` +- New function `QueuesClient.ListKeysSender(*http.Request) (*http.Response, error)` +- New function `SubscriptionsClient.CreateOrUpdate(context.Context, string, string, string, string, SBSubscription) (SBSubscription, error)` +- New function `NamespacesClient.DeleteAuthorizationRulePreparer(context.Context, string, string, string) (*http.Request, error)` +- New function `TopicsClient.GetAuthorizationRuleResponder(*http.Response) (SBAuthorizationRule, error)` +- New function `DisasterRecoveryConfigsClient.Get(context.Context, string, string, string) (ArmDisasterRecovery, error)` +- New function `*SBAuthorizationRuleListResultIterator.NextWithContext(context.Context) error` +- New function `*MigrationConfigListResultPage.Next() error` +- New function `*Destination.UnmarshalJSON([]byte) error` +- New function `DisasterRecoveryConfigsClient.GetResponder(*http.Response) (ArmDisasterRecovery, error)` +- New function `RuleListResultIterator.NotDone() bool` +- New function `NewPrivateEndpointConnectionListResultPage(PrivateEndpointConnectionListResult, func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage` +- New function `QueuesClient.ListByNamespaceResponder(*http.Response) (SBQueueListResult, error)` +- New function `MigrationConfigsClient.DeletePreparer(context.Context, string, string) (*http.Request, error)` +- New function `QueuesClient.CreateOrUpdateResponder(*http.Response) (SBQueue, error)` +- New function `*SBSubscriptionListResultPage.Next() error` +- New function `TopicsClient.CreateOrUpdateAuthorizationRule(context.Context, string, string, string, string, SBAuthorizationRule) (SBAuthorizationRule, error)` +- New function `*SBQueue.UnmarshalJSON([]byte) error` +- New function `NewRulesClientWithBaseURI(string, string) RulesClient` +- New struct `AccessKeys` +- New struct `Action` +- New struct `ArmDisasterRecovery` +- New struct `ArmDisasterRecoveryListResult` +- New struct `ArmDisasterRecoveryListResultIterator` +- New struct `ArmDisasterRecoveryListResultPage` +- New struct `ArmDisasterRecoveryProperties` +- New struct `CaptureDescription` +- New struct `CheckNameAvailability` +- New struct `CheckNameAvailabilityResult` +- New struct `ConnectionState` +- New struct `CorrelationFilter` +- New struct `Destination` +- New struct `DestinationProperties` +- New struct `DisasterRecoveryConfigsClient` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorResponseError` +- New struct `EventHubListResult` +- New struct `EventHubListResultIterator` +- New struct `EventHubListResultPage` +- New struct `EventHubsClient` +- New struct `Eventhub` +- New struct `EventhubProperties` +- New struct `FailoverProperties` +- New struct `FailoverPropertiesProperties` +- New struct `MessageCountDetails` +- New struct `MigrationConfigListResult` +- New struct `MigrationConfigListResultIterator` +- New struct `MigrationConfigListResultPage` +- New struct `MigrationConfigProperties` +- New struct `MigrationConfigPropertiesProperties` +- New struct `MigrationConfigsClient` +- New struct `MigrationConfigsCreateAndStartMigrationFuture` +- New struct `PremiumMessagingRegions` +- New struct `PremiumMessagingRegionsClient` +- New struct `PremiumMessagingRegionsListResult` +- New struct `PremiumMessagingRegionsListResultIterator` +- New struct `PremiumMessagingRegionsListResultPage` +- New struct `PremiumMessagingRegionsProperties` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionListResultIterator` +- New struct `PrivateEndpointConnectionListResultPage` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateEndpointConnectionsClient` +- New struct `PrivateEndpointConnectionsDeleteFuture` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkResourcesClient` +- New struct `PrivateLinkResourcesListResult` +- New struct `QueuesClient` +- New struct `RegenerateAccessKeyParameters` +- New struct `RegionsClient` +- New struct `Rule` +- New struct `RuleListResult` +- New struct `RuleListResultIterator` +- New struct `RuleListResultPage` +- New struct `Ruleproperties` +- New struct `RulesClient` +- New struct `SBAuthorizationRule` +- New struct `SBAuthorizationRuleListResult` +- New struct `SBAuthorizationRuleListResultIterator` +- New struct `SBAuthorizationRuleListResultPage` +- New struct `SBAuthorizationRuleProperties` +- New struct `SBNamespaceMigrate` +- New struct `SBQueue` +- New struct `SBQueueListResult` +- New struct `SBQueueListResultIterator` +- New struct `SBQueueListResultPage` +- New struct `SBQueueProperties` +- New struct `SBSubscription` +- New struct `SBSubscriptionListResult` +- New struct `SBSubscriptionListResultIterator` +- New struct `SBSubscriptionListResultPage` +- New struct `SBSubscriptionProperties` +- New struct `SBTopic` +- New struct `SBTopicListResult` +- New struct `SBTopicListResultIterator` +- New struct `SBTopicListResultPage` +- New struct `SBTopicProperties` +- New struct `SQLFilter` +- New struct `SQLRuleAction` +- New struct `SubscriptionsClient` +- New struct `TopicsClient` +- New field `Error` in struct `ErrorResponse` +- New field `Identity` in struct `SBNamespace` diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/client.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/client.go index c06c9c68d67a..f2e9222f253b 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/client.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/client.go @@ -1,6 +1,6 @@ // Package servicebus implements the Azure ARM Servicebus service API version 2018-01-01-preview. // -// Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant +// package servicebus // Copyright (c) Microsoft and contributors. All rights reserved. diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/disasterrecoveryconfigs.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/disasterrecoveryconfigs.go new file mode 100644 index 000000000000..fc9410ea44e7 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/disasterrecoveryconfigs.go @@ -0,0 +1,1050 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DisasterRecoveryConfigsClient is the client for the DisasterRecoveryConfigs methods of the Servicebus service. +type DisasterRecoveryConfigsClient struct { + BaseClient +} + +// NewDisasterRecoveryConfigsClient creates an instance of the DisasterRecoveryConfigsClient client. +func NewDisasterRecoveryConfigsClient(subscriptionID string) DisasterRecoveryConfigsClient { + return NewDisasterRecoveryConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisasterRecoveryConfigsClientWithBaseURI creates an instance of the DisasterRecoveryConfigsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewDisasterRecoveryConfigsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigsClient { + return DisasterRecoveryConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// BreakPairing this operation disables the Disaster Recovery and stops replicating changes from primary to secondary +// namespaces +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +func (client DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.BreakPairing") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "BreakPairing", err.Error()) + } + + req, err := client.BreakPairingPreparer(ctx, resourceGroupName, namespaceName, alias) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") + return + } + + resp, err := client.BreakPairingSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure sending request") + return + } + + result, err = client.BreakPairingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure responding to request") + return + } + + return +} + +// BreakPairingPreparer prepares the BreakPairing request. +func (client DisasterRecoveryConfigsClient) BreakPairingPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BreakPairingSender sends the BreakPairing request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) BreakPairingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// BreakPairingResponder handles the response to the BreakPairing request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) BreakPairingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckNameAvailabilityMethod check the give namespace name availability. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// parameters - parameters to check availability of the given namespace name +func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethod(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CheckNameAvailabilityMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", err.Error()) + } + + req, err := client.CheckNameAvailabilityMethodPreparer(ctx, resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailability) (*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 = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a new Alias(Disaster Recovery configuration) +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +// parameters - parameters required to create an Alias(Disaster Recovery configuration) +func (client DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (result ArmDisasterRecovery, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, alias, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisasterRecoveryConfigsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), + autorest.WithJSON(parameters), + 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 DisasterRecoveryConfigsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) CreateOrUpdateResponder(resp *http.Response) (result ArmDisasterRecovery, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Alias(Disaster Recovery configuration) +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +func (client DisasterRecoveryConfigsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, alias) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DisasterRecoveryConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", 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 DisasterRecoveryConfigsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// FailOver invokes GEO DR failover and reconfigure the alias to point to the secondary namespace +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +// parameters - parameters required to create an Alias(Disaster Recovery configuration) +func (client DisasterRecoveryConfigsClient) FailOver(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters *FailoverProperties) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.FailOver") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "FailOver", err.Error()) + } + + req, err := client.FailOverPreparer(ctx, resourceGroupName, namespaceName, alias, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") + return + } + + resp, err := client.FailOverSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure sending request") + return + } + + result, err = client.FailOverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure responding to request") + return + } + + return +} + +// FailOverPreparer prepares the FailOver request. +func (client DisasterRecoveryConfigsClient) FailOverPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters *FailoverProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FailOverSender sends the FailOver request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) FailOverSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// FailOverResponder handles the response to the FailOver request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) FailOverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +func (client DisasterRecoveryConfigsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result ArmDisasterRecovery, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, alias) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisasterRecoveryConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", 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 DisasterRecoveryConfigsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) GetResponder(resp *http.Response) (result ArmDisasterRecovery, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a namespace by rule name. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +// authorizationRuleName - the authorization rule name. +func (client DisasterRecoveryConfigsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.GetAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", err.Error()) + } + + req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client DisasterRecoveryConfigsClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all Alias(Disaster Recovery configurations) +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client DisasterRecoveryConfigsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") + defer func() { + sc := -1 + if result.adrlr.Response.Response != nil { + sc = result.adrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.adrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", resp, "Failure sending request") + return + } + + result.adrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", resp, "Failure responding to request") + return + } + if result.adrlr.hasNextLink() && result.adrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DisasterRecoveryConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) ListResponder(resp *http.Response) (result ArmDisasterRecoveryListResult, err error) { + err = autorest.Respond( + resp, + 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 DisasterRecoveryConfigsClient) listNextResults(ctx context.Context, lastResults ArmDisasterRecoveryListResult) (result ArmDisasterRecoveryListResult, err error) { + req, err := lastResults.armDisasterRecoveryListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", 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, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, namespaceName) + return +} + +// ListAuthorizationRules gets the authorization rules for a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +func (client DisasterRecoveryConfigsClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result SBAuthorizationRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.sarlr.Response.Response != nil { + sc = result.sarlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", err.Error()) + } + + result.fn = client.listAuthorizationRulesNextResults + req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, alias) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.sarlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result.sarlr, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure responding to request") + return + } + if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + 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 DisasterRecoveryConfigsClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { + req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", 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, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result SBAuthorizationRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, alias) + return +} + +// ListKeys gets the primary and secondary connection strings for the namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// alias - the Disaster Recovery configuration name +// authorizationRuleName - the authorization rule name. +func (client DisasterRecoveryConfigsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: alias, + Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client DisasterRecoveryConfigsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alias": autorest.Encode("path", alias), + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigsClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/enums.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/enums.go index 7324a019ffab..c68d0f007e54 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/enums.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/enums.go @@ -17,6 +17,23 @@ package servicebus // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen ... + Listen AccessRights = "Listen" + // Manage ... + Manage AccessRights = "Manage" + // SendEnumValue ... + SendEnumValue AccessRights = "Send" +) + +// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. +func PossibleAccessRightsValues() []AccessRights { + return []AccessRights{Listen, Manage, SendEnumValue} +} + // DefaultAction enumerates the values for default action. type DefaultAction string @@ -32,6 +49,88 @@ func PossibleDefaultActionValues() []DefaultAction { return []DefaultAction{Allow, Deny} } +// EncodingCaptureDescription enumerates the values for encoding capture description. +type EncodingCaptureDescription string + +const ( + // Avro ... + Avro EncodingCaptureDescription = "Avro" + // AvroDeflate ... + AvroDeflate EncodingCaptureDescription = "AvroDeflate" +) + +// PossibleEncodingCaptureDescriptionValues returns an array of possible values for the EncodingCaptureDescription const type. +func PossibleEncodingCaptureDescriptionValues() []EncodingCaptureDescription { + return []EncodingCaptureDescription{Avro, AvroDeflate} +} + +// EndPointProvisioningState enumerates the values for end point provisioning state. +type EndPointProvisioningState string + +const ( + // Canceled ... + Canceled EndPointProvisioningState = "Canceled" + // Creating ... + Creating EndPointProvisioningState = "Creating" + // Deleting ... + Deleting EndPointProvisioningState = "Deleting" + // Failed ... + Failed EndPointProvisioningState = "Failed" + // Succeeded ... + Succeeded EndPointProvisioningState = "Succeeded" + // Updating ... + Updating EndPointProvisioningState = "Updating" +) + +// PossibleEndPointProvisioningStateValues returns an array of possible values for the EndPointProvisioningState const type. +func PossibleEndPointProvisioningStateValues() []EndPointProvisioningState { + return []EndPointProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} +} + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // EntityStatusActive ... + EntityStatusActive EntityStatus = "Active" + // EntityStatusCreating ... + EntityStatusCreating EntityStatus = "Creating" + // EntityStatusDeleting ... + EntityStatusDeleting EntityStatus = "Deleting" + // EntityStatusDisabled ... + EntityStatusDisabled EntityStatus = "Disabled" + // EntityStatusReceiveDisabled ... + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + // EntityStatusRenaming ... + EntityStatusRenaming EntityStatus = "Renaming" + // EntityStatusRestoring ... + EntityStatusRestoring EntityStatus = "Restoring" + // EntityStatusSendDisabled ... + EntityStatusSendDisabled EntityStatus = "SendDisabled" + // EntityStatusUnknown ... + EntityStatusUnknown EntityStatus = "Unknown" +) + +// PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type. +func PossibleEntityStatusValues() []EntityStatus { + return []EntityStatus{EntityStatusActive, EntityStatusCreating, EntityStatusDeleting, EntityStatusDisabled, EntityStatusReceiveDisabled, EntityStatusRenaming, EntityStatusRestoring, EntityStatusSendDisabled, EntityStatusUnknown} +} + +// FilterType enumerates the values for filter type. +type FilterType string + +const ( + // FilterTypeCorrelationFilter ... + FilterTypeCorrelationFilter FilterType = "CorrelationFilter" + // FilterTypeSQLFilter ... + FilterTypeSQLFilter FilterType = "SqlFilter" +) + +// PossibleFilterTypeValues returns an array of possible values for the FilterType const type. +func PossibleFilterTypeValues() []FilterType { + return []FilterType{FilterTypeCorrelationFilter, FilterTypeSQLFilter} +} + // IdentityType enumerates the values for identity type. type IdentityType string @@ -73,6 +172,42 @@ func PossibleKeySourceValues() []KeySource { return []KeySource{MicrosoftKeyVault} } +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // PrimaryKey ... + PrimaryKey KeyType = "PrimaryKey" + // SecondaryKey ... + SecondaryKey KeyType = "SecondaryKey" +) + +// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{PrimaryKey, SecondaryKey} +} + +// NameSpaceType enumerates the values for name space type. +type NameSpaceType string + +const ( + // EventHub ... + EventHub NameSpaceType = "EventHub" + // Messaging ... + Messaging NameSpaceType = "Messaging" + // Mixed ... + Mixed NameSpaceType = "Mixed" + // NotificationHub ... + NotificationHub NameSpaceType = "NotificationHub" + // Relay ... + Relay NameSpaceType = "Relay" +) + +// PossibleNameSpaceTypeValues returns an array of possible values for the NameSpaceType const type. +func PossibleNameSpaceTypeValues() []NameSpaceType { + return []NameSpaceType{EventHub, Messaging, Mixed, NotificationHub, Relay} +} + // NetworkRuleIPAction enumerates the values for network rule ip action. type NetworkRuleIPAction string @@ -86,6 +221,59 @@ func PossibleNetworkRuleIPActionValues() []NetworkRuleIPAction { return []NetworkRuleIPAction{NetworkRuleIPActionAllow} } +// PrivateLinkConnectionStatus enumerates the values for private link connection status. +type PrivateLinkConnectionStatus string + +const ( + // Approved ... + Approved PrivateLinkConnectionStatus = "Approved" + // Disconnected ... + Disconnected PrivateLinkConnectionStatus = "Disconnected" + // Pending ... + Pending PrivateLinkConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateLinkConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkConnectionStatusValues returns an array of possible values for the PrivateLinkConnectionStatus const type. +func PossiblePrivateLinkConnectionStatusValues() []PrivateLinkConnectionStatus { + return []PrivateLinkConnectionStatus{Approved, Disconnected, Pending, Rejected} +} + +// ProvisioningStateDR enumerates the values for provisioning state dr. +type ProvisioningStateDR string + +const ( + // ProvisioningStateDRAccepted ... + ProvisioningStateDRAccepted ProvisioningStateDR = "Accepted" + // ProvisioningStateDRFailed ... + ProvisioningStateDRFailed ProvisioningStateDR = "Failed" + // ProvisioningStateDRSucceeded ... + ProvisioningStateDRSucceeded ProvisioningStateDR = "Succeeded" +) + +// PossibleProvisioningStateDRValues returns an array of possible values for the ProvisioningStateDR const type. +func PossibleProvisioningStateDRValues() []ProvisioningStateDR { + return []ProvisioningStateDR{ProvisioningStateDRAccepted, ProvisioningStateDRFailed, ProvisioningStateDRSucceeded} +} + +// RoleDisasterRecovery enumerates the values for role disaster recovery. +type RoleDisasterRecovery string + +const ( + // Primary ... + Primary RoleDisasterRecovery = "Primary" + // PrimaryNotReplicating ... + PrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" + // Secondary ... + Secondary RoleDisasterRecovery = "Secondary" +) + +// PossibleRoleDisasterRecoveryValues returns an array of possible values for the RoleDisasterRecovery const type. +func PossibleRoleDisasterRecoveryValues() []RoleDisasterRecovery { + return []RoleDisasterRecovery{Primary, PrimaryNotReplicating, Secondary} +} + // SkuName enumerates the values for sku name. type SkuName string @@ -119,3 +307,26 @@ const ( func PossibleSkuTierValues() []SkuTier { return []SkuTier{SkuTierBasic, SkuTierPremium, SkuTierStandard} } + +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName ... + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown ... + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse ... + NameInUse UnavailableReason = "NameInUse" + // None ... + None UnavailableReason = "None" + // SubscriptionIsDisabled ... + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription ... + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// PossibleUnavailableReasonValues returns an array of possible values for the UnavailableReason const type. +func PossibleUnavailableReasonValues() []UnavailableReason { + return []UnavailableReason{InvalidName, NameInLockdown, NameInUse, None, SubscriptionIsDisabled, TooManyNamespaceInCurrentSubscription} +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/eventhubs.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/eventhubs.go new file mode 100644 index 000000000000..2f15cfdfdb2e --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/eventhubs.go @@ -0,0 +1,171 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EventHubsClient is the client for the EventHubs methods of the Servicebus service. +type EventHubsClient struct { + BaseClient +} + +// NewEventHubsClient creates an instance of the EventHubsClient client. +func NewEventHubsClient(subscriptionID string) EventHubsClient { + return NewEventHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventHubsClientWithBaseURI creates an instance of the EventHubsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEventHubsClientWithBaseURI(baseURI string, subscriptionID string) EventHubsClient { + return EventHubsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByNamespace gets all the Event Hubs in a service bus Namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client EventHubsClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string) (result EventHubListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubsClient.ListByNamespace") + defer func() { + sc := -1 + if result.ehlr.Response.Response != nil { + sc = result.ehlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.EventHubsClient", "ListByNamespace", err.Error()) + } + + result.fn = client.listByNamespaceNextResults + req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.ehlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "ListByNamespace", resp, "Failure sending request") + return + } + + result.ehlr, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "ListByNamespace", resp, "Failure responding to request") + return + } + if result.ehlr.hasNextLink() && result.ehlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client EventHubsClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/eventhubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByNamespaceSender sends the ListByNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListByNamespaceResponder(resp *http.Response) (result EventHubListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByNamespaceNextResults retrieves the next set of results, if any. +func (client EventHubsClient) listByNamespaceNextResults(ctx context.Context, lastResults EventHubListResult) (result EventHubListResult, err error) { + req, err := lastResults.eventHubListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "listByNamespaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "listByNamespaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.EventHubsClient", "listByNamespaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventHubsClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result EventHubListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubsClient.ListByNamespace") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/migrationconfigs.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/migrationconfigs.go new file mode 100644 index 000000000000..66a16e558027 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/migrationconfigs.go @@ -0,0 +1,614 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MigrationConfigsClient is the client for the MigrationConfigs methods of the Servicebus service. +type MigrationConfigsClient struct { + BaseClient +} + +// NewMigrationConfigsClient creates an instance of the MigrationConfigsClient client. +func NewMigrationConfigsClient(subscriptionID string) MigrationConfigsClient { + return NewMigrationConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMigrationConfigsClientWithBaseURI creates an instance of the MigrationConfigsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewMigrationConfigsClientWithBaseURI(baseURI string, subscriptionID string) MigrationConfigsClient { + return MigrationConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CompleteMigration this operation Completes Migration of entities by pointing the connection strings to Premium +// namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation +// will fail when entity migration is in-progress. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client MigrationConfigsClient) CompleteMigration(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.CompleteMigration") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "CompleteMigration", err.Error()) + } + + req, err := client.CompleteMigrationPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", nil, "Failure preparing request") + return + } + + resp, err := client.CompleteMigrationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", resp, "Failure sending request") + return + } + + result, err = client.CompleteMigrationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", resp, "Failure responding to request") + return + } + + return +} + +// CompleteMigrationPreparer prepares the CompleteMigration request. +func (client MigrationConfigsClient) CompleteMigrationPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", "$default"), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CompleteMigrationSender sends the CompleteMigration request. The method will close the +// http.Response Body if it receives an error. +func (client MigrationConfigsClient) CompleteMigrationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CompleteMigrationResponder handles the response to the CompleteMigration request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) CompleteMigrationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateAndStartMigration creates Migration configuration and starts migration of entities from Standard to Premium +// namespace +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// parameters - parameters required to create Migration Configuration +func (client MigrationConfigsClient) CreateAndStartMigration(ctx context.Context, resourceGroupName string, namespaceName string, parameters MigrationConfigProperties) (result MigrationConfigsCreateAndStartMigrationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.CreateAndStartMigration") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.MigrationConfigPropertiesProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.MigrationConfigPropertiesProperties.TargetNamespace", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MigrationConfigPropertiesProperties.PostMigrationName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "CreateAndStartMigration", err.Error()) + } + + req, err := client.CreateAndStartMigrationPreparer(ctx, resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CreateAndStartMigration", nil, "Failure preparing request") + return + } + + result, err = client.CreateAndStartMigrationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CreateAndStartMigration", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateAndStartMigrationPreparer prepares the CreateAndStartMigration request. +func (client MigrationConfigsClient) CreateAndStartMigrationPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters MigrationConfigProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", "$default"), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateAndStartMigrationSender sends the CreateAndStartMigration request. The method will close the +// http.Response Body if it receives an error. +func (client MigrationConfigsClient) CreateAndStartMigrationSender(req *http.Request) (future MigrationConfigsCreateAndStartMigrationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateAndStartMigrationResponder handles the response to the CreateAndStartMigration request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) CreateAndStartMigrationResponder(resp *http.Response) (result MigrationConfigProperties, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a MigrationConfiguration +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client MigrationConfigsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MigrationConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", "$default"), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", 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 MigrationConfigsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves Migration Config +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client MigrationConfigsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigProperties, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MigrationConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", "$default"), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", 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 MigrationConfigsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) GetResponder(resp *http.Response) (result MigrationConfigProperties, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all migrationConfigurations +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client MigrationConfigsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.List") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MigrationConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MigrationConfigsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) ListResponder(resp *http.Response) (result MigrationConfigListResult, err error) { + err = autorest.Respond( + resp, + 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 MigrationConfigsClient) listNextResults(ctx context.Context, lastResults MigrationConfigListResult) (result MigrationConfigListResult, err error) { + req, err := lastResults.migrationConfigListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "listNextResults", 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, "servicebus.MigrationConfigsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MigrationConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, namespaceName) + return +} + +// Revert this operation reverts Migration +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client MigrationConfigsClient) Revert(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Revert") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.MigrationConfigsClient", "Revert", err.Error()) + } + + req, err := client.RevertPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", nil, "Failure preparing request") + return + } + + resp, err := client.RevertSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", resp, "Failure sending request") + return + } + + result, err = client.RevertResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", resp, "Failure responding to request") + return + } + + return +} + +// RevertPreparer prepares the Revert request. +func (client MigrationConfigsClient) RevertPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", "$default"), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevertSender sends the Revert request. The method will close the +// http.Response Body if it receives an error. +func (client MigrationConfigsClient) RevertSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RevertResponder handles the response to the Revert request. The method always +// closes the http.Response Body. +func (client MigrationConfigsClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/models.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/models.go index 0139b202a8f7..103f9e67c8ac 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/models.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/models.go @@ -31,47 +31,41 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus" -// Encryption properties to configure Encryption -type Encryption struct { - // KeyVaultProperties - Properties of KeyVault - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` - // KeySource - Enumerates the possible value of keySource for Encryption. Possible values include: 'MicrosoftKeyVault' - KeySource KeySource `json:"keySource,omitempty"` -} - -// ErrorResponse error response indicates ServiceBus service is not able to process the incoming request. The -// reason is provided in the error message. -type ErrorResponse struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// Identity properties to configure Identity for Bring your Own Keys -type Identity struct { - // PrincipalID - READ-ONLY; ObjectId from the KeyVault - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; TenantId from the KeyVault - TenantID *string `json:"tenantId,omitempty"` - // Type - Enumerates the possible value Identity type, which currently supports only 'SystemAssigned'. Possible values include: 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` +// AccessKeys namespace/ServiceBus Connection String +type AccessKeys struct { + autorest.Response `json:"-"` + // PrimaryConnectionString - READ-ONLY; Primary connection string of the created namespace authorization rule. + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + // SecondaryConnectionString - READ-ONLY; Secondary connection string of the created namespace authorization rule. + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + // AliasPrimaryConnectionString - READ-ONLY; Primary connection string of the alias if GEO DR is enabled + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + // AliasSecondaryConnectionString - READ-ONLY; Secondary connection string of the alias if GEO DR is enabled + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + // PrimaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. + SecondaryKey *string `json:"secondaryKey,omitempty"` + // KeyName - READ-ONLY; A string that describes the authorization rule. + KeyName *string `json:"keyName,omitempty"` } -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) +// Action represents the filter actions which are allowed for the transformation of a message that have +// been matched by a filter expression. +type Action struct { + // SQLExpression - SQL expression. e.g. MyProperty='ABC' + SQLExpression *string `json:"sqlExpression,omitempty"` + // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` + // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` } -// IPFilterRule single item in a List or Get IpFilterRules operation -type IPFilterRule struct { +// ArmDisasterRecovery single item in List or Get Alias(Disaster Recovery configuration) operation +type ArmDisasterRecovery struct { autorest.Response `json:"-"` - // IPFilterRuleProperties - Properties supplied to create or update IpFilterRules - *IPFilterRuleProperties `json:"properties,omitempty"` + // ArmDisasterRecoveryProperties - Properties required to the Create Or Update Alias(Disaster Recovery configurations) + *ArmDisasterRecoveryProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -80,17 +74,17 @@ type IPFilterRule struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for IPFilterRule. -func (ifr IPFilterRule) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ArmDisasterRecovery. +func (adr ArmDisasterRecovery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ifr.IPFilterRuleProperties != nil { - objectMap["properties"] = ifr.IPFilterRuleProperties + if adr.ArmDisasterRecoveryProperties != nil { + objectMap["properties"] = adr.ArmDisasterRecoveryProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for IPFilterRule struct. -func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ArmDisasterRecovery struct. +func (adr *ArmDisasterRecovery) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -100,12 +94,12 @@ func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var IPFilterRuleProperties IPFilterRuleProperties - err = json.Unmarshal(*v, &IPFilterRuleProperties) + var armDisasterRecoveryProperties ArmDisasterRecoveryProperties + err = json.Unmarshal(*v, &armDisasterRecoveryProperties) if err != nil { return err } - ifr.IPFilterRuleProperties = &IPFilterRuleProperties + adr.ArmDisasterRecoveryProperties = &armDisasterRecoveryProperties } case "id": if v != nil { @@ -114,7 +108,7 @@ func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifr.ID = &ID + adr.ID = &ID } case "name": if v != nil { @@ -123,7 +117,7 @@ func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifr.Name = &name + adr.Name = &name } case "type": if v != nil { @@ -132,7 +126,7 @@ func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifr.Type = &typeVar + adr.Type = &typeVar } } } @@ -140,26 +134,36 @@ func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { return nil } -// IPFilterRuleListResult the response from the List namespace operation. -type IPFilterRuleListResult struct { +// ArmDisasterRecoveryListResult the result of the List Alias(Disaster Recovery configuration) operation. +type ArmDisasterRecoveryListResult struct { autorest.Response `json:"-"` - // Value - Result of the List IpFilter Rules operation. - Value *[]IPFilterRule `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules + // Value - List of Alias(Disaster Recovery configurations) + Value *[]ArmDisasterRecovery `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration) NextLink *string `json:"nextLink,omitempty"` } -// IPFilterRuleListResultIterator provides access to a complete listing of IPFilterRule values. -type IPFilterRuleListResultIterator struct { +// MarshalJSON is the custom marshaler for ArmDisasterRecoveryListResult. +func (adrlr ArmDisasterRecoveryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adrlr.Value != nil { + objectMap["value"] = adrlr.Value + } + return json.Marshal(objectMap) +} + +// ArmDisasterRecoveryListResultIterator provides access to a complete listing of ArmDisasterRecovery +// values. +type ArmDisasterRecoveryListResultIterator struct { i int - page IPFilterRuleListResultPage + page ArmDisasterRecoveryListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *IPFilterRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ArmDisasterRecoveryListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFilterRuleListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -184,67 +188,67 @@ func (iter *IPFilterRuleListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *IPFilterRuleListResultIterator) Next() error { +func (iter *ArmDisasterRecoveryListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IPFilterRuleListResultIterator) NotDone() bool { +func (iter ArmDisasterRecoveryListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter IPFilterRuleListResultIterator) Response() IPFilterRuleListResult { +func (iter ArmDisasterRecoveryListResultIterator) Response() ArmDisasterRecoveryListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter IPFilterRuleListResultIterator) Value() IPFilterRule { +func (iter ArmDisasterRecoveryListResultIterator) Value() ArmDisasterRecovery { if !iter.page.NotDone() { - return IPFilterRule{} + return ArmDisasterRecovery{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the IPFilterRuleListResultIterator type. -func NewIPFilterRuleListResultIterator(page IPFilterRuleListResultPage) IPFilterRuleListResultIterator { - return IPFilterRuleListResultIterator{page: page} +// Creates a new instance of the ArmDisasterRecoveryListResultIterator type. +func NewArmDisasterRecoveryListResultIterator(page ArmDisasterRecoveryListResultPage) ArmDisasterRecoveryListResultIterator { + return ArmDisasterRecoveryListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ifrlr IPFilterRuleListResult) IsEmpty() bool { - return ifrlr.Value == nil || len(*ifrlr.Value) == 0 +func (adrlr ArmDisasterRecoveryListResult) IsEmpty() bool { + return adrlr.Value == nil || len(*adrlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ifrlr IPFilterRuleListResult) hasNextLink() bool { - return ifrlr.NextLink != nil && len(*ifrlr.NextLink) != 0 +func (adrlr ArmDisasterRecoveryListResult) hasNextLink() bool { + return adrlr.NextLink != nil && len(*adrlr.NextLink) != 0 } -// iPFilterRuleListResultPreparer prepares a request to retrieve the next set of results. +// armDisasterRecoveryListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ifrlr IPFilterRuleListResult) iPFilterRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifrlr.hasNextLink() { +func (adrlr ArmDisasterRecoveryListResult) armDisasterRecoveryListResultPreparer(ctx context.Context) (*http.Request, error) { + if !adrlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ifrlr.NextLink))) + autorest.WithBaseURL(to.String(adrlr.NextLink))) } -// IPFilterRuleListResultPage contains a page of IPFilterRule values. -type IPFilterRuleListResultPage struct { - fn func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error) - ifrlr IPFilterRuleListResult +// ArmDisasterRecoveryListResultPage contains a page of ArmDisasterRecovery values. +type ArmDisasterRecoveryListResultPage struct { + fn func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error) + adrlr ArmDisasterRecoveryListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *IPFilterRuleListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ArmDisasterRecoveryListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFilterRuleListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -254,11 +258,11 @@ func (page *IPFilterRuleListResultPage) NextWithContext(ctx context.Context) (er }() } for { - next, err := page.fn(ctx, page.ifrlr) + next, err := page.fn(ctx, page.adrlr) if err != nil { return err } - page.ifrlr = next + page.adrlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -269,107 +273,278 @@ func (page *IPFilterRuleListResultPage) NextWithContext(ctx context.Context) (er // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *IPFilterRuleListResultPage) Next() error { +func (page *ArmDisasterRecoveryListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IPFilterRuleListResultPage) NotDone() bool { - return !page.ifrlr.IsEmpty() +func (page ArmDisasterRecoveryListResultPage) NotDone() bool { + return !page.adrlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page IPFilterRuleListResultPage) Response() IPFilterRuleListResult { - return page.ifrlr +func (page ArmDisasterRecoveryListResultPage) Response() ArmDisasterRecoveryListResult { + return page.adrlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page IPFilterRuleListResultPage) Values() []IPFilterRule { - if page.ifrlr.IsEmpty() { +func (page ArmDisasterRecoveryListResultPage) Values() []ArmDisasterRecovery { + if page.adrlr.IsEmpty() { return nil } - return *page.ifrlr.Value + return *page.adrlr.Value } -// Creates a new instance of the IPFilterRuleListResultPage type. -func NewIPFilterRuleListResultPage(getNextPage func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error)) IPFilterRuleListResultPage { - return IPFilterRuleListResultPage{fn: getNextPage} +// Creates a new instance of the ArmDisasterRecoveryListResultPage type. +func NewArmDisasterRecoveryListResultPage(cur ArmDisasterRecoveryListResult, getNextPage func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)) ArmDisasterRecoveryListResultPage { + return ArmDisasterRecoveryListResultPage{ + fn: getNextPage, + adrlr: cur, + } } -// IPFilterRuleProperties properties supplied to create or update IpFilterRules -type IPFilterRuleProperties struct { - // IPMask - IP Mask - IPMask *string `json:"ipMask,omitempty"` - // Action - The IP Filter Action. Possible values include: 'Accept', 'Reject' - Action IPAction `json:"action,omitempty"` - // FilterName - IP Filter name - FilterName *string `json:"filterName,omitempty"` +// ArmDisasterRecoveryProperties properties required to the Create Or Update Alias(Disaster Recovery +// configurations) +type ArmDisasterRecoveryProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'ProvisioningStateDRAccepted', 'ProvisioningStateDRSucceeded', 'ProvisioningStateDRFailed' + ProvisioningState ProvisioningStateDR `json:"provisioningState,omitempty"` + // PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated. + PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` + // PartnerNamespace - ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + PartnerNamespace *string `json:"partnerNamespace,omitempty"` + // AlternateName - Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + AlternateName *string `json:"alternateName,omitempty"` + // Role - READ-ONLY; role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'Primary', 'PrimaryNotReplicating', 'Secondary' + Role RoleDisasterRecovery `json:"role,omitempty"` } -// KeyVaultProperties properties to configure keyVault Properties -type KeyVaultProperties struct { - // KeyName - Name of the Key from KeyVault - KeyName *string `json:"keyName,omitempty"` - // KeyVaultURI - Uri of KeyVault - KeyVaultURI *string `json:"keyVaultUri,omitempty"` +// MarshalJSON is the custom marshaler for ArmDisasterRecoveryProperties. +func (adr ArmDisasterRecoveryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adr.PartnerNamespace != nil { + objectMap["partnerNamespace"] = adr.PartnerNamespace + } + if adr.AlternateName != nil { + objectMap["alternateName"] = adr.AlternateName + } + return json.Marshal(objectMap) } -// NamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamespacesCreateOrUpdateFuture struct { - azure.Future +// CaptureDescription properties to configure capture description for eventhub +type CaptureDescription struct { + // Enabled - A value that indicates whether capture description is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Encoding - Enumerates the possible values for the encoding format of capture description. Possible values include: 'Avro', 'AvroDeflate' + Encoding EncodingCaptureDescription `json:"encoding,omitempty"` + // IntervalInSeconds - The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + // SizeLimitInBytes - The size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 and 524288000 bytes + SizeLimitInBytes *int32 `json:"sizeLimitInBytes,omitempty"` + // Destination - Properties of Destination where capture will be stored. (Storage Account, Blob Names) + Destination *Destination `json:"destination,omitempty"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn SBNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return +// CheckNameAvailability description of a Check Name availability request properties. +type CheckNameAvailability struct { + // Name - The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult description of a Check Name availability request properties. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // Message - READ-ONLY; The detailed info regarding the reason associated with the namespace. + Message *string `json:"message,omitempty"` + // NameAvailable - Value indicating namespace is availability, true if the namespace is available; otherwise, false. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason for unavailability of a namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription' + Reason UnavailableReason `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. +func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnar.NameAvailable != nil { + objectMap["nameAvailable"] = cnar.NameAvailable } - if !done { - err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesCreateOrUpdateFuture") - return + if cnar.Reason != "" { + objectMap["reason"] = cnar.Reason } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sn.Response.Response, err = future.GetResult(sender); err == nil && sn.Response.Response.StatusCode != http.StatusNoContent { - sn, err = client.CreateOrUpdateResponder(sn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", sn.Response.Response, "Failure responding to request") - } + return json.Marshal(objectMap) +} + +// ConnectionState connectionState information. +type ConnectionState struct { + // Status - Status of the connection. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + Status PrivateLinkConnectionStatus `json:"status,omitempty"` + // Description - Description of the connection state. + Description *string `json:"description,omitempty"` +} + +// CorrelationFilter represents the correlation filter expression. +type CorrelationFilter struct { + // Properties - dictionary object for custom filters + Properties map[string]*string `json:"properties"` + // CorrelationID - Identifier of the correlation. + CorrelationID *string `json:"correlationId,omitempty"` + // MessageID - Identifier of the message. + MessageID *string `json:"messageId,omitempty"` + // To - Address to send to. + To *string `json:"to,omitempty"` + // ReplyTo - Address of the queue to reply to. + ReplyTo *string `json:"replyTo,omitempty"` + // Label - Application specific label. + Label *string `json:"label,omitempty"` + // SessionID - Session identifier. + SessionID *string `json:"sessionId,omitempty"` + // ReplyToSessionID - Session identifier to reply to. + ReplyToSessionID *string `json:"replyToSessionId,omitempty"` + // ContentType - Content type of the message. + ContentType *string `json:"contentType,omitempty"` + // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` +} + +// MarshalJSON is the custom marshaler for CorrelationFilter. +func (cf CorrelationFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cf.Properties != nil { + objectMap["properties"] = cf.Properties } - return + if cf.CorrelationID != nil { + objectMap["correlationId"] = cf.CorrelationID + } + if cf.MessageID != nil { + objectMap["messageId"] = cf.MessageID + } + if cf.To != nil { + objectMap["to"] = cf.To + } + if cf.ReplyTo != nil { + objectMap["replyTo"] = cf.ReplyTo + } + if cf.Label != nil { + objectMap["label"] = cf.Label + } + if cf.SessionID != nil { + objectMap["sessionId"] = cf.SessionID + } + if cf.ReplyToSessionID != nil { + objectMap["replyToSessionId"] = cf.ReplyToSessionID + } + if cf.ContentType != nil { + objectMap["contentType"] = cf.ContentType + } + if cf.RequiresPreprocessing != nil { + objectMap["requiresPreprocessing"] = cf.RequiresPreprocessing + } + return json.Marshal(objectMap) } -// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type NamespacesDeleteFuture struct { - azure.Future +// Destination capture storage details for capture description +type Destination struct { + // Name - Name for capture destination + Name *string `json:"name,omitempty"` + // DestinationProperties - Properties describing the storage account, blob container and archive name format for capture destination + *DestinationProperties `json:"properties,omitempty"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// MarshalJSON is the custom marshaler for Destination. +func (d Destination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.DestinationProperties != nil { + objectMap["properties"] = d.DestinationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Destination struct. +func (d *Destination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure") - return + return err } - if !done { - err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesDeleteFuture") - return + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "properties": + if v != nil { + var destinationProperties DestinationProperties + err = json.Unmarshal(*v, &destinationProperties) + if err != nil { + return err + } + d.DestinationProperties = &destinationProperties + } + } } - ar.Response = future.Response() - return + + return nil } -// NetworkRuleSet description of topic resource. -type NetworkRuleSet struct { - autorest.Response `json:"-"` - // NetworkRuleSetProperties - NetworkRuleSet properties - *NetworkRuleSetProperties `json:"properties,omitempty"` +// DestinationProperties properties describing the storage account, blob container and archive name format +// for capture destination +type DestinationProperties struct { + // StorageAccountResourceID - Resource id of the storage account to be used to create the blobs + StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + // BlobContainer - Blob container Name + BlobContainer *string `json:"blobContainer,omitempty"` + // ArchiveNameFormat - Blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order + ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"` +} + +// Encryption properties to configure Encryption +type Encryption struct { + // KeyVaultProperties - Properties of KeyVault + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + // KeySource - Enumerates the possible value of keySource for Encryption. Possible values include: 'MicrosoftKeyVault' + KeySource KeySource `json:"keySource,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// ErrorResponse the resource management error response. +type ErrorResponse struct { + // Error - The error object. + Error *ErrorResponseError `json:"error,omitempty"` +} + +// ErrorResponseError the error object. +type ErrorResponseError struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorResponse `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// Eventhub single item in List or Get Event Hub operation +type Eventhub struct { + // EventhubProperties - Properties supplied to the Create Or Update Event Hub operation. + *EventhubProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -378,17 +553,17 @@ type NetworkRuleSet struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for NetworkRuleSet. -func (nrs NetworkRuleSet) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Eventhub. +func (e Eventhub) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if nrs.NetworkRuleSetProperties != nil { - objectMap["properties"] = nrs.NetworkRuleSetProperties + if e.EventhubProperties != nil { + objectMap["properties"] = e.EventhubProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for NetworkRuleSet struct. -func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for Eventhub struct. +func (e *Eventhub) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -398,12 +573,12 @@ func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var networkRuleSetProperties NetworkRuleSetProperties - err = json.Unmarshal(*v, &networkRuleSetProperties) + var eventhubProperties EventhubProperties + err = json.Unmarshal(*v, &eventhubProperties) if err != nil { return err } - nrs.NetworkRuleSetProperties = &networkRuleSetProperties + e.EventhubProperties = &eventhubProperties } case "id": if v != nil { @@ -412,7 +587,7 @@ func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { if err != nil { return err } - nrs.ID = &ID + e.ID = &ID } case "name": if v != nil { @@ -421,7 +596,7 @@ func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { if err != nil { return err } - nrs.Name = &name + e.Name = &name } case "type": if v != nil { @@ -430,7 +605,7 @@ func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { if err != nil { return err } - nrs.Type = &typeVar + e.Type = &typeVar } } } @@ -438,80 +613,3315 @@ func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { return nil } -// NetworkRuleSetProperties networkRuleSet properties -type NetworkRuleSetProperties struct { - // DefaultAction - Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - List VirtualNetwork Rules - VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` - // IPRules - List of IpRules - IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` +// EventHubListResult the result of the List EventHubs operation. +type EventHubListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List EventHubs operation. + Value *[]Eventhub `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. + NextLink *string `json:"nextLink,omitempty"` } -// NWRuleSetIPRules the response from the List namespace operation. -type NWRuleSetIPRules struct { - // IPMask - IP Mask - IPMask *string `json:"ipMask,omitempty"` - // Action - The IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow' - Action NetworkRuleIPAction `json:"action,omitempty"` +// MarshalJSON is the custom marshaler for EventHubListResult. +func (ehlr EventHubListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehlr.Value != nil { + objectMap["value"] = ehlr.Value + } + return json.Marshal(objectMap) } -// NWRuleSetVirtualNetworkRules the response from the List namespace operation. -type NWRuleSetVirtualNetworkRules struct { - // Subnet - Subnet properties - Subnet *Subnet `json:"subnet,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Value that indicates whether to ignore missing Vnet Service Endpoint - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` +// EventHubListResultIterator provides access to a complete listing of Eventhub values. +type EventHubListResultIterator struct { + i int + page EventHubListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EventHubListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EventHubListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventHubListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EventHubListResultIterator) Response() EventHubListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EventHubListResultIterator) Value() Eventhub { + if !iter.page.NotDone() { + return Eventhub{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventHubListResultIterator type. +func NewEventHubListResultIterator(page EventHubListResultPage) EventHubListResultIterator { + return EventHubListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ehlr EventHubListResult) IsEmpty() bool { + return ehlr.Value == nil || len(*ehlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ehlr EventHubListResult) hasNextLink() bool { + return ehlr.NextLink != nil && len(*ehlr.NextLink) != 0 +} + +// eventHubListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ehlr EventHubListResult) eventHubListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ehlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ehlr.NextLink))) +} + +// EventHubListResultPage contains a page of Eventhub values. +type EventHubListResultPage struct { + fn func(context.Context, EventHubListResult) (EventHubListResult, error) + ehlr EventHubListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EventHubListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventHubListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ehlr) + if err != nil { + return err + } + page.ehlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EventHubListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventHubListResultPage) NotDone() bool { + return !page.ehlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventHubListResultPage) Response() EventHubListResult { + return page.ehlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventHubListResultPage) Values() []Eventhub { + if page.ehlr.IsEmpty() { + return nil + } + return *page.ehlr.Value +} + +// Creates a new instance of the EventHubListResultPage type. +func NewEventHubListResultPage(cur EventHubListResult, getNextPage func(context.Context, EventHubListResult) (EventHubListResult, error)) EventHubListResultPage { + return EventHubListResultPage{ + fn: getNextPage, + ehlr: cur, + } +} + +// EventhubProperties properties supplied to the Create Or Update Event Hub operation. +type EventhubProperties struct { + // PartitionIds - READ-ONLY; Current number of shards on the Event Hub. + PartitionIds *[]string `json:"partitionIds,omitempty"` + // CreatedAt - READ-ONLY; Exact time the Event Hub was created. + CreatedAt *date.Time `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; The exact time the message was updated. + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + // MessageRetentionInDays - Number of days to retain the events for this Event Hub, value should be 1 to 7 days + MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` + // PartitionCount - Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. + PartitionCount *int64 `json:"partitionCount,omitempty"` + // Status - Enumerates the possible values for the status of a Event Hub. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' + Status EntityStatus `json:"status,omitempty"` + // CaptureDescription - Properties of capture description + CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventhubProperties. +func (e EventhubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.MessageRetentionInDays != nil { + objectMap["messageRetentionInDays"] = e.MessageRetentionInDays + } + if e.PartitionCount != nil { + objectMap["partitionCount"] = e.PartitionCount + } + if e.Status != "" { + objectMap["status"] = e.Status + } + if e.CaptureDescription != nil { + objectMap["captureDescription"] = e.CaptureDescription + } + return json.Marshal(objectMap) +} + +// FailoverProperties safe failover is to indicate the service should wait for pending replication to +// finish before switching to the secondary. +type FailoverProperties struct { + // FailoverPropertiesProperties - Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + *FailoverPropertiesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FailoverProperties. +func (fp FailoverProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fp.FailoverPropertiesProperties != nil { + objectMap["properties"] = fp.FailoverPropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FailoverProperties struct. +func (fp *FailoverProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var failoverPropertiesProperties FailoverPropertiesProperties + err = json.Unmarshal(*v, &failoverPropertiesProperties) + if err != nil { + return err + } + fp.FailoverPropertiesProperties = &failoverPropertiesProperties + } + } + } + + return nil +} + +// FailoverPropertiesProperties safe failover is to indicate the service should wait for pending +// replication to finish before switching to the secondary. +type FailoverPropertiesProperties struct { + // IsSafeFailover - Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + IsSafeFailover *bool `json:"IsSafeFailover,omitempty"` +} + +// Identity properties to configure Identity for Bring your Own Keys +type Identity struct { + // PrincipalID - ObjectId from the KeyVault + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - TenantId from the KeyVault + TenantID *string `json:"tenantId,omitempty"` + // Type - Enumerates the possible value Identity type, which currently supports only 'SystemAssigned'. Possible values include: 'SystemAssigned' + Type IdentityType `json:"type,omitempty"` +} + +// IPFilterRule single item in a List or Get IpFilterRules operation +type IPFilterRule struct { + autorest.Response `json:"-"` + // IPFilterRuleProperties - Properties supplied to create or update IpFilterRules + *IPFilterRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPFilterRule. +func (ifr IPFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ifr.IPFilterRuleProperties != nil { + objectMap["properties"] = ifr.IPFilterRuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPFilterRule struct. +func (ifr *IPFilterRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPFilterRuleProperties IPFilterRuleProperties + err = json.Unmarshal(*v, &IPFilterRuleProperties) + if err != nil { + return err + } + ifr.IPFilterRuleProperties = &IPFilterRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ifr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ifr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ifr.Type = &typeVar + } + } + } + + return nil +} + +// IPFilterRuleListResult the response from the List namespace operation. +type IPFilterRuleListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List IpFilter Rules operation. + Value *[]IPFilterRule `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules + NextLink *string `json:"nextLink,omitempty"` +} + +// IPFilterRuleListResultIterator provides access to a complete listing of IPFilterRule values. +type IPFilterRuleListResultIterator struct { + i int + page IPFilterRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IPFilterRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPFilterRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IPFilterRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IPFilterRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IPFilterRuleListResultIterator) Response() IPFilterRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IPFilterRuleListResultIterator) Value() IPFilterRule { + if !iter.page.NotDone() { + return IPFilterRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IPFilterRuleListResultIterator type. +func NewIPFilterRuleListResultIterator(page IPFilterRuleListResultPage) IPFilterRuleListResultIterator { + return IPFilterRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ifrlr IPFilterRuleListResult) IsEmpty() bool { + return ifrlr.Value == nil || len(*ifrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ifrlr IPFilterRuleListResult) hasNextLink() bool { + return ifrlr.NextLink != nil && len(*ifrlr.NextLink) != 0 +} + +// iPFilterRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ifrlr IPFilterRuleListResult) iPFilterRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ifrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ifrlr.NextLink))) +} + +// IPFilterRuleListResultPage contains a page of IPFilterRule values. +type IPFilterRuleListResultPage struct { + fn func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error) + ifrlr IPFilterRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IPFilterRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPFilterRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ifrlr) + if err != nil { + return err + } + page.ifrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IPFilterRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IPFilterRuleListResultPage) NotDone() bool { + return !page.ifrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IPFilterRuleListResultPage) Response() IPFilterRuleListResult { + return page.ifrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IPFilterRuleListResultPage) Values() []IPFilterRule { + if page.ifrlr.IsEmpty() { + return nil + } + return *page.ifrlr.Value +} + +// Creates a new instance of the IPFilterRuleListResultPage type. +func NewIPFilterRuleListResultPage(cur IPFilterRuleListResult, getNextPage func(context.Context, IPFilterRuleListResult) (IPFilterRuleListResult, error)) IPFilterRuleListResultPage { + return IPFilterRuleListResultPage{ + fn: getNextPage, + ifrlr: cur, + } +} + +// IPFilterRuleProperties properties supplied to create or update IpFilterRules +type IPFilterRuleProperties struct { + // IPMask - IP Mask + IPMask *string `json:"ipMask,omitempty"` + // Action - The IP Filter Action. Possible values include: 'Accept', 'Reject' + Action IPAction `json:"action,omitempty"` + // FilterName - IP Filter name + FilterName *string `json:"filterName,omitempty"` +} + +// KeyVaultProperties properties to configure keyVault Properties +type KeyVaultProperties struct { + // KeyName - Name of the Key from KeyVault + KeyName *string `json:"keyName,omitempty"` + // KeyVaultURI - Uri of KeyVault + KeyVaultURI *string `json:"keyVaultUri,omitempty"` +} + +// MessageCountDetails message Count Details. +type MessageCountDetails struct { + // ActiveMessageCount - READ-ONLY; Number of active messages in the queue, topic, or subscription. + ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` + // DeadLetterMessageCount - READ-ONLY; Number of messages that are dead lettered. + DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` + // ScheduledMessageCount - READ-ONLY; Number of scheduled messages. + ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` + // TransferMessageCount - READ-ONLY; Number of messages transferred to another queue, topic, or subscription. + TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` + // TransferDeadLetterMessageCount - READ-ONLY; Number of messages transferred into dead letters. + TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` +} + +// MigrationConfigListResult the result of the List migrationConfigurations operation. +type MigrationConfigListResult struct { + autorest.Response `json:"-"` + // Value - List of Migration Configs + Value *[]MigrationConfigProperties `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrationConfigListResult. +func (mclr MigrationConfigListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// MigrationConfigListResultIterator provides access to a complete listing of MigrationConfigProperties +// values. +type MigrationConfigListResultIterator struct { + i int + page MigrationConfigListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MigrationConfigListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MigrationConfigListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MigrationConfigListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MigrationConfigListResultIterator) Response() MigrationConfigListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MigrationConfigListResultIterator) Value() MigrationConfigProperties { + if !iter.page.NotDone() { + return MigrationConfigProperties{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MigrationConfigListResultIterator type. +func NewMigrationConfigListResultIterator(page MigrationConfigListResultPage) MigrationConfigListResultIterator { + return MigrationConfigListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr MigrationConfigListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr MigrationConfigListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// migrationConfigListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr MigrationConfigListResult) migrationConfigListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// MigrationConfigListResultPage contains a page of MigrationConfigProperties values. +type MigrationConfigListResultPage struct { + fn func(context.Context, MigrationConfigListResult) (MigrationConfigListResult, error) + mclr MigrationConfigListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MigrationConfigListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MigrationConfigListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MigrationConfigListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MigrationConfigListResultPage) Response() MigrationConfigListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MigrationConfigListResultPage) Values() []MigrationConfigProperties { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the MigrationConfigListResultPage type. +func NewMigrationConfigListResultPage(cur MigrationConfigListResult, getNextPage func(context.Context, MigrationConfigListResult) (MigrationConfigListResult, error)) MigrationConfigListResultPage { + return MigrationConfigListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// MigrationConfigProperties single item in List or Get Migration Config operation +type MigrationConfigProperties struct { + autorest.Response `json:"-"` + // MigrationConfigPropertiesProperties - Properties required to the Create Migration Configuration + *MigrationConfigPropertiesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrationConfigProperties. +func (mcp MigrationConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.MigrationConfigPropertiesProperties != nil { + objectMap["properties"] = mcp.MigrationConfigPropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MigrationConfigProperties struct. +func (mcp *MigrationConfigProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var migrationConfigPropertiesProperties MigrationConfigPropertiesProperties + err = json.Unmarshal(*v, &migrationConfigPropertiesProperties) + if err != nil { + return err + } + mcp.MigrationConfigPropertiesProperties = &migrationConfigPropertiesProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcp.Type = &typeVar + } + } + } + + return nil +} + +// MigrationConfigPropertiesProperties properties required to the Create Migration Configuration +type MigrationConfigPropertiesProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of Migration Configuration + ProvisioningState *string `json:"provisioningState,omitempty"` + // PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated. + PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` + // TargetNamespace - Existing premium Namespace ARM Id name which has no entities, will be used for migration + TargetNamespace *string `json:"targetNamespace,omitempty"` + // PostMigrationName - Name to access Standard Namespace after migration + PostMigrationName *string `json:"postMigrationName,omitempty"` + // MigrationState - READ-ONLY; State in which Standard to Premium Migration is, possible values : Unknown, Reverting, Completing, Initiating, Syncing, Active + MigrationState *string `json:"migrationState,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrationConfigPropertiesProperties. +func (mcp MigrationConfigPropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.TargetNamespace != nil { + objectMap["targetNamespace"] = mcp.TargetNamespace + } + if mcp.PostMigrationName != nil { + objectMap["postMigrationName"] = mcp.PostMigrationName + } + return json.Marshal(objectMap) +} + +// MigrationConfigsCreateAndStartMigrationFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type MigrationConfigsCreateAndStartMigrationFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *MigrationConfigsCreateAndStartMigrationFuture) Result(client MigrationConfigsClient) (mcp MigrationConfigProperties, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("servicebus.MigrationConfigsCreateAndStartMigrationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mcp.Response.Response, err = future.GetResult(sender); err == nil && mcp.Response.Response.StatusCode != http.StatusNoContent { + mcp, err = client.CreateAndStartMigrationResponder(mcp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", mcp.Response.Response, "Failure responding to request") + } + } + return +} + +// NamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type NamespacesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn SBNamespace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sn.Response.Response, err = future.GetResult(sender); err == nil && sn.Response.Response.StatusCode != http.StatusNoContent { + sn, err = client.CreateOrUpdateResponder(sn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", sn.Response.Response, "Failure responding to request") + } + } + return +} + +// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NamespacesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NetworkRuleSet description of NetworkRuleSet resource. +type NetworkRuleSet struct { + autorest.Response `json:"-"` + // NetworkRuleSetProperties - NetworkRuleSet properties + *NetworkRuleSetProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkRuleSet. +func (nrs NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nrs.NetworkRuleSetProperties != nil { + objectMap["properties"] = nrs.NetworkRuleSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NetworkRuleSet struct. +func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var networkRuleSetProperties NetworkRuleSetProperties + err = json.Unmarshal(*v, &networkRuleSetProperties) + if err != nil { + return err + } + nrs.NetworkRuleSetProperties = &networkRuleSetProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nrs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + nrs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + nrs.Type = &typeVar + } + } + } + + return nil +} + +// NetworkRuleSetListResult the response of the List NetworkRuleSet operation. +type NetworkRuleSetListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List NetworkRuleSet operation. + Value *[]NetworkRuleSet `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of NetworkRuleSet. + NextLink *string `json:"nextLink,omitempty"` +} + +// NetworkRuleSetListResultIterator provides access to a complete listing of NetworkRuleSet values. +type NetworkRuleSetListResultIterator struct { + i int + page NetworkRuleSetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NetworkRuleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NetworkRuleSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NetworkRuleSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NetworkRuleSetListResultIterator) Response() NetworkRuleSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NetworkRuleSetListResultIterator) Value() NetworkRuleSet { + if !iter.page.NotDone() { + return NetworkRuleSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NetworkRuleSetListResultIterator type. +func NewNetworkRuleSetListResultIterator(page NetworkRuleSetListResultPage) NetworkRuleSetListResultIterator { + return NetworkRuleSetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nrslr NetworkRuleSetListResult) IsEmpty() bool { + return nrslr.Value == nil || len(*nrslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nrslr NetworkRuleSetListResult) hasNextLink() bool { + return nrslr.NextLink != nil && len(*nrslr.NextLink) != 0 +} + +// networkRuleSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nrslr NetworkRuleSetListResult) networkRuleSetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !nrslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nrslr.NextLink))) +} + +// NetworkRuleSetListResultPage contains a page of NetworkRuleSet values. +type NetworkRuleSetListResultPage struct { + fn func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error) + nrslr NetworkRuleSetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NetworkRuleSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nrslr) + if err != nil { + return err + } + page.nrslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NetworkRuleSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NetworkRuleSetListResultPage) NotDone() bool { + return !page.nrslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NetworkRuleSetListResultPage) Response() NetworkRuleSetListResult { + return page.nrslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NetworkRuleSetListResultPage) Values() []NetworkRuleSet { + if page.nrslr.IsEmpty() { + return nil + } + return *page.nrslr.Value +} + +// Creates a new instance of the NetworkRuleSetListResultPage type. +func NewNetworkRuleSetListResultPage(cur NetworkRuleSetListResult, getNextPage func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error)) NetworkRuleSetListResultPage { + return NetworkRuleSetListResultPage{ + fn: getNextPage, + nrslr: cur, + } +} + +// NetworkRuleSetProperties networkRuleSet properties +type NetworkRuleSetProperties struct { + // DefaultAction - Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' + DefaultAction DefaultAction `json:"defaultAction,omitempty"` + // VirtualNetworkRules - List VirtualNetwork Rules + VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` + // IPRules - List of IpRules + IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` +} + +// NWRuleSetIPRules description of NetWorkRuleSet - IpRules resource. +type NWRuleSetIPRules struct { + // IPMask - IP Mask + IPMask *string `json:"ipMask,omitempty"` + // Action - The IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow' + Action NetworkRuleIPAction `json:"action,omitempty"` +} + +// NWRuleSetVirtualNetworkRules description of VirtualNetworkRules - NetworkRules resource. +type NWRuleSetVirtualNetworkRules struct { + // Subnet - Subnet properties + Subnet *Subnet `json:"subnet,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Value that indicates whether to ignore missing VNet Service Endpoint + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` } // Operation a ServiceBus REST API operation type Operation struct { // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - READ-ONLY; Service provider: Microsoft.ServiceBus + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list ServiceBus operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PremiumMessagingRegions premium Messaging Region +type PremiumMessagingRegions struct { + Properties *PremiumMessagingRegionsProperties `json:"properties,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PremiumMessagingRegions. +func (pmr PremiumMessagingRegions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmr.Properties != nil { + objectMap["properties"] = pmr.Properties + } + if pmr.Location != nil { + objectMap["location"] = pmr.Location + } + if pmr.Tags != nil { + objectMap["tags"] = pmr.Tags + } + return json.Marshal(objectMap) +} + +// PremiumMessagingRegionsListResult the response of the List PremiumMessagingRegions operation. +type PremiumMessagingRegionsListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List PremiumMessagingRegions type. + Value *[]PremiumMessagingRegions `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of PremiumMessagingRegions. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PremiumMessagingRegionsListResult. +func (pmrlr PremiumMessagingRegionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmrlr.Value != nil { + objectMap["value"] = pmrlr.Value + } + return json.Marshal(objectMap) +} + +// PremiumMessagingRegionsListResultIterator provides access to a complete listing of +// PremiumMessagingRegions values. +type PremiumMessagingRegionsListResultIterator struct { + i int + page PremiumMessagingRegionsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PremiumMessagingRegionsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremiumMessagingRegionsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PremiumMessagingRegionsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PremiumMessagingRegionsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PremiumMessagingRegionsListResultIterator) Response() PremiumMessagingRegionsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PremiumMessagingRegionsListResultIterator) Value() PremiumMessagingRegions { + if !iter.page.NotDone() { + return PremiumMessagingRegions{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PremiumMessagingRegionsListResultIterator type. +func NewPremiumMessagingRegionsListResultIterator(page PremiumMessagingRegionsListResultPage) PremiumMessagingRegionsListResultIterator { + return PremiumMessagingRegionsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pmrlr PremiumMessagingRegionsListResult) IsEmpty() bool { + return pmrlr.Value == nil || len(*pmrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pmrlr PremiumMessagingRegionsListResult) hasNextLink() bool { + return pmrlr.NextLink != nil && len(*pmrlr.NextLink) != 0 +} + +// premiumMessagingRegionsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pmrlr PremiumMessagingRegionsListResult) premiumMessagingRegionsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pmrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pmrlr.NextLink))) +} + +// PremiumMessagingRegionsListResultPage contains a page of PremiumMessagingRegions values. +type PremiumMessagingRegionsListResultPage struct { + fn func(context.Context, PremiumMessagingRegionsListResult) (PremiumMessagingRegionsListResult, error) + pmrlr PremiumMessagingRegionsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PremiumMessagingRegionsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremiumMessagingRegionsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pmrlr) + if err != nil { + return err + } + page.pmrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PremiumMessagingRegionsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PremiumMessagingRegionsListResultPage) NotDone() bool { + return !page.pmrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PremiumMessagingRegionsListResultPage) Response() PremiumMessagingRegionsListResult { + return page.pmrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PremiumMessagingRegionsListResultPage) Values() []PremiumMessagingRegions { + if page.pmrlr.IsEmpty() { + return nil + } + return *page.pmrlr.Value +} + +// Creates a new instance of the PremiumMessagingRegionsListResultPage type. +func NewPremiumMessagingRegionsListResultPage(cur PremiumMessagingRegionsListResult, getNextPage func(context.Context, PremiumMessagingRegionsListResult) (PremiumMessagingRegionsListResult, error)) PremiumMessagingRegionsListResultPage { + return PremiumMessagingRegionsListResultPage{ + fn: getNextPage, + pmrlr: cur, + } +} + +// PremiumMessagingRegionsProperties ... +type PremiumMessagingRegionsProperties struct { + // Code - READ-ONLY; Region code + Code *string `json:"code,omitempty"` + // FullName - READ-ONLY; Full name of the region + FullName *string `json:"fullName,omitempty"` +} + +// PrivateEndpoint privateEndpoint information. +type PrivateEndpoint struct { + // ID - The ARM identifier for Private Endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection properties of the PrivateEndpointConnection. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult result of the list of all private endpoint connections operation. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A collection of private endpoint connection resources. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - A link for the next page of private endpoint connection resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateEndpointConnectionListResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultIterator struct { + i int + page PrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. +func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { + return PrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { + return peclr.Value == nil || len(*peclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { + return peclr.NextLink != nil && len(*peclr.NextLink) != 0 +} + +// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !peclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(peclr.NextLink))) +} + +// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultPage struct { + fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) + peclr PrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.peclr) + if err != nil { + return err + } + page.peclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.peclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { + return page.peclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { + if page.peclr.IsEmpty() { + return nil + } + return *page.peclr.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListResultPage type. +func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { + return PrivateEndpointConnectionListResultPage{ + fn: getNextPage, + peclr: cur, + } +} + +// PrivateEndpointConnectionProperties properties of the private endpoint connection resource. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The Private Endpoint resource for this Connection. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Details about the state of the connection. + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the Private Endpoint Connection. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' + ProvisioningState EndPointProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *PrivateEndpointConnectionsDeleteFuture) Result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("servicebus.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource information of the private link resource. +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Properties of the private link resource. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // 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"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceProperties properties of PrivateLinkResource +type PrivateLinkResourceProperties struct { + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - Required Members + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required Zone Names + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// PrivateLinkResourcesListResult result of the List private link resources operation. +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - A link for the next page of private link resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// RegenerateAccessKeyParameters parameters supplied to the Regenerate Authorization Rule operation, +// specifies which key needs to be reset. +type RegenerateAccessKeyParameters struct { + // KeyType - The access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey' + KeyType KeyType `json:"keyType,omitempty"` + // Key - Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType + Key *string `json:"key,omitempty"` +} + +// Resource the Resource definition for other than namespace. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// ResourceNamespacePatch the Resource definition. +type ResourceNamespacePatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNamespacePatch. +func (rnp ResourceNamespacePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnp.Location != nil { + objectMap["location"] = rnp.Location + } + if rnp.Tags != nil { + objectMap["tags"] = rnp.Tags + } + return json.Marshal(objectMap) +} + +// Rule description of Rule Resource. +type Rule struct { + autorest.Response `json:"-"` + // Ruleproperties - Properties of Rule resource + *Ruleproperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Ruleproperties != nil { + objectMap["properties"] = r.Ruleproperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Rule struct. +func (r *Rule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleproperties Ruleproperties + err = json.Unmarshal(*v, &ruleproperties) + if err != nil { + return err + } + r.Ruleproperties = &ruleproperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + } + } + + return nil +} + +// RuleListResult the response of the List rule operation. +type RuleListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List Rules operation. + Value *[]Rule `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of rules + NextLink *string `json:"nextLink,omitempty"` +} + +// RuleListResultIterator provides access to a complete listing of Rule values. +type RuleListResultIterator struct { + i int + page RuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleListResultIterator) Response() RuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleListResultIterator) Value() Rule { + if !iter.page.NotDone() { + return Rule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleListResultIterator type. +func NewRuleListResultIterator(page RuleListResultPage) RuleListResultIterator { + return RuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RuleListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RuleListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// ruleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RuleListResult) ruleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RuleListResultPage contains a page of Rule values. +type RuleListResultPage struct { + fn func(context.Context, RuleListResult) (RuleListResult, error) + rlr RuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleListResultPage) Response() RuleListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleListResultPage) Values() []Rule { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RuleListResultPage type. +func NewRuleListResultPage(cur RuleListResult, getNextPage func(context.Context, RuleListResult) (RuleListResult, error)) RuleListResultPage { + return RuleListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// Ruleproperties description of Rule Resource. +type Ruleproperties struct { + // Action - Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + Action *Action `json:"action,omitempty"` + // FilterType - Filter type that is evaluated against a BrokeredMessage. Possible values include: 'FilterTypeSQLFilter', 'FilterTypeCorrelationFilter' + FilterType FilterType `json:"filterType,omitempty"` + // SQLFilter - Properties of sqlFilter + SQLFilter *SQLFilter `json:"sqlFilter,omitempty"` + // CorrelationFilter - Properties of correlationFilter + CorrelationFilter *CorrelationFilter `json:"correlationFilter,omitempty"` +} + +// SBAuthorizationRule description of a namespace authorization rule. +type SBAuthorizationRule struct { + autorest.Response `json:"-"` + // SBAuthorizationRuleProperties - AuthorizationRule properties. + *SBAuthorizationRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBAuthorizationRule. +func (sar SBAuthorizationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sar.SBAuthorizationRuleProperties != nil { + objectMap["properties"] = sar.SBAuthorizationRuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SBAuthorizationRule struct. +func (sar *SBAuthorizationRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sBAuthorizationRuleProperties SBAuthorizationRuleProperties + err = json.Unmarshal(*v, &sBAuthorizationRuleProperties) + if err != nil { + return err + } + sar.SBAuthorizationRuleProperties = &sBAuthorizationRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sar.Type = &typeVar + } + } + } + + return nil +} + +// SBAuthorizationRuleListResult the response to the List Namespace operation. +type SBAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List Authorization Rules operation. + Value *[]SBAuthorizationRule `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. + NextLink *string `json:"nextLink,omitempty"` +} + +// SBAuthorizationRuleListResultIterator provides access to a complete listing of SBAuthorizationRule +// values. +type SBAuthorizationRuleListResultIterator struct { + i int + page SBAuthorizationRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SBAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBAuthorizationRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SBAuthorizationRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SBAuthorizationRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SBAuthorizationRuleListResultIterator) Response() SBAuthorizationRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SBAuthorizationRuleListResultIterator) Value() SBAuthorizationRule { + if !iter.page.NotDone() { + return SBAuthorizationRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SBAuthorizationRuleListResultIterator type. +func NewSBAuthorizationRuleListResultIterator(page SBAuthorizationRuleListResultPage) SBAuthorizationRuleListResultIterator { + return SBAuthorizationRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sarlr SBAuthorizationRuleListResult) IsEmpty() bool { + return sarlr.Value == nil || len(*sarlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sarlr SBAuthorizationRuleListResult) hasNextLink() bool { + return sarlr.NextLink != nil && len(*sarlr.NextLink) != 0 +} + +// sBAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sarlr SBAuthorizationRuleListResult) sBAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sarlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sarlr.NextLink))) +} + +// SBAuthorizationRuleListResultPage contains a page of SBAuthorizationRule values. +type SBAuthorizationRuleListResultPage struct { + fn func(context.Context, SBAuthorizationRuleListResult) (SBAuthorizationRuleListResult, error) + sarlr SBAuthorizationRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SBAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBAuthorizationRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sarlr) + if err != nil { + return err + } + page.sarlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SBAuthorizationRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SBAuthorizationRuleListResultPage) NotDone() bool { + return !page.sarlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SBAuthorizationRuleListResultPage) Response() SBAuthorizationRuleListResult { + return page.sarlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SBAuthorizationRuleListResultPage) Values() []SBAuthorizationRule { + if page.sarlr.IsEmpty() { + return nil + } + return *page.sarlr.Value +} + +// Creates a new instance of the SBAuthorizationRuleListResultPage type. +func NewSBAuthorizationRuleListResultPage(cur SBAuthorizationRuleListResult, getNextPage func(context.Context, SBAuthorizationRuleListResult) (SBAuthorizationRuleListResult, error)) SBAuthorizationRuleListResultPage { + return SBAuthorizationRuleListResultPage{ + fn: getNextPage, + sarlr: cur, + } +} + +// SBAuthorizationRuleProperties authorizationRule properties. +type SBAuthorizationRuleProperties struct { + // Rights - The rights associated with the rule. + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// SBNamespace description of a namespace resource. +type SBNamespace struct { + autorest.Response `json:"-"` + // Sku - Properties of SKU + Sku *SBSku `json:"sku,omitempty"` + // Identity - Properties of BYOK Identity description + Identity *Identity `json:"identity,omitempty"` + // SBNamespaceProperties - Properties of the namespace. + *SBNamespaceProperties `json:"properties,omitempty"` + // Location - The Geo-location where the resource lives + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBNamespace. +func (sn SBNamespace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sn.Sku != nil { + objectMap["sku"] = sn.Sku + } + if sn.Identity != nil { + objectMap["identity"] = sn.Identity + } + if sn.SBNamespaceProperties != nil { + objectMap["properties"] = sn.SBNamespaceProperties + } + if sn.Location != nil { + objectMap["location"] = sn.Location + } + if sn.Tags != nil { + objectMap["tags"] = sn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SBNamespace struct. +func (sn *SBNamespace) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku SBSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + sn.Sku = &sku + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + sn.Identity = &identity + } + case "properties": + if v != nil { + var sBNamespaceProperties SBNamespaceProperties + err = json.Unmarshal(*v, &sBNamespaceProperties) + if err != nil { + return err + } + sn.SBNamespaceProperties = &sBNamespaceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sn.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sn.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sn.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sn.Type = &typeVar + } + } + } + + return nil +} + +// SBNamespaceListResult the response of the List Namespace operation. +type SBNamespaceListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List Namespace operation. + Value *[]SBNamespace `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. + NextLink *string `json:"nextLink,omitempty"` +} + +// SBNamespaceListResultIterator provides access to a complete listing of SBNamespace values. +type SBNamespaceListResultIterator struct { + i int + page SBNamespaceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SBNamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SBNamespaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SBNamespaceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SBNamespaceListResultIterator) Response() SBNamespaceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SBNamespaceListResultIterator) Value() SBNamespace { + if !iter.page.NotDone() { + return SBNamespace{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SBNamespaceListResultIterator type. +func NewSBNamespaceListResultIterator(page SBNamespaceListResultPage) SBNamespaceListResultIterator { + return SBNamespaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (snlr SBNamespaceListResult) IsEmpty() bool { + return snlr.Value == nil || len(*snlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (snlr SBNamespaceListResult) hasNextLink() bool { + return snlr.NextLink != nil && len(*snlr.NextLink) != 0 +} + +// sBNamespaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (snlr SBNamespaceListResult) sBNamespaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !snlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(snlr.NextLink))) +} + +// SBNamespaceListResultPage contains a page of SBNamespace values. +type SBNamespaceListResultPage struct { + fn func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error) + snlr SBNamespaceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SBNamespaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.snlr) + if err != nil { + return err + } + page.snlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SBNamespaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SBNamespaceListResultPage) NotDone() bool { + return !page.snlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SBNamespaceListResultPage) Response() SBNamespaceListResult { + return page.snlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SBNamespaceListResultPage) Values() []SBNamespace { + if page.snlr.IsEmpty() { + return nil + } + return *page.snlr.Value +} + +// Creates a new instance of the SBNamespaceListResultPage type. +func NewSBNamespaceListResultPage(cur SBNamespaceListResult, getNextPage func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error)) SBNamespaceListResultPage { + return SBNamespaceListResultPage{ + fn: getNextPage, + snlr: cur, + } +} + +// SBNamespaceMigrate namespace Migrate Object +type SBNamespaceMigrate struct { + // TargetNamespaceType - Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + TargetNamespaceType NameSpaceType `json:"targetNamespaceType,omitempty"` +} + +// SBNamespaceProperties properties of the namespace. +type SBNamespaceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the namespace. + ProvisioningState *string `json:"provisioningState,omitempty"` + // CreatedAt - READ-ONLY; The time the namespace was created + CreatedAt *date.Time `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; The time the namespace was updated. + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + // ServiceBusEndpoint - READ-ONLY; Endpoint you can use to perform Service Bus operations. + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + // MetricID - READ-ONLY; Identifier for Azure Insights metrics + MetricID *string `json:"metricId,omitempty"` + // ZoneRedundant - Enabling this property creates a Premium Service Bus Namespace in regions supported availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Encryption - Properties of BYOK Encryption description + Encryption *Encryption `json:"encryption,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBNamespaceProperties. +func (snp SBNamespaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if snp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = snp.ZoneRedundant + } + if snp.Encryption != nil { + objectMap["encryption"] = snp.Encryption + } + return json.Marshal(objectMap) +} + +// SBNamespaceUpdateParameters description of a namespace resource. +type SBNamespaceUpdateParameters struct { + // Sku - Properties of SKU + Sku *SBSku `json:"sku,omitempty"` + // SBNamespaceProperties - Properties of the namespace. + *SBNamespaceProperties `json:"properties,omitempty"` + // Identity - Properties of BYOK Identity description + Identity *Identity `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBNamespaceUpdateParameters. +func (snup SBNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if snup.Sku != nil { + objectMap["sku"] = snup.Sku + } + if snup.SBNamespaceProperties != nil { + objectMap["properties"] = snup.SBNamespaceProperties + } + if snup.Identity != nil { + objectMap["identity"] = snup.Identity + } + if snup.Location != nil { + objectMap["location"] = snup.Location + } + if snup.Tags != nil { + objectMap["tags"] = snup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SBNamespaceUpdateParameters struct. +func (snup *SBNamespaceUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku SBSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + snup.Sku = &sku + } + case "properties": + if v != nil { + var sBNamespaceProperties SBNamespaceProperties + err = json.Unmarshal(*v, &sBNamespaceProperties) + if err != nil { + return err + } + snup.SBNamespaceProperties = &sBNamespaceProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + snup.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + snup.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + snup.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + snup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + snup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + snup.Type = &typeVar + } + } + } + + return nil +} + +// SBQueue description of queue Resource. +type SBQueue struct { + autorest.Response `json:"-"` + // SBQueueProperties - Queue Properties + *SBQueueProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBQueue. +func (sq SBQueue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sq.SBQueueProperties != nil { + objectMap["properties"] = sq.SBQueueProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SBQueue struct. +func (sq *SBQueue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sBQueueProperties SBQueueProperties + err = json.Unmarshal(*v, &sBQueueProperties) + if err != nil { + return err + } + sq.SBQueueProperties = &sBQueueProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sq.Type = &typeVar + } + } + } + + return nil +} + +// SBQueueListResult the response to the List Queues operation. +type SBQueueListResult struct { + autorest.Response `json:"-"` + // Value - Result of the List Queues operation. + Value *[]SBQueue `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of queues. + NextLink *string `json:"nextLink,omitempty"` +} + +// SBQueueListResultIterator provides access to a complete listing of SBQueue values. +type SBQueueListResultIterator struct { + i int + page SBQueueListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SBQueueListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBQueueListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SBQueueListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SBQueueListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SBQueueListResultIterator) Response() SBQueueListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SBQueueListResultIterator) Value() SBQueue { + if !iter.page.NotDone() { + return SBQueue{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SBQueueListResultIterator type. +func NewSBQueueListResultIterator(page SBQueueListResultPage) SBQueueListResultIterator { + return SBQueueListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sqlr SBQueueListResult) IsEmpty() bool { + return sqlr.Value == nil || len(*sqlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sqlr SBQueueListResult) hasNextLink() bool { + return sqlr.NextLink != nil && len(*sqlr.NextLink) != 0 +} + +// sBQueueListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sqlr SBQueueListResult) sBQueueListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sqlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sqlr.NextLink))) +} + +// SBQueueListResultPage contains a page of SBQueue values. +type SBQueueListResultPage struct { + fn func(context.Context, SBQueueListResult) (SBQueueListResult, error) + sqlr SBQueueListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SBQueueListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SBQueueListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sqlr) + if err != nil { + return err + } + page.sqlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SBQueueListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SBQueueListResultPage) NotDone() bool { + return !page.sqlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SBQueueListResultPage) Response() SBQueueListResult { + return page.sqlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SBQueueListResultPage) Values() []SBQueue { + if page.sqlr.IsEmpty() { + return nil + } + return *page.sqlr.Value +} + +// Creates a new instance of the SBQueueListResultPage type. +func NewSBQueueListResultPage(cur SBQueueListResult, getNextPage func(context.Context, SBQueueListResult) (SBQueueListResult, error)) SBQueueListResultPage { + return SBQueueListResultPage{ + fn: getNextPage, + sqlr: cur, + } +} + +// SBQueueProperties the Queue Properties definition. +type SBQueueProperties struct { + // CountDetails - READ-ONLY; Message Count Details. + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + // CreatedAt - READ-ONLY; The exact time the message was created. + CreatedAt *date.Time `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; The exact time the message was updated. + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + // AccessedAt - READ-ONLY; Last time a message was sent, or the last time there was a receive request to this queue. + AccessedAt *date.Time `json:"accessedAt,omitempty"` + // SizeInBytes - READ-ONLY; The size of the queue, in bytes. + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + // MessageCount - READ-ONLY; The number of messages in the queue. + MessageCount *int64 `json:"messageCount,omitempty"` + // LockDuration - ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + LockDuration *string `json:"lockDuration,omitempty"` + // MaxSizeInMegabytes - The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. + MaxSizeInMegabytes *int32 `json:"maxSizeInMegabytes,omitempty"` + // RequiresDuplicateDetection - A value indicating if this queue requires duplicate detection. + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + // RequiresSession - A value that indicates whether the queue supports the concept of sessions. + RequiresSession *bool `json:"requiresSession,omitempty"` + // DefaultMessageTimeToLive - ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + // DeadLetteringOnMessageExpiration - A value that indicates whether this queue has dead letter support when a message expires. + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + // MaxDeliveryCount - The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' + Status EntityStatus `json:"status,omitempty"` + // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + // AutoDeleteOnIdle - ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + // EnablePartitioning - A value that indicates whether the queue is to be partitioned across multiple message brokers. + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + // EnableExpress - A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + EnableExpress *bool `json:"enableExpress,omitempty"` + // ForwardTo - Queue/Topic name to forward the messages + ForwardTo *string `json:"forwardTo,omitempty"` + // ForwardDeadLetteredMessagesTo - Queue/Topic name to forward the Dead Letter message + ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` +} + +// MarshalJSON is the custom marshaler for SBQueueProperties. +func (sqp SBQueueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sqp.LockDuration != nil { + objectMap["lockDuration"] = sqp.LockDuration + } + if sqp.MaxSizeInMegabytes != nil { + objectMap["maxSizeInMegabytes"] = sqp.MaxSizeInMegabytes + } + if sqp.RequiresDuplicateDetection != nil { + objectMap["requiresDuplicateDetection"] = sqp.RequiresDuplicateDetection + } + if sqp.RequiresSession != nil { + objectMap["requiresSession"] = sqp.RequiresSession + } + if sqp.DefaultMessageTimeToLive != nil { + objectMap["defaultMessageTimeToLive"] = sqp.DefaultMessageTimeToLive + } + if sqp.DeadLetteringOnMessageExpiration != nil { + objectMap["deadLetteringOnMessageExpiration"] = sqp.DeadLetteringOnMessageExpiration + } + if sqp.DuplicateDetectionHistoryTimeWindow != nil { + objectMap["duplicateDetectionHistoryTimeWindow"] = sqp.DuplicateDetectionHistoryTimeWindow + } + if sqp.MaxDeliveryCount != nil { + objectMap["maxDeliveryCount"] = sqp.MaxDeliveryCount + } + if sqp.Status != "" { + objectMap["status"] = sqp.Status + } + if sqp.EnableBatchedOperations != nil { + objectMap["enableBatchedOperations"] = sqp.EnableBatchedOperations + } + if sqp.AutoDeleteOnIdle != nil { + objectMap["autoDeleteOnIdle"] = sqp.AutoDeleteOnIdle + } + if sqp.EnablePartitioning != nil { + objectMap["enablePartitioning"] = sqp.EnablePartitioning + } + if sqp.EnableExpress != nil { + objectMap["enableExpress"] = sqp.EnableExpress + } + if sqp.ForwardTo != nil { + objectMap["forwardTo"] = sqp.ForwardTo + } + if sqp.ForwardDeadLetteredMessagesTo != nil { + objectMap["forwardDeadLetteredMessagesTo"] = sqp.ForwardDeadLetteredMessagesTo + } + return json.Marshal(objectMap) +} + +// SBSku SKU of the namespace. +type SBSku struct { + // Name - Name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium' + Name SkuName `json:"name,omitempty"` + // Tier - The billing tier of this particular SKU. Possible values include: 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' + Tier SkuTier `json:"tier,omitempty"` + // Capacity - The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SBSubscription description of subscription resource. +type SBSubscription struct { + autorest.Response `json:"-"` + // SBSubscriptionProperties - Properties of subscriptions resource. + *SBSubscriptionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for SBSubscription. +func (ss SBSubscription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display + if ss.SBSubscriptionProperties != nil { + objectMap["properties"] = ss.SBSubscriptionProperties } return json.Marshal(objectMap) } -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft.ServiceBus - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` +// UnmarshalJSON is the custom unmarshaler for SBSubscription struct. +func (ss *SBSubscription) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sBSubscriptionProperties SBSubscriptionProperties + err = json.Unmarshal(*v, &sBSubscriptionProperties) + if err != nil { + return err + } + ss.SBSubscriptionProperties = &sBSubscriptionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ss.Type = &typeVar + } + } + } + + return nil } -// OperationListResult result of the request to list ServiceBus operations. It contains a list of operations -// and a URL link to get the next set of results. -type OperationListResult struct { +// SBSubscriptionListResult the response to the List Subscriptions operation. +type SBSubscriptionListResult struct { autorest.Response `json:"-"` - // Value - READ-ONLY; List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. + // Value - Result of the List Subscriptions operation. + Value *[]SBSubscription `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. NextLink *string `json:"nextLink,omitempty"` } -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { +// SBSubscriptionListResultIterator provides access to a complete listing of SBSubscription values. +type SBSubscriptionListResultIterator struct { i int - page OperationListResultPage + page SBSubscriptionListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *SBSubscriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SBSubscriptionListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -536,67 +3946,67 @@ func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (e // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { +func (iter *SBSubscriptionListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { +func (iter SBSubscriptionListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { +func (iter SBSubscriptionListResultIterator) Response() SBSubscriptionListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { +func (iter SBSubscriptionListResultIterator) Value() SBSubscription { if !iter.page.NotDone() { - return Operation{} + return SBSubscription{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} +// Creates a new instance of the SBSubscriptionListResultIterator type. +func NewSBSubscriptionListResultIterator(page SBSubscriptionListResultPage) SBSubscriptionListResultIterator { + return SBSubscriptionListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 +func (sslr SBSubscriptionListResult) IsEmpty() bool { + return sslr.Value == nil || len(*sslr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 +func (sslr SBSubscriptionListResult) hasNextLink() bool { + return sslr.NextLink != nil && len(*sslr.NextLink) != 0 } -// operationListResultPreparer prepares a request to retrieve the next set of results. +// sBSubscriptionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { +func (sslr SBSubscriptionListResult) sBSubscriptionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sslr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) + autorest.WithBaseURL(to.String(sslr.NextLink))) } -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult +// SBSubscriptionListResultPage contains a page of SBSubscription values. +type SBSubscriptionListResultPage struct { + fn func(context.Context, SBSubscriptionListResult) (SBSubscriptionListResult, error) + sslr SBSubscriptionListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *SBSubscriptionListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SBSubscriptionListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -606,11 +4016,11 @@ func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err e }() } for { - next, err := page.fn(ctx, page.olr) + next, err := page.fn(ctx, page.sslr) if err != nil { return err } - page.olr = next + page.sslr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -621,80 +4031,121 @@ func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err e // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { +func (page *SBSubscriptionListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() +func (page SBSubscriptionListResultPage) NotDone() bool { + return !page.sslr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr +func (page SBSubscriptionListResultPage) Response() SBSubscriptionListResult { + return page.sslr } // Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { +func (page SBSubscriptionListResultPage) Values() []SBSubscription { + if page.sslr.IsEmpty() { return nil } - return *page.olr.Value + return *page.sslr.Value } -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{fn: getNextPage} -} - -// Resource the Resource definition for other than namespace. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// Creates a new instance of the SBSubscriptionListResultPage type. +func NewSBSubscriptionListResultPage(cur SBSubscriptionListResult, getNextPage func(context.Context, SBSubscriptionListResult) (SBSubscriptionListResult, error)) SBSubscriptionListResultPage { + return SBSubscriptionListResultPage{ + fn: getNextPage, + sslr: cur, + } } -// ResourceNamespacePatch the Resource definition. -type ResourceNamespacePatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// SBSubscriptionProperties description of Subscription Resource. +type SBSubscriptionProperties struct { + // MessageCount - READ-ONLY; Number of messages. + MessageCount *int64 `json:"messageCount,omitempty"` + // CreatedAt - READ-ONLY; Exact time the message was created. + CreatedAt *date.Time `json:"createdAt,omitempty"` + // AccessedAt - READ-ONLY; Last time there was a receive request to this subscription. + AccessedAt *date.Time `json:"accessedAt,omitempty"` + // UpdatedAt - READ-ONLY; The exact time the message was updated. + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + // CountDetails - READ-ONLY; Message count details + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + // LockDuration - ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. + LockDuration *string `json:"lockDuration,omitempty"` + // RequiresSession - Value indicating if a subscription supports the concept of sessions. + RequiresSession *bool `json:"requiresSession,omitempty"` + // DefaultMessageTimeToLive - ISO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + // DeadLetteringOnFilterEvaluationExceptions - Value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"` + // DeadLetteringOnMessageExpiration - Value that indicates whether a subscription has dead letter support when a message expires. + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + // MaxDeliveryCount - Number of maximum deliveries. + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' + Status EntityStatus `json:"status,omitempty"` + // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + // AutoDeleteOnIdle - ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + // ForwardTo - Queue/Topic name to forward the messages + ForwardTo *string `json:"forwardTo,omitempty"` + // ForwardDeadLetteredMessagesTo - Queue/Topic name to forward the Dead Letter message + ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` } -// MarshalJSON is the custom marshaler for ResourceNamespacePatch. -func (rnp ResourceNamespacePatch) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for SBSubscriptionProperties. +func (ssp SBSubscriptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rnp.Location != nil { - objectMap["location"] = rnp.Location + if ssp.LockDuration != nil { + objectMap["lockDuration"] = ssp.LockDuration + } + if ssp.RequiresSession != nil { + objectMap["requiresSession"] = ssp.RequiresSession + } + if ssp.DefaultMessageTimeToLive != nil { + objectMap["defaultMessageTimeToLive"] = ssp.DefaultMessageTimeToLive + } + if ssp.DeadLetteringOnFilterEvaluationExceptions != nil { + objectMap["deadLetteringOnFilterEvaluationExceptions"] = ssp.DeadLetteringOnFilterEvaluationExceptions + } + if ssp.DeadLetteringOnMessageExpiration != nil { + objectMap["deadLetteringOnMessageExpiration"] = ssp.DeadLetteringOnMessageExpiration + } + if ssp.DuplicateDetectionHistoryTimeWindow != nil { + objectMap["duplicateDetectionHistoryTimeWindow"] = ssp.DuplicateDetectionHistoryTimeWindow + } + if ssp.MaxDeliveryCount != nil { + objectMap["maxDeliveryCount"] = ssp.MaxDeliveryCount + } + if ssp.Status != "" { + objectMap["status"] = ssp.Status + } + if ssp.EnableBatchedOperations != nil { + objectMap["enableBatchedOperations"] = ssp.EnableBatchedOperations + } + if ssp.AutoDeleteOnIdle != nil { + objectMap["autoDeleteOnIdle"] = ssp.AutoDeleteOnIdle + } + if ssp.ForwardTo != nil { + objectMap["forwardTo"] = ssp.ForwardTo } - if rnp.Tags != nil { - objectMap["tags"] = rnp.Tags + if ssp.ForwardDeadLetteredMessagesTo != nil { + objectMap["forwardDeadLetteredMessagesTo"] = ssp.ForwardDeadLetteredMessagesTo } return json.Marshal(objectMap) } -// SBNamespace description of a namespace resource. -type SBNamespace struct { +// SBTopic description of topic resource. +type SBTopic struct { autorest.Response `json:"-"` - // Sku - Properties of SKU - Sku *SBSku `json:"sku,omitempty"` - // SBNamespaceProperties - Properties of the namespace. - *SBNamespaceProperties `json:"properties,omitempty"` - // Location - The Geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` + // SBTopicProperties - Properties of topic resource. + *SBTopicProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -703,26 +4154,17 @@ type SBNamespace struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for SBNamespace. -func (sn SBNamespace) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for SBTopic. +func (st SBTopic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if sn.Sku != nil { - objectMap["sku"] = sn.Sku - } - if sn.SBNamespaceProperties != nil { - objectMap["properties"] = sn.SBNamespaceProperties - } - if sn.Location != nil { - objectMap["location"] = sn.Location - } - if sn.Tags != nil { - objectMap["tags"] = sn.Tags + if st.SBTopicProperties != nil { + objectMap["properties"] = st.SBTopicProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for SBNamespace struct. -func (sn *SBNamespace) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for SBTopic struct. +func (st *SBTopic) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -730,41 +4172,14 @@ func (sn *SBNamespace) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "sku": - if v != nil { - var sku SBSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sn.Sku = &sku - } case "properties": if v != nil { - var sBNamespaceProperties SBNamespaceProperties - err = json.Unmarshal(*v, &sBNamespaceProperties) - if err != nil { - return err - } - sn.SBNamespaceProperties = &sBNamespaceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var sBTopicProperties SBTopicProperties + err = json.Unmarshal(*v, &sBTopicProperties) if err != nil { return err } - sn.Tags = tags + st.SBTopicProperties = &sBTopicProperties } case "id": if v != nil { @@ -773,7 +4188,7 @@ func (sn *SBNamespace) UnmarshalJSON(body []byte) error { if err != nil { return err } - sn.ID = &ID + st.ID = &ID } case "name": if v != nil { @@ -782,7 +4197,7 @@ func (sn *SBNamespace) UnmarshalJSON(body []byte) error { if err != nil { return err } - sn.Name = &name + st.Name = &name } case "type": if v != nil { @@ -791,7 +4206,7 @@ func (sn *SBNamespace) UnmarshalJSON(body []byte) error { if err != nil { return err } - sn.Type = &typeVar + st.Type = &typeVar } } } @@ -799,26 +4214,26 @@ func (sn *SBNamespace) UnmarshalJSON(body []byte) error { return nil } -// SBNamespaceListResult the response of the List Namespace operation. -type SBNamespaceListResult struct { +// SBTopicListResult the response to the List Topics operation. +type SBTopicListResult struct { autorest.Response `json:"-"` - // Value - Result of the List Namespace operation. - Value *[]SBNamespace `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. + // Value - Result of the List Topics operation. + Value *[]SBTopic `json:"value,omitempty"` + // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of topics. NextLink *string `json:"nextLink,omitempty"` } -// SBNamespaceListResultIterator provides access to a complete listing of SBNamespace values. -type SBNamespaceListResultIterator struct { +// SBTopicListResultIterator provides access to a complete listing of SBTopic values. +type SBTopicListResultIterator struct { i int - page SBNamespaceListResultPage + page SBTopicListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *SBNamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *SBTopicListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SBTopicListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -843,67 +4258,67 @@ func (iter *SBNamespaceListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *SBNamespaceListResultIterator) Next() error { +func (iter *SBTopicListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBNamespaceListResultIterator) NotDone() bool { +func (iter SBTopicListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter SBNamespaceListResultIterator) Response() SBNamespaceListResult { +func (iter SBTopicListResultIterator) Response() SBTopicListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter SBNamespaceListResultIterator) Value() SBNamespace { +func (iter SBTopicListResultIterator) Value() SBTopic { if !iter.page.NotDone() { - return SBNamespace{} + return SBTopic{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the SBNamespaceListResultIterator type. -func NewSBNamespaceListResultIterator(page SBNamespaceListResultPage) SBNamespaceListResultIterator { - return SBNamespaceListResultIterator{page: page} +// Creates a new instance of the SBTopicListResultIterator type. +func NewSBTopicListResultIterator(page SBTopicListResultPage) SBTopicListResultIterator { + return SBTopicListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (snlr SBNamespaceListResult) IsEmpty() bool { - return snlr.Value == nil || len(*snlr.Value) == 0 +func (stlr SBTopicListResult) IsEmpty() bool { + return stlr.Value == nil || len(*stlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (snlr SBNamespaceListResult) hasNextLink() bool { - return snlr.NextLink != nil && len(*snlr.NextLink) != 0 +func (stlr SBTopicListResult) hasNextLink() bool { + return stlr.NextLink != nil && len(*stlr.NextLink) != 0 } -// sBNamespaceListResultPreparer prepares a request to retrieve the next set of results. +// sBTopicListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (snlr SBNamespaceListResult) sBNamespaceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !snlr.hasNextLink() { +func (stlr SBTopicListResult) sBTopicListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(snlr.NextLink))) + autorest.WithBaseURL(to.String(stlr.NextLink))) } -// SBNamespaceListResultPage contains a page of SBNamespace values. -type SBNamespaceListResultPage struct { - fn func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error) - snlr SBNamespaceListResult +// SBTopicListResultPage contains a page of SBTopic values. +type SBTopicListResultPage struct { + fn func(context.Context, SBTopicListResult) (SBTopicListResult, error) + stlr SBTopicListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *SBNamespaceListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *SBTopicListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SBTopicListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -913,11 +4328,11 @@ func (page *SBNamespaceListResultPage) NextWithContext(ctx context.Context) (err }() } for { - next, err := page.fn(ctx, page.snlr) + next, err := page.fn(ctx, page.stlr) if err != nil { return err } - page.snlr = next + page.stlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -928,199 +4343,128 @@ func (page *SBNamespaceListResultPage) NextWithContext(ctx context.Context) (err // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *SBNamespaceListResultPage) Next() error { +func (page *SBTopicListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBNamespaceListResultPage) NotDone() bool { - return !page.snlr.IsEmpty() +func (page SBTopicListResultPage) NotDone() bool { + return !page.stlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page SBNamespaceListResultPage) Response() SBNamespaceListResult { - return page.snlr +func (page SBTopicListResultPage) Response() SBTopicListResult { + return page.stlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page SBNamespaceListResultPage) Values() []SBNamespace { - if page.snlr.IsEmpty() { +func (page SBTopicListResultPage) Values() []SBTopic { + if page.stlr.IsEmpty() { return nil } - return *page.snlr.Value + return *page.stlr.Value } -// Creates a new instance of the SBNamespaceListResultPage type. -func NewSBNamespaceListResultPage(getNextPage func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error)) SBNamespaceListResultPage { - return SBNamespaceListResultPage{fn: getNextPage} +// Creates a new instance of the SBTopicListResultPage type. +func NewSBTopicListResultPage(cur SBTopicListResult, getNextPage func(context.Context, SBTopicListResult) (SBTopicListResult, error)) SBTopicListResultPage { + return SBTopicListResultPage{ + fn: getNextPage, + stlr: cur, + } } -// SBNamespaceProperties properties of the namespace. -type SBNamespaceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the namespace. - ProvisioningState *string `json:"provisioningState,omitempty"` - // CreatedAt - READ-ONLY; The time the namespace was created. +// SBTopicProperties the Topic Properties definition. +type SBTopicProperties struct { + // SizeInBytes - READ-ONLY; Size of the topic, in bytes. + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + // CreatedAt - READ-ONLY; Exact time the message was created. CreatedAt *date.Time `json:"createdAt,omitempty"` - // UpdatedAt - READ-ONLY; The time the namespace was updated. + // UpdatedAt - READ-ONLY; The exact time the message was updated. UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // ServiceBusEndpoint - READ-ONLY; Endpoint you can use to perform Service Bus operations. - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - // MetricID - READ-ONLY; Identifier for Azure Insights metrics - MetricID *string `json:"metricId,omitempty"` - // ZoneRedundant - Enabling this property creates a Premium Service Bus Namespace in regions supported availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Encryption - Properties of BYOK Encryption description - Encryption *Encryption `json:"encryption,omitempty"` + // AccessedAt - READ-ONLY; Last time the message was sent, or a request was received, for this topic. + AccessedAt *date.Time `json:"accessedAt,omitempty"` + // SubscriptionCount - READ-ONLY; Number of subscriptions. + SubscriptionCount *int32 `json:"subscriptionCount,omitempty"` + // CountDetails - READ-ONLY; Message count details + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + // DefaultMessageTimeToLive - ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + // MaxSizeInMegabytes - Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024. + MaxSizeInMegabytes *int32 `json:"maxSizeInMegabytes,omitempty"` + // RequiresDuplicateDetection - Value indicating if this topic requires duplicate detection. + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + // DuplicateDetectionHistoryTimeWindow - ISO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' + Status EntityStatus `json:"status,omitempty"` + // SupportOrdering - Value that indicates whether the topic supports ordering. + SupportOrdering *bool `json:"supportOrdering,omitempty"` + // AutoDeleteOnIdle - ISO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + // EnablePartitioning - Value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + // EnableExpress - Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + EnableExpress *bool `json:"enableExpress,omitempty"` } -// MarshalJSON is the custom marshaler for SBNamespaceProperties. -func (snp SBNamespaceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for SBTopicProperties. +func (stp SBTopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if snp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = snp.ZoneRedundant + if stp.DefaultMessageTimeToLive != nil { + objectMap["defaultMessageTimeToLive"] = stp.DefaultMessageTimeToLive } - if snp.Encryption != nil { - objectMap["encryption"] = snp.Encryption + if stp.MaxSizeInMegabytes != nil { + objectMap["maxSizeInMegabytes"] = stp.MaxSizeInMegabytes } - return json.Marshal(objectMap) -} - -// SBNamespaceUpdateParameters description of a namespace resource. -type SBNamespaceUpdateParameters struct { - // Sku - Properties of SKU - Sku *SBSku `json:"sku,omitempty"` - // SBNamespaceProperties - Properties of the namespace. - *SBNamespaceProperties `json:"properties,omitempty"` - // Identity - Properties of BYOK Identity description - Identity *Identity `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBNamespaceUpdateParameters. -func (snup SBNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snup.Sku != nil { - objectMap["sku"] = snup.Sku + if stp.RequiresDuplicateDetection != nil { + objectMap["requiresDuplicateDetection"] = stp.RequiresDuplicateDetection } - if snup.SBNamespaceProperties != nil { - objectMap["properties"] = snup.SBNamespaceProperties + if stp.DuplicateDetectionHistoryTimeWindow != nil { + objectMap["duplicateDetectionHistoryTimeWindow"] = stp.DuplicateDetectionHistoryTimeWindow } - if snup.Identity != nil { - objectMap["identity"] = snup.Identity + if stp.EnableBatchedOperations != nil { + objectMap["enableBatchedOperations"] = stp.EnableBatchedOperations } - if snup.Location != nil { - objectMap["location"] = snup.Location + if stp.Status != "" { + objectMap["status"] = stp.Status } - if snup.Tags != nil { - objectMap["tags"] = snup.Tags + if stp.SupportOrdering != nil { + objectMap["supportOrdering"] = stp.SupportOrdering } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBNamespaceUpdateParameters struct. -func (snup *SBNamespaceUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + if stp.AutoDeleteOnIdle != nil { + objectMap["autoDeleteOnIdle"] = stp.AutoDeleteOnIdle } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku SBSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - snup.Sku = &sku - } - case "properties": - if v != nil { - var sBNamespaceProperties SBNamespaceProperties - err = json.Unmarshal(*v, &sBNamespaceProperties) - if err != nil { - return err - } - snup.SBNamespaceProperties = &sBNamespaceProperties - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - snup.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - snup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - snup.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - snup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - snup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - snup.Type = &typeVar - } - } + if stp.EnablePartitioning != nil { + objectMap["enablePartitioning"] = stp.EnablePartitioning + } + if stp.EnableExpress != nil { + objectMap["enableExpress"] = stp.EnableExpress } + return json.Marshal(objectMap) +} - return nil +// SQLFilter represents a filter which is a composition of an expression and an action that is executed in +// the pub/sub pipeline. +type SQLFilter struct { + // SQLExpression - The SQL expression. e.g. MyProperty='ABC' + SQLExpression *string `json:"sqlExpression,omitempty"` + // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` + // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` } -// SBSku SKU of the namespace. -type SBSku struct { - // Name - Name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium' - Name SkuName `json:"name,omitempty"` - // Tier - The billing tier of this particular SKU. Possible values include: 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Capacity - The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. - Capacity *int32 `json:"capacity,omitempty"` +// SQLRuleAction represents set of actions written in SQL language-based syntax that is performed against a +// ServiceBus.Messaging.BrokeredMessage +type SQLRuleAction struct { + // SQLExpression - SQL expression. e.g. MyProperty='ABC' + SQLExpression *string `json:"sqlExpression,omitempty"` + // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` + // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` } // Subnet properties supplied for Subnet @@ -1380,8 +4724,11 @@ func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { } // Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{fn: getNextPage} +func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { + return VirtualNetworkRuleListResultPage{ + fn: getNextPage, + vnrlr: cur, + } } // VirtualNetworkRuleProperties properties supplied to create or update VirtualNetworkRules diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/namespaces.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/namespaces.go index 097e64079b1c..ff9025adf4bd 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/namespaces.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/namespaces.go @@ -26,8 +26,7 @@ import ( "net/http" ) -// NamespacesClient is the azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and -// Zone Redundant +// NamespacesClient is the client for the Namespaces methods of the Servicebus service. type NamespacesClient struct { BaseClient } @@ -43,6 +42,87 @@ func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) Names return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// CheckNameAvailabilityMethod check the give namespace name availability. +// Parameters: +// parameters - parameters to check availability of the given namespace name +func (client NamespacesClient) CheckNameAvailabilityMethod(ctx context.Context, parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CheckNameAvailabilityMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "CheckNameAvailabilityMethod", err.Error()) + } + + req, err := client.CheckNameAvailabilityMethodPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(ctx context.Context, parameters CheckNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateOrUpdate creates or updates a service namespace. Once created, this namespace's resource manifest is // immutable. This operation is idempotent. // Parameters: @@ -129,6 +209,103 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res return } +// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// authorizationRuleName - the authorization rule name. +// parameters - the shared access authorization rule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdateAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", err.Error()) + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateOrUpdateIPFilterRule creates or updates an IpFilterRule for a Namespace. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. @@ -174,6 +351,7 @@ func (client NamespacesClient) CreateOrUpdateIPFilterRule(ctx context.Context, r result, err = client.CreateOrUpdateIPFilterRuleResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateIPFilterRule", resp, "Failure responding to request") + return } return @@ -221,7 +399,7 @@ func (client NamespacesClient) CreateOrUpdateIPFilterRuleResponder(resp *http.Re return } -// CreateOrUpdateNetworkRuleSet gets NetworkRuleSet for a Namespace. +// CreateOrUpdateNetworkRuleSet create or update NetworkRuleSet for a Namespace. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. // namespaceName - the namespace name @@ -263,6 +441,7 @@ func (client NamespacesClient) CreateOrUpdateNetworkRuleSet(ctx context.Context, result, err = client.CreateOrUpdateNetworkRuleSetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateNetworkRuleSet", resp, "Failure responding to request") + return } return @@ -285,7 +464,7 @@ func (client NamespacesClient) CreateOrUpdateNetworkRuleSetPreparer(ctx context. autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -354,6 +533,7 @@ func (client NamespacesClient) CreateOrUpdateVirtualNetworkRule(ctx context.Cont result, err = client.CreateOrUpdateVirtualNetworkRuleResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateVirtualNetworkRule", resp, "Failure responding to request") + return } return @@ -485,6 +665,96 @@ func (client NamespacesClient) DeleteResponder(resp *http.Response) (result auto return } +// DeleteAuthorizationRule deletes a namespace authorization rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// authorizationRuleName - the authorization rule name. +func (client NamespacesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.DeleteAuthorizationRule") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "DeleteAuthorizationRule", err.Error()) + } + + req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // DeleteIPFilterRule deletes an IpFilterRule for a Namespace. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. @@ -529,6 +799,7 @@ func (client NamespacesClient) DeleteIPFilterRule(ctx context.Context, resourceG result, err = client.DeleteIPFilterRuleResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteIPFilterRule", resp, "Failure responding to request") + return } return @@ -617,6 +888,7 @@ func (client NamespacesClient) DeleteVirtualNetworkRule(ctx context.Context, res result, err = client.DeleteVirtualNetworkRuleResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteVirtualNetworkRule", resp, "Failure responding to request") + return } return @@ -702,6 +974,7 @@ func (client NamespacesClient) Get(ctx context.Context, resourceGroupName string result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure responding to request") + return } return @@ -746,14 +1019,14 @@ func (client NamespacesClient) GetResponder(resp *http.Response) (result SBNames return } -// GetIPFilterRule gets an IpFilterRule for a Namespace by rule name. +// GetAuthorizationRule gets an authorization rule for a namespace by rule name. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. // namespaceName - the namespace name -// IPFilterRuleName - the IP Filter Rule name. -func (client NamespacesClient) GetIPFilterRule(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (result IPFilterRule, err error) { +// authorizationRuleName - the authorization rule name. +func (client NamespacesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetIPFilterRule") + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetAuthorizationRule") defer func() { sc := -1 if result.Response.Response != nil { @@ -769,39 +1042,41 @@ func (client NamespacesClient) GetIPFilterRule(ctx context.Context, resourceGrou {TargetValue: namespaceName, Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: IPFilterRuleName, - Constraints: []validation.Constraint{{Target: "IPFilterRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "GetIPFilterRule", err.Error()) + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "GetAuthorizationRule", err.Error()) } - req, err := client.GetIPFilterRulePreparer(ctx, resourceGroupName, namespaceName, IPFilterRuleName) + req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") return } - resp, err := client.GetIPFilterRuleSender(req) + resp, err := client.GetAuthorizationRuleSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") return } - result, err = client.GetIPFilterRuleResponder(resp) + result, err = client.GetAuthorizationRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + return } return } -// GetIPFilterRulePreparer prepares the GetIPFilterRule request. -func (client NamespacesClient) GetIPFilterRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (*http.Request, error) { +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "ipFilterRuleName": autorest.Encode("path", IPFilterRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2018-01-01-preview" @@ -812,20 +1087,20 @@ func (client NamespacesClient) GetIPFilterRulePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetIPFilterRuleSender sends the GetIPFilterRule request. The method will close the +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the // http.Response Body if it receives an error. -func (client NamespacesClient) GetIPFilterRuleSender(req *http.Request) (*http.Response, error) { +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetIPFilterRuleResponder handles the response to the GetIPFilterRule request. The method always +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always // closes the http.Response Body. -func (client NamespacesClient) GetIPFilterRuleResponder(resp *http.Response) (result IPFilterRule, err error) { +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -835,13 +1110,14 @@ func (client NamespacesClient) GetIPFilterRuleResponder(resp *http.Response) (re return } -// GetNetworkRuleSet gets NetworkRuleSet for a Namespace. +// GetIPFilterRule gets an IpFilterRule for a Namespace by rule name. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. // namespaceName - the namespace name -func (client NamespacesClient) GetNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSet, err error) { +// IPFilterRuleName - the IP Filter Rule name. +func (client NamespacesClient) GetIPFilterRule(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (result IPFilterRule, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetNetworkRuleSet") + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetIPFilterRule") defer func() { sc := -1 if result.Response.Response != nil { @@ -856,34 +1132,38 @@ func (client NamespacesClient) GetNetworkRuleSet(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: namespaceName, Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "GetNetworkRuleSet", err.Error()) + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: IPFilterRuleName, + Constraints: []validation.Constraint{{Target: "IPFilterRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "GetIPFilterRule", err.Error()) } - req, err := client.GetNetworkRuleSetPreparer(ctx, resourceGroupName, namespaceName) + req, err := client.GetIPFilterRulePreparer(ctx, resourceGroupName, namespaceName, IPFilterRuleName) if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", nil, "Failure preparing request") return } - resp, err := client.GetNetworkRuleSetSender(req) + resp, err := client.GetIPFilterRuleSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", resp, "Failure sending request") return } - result, err = client.GetNetworkRuleSetResponder(resp) + result, err = client.GetIPFilterRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetIPFilterRule", resp, "Failure responding to request") + return } return } -// GetNetworkRuleSetPreparer prepares the GetNetworkRuleSet request. -func (client NamespacesClient) GetNetworkRuleSetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { +// GetIPFilterRulePreparer prepares the GetIPFilterRule request. +func (client NamespacesClient) GetIPFilterRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ + "ipFilterRuleName": autorest.Encode("path", IPFilterRuleName), "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -897,7 +1177,93 @@ func (client NamespacesClient) GetNetworkRuleSetPreparer(ctx context.Context, re preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIPFilterRuleSender sends the GetIPFilterRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetIPFilterRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetIPFilterRuleResponder handles the response to the GetIPFilterRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetIPFilterRuleResponder(resp *http.Response) (result IPFilterRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkRuleSet gets NetworkRuleSet for a Namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client NamespacesClient) GetNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetNetworkRuleSet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "GetNetworkRuleSet", err.Error()) + } + + req, err := client.GetNetworkRuleSetPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkRuleSetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkRuleSetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkRuleSetPreparer prepares the GetNetworkRuleSet request. +func (client NamespacesClient) GetNetworkRuleSetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -964,6 +1330,7 @@ func (client NamespacesClient) GetVirtualNetworkRule(ctx context.Context, resour result, err = client.GetVirtualNetworkRuleResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetVirtualNetworkRule", resp, "Failure responding to request") + return } return @@ -1038,9 +1405,11 @@ func (client NamespacesClient) List(ctx context.Context) (result SBNamespaceList result.snlr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "List", resp, "Failure responding to request") + return } if result.snlr.hasNextLink() && result.snlr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -1120,6 +1489,134 @@ func (client NamespacesClient) ListComplete(ctx context.Context) (result SBNames return } +// ListAuthorizationRules gets the authorization rules for a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client NamespacesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string) (result SBAuthorizationRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.sarlr.Response.Response != nil { + sc = result.sarlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "ListAuthorizationRules", err.Error()) + } + + result.fn = client.listAuthorizationRulesNextResults + req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.sarlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result.sarlr, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + return + } + if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + 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 NamespacesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { + req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", 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, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result SBAuthorizationRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName) + return +} + // ListByResourceGroup gets the available namespaces within a resource group. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. @@ -1158,9 +1655,11 @@ func (client NamespacesClient) ListByResourceGroup(ctx context.Context, resource result.snlr, err = client.ListByResourceGroupResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + return } if result.snlr.hasNextLink() && result.snlr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -1283,9 +1782,11 @@ func (client NamespacesClient) ListIPFilterRules(ctx context.Context, resourceGr result.ifrlr, err = client.ListIPFilterRulesResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListIPFilterRules", resp, "Failure responding to request") + return } if result.ifrlr.hasNextLink() && result.ifrlr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -1367,6 +1868,225 @@ func (client NamespacesClient) ListIPFilterRulesComplete(ctx context.Context, re return } +// ListKeys gets the primary and secondary connection strings for the namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// authorizationRuleName - the authorization rule name. +func (client NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkRuleSets gets list of NetworkRuleSet for a Namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client NamespacesClient) ListNetworkRuleSets(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListNetworkRuleSets") + defer func() { + sc := -1 + if result.nrslr.Response.Response != nil { + sc = result.nrslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "ListNetworkRuleSets", err.Error()) + } + + result.fn = client.listNetworkRuleSetsNextResults + req, err := client.ListNetworkRuleSetsPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkRuleSetsSender(req) + if err != nil { + result.nrslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", resp, "Failure sending request") + return + } + + result.nrslr, err = client.ListNetworkRuleSetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", resp, "Failure responding to request") + return + } + if result.nrslr.hasNextLink() && result.nrslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListNetworkRuleSetsPreparer prepares the ListNetworkRuleSets request. +func (client NamespacesClient) ListNetworkRuleSetsPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/networkRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNetworkRuleSetsSender sends the ListNetworkRuleSets request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListNetworkRuleSetsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNetworkRuleSetsResponder handles the response to the ListNetworkRuleSets request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListNetworkRuleSetsResponder(resp *http.Response) (result NetworkRuleSetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNetworkRuleSetsNextResults retrieves the next set of results, if any. +func (client NamespacesClient) listNetworkRuleSetsNextResults(ctx context.Context, lastResults NetworkRuleSetListResult) (result NetworkRuleSetListResult, err error) { + req, err := lastResults.networkRuleSetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListNetworkRuleSetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListNetworkRuleSetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListNetworkRuleSetsComplete enumerates all values, automatically crossing page boundaries as required. +func (client NamespacesClient) ListNetworkRuleSetsComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListNetworkRuleSets") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListNetworkRuleSets(ctx, resourceGroupName, namespaceName) + return +} + // ListVirtualNetworkRules gets a list of VirtualNetwork rules for a Namespace. // Parameters: // resourceGroupName - name of the Resource group within the Azure subscription. @@ -1409,9 +2129,11 @@ func (client NamespacesClient) ListVirtualNetworkRules(ctx context.Context, reso result.vnrlr, err = client.ListVirtualNetworkRulesResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListVirtualNetworkRules", resp, "Failure responding to request") + return } if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -1493,6 +2215,188 @@ func (client NamespacesClient) ListVirtualNetworkRulesComplete(ctx context.Conte return } +// Migrate this operation Migrate the given namespace to provided name type +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// parameters - parameters supplied to migrate namespace type. +func (client NamespacesClient) Migrate(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespaceMigrate) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Migrate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "Migrate", err.Error()) + } + + req, err := client.MigratePreparer(ctx, resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Migrate", nil, "Failure preparing request") + return + } + + resp, err := client.MigrateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Migrate", resp, "Failure sending request") + return + } + + result, err = client.MigrateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Migrate", resp, "Failure responding to request") + return + } + + return +} + +// MigratePreparer prepares the Migrate request. +func (client NamespacesClient) MigratePreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespaceMigrate) (*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 = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MigrateSender sends the Migrate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) MigrateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// MigrateResponder handles the response to the Migrate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) MigrateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RegenerateKeys regenerates the primary or secondary connection strings for the namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// authorizationRuleName - the authorization rule name. +// parameters - parameters supplied to regenerate the authorization rule. +func (client NamespacesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.RegenerateKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.NamespacesClient", "RegenerateKeys", err.Error()) + } + + req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is // idempotent. // Parameters: @@ -1536,6 +2440,7 @@ func (client NamespacesClient) Update(ctx context.Context, resourceGroupName str result, err = client.UpdateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure responding to request") + return } return diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/operations.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/operations.go index 9d3f46f969f1..f14a7597f1f6 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/operations.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/operations.go @@ -25,8 +25,7 @@ import ( "net/http" ) -// OperationsClient is the azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and -// Zone Redundant +// OperationsClient is the client for the Operations methods of the Servicebus service. type OperationsClient struct { BaseClient } @@ -71,9 +70,11 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe result.olr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to request") + return } if result.olr.hasNextLink() && result.olr.IsEmpty() { err = result.NextWithContext(ctx) + return } return diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/premiummessagingregions.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/premiummessagingregions.go new file mode 100644 index 000000000000..0a1feff00a0e --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/premiummessagingregions.go @@ -0,0 +1,156 @@ +package servicebus + +// 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/tracing" + "net/http" +) + +// PremiumMessagingRegionsClient is the client for the PremiumMessagingRegions methods of the Servicebus service. +type PremiumMessagingRegionsClient struct { + BaseClient +} + +// NewPremiumMessagingRegionsClient creates an instance of the PremiumMessagingRegionsClient client. +func NewPremiumMessagingRegionsClient(subscriptionID string) PremiumMessagingRegionsClient { + return NewPremiumMessagingRegionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPremiumMessagingRegionsClientWithBaseURI creates an instance of the PremiumMessagingRegionsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewPremiumMessagingRegionsClientWithBaseURI(baseURI string, subscriptionID string) PremiumMessagingRegionsClient { + return PremiumMessagingRegionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the available premium messaging regions for servicebus +func (client PremiumMessagingRegionsClient) List(ctx context.Context) (result PremiumMessagingRegionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremiumMessagingRegionsClient.List") + defer func() { + sc := -1 + if result.pmrlr.Response.Response != nil { + sc = result.pmrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PremiumMessagingRegionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pmrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.PremiumMessagingRegionsClient", "List", resp, "Failure sending request") + return + } + + result.pmrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PremiumMessagingRegionsClient", "List", resp, "Failure responding to request") + return + } + if result.pmrlr.hasNextLink() && result.pmrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PremiumMessagingRegionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PremiumMessagingRegionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PremiumMessagingRegionsClient) ListResponder(resp *http.Response) (result PremiumMessagingRegionsListResult, err error) { + err = autorest.Respond( + resp, + 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 PremiumMessagingRegionsClient) listNextResults(ctx context.Context, lastResults PremiumMessagingRegionsListResult) (result PremiumMessagingRegionsListResult, err error) { + req, err := lastResults.premiumMessagingRegionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.PremiumMessagingRegionsClient", "listNextResults", 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, "servicebus.PremiumMessagingRegionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PremiumMessagingRegionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PremiumMessagingRegionsClient) ListComplete(ctx context.Context) (result PremiumMessagingRegionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremiumMessagingRegionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privateendpointconnections.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privateendpointconnections.go new file mode 100644 index 000000000000..6af808def0cc --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privateendpointconnections.go @@ -0,0 +1,437 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Servicebus service. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates PrivateEndpointConnections of service namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// privateEndpointConnectionName - the PrivateEndpointConnection name +// parameters - parameters supplied to update Status of PrivateEndPoint Connection to namespace resource. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Private Endpoint Connection. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// privateEndpointConnectionName - the PrivateEndpointConnection name +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a description for the specified Private Endpoint Connection. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// privateEndpointConnectionName - the PrivateEndpointConnection name +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the available PrivateEndpointConnections within a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", 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, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, namespaceName) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privatelinkresources.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privatelinkresources.go new file mode 100644 index 000000000000..1f3c527bf9a3 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/privatelinkresources.go @@ -0,0 +1,130 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Servicebus service. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets lists of resources that supports Privatelinks. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateLinkResourcesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.PrivateLinkResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/privateLinkResources", 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 PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/queues.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/queues.go new file mode 100644 index 000000000000..e13f5ef285a0 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/queues.go @@ -0,0 +1,1078 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QueuesClient is the client for the Queues methods of the Servicebus service. +type QueuesClient struct { + BaseClient +} + +// NewQueuesClient creates an instance of the QueuesClient client. +func NewQueuesClient(subscriptionID string) QueuesClient { + return NewQueuesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueuesClientWithBaseURI creates an instance of the QueuesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesClient { + return QueuesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Service Bus queue. This operation is idempotent. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// parameters - parameters supplied to create or update a queue resource. +func (client QueuesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (result SBQueue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, queueName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client QueuesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), + autorest.WithJSON(parameters), + 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 QueuesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result SBQueue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for a queue. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// authorizationRuleName - the authorization rule name. +// parameters - the shared access authorization rule. +func (client QueuesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdateAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", err.Error()) + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a queue from the specified namespace in a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +func (client QueuesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client QueuesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", 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 QueuesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a queue authorization rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// authorizationRuleName - the authorization rule name. +func (client QueuesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.DeleteAuthorizationRule") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "DeleteAuthorizationRule", err.Error()) + } + + req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client QueuesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a description for the specified queue. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +func (client QueuesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBQueue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client QueuesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", 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 QueuesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QueuesClient) GetResponder(resp *http.Response) (result SBQueue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a queue by rule name. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// authorizationRuleName - the authorization rule name. +func (client QueuesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.GetAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "GetAuthorizationRule", err.Error()) + } + + req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client QueuesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules gets all authorization rules for a queue. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +func (client QueuesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.sarlr.Response.Response != nil { + sc = result.sarlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "ListAuthorizationRules", err.Error()) + } + + result.fn = client.listAuthorizationRulesNextResults + req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.sarlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result.sarlr, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to request") + return + } + if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client QueuesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + 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 QueuesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { + req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", 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, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client QueuesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, queueName) + return +} + +// ListByNamespace gets the queues within a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client QueuesClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace") + defer func() { + sc := -1 + if result.sqlr.Response.Response != nil { + sc = result.sqlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "ListByNamespace", err.Error()) + } + + result.fn = client.listByNamespaceNextResults + req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.sqlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure sending request") + return + } + + result.sqlr, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure responding to request") + return + } + if result.sqlr.hasNextLink() && result.sqlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client QueuesClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*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 = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByNamespaceSender sends the ListByNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListByNamespaceResponder(resp *http.Response) (result SBQueueListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByNamespaceNextResults retrieves the next set of results, if any. +func (client QueuesClient) listByNamespaceNextResults(ctx context.Context, lastResults SBQueueListResult) (result SBQueueListResult, err error) { + req, err := lastResults.sBQueueListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client QueuesClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top) + return +} + +// ListKeys primary and secondary connection strings to the queue. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// authorizationRuleName - the authorization rule name. +func (client QueuesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client QueuesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the primary or secondary connection strings to the queue. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// queueName - the queue name. +// authorizationRuleName - the authorization rule name. +// parameters - parameters supplied to regenerate the authorization rule. +func (client QueuesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.RegenerateKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.QueuesClient", "RegenerateKeys", err.Error()) + } + + req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client QueuesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client QueuesClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/regions.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/regions.go new file mode 100644 index 000000000000..ca096475eba3 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/regions.go @@ -0,0 +1,166 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RegionsClient is the client for the Regions methods of the Servicebus service. +type RegionsClient struct { + BaseClient +} + +// NewRegionsClient creates an instance of the RegionsClient client. +func NewRegionsClient(subscriptionID string) RegionsClient { + return NewRegionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRegionsClientWithBaseURI creates an instance of the RegionsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRegionsClientWithBaseURI(baseURI string, subscriptionID string) RegionsClient { + return RegionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListBySku gets the available Regions for a given sku +// Parameters: +// sku - the sku type. +func (client RegionsClient) ListBySku(ctx context.Context, sku string) (result PremiumMessagingRegionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegionsClient.ListBySku") + defer func() { + sc := -1 + if result.pmrlr.Response.Response != nil { + sc = result.pmrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: sku, + Constraints: []validation.Constraint{{Target: "sku", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "sku", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.RegionsClient", "ListBySku", err.Error()) + } + + result.fn = client.listBySkuNextResults + req, err := client.ListBySkuPreparer(ctx, sku) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RegionsClient", "ListBySku", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySkuSender(req) + if err != nil { + result.pmrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.RegionsClient", "ListBySku", resp, "Failure sending request") + return + } + + result.pmrlr, err = client.ListBySkuResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RegionsClient", "ListBySku", resp, "Failure responding to request") + return + } + if result.pmrlr.hasNextLink() && result.pmrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySkuPreparer prepares the ListBySku request. +func (client RegionsClient) ListBySkuPreparer(ctx context.Context, sku string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sku": autorest.Encode("path", sku), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySkuSender sends the ListBySku request. The method will close the +// http.Response Body if it receives an error. +func (client RegionsClient) ListBySkuSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySkuResponder handles the response to the ListBySku request. The method always +// closes the http.Response Body. +func (client RegionsClient) ListBySkuResponder(resp *http.Response) (result PremiumMessagingRegionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySkuNextResults retrieves the next set of results, if any. +func (client RegionsClient) listBySkuNextResults(ctx context.Context, lastResults PremiumMessagingRegionsListResult) (result PremiumMessagingRegionsListResult, err error) { + req, err := lastResults.premiumMessagingRegionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.RegionsClient", "listBySkuNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySkuSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.RegionsClient", "listBySkuNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySkuResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RegionsClient", "listBySkuNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySkuComplete enumerates all values, automatically crossing page boundaries as required. +func (client RegionsClient) ListBySkuComplete(ctx context.Context, sku string) (result PremiumMessagingRegionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegionsClient.ListBySku") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySku(ctx, sku) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/rules.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/rules.go new file mode 100644 index 000000000000..63164d1d7216 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/rules.go @@ -0,0 +1,511 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RulesClient is the client for the Rules methods of the Servicebus service. +type RulesClient struct { + BaseClient +} + +// NewRulesClient creates an instance of the RulesClient client. +func NewRulesClient(subscriptionID string) RulesClient { + return NewRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRulesClientWithBaseURI creates an instance of the RulesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRulesClientWithBaseURI(baseURI string, subscriptionID string) RulesClient { + return RulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new rule and updates an existing rule +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +// ruleName - the rule name. +// parameters - parameters supplied to create a rule. +func (client RulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string, parameters Rule) (result Rule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: ruleName, + Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Ruleproperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Ruleproperties.SQLFilter", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Ruleproperties.SQLFilter.CompatibilityLevel", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Ruleproperties.SQLFilter.CompatibilityLevel", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "parameters.Ruleproperties.SQLFilter.CompatibilityLevel", Name: validation.InclusiveMinimum, Rule: int64(20), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.RulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string, parameters Rule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + 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 RulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RulesClient) CreateOrUpdateResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +// ruleName - the rule name. +func (client RulesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: ruleName, + Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.RulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", 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 RulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the description for the specified rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +// ruleName - the rule name. +func (client RulesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result Rule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: ruleName, + Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.RulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RulesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", 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 RulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RulesClient) GetResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptions list all the rules within given topic-subscription +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client RulesClient) ListBySubscriptions(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result RuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscriptions") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.RulesClient", "ListBySubscriptions", err.Error()) + } + + result.fn = client.listBySubscriptionsNextResults + req, err := client.ListBySubscriptionsPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionsSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListBySubscriptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionsPreparer prepares the ListBySubscriptions request. +func (client RulesClient) ListBySubscriptionsPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionsSender sends the ListBySubscriptions request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) ListBySubscriptionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionsResponder handles the response to the ListBySubscriptions request. The method always +// closes the http.Response Body. +func (client RulesClient) ListBySubscriptionsResponder(resp *http.Response) (result RuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionsNextResults retrieves the next set of results, if any. +func (client RulesClient) listBySubscriptionsNextResults(ctx context.Context, lastResults RuleListResult) (result RuleListResult, err error) { + req, err := lastResults.ruleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client RulesClient) ListBySubscriptionsComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result RuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscriptions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscriptions(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/servicebusapi/interfaces.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/servicebusapi/interfaces.go index 3bf7e9432adf..5c85744d8fc9 100644 --- a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/servicebusapi/interfaces.go +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/servicebusapi/interfaces.go @@ -23,36 +23,178 @@ import ( "github.com/Azure/go-autorest/autorest" ) -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result servicebus.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result servicebus.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*servicebus.OperationsClient)(nil) - // NamespacesClientAPI contains the set of methods on the NamespacesClient type. type NamespacesClientAPI interface { + CheckNameAvailabilityMethod(ctx context.Context, parameters servicebus.CheckNameAvailability) (result servicebus.CheckNameAvailabilityResult, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.SBNamespace) (result servicebus.NamespacesCreateOrUpdateFuture, err error) + CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters servicebus.SBAuthorizationRule) (result servicebus.SBAuthorizationRule, err error) CreateOrUpdateIPFilterRule(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string, parameters servicebus.IPFilterRule) (result servicebus.IPFilterRule, err error) CreateOrUpdateNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.NetworkRuleSet) (result servicebus.NetworkRuleSet, err error) CreateOrUpdateVirtualNetworkRule(ctx context.Context, resourceGroupName string, namespaceName string, virtualNetworkRuleName string, parameters servicebus.VirtualNetworkRule) (result servicebus.VirtualNetworkRule, err error) Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.NamespacesDeleteFuture, err error) + DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) DeleteIPFilterRule(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (result autorest.Response, err error) DeleteVirtualNetworkRule(ctx context.Context, resourceGroupName string, namespaceName string, virtualNetworkRuleName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.SBNamespace, err error) + GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result servicebus.SBAuthorizationRule, err error) GetIPFilterRule(ctx context.Context, resourceGroupName string, namespaceName string, IPFilterRuleName string) (result servicebus.IPFilterRule, err error) GetNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.NetworkRuleSet, err error) GetVirtualNetworkRule(ctx context.Context, resourceGroupName string, namespaceName string, virtualNetworkRuleName string) (result servicebus.VirtualNetworkRule, err error) List(ctx context.Context) (result servicebus.SBNamespaceListResultPage, err error) ListComplete(ctx context.Context) (result servicebus.SBNamespaceListResultIterator, err error) + ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.SBAuthorizationRuleListResultPage, err error) + ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.SBAuthorizationRuleListResultIterator, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result servicebus.SBNamespaceListResultPage, err error) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result servicebus.SBNamespaceListResultIterator, err error) ListIPFilterRules(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.IPFilterRuleListResultPage, err error) ListIPFilterRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.IPFilterRuleListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result servicebus.AccessKeys, err error) + ListNetworkRuleSets(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.NetworkRuleSetListResultPage, err error) + ListNetworkRuleSetsComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.NetworkRuleSetListResultIterator, err error) ListVirtualNetworkRules(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.VirtualNetworkRuleListResultPage, err error) ListVirtualNetworkRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.VirtualNetworkRuleListResultIterator, err error) + Migrate(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.SBNamespaceMigrate) (result autorest.Response, err error) + RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters servicebus.RegenerateAccessKeyParameters) (result servicebus.AccessKeys, err error) Update(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.SBNamespaceUpdateParameters) (result servicebus.SBNamespace, err error) } var _ NamespacesClientAPI = (*servicebus.NamespacesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, parameters servicebus.PrivateEndpointConnection) (result servicebus.PrivateEndpointConnection, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result servicebus.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result servicebus.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.PrivateEndpointConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.PrivateEndpointConnectionListResultIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*servicebus.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.PrivateLinkResourcesListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*servicebus.PrivateLinkResourcesClient)(nil) + +// DisasterRecoveryConfigsClientAPI contains the set of methods on the DisasterRecoveryConfigsClient type. +type DisasterRecoveryConfigsClientAPI interface { + BreakPairing(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) + CheckNameAvailabilityMethod(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.CheckNameAvailability) (result servicebus.CheckNameAvailabilityResult, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters servicebus.ArmDisasterRecovery) (result servicebus.ArmDisasterRecovery, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) + FailOver(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters *servicebus.FailoverProperties) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result servicebus.ArmDisasterRecovery, err error) + GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result servicebus.SBAuthorizationRule, err error) + List(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.ArmDisasterRecoveryListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.ArmDisasterRecoveryListResultIterator, err error) + ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result servicebus.SBAuthorizationRuleListResultPage, err error) + ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result servicebus.SBAuthorizationRuleListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result servicebus.AccessKeys, err error) +} + +var _ DisasterRecoveryConfigsClientAPI = (*servicebus.DisasterRecoveryConfigsClient)(nil) + +// QueuesClientAPI contains the set of methods on the QueuesClient type. +type QueuesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters servicebus.SBQueue) (result servicebus.SBQueue, err error) + CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters servicebus.SBAuthorizationRule) (result servicebus.SBAuthorizationRule, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) + DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result servicebus.SBQueue, err error) + GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result servicebus.SBAuthorizationRule, err error) + ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result servicebus.SBAuthorizationRuleListResultPage, err error) + ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result servicebus.SBAuthorizationRuleListResultIterator, err error) + ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result servicebus.SBQueueListResultPage, err error) + ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result servicebus.SBQueueListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result servicebus.AccessKeys, err error) + RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters servicebus.RegenerateAccessKeyParameters) (result servicebus.AccessKeys, err error) +} + +var _ QueuesClientAPI = (*servicebus.QueuesClient)(nil) + +// TopicsClientAPI contains the set of methods on the TopicsClient type. +type TopicsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, parameters servicebus.SBTopic) (result servicebus.SBTopic, err error) + CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters servicebus.SBAuthorizationRule) (result servicebus.SBAuthorizationRule, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) + DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result servicebus.SBTopic, err error) + GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result servicebus.SBAuthorizationRule, err error) + ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result servicebus.SBAuthorizationRuleListResultPage, err error) + ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result servicebus.SBAuthorizationRuleListResultIterator, err error) + ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result servicebus.SBTopicListResultPage, err error) + ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result servicebus.SBTopicListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result servicebus.AccessKeys, err error) + RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters servicebus.RegenerateAccessKeyParameters) (result servicebus.AccessKeys, err error) +} + +var _ TopicsClientAPI = (*servicebus.TopicsClient)(nil) + +// EventHubsClientAPI contains the set of methods on the EventHubsClient type. +type EventHubsClientAPI interface { + ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.EventHubListResultPage, err error) + ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.EventHubListResultIterator, err error) +} + +var _ EventHubsClientAPI = (*servicebus.EventHubsClient)(nil) + +// MigrationConfigsClientAPI contains the set of methods on the MigrationConfigsClient type. +type MigrationConfigsClientAPI interface { + CompleteMigration(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) + CreateAndStartMigration(ctx context.Context, resourceGroupName string, namespaceName string, parameters servicebus.MigrationConfigProperties) (result servicebus.MigrationConfigsCreateAndStartMigrationFuture, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.MigrationConfigProperties, err error) + List(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.MigrationConfigListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result servicebus.MigrationConfigListResultIterator, err error) + Revert(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) +} + +var _ MigrationConfigsClientAPI = (*servicebus.MigrationConfigsClient)(nil) + +// PremiumMessagingRegionsClientAPI contains the set of methods on the PremiumMessagingRegionsClient type. +type PremiumMessagingRegionsClientAPI interface { + List(ctx context.Context) (result servicebus.PremiumMessagingRegionsListResultPage, err error) + ListComplete(ctx context.Context) (result servicebus.PremiumMessagingRegionsListResultIterator, err error) +} + +var _ PremiumMessagingRegionsClientAPI = (*servicebus.PremiumMessagingRegionsClient)(nil) + +// RegionsClientAPI contains the set of methods on the RegionsClient type. +type RegionsClientAPI interface { + ListBySku(ctx context.Context, sku string) (result servicebus.PremiumMessagingRegionsListResultPage, err error) + ListBySkuComplete(ctx context.Context, sku string) (result servicebus.PremiumMessagingRegionsListResultIterator, err error) +} + +var _ RegionsClientAPI = (*servicebus.RegionsClient)(nil) + +// SubscriptionsClientAPI contains the set of methods on the SubscriptionsClient type. +type SubscriptionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters servicebus.SBSubscription) (result servicebus.SBSubscription, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result servicebus.SBSubscription, err error) + ListByTopic(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result servicebus.SBSubscriptionListResultPage, err error) + ListByTopicComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result servicebus.SBSubscriptionListResultIterator, err error) +} + +var _ SubscriptionsClientAPI = (*servicebus.SubscriptionsClient)(nil) + +// RulesClientAPI contains the set of methods on the RulesClient type. +type RulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string, parameters servicebus.Rule) (result servicebus.Rule, err error) + Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result servicebus.Rule, err error) + ListBySubscriptions(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result servicebus.RuleListResultPage, err error) + ListBySubscriptionsComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result servicebus.RuleListResultIterator, err error) +} + +var _ RulesClientAPI = (*servicebus.RulesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result servicebus.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result servicebus.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*servicebus.OperationsClient)(nil) diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/subscriptions.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/subscriptions.go new file mode 100644 index 000000000000..faed95dcc4b4 --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/subscriptions.go @@ -0,0 +1,482 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubscriptionsClient is the client for the Subscriptions methods of the Servicebus service. +type SubscriptionsClient struct { + BaseClient +} + +// NewSubscriptionsClient creates an instance of the SubscriptionsClient client. +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionsClientWithBaseURI creates an instance of the SubscriptionsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a topic subscription. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +// parameters - parameters supplied to create a subscription resource. +func (client SubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SBSubscription) (result SBSubscription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.SubscriptionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SBSubscription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), + autorest.WithJSON(parameters), + 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 SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result SBSubscription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a subscription from the specified topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +func (client SubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.SubscriptionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", 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 SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a subscription description for the specified topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// subscriptionName - the subscription name. +func (client SubscriptionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result SBSubscription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.SubscriptionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", 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 SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SBSubscription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByTopic list all the subscriptions under a specified topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client SubscriptionsClient) ListByTopic(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result SBSubscriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByTopic") + defer func() { + sc := -1 + if result.sslr.Response.Response != nil { + sc = result.sslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.SubscriptionsClient", "ListByTopic", err.Error()) + } + + result.fn = client.listByTopicNextResults + req, err := client.ListByTopicPreparer(ctx, resourceGroupName, namespaceName, topicName, skip, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTopicSender(req) + if err != nil { + result.sslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", resp, "Failure sending request") + return + } + + result.sslr, err = client.ListByTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", resp, "Failure responding to request") + return + } + if result.sslr.hasNextLink() && result.sslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByTopicPreparer prepares the ListByTopic request. +func (client SubscriptionsClient) ListByTopicPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByTopicSender sends the ListByTopic request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListByTopicSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByTopicResponder handles the response to the ListByTopic request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListByTopicResponder(resp *http.Response) (result SBSubscriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByTopicNextResults retrieves the next set of results, if any. +func (client SubscriptionsClient) listByTopicNextResults(ctx context.Context, lastResults SBSubscriptionListResult) (result SBSubscriptionListResult, err error) { + req, err := lastResults.sBSubscriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByTopicSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByTopicComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubscriptionsClient) ListByTopicComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result SBSubscriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByTopic") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByTopic(ctx, resourceGroupName, namespaceName, topicName, skip, top) + return +} diff --git a/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/topics.go b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/topics.go new file mode 100644 index 000000000000..1666ee90546b --- /dev/null +++ b/services/preview/servicebus/mgmt/2018-01-01-preview/servicebus/topics.go @@ -0,0 +1,1078 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TopicsClient is the client for the Topics methods of the Servicebus service. +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 using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { + return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a topic in the specified namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// parameters - parameters supplied to create a topic resource. +func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, parameters SBTopic) (result SBTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, parameters SBTopic) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), + autorest.WithJSON(parameters), + 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) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result SBTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for the specified topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// authorizationRuleName - the authorization rule name. +// parameters - the shared access authorization rule. +func (client TopicsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdateAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", err.Error()) + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client TopicsClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a topic from the specified namespace and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/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) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a topic authorization rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// authorizationRuleName - the authorization rule name. +func (client TopicsClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.DeleteAuthorizationRule") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "DeleteAuthorizationRule", err.Error()) + } + + req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client TopicsClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a description for the specified topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.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, "servicebus.TopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/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 client.Send(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 SBTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule returns the specified authorization rule. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// authorizationRuleName - the authorization rule name. +func (client TopicsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.GetAuthorizationRule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "GetAuthorizationRule", err.Error()) + } + + req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client TopicsClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules gets authorization rules for a topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +func (client TopicsClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBAuthorizationRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.sarlr.Response.Response != nil { + sc = result.sarlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "ListAuthorizationRules", err.Error()) + } + + result.fn = client.listAuthorizationRulesNextResults + req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.sarlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result.sarlr, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to request") + return + } + if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client TopicsClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + 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 TopicsClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { + req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", 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, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopicsClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBAuthorizationRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListAuthorizationRules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, topicName) + return +} + +// ListByNamespace gets all the topics in a namespace. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client TopicsClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBTopicListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByNamespace") + defer func() { + sc := -1 + if result.stlr.Response.Response != nil { + sc = result.stlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "ListByNamespace", err.Error()) + } + + result.fn = client.listByNamespaceNextResults + req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.stlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", resp, "Failure sending request") + return + } + + result.stlr, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", resp, "Failure responding to request") + return + } + if result.stlr.hasNextLink() && result.stlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client TopicsClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*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 = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByNamespaceSender sends the ListByNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListByNamespaceResponder(resp *http.Response) (result SBTopicListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByNamespaceNextResults retrieves the next set of results, if any. +func (client TopicsClient) listByNamespaceNextResults(ctx context.Context, lastResults SBTopicListResult) (result SBTopicListResult, err error) { + req, err := lastResults.sBTopicListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopicsClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBTopicListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByNamespace") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top) + return +} + +// ListKeys gets the primary and secondary connection strings for the topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// authorizationRuleName - the authorization rule name. +func (client TopicsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client TopicsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates primary or secondary connection strings for the topic. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// namespaceName - the namespace name +// topicName - the topic name. +// authorizationRuleName - the authorization rule name. +// parameters - parameters supplied to regenerate the authorization rule. +func (client TopicsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.RegenerateKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("servicebus.TopicsClient", "RegenerateKeys", err.Error()) + } + + req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client TopicsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client TopicsClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}