class Azure::ServerManagement::Mgmt::V2016_07_01_preview::Node
REST API for Azure
Server Management Service.
Attributes
@return [ServerManagement] reference to the ServerManagement
Private Class Methods
Creates and initializes a new instance of the Node
class. @param client service class for accessing basic functionality.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 17 def initialize(client) @client = client end
Private Instance Methods
Creates or updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResource] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 519 def begin_create(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) response = begin_create_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates or updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 562 def begin_create_async(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3 fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil? fail ArgumentError, 'node_name is nil' if node_name.nil? fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256 fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1 fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil? gateway_parameters = NodeParameters.new unless location.nil? && tags.nil? && gateway_id.nil? && connection_name.nil? && user_name.nil? && password.nil? gateway_parameters.location = location gateway_parameters.tags = tags gateway_parameters.gateway_id = gateway_id gateway_parameters.connection_name = connection_name gateway_parameters.user_name = user_name gateway_parameters.password = password end 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::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeParameters.mapper() request_content = @client.serialize(request_mapper, gateway_parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_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 == 201 || status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.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 # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Creates or updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 541 def begin_create_with_http_info(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) begin_create_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! end
Updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResource] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 663 def begin_update(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) response = begin_update_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 706 def begin_update_async(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3 fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil? fail ArgumentError, 'node_name is nil' if node_name.nil? fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256 fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1 fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil? node_parameters = NodeParameters.new unless location.nil? && tags.nil? && gateway_id.nil? && connection_name.nil? && user_name.nil? && password.nil? node_parameters.location = location node_parameters.tags = tags node_parameters.gateway_id = gateway_id node_parameters.connection_name = connection_name node_parameters.user_name = user_name node_parameters.password = password end 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::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeParameters.mapper() request_content = @client.serialize(request_mapper, node_parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_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 MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.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
Updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 685 def begin_update_with_http_info(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) begin_update_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! end
Creates or updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResource] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 41 def create(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) response = create_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 62 def create_async(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) # Send request promise = begin_create_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.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
deletes a management node
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 146 def delete(resource_group_name, node_name, custom_headers:nil) response = delete_async(resource_group_name, node_name, custom_headers:custom_headers).value! nil end
deletes a management node
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 177 def delete_async(resource_group_name, node_name, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3 fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil? fail ArgumentError, 'node_name is nil' if node_name.nil? fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256 fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1 fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/nodes/{nodeName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_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 == 200 || status_code == 204 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
deletes a management node
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 162 def delete_with_http_info(resource_group_name, node_name, custom_headers:nil) delete_async(resource_group_name, node_name, custom_headers:custom_headers).value! end
Gets a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResource] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 236 def get(resource_group_name, node_name, custom_headers:nil) response = get_async(resource_group_name, node_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 267 def get_async(resource_group_name, node_name, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3 fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil? fail ArgumentError, 'node_name is nil' if node_name.nil? fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256 fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1 fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/nodes/{nodeName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_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 MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.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 a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 252 def get_with_http_info(resource_group_name, node_name, custom_headers:nil) get_async(resource_group_name, node_name, custom_headers:custom_headers).value! end
Lists nodes in a subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<NodeResource>] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 333 def list(custom_headers:nil) first_page = list_as_lazy(custom_headers:custom_headers) first_page.get_all_items end
Lists nodes in a subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResources] which provide lazy access to pages of the response.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 964 def list_as_lazy(custom_headers:nil) response = list_async(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
Lists nodes in a subscription.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 358 def list_async(custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.ServerManagement/nodes' request_url = @base_url || @client.base_url options = { 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, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResources.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
Lists nodes in a resource group.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<NodeResource>] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 419 def list_for_resource_group(resource_group_name, custom_headers:nil) first_page = list_for_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers) first_page.get_all_items end
Lists nodes in a resource group.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResources] which provide lazy access to pages of the response.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 985 def list_for_resource_group_as_lazy(resource_group_name, custom_headers:nil) response = list_for_resource_group_async(resource_group_name, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers) end page end end
Lists nodes in a resource group.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 448 def list_for_resource_group_async(resource_group_name, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3 fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).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.ServerManagement/nodes' request_url = @base_url || @client.base_url options = { 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, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResources.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
Lists nodes in a resource group.
@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 [NodeResources] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 878 def list_for_resource_group_next(next_page_link, custom_headers:nil) response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Lists nodes in a resource group.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 907 def list_for_resource_group_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 MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResources.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
Lists nodes in a resource group.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 893 def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil) list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value! end
Lists nodes in a resource group.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 434 def list_for_resource_group_with_http_info(resource_group_name, custom_headers:nil) list_for_resource_group_async(resource_group_name, custom_headers:custom_headers).value! end
Lists nodes in a subscription.
@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 [NodeResources] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 790 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
Lists nodes in a subscription.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 819 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 MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResources.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
Lists nodes in a subscription.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 805 def list_next_with_http_info(next_page_link, custom_headers:nil) list_next_async(next_page_link, custom_headers:custom_headers).value! end
Lists nodes in a subscription.
@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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 346 def list_with_http_info(custom_headers:nil) list_async(custom_headers:custom_headers).value! end
Updates a management node.
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [NodeResource] operation results.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 97 def update(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) response = update_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The resource group name uniquely identifies the resource group within the user subscriptionId. @param node_name [String] The node name (256 characters maximum). @param location [String] Location of the resource. @param tags Resource tags. @param gateway_id [String] Gateway
ID which will manage this node. @param connection_name [String] myhost.domain.com @param user_name [String] User name to be used to connect to node. @param password [String] Password associated with user 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.
# File lib/2016-07-01-preview/generated/azure_mgmt_server_management/node.rb, line 118 def update_async(resource_group_name, node_name, location:nil, tags:nil, gateway_id:nil, connection_name:nil, user_name:nil, password:nil, custom_headers:nil) # Send request promise = begin_update_async(resource_group_name, node_name, location:location, tags:tags, gateway_id:gateway_id, connection_name:connection_name, user_name:user_name, password:password, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::NodeResource.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