Class: Azure::ServerManagement::Mgmt::V2016_07_01_preview::Session
- Inherits:
-
Object
- Object
- Azure::ServerManagement::Mgmt::V2016_07_01_preview::Session
- Includes:
- MsRestAzure
- Defined in:
- lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb
Overview
REST API for Azure Server Management Service.
Instance Attribute Summary collapse
-
#client ⇒ ServerManagement
readonly
Reference to the ServerManagement.
Instance Method Summary collapse
-
#begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ SessionResource
Creates a session for a node.
-
#begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ Concurrent::Promise
Creates a session for a node.
-
#begin_create_with_http_info(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Creates a session for a node.
-
#create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ SessionResource
Creates a session for a node.
-
#create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ Concurrent::Promise
identifies the resource group within the user subscriptionId.
-
#delete(resource_group_name, node_name, session, custom_headers = nil) ⇒ Object
Deletes a session for a node.
-
#delete_async(resource_group_name, node_name, session, custom_headers = nil) ⇒ Concurrent::Promise
Deletes a session for a node.
-
#delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Deletes a session for a node.
-
#get(resource_group_name, node_name, session, custom_headers = nil) ⇒ SessionResource
Gets a session for a node.
-
#get_async(resource_group_name, node_name, session, custom_headers = nil) ⇒ Concurrent::Promise
Gets a session for a node.
-
#get_with_http_info(resource_group_name, node_name, session, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets a session for a node.
-
#initialize(client) ⇒ Session
constructor
Creates and initializes a new instance of the Session class.
Constructor Details
#initialize(client) ⇒ Session
Creates and initializes a new instance of the Session class.
17 18 19 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 17 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ ServerManagement (readonly)
Returns reference to the ServerManagement.
22 23 24 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 22 def client @client end |
Instance Method Details
#begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ SessionResource
Creates a session for a node.
identifies the resource group within the user subscriptionId. values include: ‘Session’, ‘Persistent’ Possible values include: ‘RsaEncrypted’ thumbprint. will be added to the HTTP request.
301 302 303 304 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 301 def begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) response = begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value! response.body unless response.nil? end |
#begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ Concurrent::Promise
Creates a session for a node.
identifies the resource group within the user subscriptionId. values include: ‘Session’, ‘Persistent’ Possible values include: ‘RsaEncrypted’ thumbprint. to the HTTP request.
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 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 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 350 def begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = 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? fail ArgumentError, 'session is nil' if session.nil? session_parameters = SessionParameters.new unless user_name.nil? && password.nil? && retention_period.nil? && credential_data_format.nil? && encryption_certificate_thumbprint.nil? session_parameters.user_name = user_name session_parameters.password = password session_parameters.retention_period = retention_period session_parameters.credential_data_format = credential_data_format session_parameters.encryption_certificate_thumbprint = encryption_certificate_thumbprint end request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::SessionParameters.mapper() request_content = @client.serialize(request_mapper, session_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}/sessions/{session}' 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,'nodeName' => node_name,'session' => session}, 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 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::SessionResource.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::SessionResource.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, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Creates a session for a node.
identifies the resource group within the user subscriptionId. values include: ‘Session’, ‘Persistent’ Possible values include: ‘RsaEncrypted’ thumbprint. will be added to the HTTP request.
326 327 328 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 326 def begin_create_with_http_info(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value! end |
#create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ SessionResource
Creates a session for a node.
identifies the resource group within the user subscriptionId. values include: ‘Session’, ‘Persistent’ Possible values include: ‘RsaEncrypted’ thumbprint. will be added to the HTTP request.
44 45 46 47 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 44 def create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) response = create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value! response.body unless response.nil? end |
#create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) ⇒ Concurrent::Promise
identifies the resource group within the user subscriptionId. values include: ‘Session’, ‘Persistent’ Possible values include: ‘RsaEncrypted’ thumbprint. will be added to the HTTP request.
response.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 68 def create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil) # Send request promise = begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, 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::SessionResource.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, node_name, session, custom_headers = nil) ⇒ Object
Deletes a session for a node.
identifies the resource group within the user subscriptionId. will be added to the HTTP request.
97 98 99 100 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 97 def delete(resource_group_name, node_name, session, custom_headers = nil) response = delete_async(resource_group_name, node_name, session, custom_headers).value! nil end |
#delete_async(resource_group_name, node_name, session, custom_headers = nil) ⇒ Concurrent::Promise
Deletes a session for a node.
identifies the resource group within the user subscriptionId. to the HTTP request.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 130 def delete_async(resource_group_name, node_name, session, 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? fail ArgumentError, 'session is nil' if session.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}' 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,'nodeName' => node_name,'session' => session}, 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 == 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 |
#delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Deletes a session for a node.
identifies the resource group within the user subscriptionId. will be added to the HTTP request.
114 115 116 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 114 def delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil) delete_async(resource_group_name, node_name, session, custom_headers).value! end |
#get(resource_group_name, node_name, session, custom_headers = nil) ⇒ SessionResource
Gets a session for a node.
identifies the resource group within the user subscriptionId. will be added to the HTTP request.
190 191 192 193 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 190 def get(resource_group_name, node_name, session, custom_headers = nil) response = get_async(resource_group_name, node_name, session, custom_headers).value! response.body unless response.nil? end |
#get_async(resource_group_name, node_name, session, custom_headers = nil) ⇒ Concurrent::Promise
Gets a session for a node.
identifies the resource group within the user subscriptionId. to the HTTP request.
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 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 223 def get_async(resource_group_name, node_name, session, 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? fail ArgumentError, 'session is nil' if session.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}' 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,'nodeName' => node_name,'session' => session}, 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 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::SessionResource.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, node_name, session, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets a session for a node.
identifies the resource group within the user subscriptionId. will be added to the HTTP request.
207 208 209 |
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/session.rb', line 207 def get_with_http_info(resource_group_name, node_name, session, custom_headers = nil) get_async(resource_group_name, node_name, session, custom_headers).value! end |