Class: Azure::Postgresql::Mgmt::V2017_12_01::Servers
- Inherits:
-
Object
- Object
- Azure::Postgresql::Mgmt::V2017_12_01::Servers
- Includes:
- MsRestAzure
- Defined in:
- lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb
Overview
The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model.
Instance Attribute Summary collapse
-
#client ⇒ PostgreSQLManagementClient
readonly
Reference to the PostgreSQLManagementClient.
Instance Method Summary collapse
-
#begin_create(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Creates a new server, or will overwrite an existing server.
-
#begin_create_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
Creates a new server, or will overwrite an existing server.
-
#begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Creates a new server, or will overwrite an existing server.
-
#begin_delete(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Deletes a server.
-
#begin_delete_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Deletes a server.
-
#begin_delete_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Deletes a server.
-
#begin_restart(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Restarts a server.
-
#begin_restart_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Restarts a server.
-
#begin_restart_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Restarts a server.
-
#begin_update(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Updates an existing server.
-
#begin_update_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
Updates an existing server.
-
#begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Updates an existing server.
-
#create(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Creates a new server, or will overwrite an existing server.
-
#create_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource.
-
#delete(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Deletes a server.
-
#delete_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource.
-
#get(resource_group_name, server_name, custom_headers: nil) ⇒ Server
Gets information about a server.
-
#get_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Gets information about a server.
-
#get_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Gets information about a server.
-
#initialize(client) ⇒ Servers
constructor
Creates and initializes a new instance of the Servers class.
-
#list(custom_headers: nil) ⇒ ServerListResult
List all the servers in a given subscription.
-
#list_async(custom_headers: nil) ⇒ Concurrent::Promise
List all the servers in a given subscription.
-
#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ ServerListResult
List all the servers in a given resource group.
-
#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise
List all the servers in a given resource group.
-
#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
List all the servers in a given resource group.
-
#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
List all the servers in a given subscription.
-
#restart(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Restarts a server.
-
#restart_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource.
-
#update(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Updates an existing server.
-
#update_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource.
Constructor Details
#initialize(client) ⇒ Servers
Creates and initializes a new instance of the Servers class.
20 21 22 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 20 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ PostgreSQLManagementClient (readonly)
Returns reference to the PostgreSQLManagementClient.
25 26 27 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 25 def client @client end |
Instance Method Details
#begin_create(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Creates a new server, or will overwrite an existing server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
508 509 510 511 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 508 def begin_create(resource_group_name, server_name, parameters, custom_headers:nil) response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end |
#begin_create_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
Creates a new server, or will overwrite an existing server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. to the HTTP request.
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 545 def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'parameters is nil' if parameters.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::Postgresql::Mgmt::V2017_12_01::Models::ServerForCreate.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_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, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 201 || 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Creates a new server, or will overwrite an existing server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
527 528 529 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 527 def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil) begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! end |
#begin_delete(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Deletes a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
746 747 748 749 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 746 def begin_delete(resource_group_name, server_name, custom_headers:nil) response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value! nil end |
#begin_delete_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Deletes a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 779 def begin_delete_async(resource_group_name, server_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_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.DBforPostgreSQL/servers/{serverName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_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, ) 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 || 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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#begin_delete_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Deletes a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
763 764 765 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 763 def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil) begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value! end |
#begin_restart(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Restarts a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
835 836 837 838 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 835 def begin_restart(resource_group_name, server_name, custom_headers:nil) response = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value! nil end |
#begin_restart_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Restarts a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 868 def begin_restart_async(resource_group_name, server_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_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.DBforPostgreSQL/servers/{serverName}/restart' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#begin_restart_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Restarts a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
852 853 854 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 852 def begin_restart_with_http_info(resource_group_name, server_name, custom_headers:nil) begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value! end |
#begin_update(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
633 634 635 636 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 633 def begin_update(resource_group_name, server_name, parameters, custom_headers:nil) response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end |
#begin_update_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. to the HTTP request.
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 672 def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'parameters is nil' if parameters.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::Postgresql::Mgmt::V2017_12_01::Models::ServerUpdateParameters.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
653 654 655 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 653 def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil) begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! end |
#create(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Creates a new server, or will overwrite an existing server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
41 42 43 44 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 41 def create(resource_group_name, server_name, parameters, custom_headers:nil) response = create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end |
#create_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
response.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 59 def create_async(resource_group_name, server_name, parameters, custom_headers:nil) # Send request promise = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.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 |
#delete(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Deletes a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
138 139 140 141 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 138 def delete(resource_group_name, server_name, custom_headers:nil) response = delete_async(resource_group_name, server_name, custom_headers:custom_headers).value! nil end |
#delete_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
response.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 154 def delete_async(resource_group_name, server_name, custom_headers:nil) # Send request promise = begin_delete_async(resource_group_name, server_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 |
#get(resource_group_name, server_name, custom_headers: nil) ⇒ Server
Gets information about a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
182 183 184 185 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 182 def get(resource_group_name, server_name, custom_headers:nil) response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
Gets information about a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 215 def get_async(resource_group_name, server_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_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.DBforPostgreSQL/servers/{serverName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Gets information about a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
199 200 201 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 199 def get_with_http_info(resource_group_name, server_name, custom_headers:nil) get_async(resource_group_name, server_name, custom_headers:custom_headers).value! end |
#list(custom_headers: nil) ⇒ ServerListResult
List all the servers in a given subscription.
will be added to the HTTP request.
374 375 376 377 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 374 def list(custom_headers:nil) response = list_async(custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_async(custom_headers: nil) ⇒ Concurrent::Promise
List all the servers in a given subscription.
to the HTTP request.
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 399 def list_async(custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} 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}/providers/Microsoft.DBforPostgreSQL/servers' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Postgresql::Mgmt::V2017_12_01::Models::ServerListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ ServerListResult
List all the servers in a given resource group.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
281 282 283 284 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 281 def list_by_resource_group(resource_group_name, custom_headers:nil) response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise
List all the servers in a given resource group.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 312 def list_by_resource_group_async(resource_group_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_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.DBforPostgreSQL/servers' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Postgresql::Mgmt::V2017_12_01::Models::ServerListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
List all the servers in a given resource group.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
297 298 299 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 297 def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil) list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value! end |
#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
List all the servers in a given subscription.
will be added to the HTTP request.
387 388 389 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 387 def list_with_http_info(custom_headers:nil) list_async(custom_headers:custom_headers).value! end |
#restart(resource_group_name, server_name, custom_headers: nil) ⇒ Object
Restarts a server.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
462 463 464 465 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 462 def restart(resource_group_name, server_name, custom_headers:nil) response = restart_async(resource_group_name, server_name, custom_headers:custom_headers).value! nil end |
#restart_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.
response.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 478 def restart_async(resource_group_name, server_name, custom_headers:nil) # Send request promise = begin_restart_async(resource_group_name, server_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 |
#update(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Server
Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
92 93 94 95 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 92 def update(resource_group_name, server_name, parameters, custom_headers:nil) response = update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end |
#update_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a server. will be added to the HTTP request.
response.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb', line 110 def update_async(resource_group_name, server_name, parameters, custom_headers:nil) # Send request promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.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 |