# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10 # # ReplicationProtectedItems # class ReplicationProtectedItems include MsRestAzure # # Creates and initializes a new instance of the ReplicationProtectedItems class. # @param client service class for accessing basic functionality. # def initialize(client) @client = client end # @return [SiteRecoveryManagementClient] reference to the SiteRecoveryManagementClient attr_reader :client # # Gets the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container 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_by_replication_protection_containers(fabric_name, protection_container_name, custom_headers:nil) first_page = list_by_replication_protection_containers_as_lazy(fabric_name, protection_container_name, custom_headers:custom_headers) first_page.get_all_items end # # Gets the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container 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_by_replication_protection_containers_with_http_info(fabric_name, protection_container_name, custom_headers:nil) list_by_replication_protection_containers_async(fabric_name, protection_container_name, custom_headers:custom_headers).value! end # # Gets the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container 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_by_replication_protection_containers_async(fabric_name, protection_container_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name}, 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 MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItemCollection.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 the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @param skip_token [String] The pagination token. Possible values: "FabricId" # or "FabricId_CloudId" or null # @param filter [String] OData filter options. # @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(skip_token:nil, filter:nil, custom_headers:nil) first_page = list_as_lazy(skip_token:skip_token, filter:filter, custom_headers:custom_headers) first_page.get_all_items end # # Gets the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @param skip_token [String] The pagination token. Possible values: "FabricId" # or "FabricId_CloudId" or null # @param filter [String] OData filter options. # @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(skip_token:nil, filter:nil, custom_headers:nil) list_async(skip_token:skip_token, filter:filter, custom_headers:custom_headers).value! end # # Gets the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @param skip_token [String] The pagination token. Possible values: "FabricId" # or "FabricId_CloudId" or null # @param filter [String] OData filter options. # @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(skip_token:nil, filter:nil, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationProtectedItems' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version,'skipToken' => skip_token,'$filter' => filter}, 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 MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItemCollection.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 # # Change or apply recovery point. # # The operation to change the recovery point of a failed over replication # protected item. # # @param fabric_name [String] The ARM fabric name. # @param protection_container_name [String] The protection container name. # @param replicated_protected_item_name [String] The replicated protected # item's name. # @param apply_recovery_point_input [ApplyRecoveryPointInput] The # ApplyRecoveryPointInput. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def apply_recovery_point(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:nil) response = apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] The ARM fabric name. # @param protection_container_name [String] The protection container name. # @param replicated_protected_item_name [String] The replicated protected # item's name. # @param apply_recovery_point_input [ApplyRecoveryPointInput] The # ApplyRecoveryPointInput. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:nil) # Send request promise = begin_apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Resynchronize or repair replication. # # The operation to start resynchronize/repair replication for a replication # protected item requiring resynchronization. # # @param fabric_name [String] The name of the fabric. # @param protection_container_name [String] The name of the container. # @param replicated_protected_item_name [String] The name of the replication # protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def repair_replication(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] The name of the fabric. # @param protection_container_name [String] The name of the container. # @param replicated_protected_item_name [String] The name of the replication # protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) # Send request promise = begin_repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Update the mobility service on a protected item. # # The operation to update(push update) the installed mobility service software # on a replication protected item to the latest available version. # # @param fabric_name [String] The name of the fabric containing the protected # item. # @param protection_container_name [String] The name of the container # containing the protected item. # @param replication_protected_item_name [String] The name of the protected # item on which the agent is to be updated. # @param update_mobility_service_request [UpdateMobilityServiceRequest] Request # to update the mobility service on the protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def update_mobility_service(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:nil) response = update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] The name of the fabric containing the protected # item. # @param protection_container_name [String] The name of the container # containing the protected item. # @param replication_protected_item_name [String] The name of the protected # item on which the agent is to be updated. # @param update_mobility_service_request [UpdateMobilityServiceRequest] Request # to update the mobility service on the protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:nil) # Send request promise = begin_update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute Reverse Replication\Reprotect # # Operation to reprotect or reverse replicate a failed over replication # protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param rr_input [ReverseReplicationInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def reprotect(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:nil) response = reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param rr_input [ReverseReplicationInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:nil) # Send request promise = begin_reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute commit failover # # Operation to commit the failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def failover_commit(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) # Send request promise = begin_failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute test failover cleanup. # # Operation to clean up the test failover of a replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param cleanup_input [TestFailoverCleanupInput] Test failover cleanup input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def test_failover_cleanup(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:nil) response = test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param cleanup_input [TestFailoverCleanupInput] Test failover cleanup input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:nil) # Send request promise = begin_test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute test failover # # Operation to perform a test failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [TestFailoverInput] Test failover input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def test_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [TestFailoverInput] Test failover input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) # Send request promise = begin_test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute unplanned failover # # Operation to initiate a failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [UnplannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def unplanned_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [UnplannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) # Send request promise = begin_unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Execute planned failover # # Operation to initiate a planned failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [PlannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def planned_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [PlannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) # Send request promise = begin_planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Disables protection. # # The operation to disable replication on a replication protected item. This # will also remove the item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param disable_protection_input [DisableProtectionInput] Disable protection # input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def delete(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:nil) response = delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:custom_headers).value! nil end # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param disable_protection_input [DisableProtectionInput] Disable protection # input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:nil) # Send request promise = begin_delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Gets the details of a Replication protected item. # # Gets the details of an ASR replication protected item. # # @param fabric_name [String] Fabric unique name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def get(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = get_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! response.body unless response.nil? end # # Gets the details of a Replication protected item. # # Gets the details of an ASR replication protected item. # # @param fabric_name [String] Fabric unique name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) get_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! end # # Gets the details of a Replication protected item. # # Gets the details of an ASR replication protected item. # # @param fabric_name [String] Fabric unique name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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 MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Enables protection. # # The operation to create an ASR replication protected item (Enable # replication). # # @param fabric_name [String] Name of the fabric. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] A name for the replication # protected item. # @param input [EnableProtectionInput] Enable Protection Input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def create(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:nil) response = create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Name of the fabric. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] A name for the replication # protected item. # @param input [EnableProtectionInput] Enable Protection Input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:nil) # Send request promise = begin_create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Purges protection. # # The operation to delete or purge a replication protected item. This operation # will force delete the replication protected item. Use the remove operation on # replication protected item to perform a clean disable replication for the # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def purge(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! nil end # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) # Send request promise = begin_purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Updates protection. # # The operation to update the recovery settings of an ASR replication protected # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param update_protection_input [UpdateReplicationProtectedItemInput] Update # protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def update(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:nil) response = update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param update_protection_input [UpdateReplicationProtectedItemInput] Update # protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:nil) # Send request promise = begin_update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Change or apply recovery point. # # The operation to change the recovery point of a failed over replication # protected item. # # @param fabric_name [String] The ARM fabric name. # @param protection_container_name [String] The protection container name. # @param replicated_protected_item_name [String] The replicated protected # item's name. # @param apply_recovery_point_input [ApplyRecoveryPointInput] The # ApplyRecoveryPointInput. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_apply_recovery_point(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:nil) response = begin_apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Change or apply recovery point. # # The operation to change the recovery point of a failed over replication # protected item. # # @param fabric_name [String] The ARM fabric name. # @param protection_container_name [String] The protection container name. # @param replicated_protected_item_name [String] The replicated protected # item's name. # @param apply_recovery_point_input [ApplyRecoveryPointInput] The # ApplyRecoveryPointInput. # @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 begin_apply_recovery_point_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:nil) begin_apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:custom_headers).value! end # # Change or apply recovery point. # # The operation to change the recovery point of a failed over replication # protected item. # # @param fabric_name [String] The ARM fabric name. # @param protection_container_name [String] The protection container name. # @param replicated_protected_item_name [String] The replicated protected # item's name. # @param apply_recovery_point_input [ApplyRecoveryPointInput] The # ApplyRecoveryPointInput. # @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 begin_apply_recovery_point_async(fabric_name, protection_container_name, replicated_protected_item_name, apply_recovery_point_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'apply_recovery_point_input is nil' if apply_recovery_point_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ApplyRecoveryPointInput.mapper() request_content = @client.serialize(request_mapper, apply_recovery_point_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Resynchronize or repair replication. # # The operation to start resynchronize/repair replication for a replication # protected item requiring resynchronization. # # @param fabric_name [String] The name of the fabric. # @param protection_container_name [String] The name of the container. # @param replicated_protected_item_name [String] The name of the replication # protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_repair_replication(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = begin_repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! response.body unless response.nil? end # # Resynchronize or repair replication. # # The operation to start resynchronize/repair replication for a replication # protected item requiring resynchronization. # # @param fabric_name [String] The name of the fabric. # @param protection_container_name [String] The name of the container. # @param replicated_protected_item_name [String] The name of the replication # protected item. # @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 begin_repair_replication_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) begin_repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! end # # Resynchronize or repair replication. # # The operation to start resynchronize/repair replication for a replication # protected item requiring resynchronization. # # @param fabric_name [String] The name of the fabric. # @param protection_container_name [String] The name of the container. # @param replicated_protected_item_name [String] The name of the replication # protected item. # @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 begin_repair_replication_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Update the mobility service on a protected item. # # The operation to update(push update) the installed mobility service software # on a replication protected item to the latest available version. # # @param fabric_name [String] The name of the fabric containing the protected # item. # @param protection_container_name [String] The name of the container # containing the protected item. # @param replication_protected_item_name [String] The name of the protected # item on which the agent is to be updated. # @param update_mobility_service_request [UpdateMobilityServiceRequest] Request # to update the mobility service on the protected item. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_update_mobility_service(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:nil) response = begin_update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:custom_headers).value! response.body unless response.nil? end # # Update the mobility service on a protected item. # # The operation to update(push update) the installed mobility service software # on a replication protected item to the latest available version. # # @param fabric_name [String] The name of the fabric containing the protected # item. # @param protection_container_name [String] The name of the container # containing the protected item. # @param replication_protected_item_name [String] The name of the protected # item on which the agent is to be updated. # @param update_mobility_service_request [UpdateMobilityServiceRequest] Request # to update the mobility service on the protected item. # @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 begin_update_mobility_service_with_http_info(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:nil) begin_update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:custom_headers).value! end # # Update the mobility service on a protected item. # # The operation to update(push update) the installed mobility service software # on a replication protected item to the latest available version. # # @param fabric_name [String] The name of the fabric containing the protected # item. # @param protection_container_name [String] The name of the container # containing the protected item. # @param replication_protected_item_name [String] The name of the protected # item on which the agent is to be updated. # @param update_mobility_service_request [UpdateMobilityServiceRequest] Request # to update the mobility service on the protected item. # @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 begin_update_mobility_service_async(fabric_name, protection_container_name, replication_protected_item_name, update_mobility_service_request, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replication_protected_item_name is nil' if replication_protected_item_name.nil? fail ArgumentError, 'update_mobility_service_request is nil' if update_mobility_service_request.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::UpdateMobilityServiceRequest.mapper() request_content = @client.serialize(request_mapper, update_mobility_service_request) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicationProtectedItemName' => replication_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute Reverse Replication\Reprotect # # Operation to reprotect or reverse replicate a failed over replication # protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param rr_input [ReverseReplicationInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_reprotect(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:nil) response = begin_reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute Reverse Replication\Reprotect # # Operation to reprotect or reverse replicate a failed over replication # protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param rr_input [ReverseReplicationInput] Disable protection input. # @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 begin_reprotect_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:nil) begin_reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:custom_headers).value! end # # Execute Reverse Replication\Reprotect # # Operation to reprotect or reverse replicate a failed over replication # protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param rr_input [ReverseReplicationInput] Disable protection input. # @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 begin_reprotect_async(fabric_name, protection_container_name, replicated_protected_item_name, rr_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'rr_input is nil' if rr_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReverseReplicationInput.mapper() request_content = @client.serialize(request_mapper, rr_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute commit failover # # Operation to commit the failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_failover_commit(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = begin_failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute commit failover # # Operation to commit the failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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 begin_failover_commit_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) begin_failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! end # # Execute commit failover # # Operation to commit the failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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 begin_failover_commit_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute test failover cleanup. # # Operation to clean up the test failover of a replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param cleanup_input [TestFailoverCleanupInput] Test failover cleanup input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_test_failover_cleanup(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:nil) response = begin_test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute test failover cleanup. # # Operation to clean up the test failover of a replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param cleanup_input [TestFailoverCleanupInput] Test failover cleanup input. # @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 begin_test_failover_cleanup_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:nil) begin_test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:custom_headers).value! end # # Execute test failover cleanup. # # Operation to clean up the test failover of a replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param cleanup_input [TestFailoverCleanupInput] Test failover cleanup input. # @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 begin_test_failover_cleanup_async(fabric_name, protection_container_name, replicated_protected_item_name, cleanup_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'cleanup_input is nil' if cleanup_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::TestFailoverCleanupInput.mapper() request_content = @client.serialize(request_mapper, cleanup_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute test failover # # Operation to perform a test failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [TestFailoverInput] Test failover input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_test_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = begin_test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute test failover # # Operation to perform a test failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [TestFailoverInput] Test failover input. # @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 begin_test_failover_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) begin_test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! end # # Execute test failover # # Operation to perform a test failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [TestFailoverInput] Test failover input. # @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 begin_test_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'failover_input is nil' if failover_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::TestFailoverInput.mapper() request_content = @client.serialize(request_mapper, failover_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute unplanned failover # # Operation to initiate a failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [UnplannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_unplanned_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = begin_unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute unplanned failover # # Operation to initiate a failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [UnplannedFailoverInput] Disable protection input. # @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 begin_unplanned_failover_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) begin_unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! end # # Execute unplanned failover # # Operation to initiate a failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [UnplannedFailoverInput] Disable protection input. # @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 begin_unplanned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'failover_input is nil' if failover_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::UnplannedFailoverInput.mapper() request_content = @client.serialize(request_mapper, failover_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Execute planned failover # # Operation to initiate a planned failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [PlannedFailoverInput] Disable protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_planned_failover(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) response = begin_planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Execute planned failover # # Operation to initiate a planned failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [PlannedFailoverInput] Disable protection input. # @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 begin_planned_failover_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) begin_planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:custom_headers).value! end # # Execute planned failover # # Operation to initiate a planned failover of the replication protected item. # # @param fabric_name [String] Unique fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param failover_input [PlannedFailoverInput] Disable protection input. # @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 begin_planned_failover_async(fabric_name, protection_container_name, replicated_protected_item_name, failover_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'failover_input is nil' if failover_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::PlannedFailoverInput.mapper() request_content = @client.serialize(request_mapper, failover_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Disables protection. # # The operation to disable replication on a replication protected item. This # will also remove the item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param disable_protection_input [DisableProtectionInput] Disable protection # input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_delete(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:nil) response = begin_delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:custom_headers).value! nil end # # Disables protection. # # The operation to disable replication on a replication protected item. This # will also remove the item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param disable_protection_input [DisableProtectionInput] Disable protection # input. # @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 begin_delete_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:nil) begin_delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:custom_headers).value! end # # Disables protection. # # The operation to disable replication on a replication protected item. This # will also remove the item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param disable_protection_input [DisableProtectionInput] Disable protection # input. # @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 begin_delete_async(fabric_name, protection_container_name, replicated_protected_item_name, disable_protection_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'disable_protection_input is nil' if disable_protection_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::DisableProtectionInput.mapper() request_content = @client.serialize(request_mapper, disable_protection_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(: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 == 202 || status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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 # # Enables protection. # # The operation to create an ASR replication protected item (Enable # replication). # # @param fabric_name [String] Name of the fabric. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] A name for the replication # protected item. # @param input [EnableProtectionInput] Enable Protection Input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_create(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:nil) response = begin_create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Enables protection. # # The operation to create an ASR replication protected item (Enable # replication). # # @param fabric_name [String] Name of the fabric. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] A name for the replication # protected item. # @param input [EnableProtectionInput] Enable Protection Input. # @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 begin_create_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:nil) begin_create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:custom_headers).value! end # # Enables protection. # # The operation to create an ASR replication protected item (Enable # replication). # # @param fabric_name [String] Name of the fabric. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] A name for the replication # protected item. # @param input [EnableProtectionInput] Enable Protection Input. # @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 begin_create_async(fabric_name, protection_container_name, replicated_protected_item_name, input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'input is nil' if input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::EnableProtectionInput.mapper() request_content = @client.serialize(request_mapper, input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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 == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 # # Purges protection. # # The operation to delete or purge a replication protected item. This operation # will force delete the replication protected item. Use the remove operation on # replication protected item to perform a clean disable replication for the # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_purge(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) response = begin_purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! nil end # # Purges protection. # # The operation to delete or purge a replication protected item. This operation # will force delete the replication protected item. Use the remove operation on # replication protected item to perform a clean disable replication for the # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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 begin_purge_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) begin_purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers).value! end # # Purges protection. # # The operation to delete or purge a replication protected item. This operation # will force delete the replication protected item. Use the remove operation on # replication protected item to perform a clean disable replication for the # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # 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 begin_purge_async(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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 == 202 || status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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 # # Updates protection. # # The operation to update the recovery settings of an ASR replication protected # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param update_protection_input [UpdateReplicationProtectedItemInput] Update # protection input. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItem] operation results. # def begin_update(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:nil) response = begin_update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:custom_headers).value! response.body unless response.nil? end # # Updates protection. # # The operation to update the recovery settings of an ASR replication protected # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param update_protection_input [UpdateReplicationProtectedItemInput] Update # protection input. # @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 begin_update_with_http_info(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:nil) begin_update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:custom_headers).value! end # # Updates protection. # # The operation to update the recovery settings of an ASR replication protected # item. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param replicated_protected_item_name [String] Replication protected item # name. # @param update_protection_input [UpdateReplicationProtectedItemInput] Update # protection input. # @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 begin_update_async(fabric_name, protection_container_name, replicated_protected_item_name, update_protection_input, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.resource_name is nil' if @client.resource_name.nil? fail ArgumentError, '@client.resource_group_name is nil' if @client.resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'fabric_name is nil' if fabric_name.nil? fail ArgumentError, 'protection_container_name is nil' if protection_container_name.nil? fail ArgumentError, 'replicated_protected_item_name is nil' if replicated_protected_item_name.nil? fail ArgumentError, 'update_protection_input is nil' if update_protection_input.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::UpdateReplicationProtectedItemInput.mapper() request_content = @client.serialize(request_mapper, update_protection_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceName' => @client.resource_name,'resourceGroupName' => @client.resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'protectionContainerName' => protection_container_name,'replicatedProtectedItemName' => replicated_protected_item_name}, 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(:patch, 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 == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItem.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 the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @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 [ReplicationProtectedItemCollection] operation results. # def list_by_replication_protection_containers_next(next_page_link, custom_headers:nil) response = list_by_replication_protection_containers_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end # # Gets the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @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_by_replication_protection_containers_next_with_http_info(next_page_link, custom_headers:nil) list_by_replication_protection_containers_next_async(next_page_link, custom_headers:custom_headers).value! end # # Gets the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @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_by_replication_protection_containers_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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 MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItemCollection.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 the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @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 [ReplicationProtectedItemCollection] operation results. # def list_next(next_page_link, custom_headers:nil) response = list_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end # # Gets the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @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:custom_headers).value! end # # Gets the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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 MsRestAzure::AzureOperationError.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::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::ReplicationProtectedItemCollection.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 the list of Replication protected items. # # Gets the list of ASR replication protected items in the protection container. # # @param fabric_name [String] Fabric name. # @param protection_container_name [String] Protection container name. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItemCollection] which provide lazy access to # pages of the response. # def list_by_replication_protection_containers_as_lazy(fabric_name, protection_container_name, custom_headers:nil) response = list_by_replication_protection_containers_async(fabric_name, protection_container_name, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_by_replication_protection_containers_next_async(next_page_link, custom_headers:custom_headers) end page end end # # Gets the list of replication protected items. # # Gets the list of ASR replication protected items in the vault. # # @param skip_token [String] The pagination token. Possible values: "FabricId" # or "FabricId_CloudId" or null # @param filter [String] OData filter options. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [ReplicationProtectedItemCollection] which provide lazy access to # pages of the response. # def list_as_lazy(skip_token:nil, filter:nil, custom_headers:nil) response = list_async(skip_token:skip_token, filter:filter, custom_headers: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:custom_headers) end page end end end end