diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus.rb index 00ffb16040..3091ee527f 100644 --- a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus.rb +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus.rb @@ -22,6 +22,7 @@ module Azure::ARM::ServiceBus autoload :Operations, 'generated/azure_mgmt_service_bus/operations.rb' autoload :Namespaces, 'generated/azure_mgmt_service_bus/namespaces.rb' + autoload :DisasterRecoveryConfigs, 'generated/azure_mgmt_service_bus/disaster_recovery_configs.rb' autoload :Queues, 'generated/azure_mgmt_service_bus/queues.rb' autoload :Topics, 'generated/azure_mgmt_service_bus/topics.rb' autoload :Subscriptions, 'generated/azure_mgmt_service_bus/subscriptions.rb' @@ -32,31 +33,32 @@ module Azure::ARM::ServiceBus autoload :ServiceBusManagementClient, 'generated/azure_mgmt_service_bus/service_bus_management_client.rb' module Models - autoload :CheckNameAvailability, 'generated/azure_mgmt_service_bus/models/check_name_availability.rb' - autoload :PremiumMessagingRegionsListResult, 'generated/azure_mgmt_service_bus/models/premium_messaging_regions_list_result.rb' + autoload :CheckNameAvailabilityResult, 'generated/azure_mgmt_service_bus/models/check_name_availability_result.rb' autoload :SBQueueListResult, 'generated/azure_mgmt_service_bus/models/sbqueue_list_result.rb' - autoload :PremiumMessagingRegionsProperties, 'generated/azure_mgmt_service_bus/models/premium_messaging_regions_properties.rb' - autoload :EventHubListResult, 'generated/azure_mgmt_service_bus/models/event_hub_list_result.rb' + autoload :PremiumMessagingRegionsListResult, 'generated/azure_mgmt_service_bus/models/premium_messaging_regions_list_result.rb' + autoload :SBSku, 'generated/azure_mgmt_service_bus/models/sbsku.rb' autoload :SBTopicListResult, 'generated/azure_mgmt_service_bus/models/sbtopic_list_result.rb' + autoload :SBNamespaceListResult, 'generated/azure_mgmt_service_bus/models/sbnamespace_list_result.rb' + autoload :PremiumMessagingRegionsProperties, 'generated/azure_mgmt_service_bus/models/premium_messaging_regions_properties.rb' autoload :CaptureDescription, 'generated/azure_mgmt_service_bus/models/capture_description.rb' - autoload :RuleListResult, 'generated/azure_mgmt_service_bus/models/rule_list_result.rb' - autoload :SBAuthorizationRuleListResult, 'generated/azure_mgmt_service_bus/models/sbauthorization_rule_list_result.rb' autoload :SBSubscriptionListResult, 'generated/azure_mgmt_service_bus/models/sbsubscription_list_result.rb' - autoload :AccessKeys, 'generated/azure_mgmt_service_bus/models/access_keys.rb' - autoload :CorrelationFilter, 'generated/azure_mgmt_service_bus/models/correlation_filter.rb' - autoload :MessageCountDetails, 'generated/azure_mgmt_service_bus/models/message_count_details.rb' - autoload :CheckNameAvailabilityResult, 'generated/azure_mgmt_service_bus/models/check_name_availability_result.rb' - autoload :SBSku, 'generated/azure_mgmt_service_bus/models/sbsku.rb' - autoload :OperationDisplay, 'generated/azure_mgmt_service_bus/models/operation_display.rb' + autoload :AuthorizationRuleProperties, 'generated/azure_mgmt_service_bus/models/authorization_rule_properties.rb' + autoload :CheckNameAvailability, 'generated/azure_mgmt_service_bus/models/check_name_availability.rb' + autoload :RegenerateAccessKeyParameters, 'generated/azure_mgmt_service_bus/models/regenerate_access_key_parameters.rb' + autoload :RuleListResult, 'generated/azure_mgmt_service_bus/models/rule_list_result.rb' autoload :Destination, 'generated/azure_mgmt_service_bus/models/destination.rb' + autoload :OperationDisplay, 'generated/azure_mgmt_service_bus/models/operation_display.rb' + autoload :ArmDisasterRecoveryListResult, 'generated/azure_mgmt_service_bus/models/arm_disaster_recovery_list_result.rb' autoload :Operation, 'generated/azure_mgmt_service_bus/models/operation.rb' - autoload :RegenerateAccessKeyParameters, 'generated/azure_mgmt_service_bus/models/regenerate_access_key_parameters.rb' + autoload :SBAuthorizationRuleListResult, 'generated/azure_mgmt_service_bus/models/sbauthorization_rule_list_result.rb' autoload :OperationListResult, 'generated/azure_mgmt_service_bus/models/operation_list_result.rb' - autoload :SBNamespaceListResult, 'generated/azure_mgmt_service_bus/models/sbnamespace_list_result.rb' + autoload :MessageCountDetails, 'generated/azure_mgmt_service_bus/models/message_count_details.rb' autoload :ErrorResponse, 'generated/azure_mgmt_service_bus/models/error_response.rb' + autoload :EventHubListResult, 'generated/azure_mgmt_service_bus/models/event_hub_list_result.rb' autoload :Action, 'generated/azure_mgmt_service_bus/models/action.rb' - autoload :AuthorizationRuleProperties, 'generated/azure_mgmt_service_bus/models/authorization_rule_properties.rb' autoload :SqlFilter, 'generated/azure_mgmt_service_bus/models/sql_filter.rb' + autoload :AccessKeys, 'generated/azure_mgmt_service_bus/models/access_keys.rb' + autoload :CorrelationFilter, 'generated/azure_mgmt_service_bus/models/correlation_filter.rb' autoload :TrackedResource, 'generated/azure_mgmt_service_bus/models/tracked_resource.rb' autoload :ResourceNamespacePatch, 'generated/azure_mgmt_service_bus/models/resource_namespace_patch.rb' autoload :SBNamespace, 'generated/azure_mgmt_service_bus/models/sbnamespace.rb' @@ -69,6 +71,7 @@ module Models autoload :SqlRuleAction, 'generated/azure_mgmt_service_bus/models/sql_rule_action.rb' autoload :PremiumMessagingRegions, 'generated/azure_mgmt_service_bus/models/premium_messaging_regions.rb' autoload :Eventhub, 'generated/azure_mgmt_service_bus/models/eventhub.rb' + autoload :ArmDisasterRecovery, 'generated/azure_mgmt_service_bus/models/arm_disaster_recovery.rb' autoload :SkuName, 'generated/azure_mgmt_service_bus/models/sku_name.rb' autoload :SkuTier, 'generated/azure_mgmt_service_bus/models/sku_tier.rb' autoload :AccessRights, 'generated/azure_mgmt_service_bus/models/access_rights.rb' @@ -77,5 +80,7 @@ module Models autoload :UnavailableReason, 'generated/azure_mgmt_service_bus/models/unavailable_reason.rb' autoload :FilterType, 'generated/azure_mgmt_service_bus/models/filter_type.rb' autoload :EncodingCaptureDescription, 'generated/azure_mgmt_service_bus/models/encoding_capture_description.rb' + autoload :ProvisioningStateDR, 'generated/azure_mgmt_service_bus/models/provisioning_state_dr.rb' + autoload :RoleDisasterRecovery, 'generated/azure_mgmt_service_bus/models/role_disaster_recovery.rb' end end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb new file mode 100644 index 0000000000..517e837a38 --- /dev/null +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb @@ -0,0 +1,711 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::ServiceBus + # + # Azure Service Bus client + # + class DisasterRecoveryConfigs + include MsRestAzure + + # + # Creates and initializes a new instance of the DisasterRecoveryConfigs class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [ServiceBusManagementClient] reference to the ServiceBusManagementClient + attr_reader :client + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list(resource_group_name, namespace_name, custom_headers = nil) + first_page = list_as_lazy(resource_group_name, namespace_name, custom_headers) + first_page.get_all_items + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_with_http_info(resource_group_name, namespace_name, custom_headers = nil) + list_async(resource_group_name, namespace_name, custom_headers).value! + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_async(resource_group_name, namespace_name, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::ARM::ServiceBus::Models::ArmDisasterRecoveryListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Creates or updates a new Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param parameters [ArmDisasterRecovery] Parameters required to create an + # Alias(Disaster Recovery configuration) + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ArmDisasterRecovery] operation results. + # + def create_or_update(resource_group_name, namespace_name, alias_parameter, parameters, custom_headers = nil) + response = create_or_update_async(resource_group_name, namespace_name, alias_parameter, parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # Creates or updates a new Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param parameters [ArmDisasterRecovery] Parameters required to create an + # Alias(Disaster Recovery configuration) + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def create_or_update_with_http_info(resource_group_name, namespace_name, alias_parameter, parameters, custom_headers = nil) + create_or_update_async(resource_group_name, namespace_name, alias_parameter, parameters, custom_headers).value! + end + + # + # Creates or updates a new Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param parameters [ArmDisasterRecovery] Parameters required to create an + # Alias(Disaster Recovery configuration) + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def create_or_update_async(resource_group_name, namespace_name, alias_parameter, parameters, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, 'alias_parameter is nil' if alias_parameter.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::ARM::ServiceBus::Models::ArmDisasterRecovery.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'alias' => alias_parameter,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:put, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 201 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::ARM::ServiceBus::Models::ArmDisasterRecovery.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Deletes an Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def delete(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + response = delete_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + nil + end + + # + # Deletes an Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def delete_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + delete_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + end + + # + # Deletes an Alias(Disaster Recovery configuration) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def delete_async(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, 'alias_parameter is nil' if alias_parameter.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'alias' => alias_parameter,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # Retrieves Alias(Disaster Recovery configuration) for primary or secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ArmDisasterRecovery] operation results. + # + def get(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + response = get_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + response.body unless response.nil? + end + + # + # Retrieves Alias(Disaster Recovery configuration) for primary or secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def get_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + get_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + end + + # + # Retrieves Alias(Disaster Recovery configuration) for primary or secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def get_async(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, 'alias_parameter is nil' if alias_parameter.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'alias' => alias_parameter,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::ARM::ServiceBus::Models::ArmDisasterRecovery.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # This operation disables the Disaster Recovery and stops replicating changes + # from primary to secondary namespaces + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def break_pairing(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + response = break_pairing_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + nil + end + + # + # This operation disables the Disaster Recovery and stops replicating changes + # from primary to secondary namespaces + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def break_pairing_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + break_pairing_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + end + + # + # This operation disables the Disaster Recovery and stops replicating changes + # from primary to secondary namespaces + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def break_pairing_async(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, 'alias_parameter is nil' if alias_parameter.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'alias' => alias_parameter,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:post, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # envokes GEO DR failover and reconfigure the alias to point to the secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def fail_over(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + response = fail_over_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + nil + end + + # + # envokes GEO DR failover and reconfigure the alias to point to the secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def fail_over_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + fail_over_async(resource_group_name, namespace_name, alias_parameter, custom_headers).value! + end + + # + # envokes GEO DR failover and reconfigure the alias to point to the secondary + # namespace + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param alias_parameter [String] The Disaster Recovery configuration name + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def fail_over_async(resource_group_name, namespace_name, alias_parameter, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'namespace_name is nil' if namespace_name.nil? + fail ArgumentError, 'alias_parameter is nil' if alias_parameter.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'alias' => alias_parameter,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:post, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ArmDisasterRecoveryListResult] operation results. + # + def list_next(next_page_link, custom_headers = nil) + response = list_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_next_with_http_info(next_page_link, custom_headers = nil) + list_next_async(next_page_link, custom_headers).value! + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::ARM::ServiceBus::Models::ArmDisasterRecoveryListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Gets all Alias(Disaster Recovery configurations) + # + # @param resource_group_name [String] Name of the Resource group within the + # Azure subscription. + # @param namespace_name [String] The namespace name + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ArmDisasterRecoveryListResult] which provide lazy access to pages of + # the response. + # + def list_as_lazy(resource_group_name, namespace_name, custom_headers = nil) + response = list_async(resource_group_name, namespace_name, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_next_async(next_page_link, custom_headers) + end + page + end + end + + end +end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/access_keys.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/access_keys.rb index b5b725dc13..7a6e8f3606 100644 --- a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/access_keys.rb +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/access_keys.rb @@ -21,6 +21,14 @@ class AccessKeys # authorization rule. attr_accessor :secondary_connection_string + # @return [String] Primary connection string of the alias if GEO DR is + # enabled + attr_accessor :alias_primary_connection_string + + # @return [String] Secondary connection string of the alias if GEO DR is + # enabled + attr_accessor :alias_secondary_connection_string + # @return [String] A base64-encoded 256-bit primary key for signing and # validating the SAS token. attr_accessor :primary_key @@ -61,6 +69,22 @@ def self.mapper() name: 'String' } }, + alias_primary_connection_string: { + required: false, + read_only: true, + serialized_name: 'aliasPrimaryConnectionString', + type: { + name: 'String' + } + }, + alias_secondary_connection_string: { + required: false, + read_only: true, + serialized_name: 'aliasSecondaryConnectionString', + type: { + name: 'String' + } + }, primary_key: { required: false, read_only: true, diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery.rb new file mode 100644 index 0000000000..1d0f3e0a8b --- /dev/null +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery.rb @@ -0,0 +1,99 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::ServiceBus + module Models + # + # Single item in List or Get Alias(Disaster Recovery configuration) + # operation + # + class ArmDisasterRecovery < MsRestAzure::Resource + + include MsRestAzure + + include MsRest::JSONable + # @return [ProvisioningStateDR] Provisioning state of the Alias(Disaster + # Recovery configuration) - possible values 'Accepted' or 'Succeeded' or + # 'Failed'. Possible values include: 'Accepted', 'Succeeded', 'Failed' + attr_accessor :provisioning_state + + # @return [String] Primary/Secondary eventhub namespace name, which is + # part of GEO DR pairning + attr_accessor :partner_namespace + + # @return [RoleDisasterRecovery] role of namespace in GEO DR - possible + # values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible + # values include: 'Primary', 'PrimaryNotReplicating', 'Secondary' + attr_accessor :role + + + # + # Mapper for ArmDisasterRecovery class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ArmDisasterRecovery', + type: { + name: 'Composite', + class_name: 'ArmDisasterRecovery', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + provisioning_state: { + required: false, + read_only: true, + serialized_name: 'properties.provisioningState', + type: { + name: 'Enum', + module: 'ProvisioningStateDR' + } + }, + partner_namespace: { + required: false, + serialized_name: 'properties.partnerNamespace', + type: { + name: 'String' + } + }, + role: { + required: false, + read_only: true, + serialized_name: 'properties.role', + type: { + name: 'Enum', + module: 'RoleDisasterRecovery' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery_list_result.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery_list_result.rb new file mode 100644 index 0000000000..e6bae93b57 --- /dev/null +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/arm_disaster_recovery_list_result.rb @@ -0,0 +1,97 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::ServiceBus + module Models + # + # The result of the List Alias(Disaster Recovery configuration) operation. + # + class ArmDisasterRecoveryListResult + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] List of Alias(Disaster Recovery + # configurations) + attr_accessor :value + + # @return [String] Link to the next set of results. Not empty if Value + # contains incomplete list of Alias(Disaster Recovery configuration) + attr_accessor :next_link + + # return [Proc] with next page method call. + attr_accessor :next_method + + # + # Gets the rest of the items for the request, enabling auto-pagination. + # + # @return [Array] operation results. + # + def get_all_items + items = @value + page = self + while page.next_link != nil do + page = page.get_next_page + items.concat(page.value) + end + items + end + + # + # Gets the next page of results. + # + # @return [ArmDisasterRecoveryListResult] with next page content. + # + def get_next_page + response = @next_method.call(@next_link).value! unless @next_method.nil? + unless response.nil? + @next_link = response.body.next_link + @value = response.body.value + self + end + end + + # + # Mapper for ArmDisasterRecoveryListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ArmDisasterRecoveryListResult', + type: { + name: 'Composite', + class_name: 'ArmDisasterRecoveryListResult', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ArmDisasterRecoveryElementType', + type: { + name: 'Composite', + class_name: 'ArmDisasterRecovery' + } + } + } + }, + next_link: { + required: false, + read_only: true, + serialized_name: 'nextLink', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/provisioning_state_dr.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/provisioning_state_dr.rb new file mode 100644 index 0000000000..a4711253df --- /dev/null +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/provisioning_state_dr.rb @@ -0,0 +1,17 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::ServiceBus + module Models + # + # Defines values for ProvisioningStateDR + # + module ProvisioningStateDR + Accepted = "Accepted" + Succeeded = "Succeeded" + Failed = "Failed" + end + end +end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/role_disaster_recovery.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/role_disaster_recovery.rb new file mode 100644 index 0000000000..6a813c9ce9 --- /dev/null +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/models/role_disaster_recovery.rb @@ -0,0 +1,17 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::ServiceBus + module Models + # + # Defines values for RoleDisasterRecovery + # + module RoleDisasterRecovery + Primary = "Primary" + PrimaryNotReplicating = "PrimaryNotReplicating" + Secondary = "Secondary" + end + end +end diff --git a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb index 3742ac9c05..cef88533fb 100644 --- a/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb +++ b/management/azure_mgmt_service_bus/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb @@ -42,6 +42,9 @@ class ServiceBusManagementClient < MsRestAzure::AzureServiceClient # @return [Namespaces] namespaces attr_reader :namespaces + # @return [DisasterRecoveryConfigs] disaster_recovery_configs + attr_reader :disaster_recovery_configs + # @return [Queues] queues attr_reader :queues @@ -79,6 +82,7 @@ def initialize(credentials = nil, base_url = nil, options = nil) @operations = Operations.new(self) @namespaces = Namespaces.new(self) + @disaster_recovery_configs = DisasterRecoveryConfigs.new(self) @queues = Queues.new(self) @topics = Topics.new(self) @subscriptions = Subscriptions.new(self)