class Azure::Labservices::Mgmt::V2018_10_15::GlobalUsers

The Managed Labs Client.

Attributes

client[R]

@return [ManagedLabsClient] reference to the ManagedLabsClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the GlobalUsers class. @param client service class for accessing basic functionality.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

begin_reset_password(user_name, reset_password_payload, custom_headers:nil) click to toggle source

Resets the user password on an environment This operation can take a while to complete

@param user_name [String] The name of the user. @param reset_password_payload [ResetPasswordPayload] Represents the payload for resetting passwords. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 856
def begin_reset_password(user_name, reset_password_payload, custom_headers:nil)
  response = begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
  nil
end
begin_reset_password_async(user_name, reset_password_payload, custom_headers:nil) click to toggle source

Resets the user password on an environment This operation can take a while to complete

@param user_name [String] The name of the user. @param reset_password_payload [ResetPasswordPayload] Represents the payload for resetting passwords. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 889
def begin_reset_password_async(user_name, reset_password_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'reset_password_payload is nil' if reset_password_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ResetPasswordPayload.mapper()
  request_content = @client.serialize(request_mapper,  reset_password_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/resetPassword'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end
begin_reset_password_with_http_info(user_name, reset_password_payload, custom_headers:nil) click to toggle source

Resets the user password on an environment This operation can take a while to complete

@param user_name [String] The name of the user. @param reset_password_payload [ResetPasswordPayload] Represents the payload for resetting passwords. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 873
def begin_reset_password_with_http_info(user_name, reset_password_payload, custom_headers:nil)
  begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
end
begin_start_environment(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Starts an environment by starting all resources inside the environment. This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 950
def begin_start_environment(user_name, environment_operations_payload, custom_headers:nil)
  response = begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
  nil
end
begin_start_environment_async(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Starts an environment by starting all resources inside the environment. This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 985
def begin_start_environment_async(user_name, environment_operations_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
  request_content = @client.serialize(request_mapper,  environment_operations_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/startEnvironment'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end
begin_start_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Starts an environment by starting all resources inside the environment. This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 968
def begin_start_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil)
  begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
end
begin_stop_environment(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Stops an environment by stopping all resources inside the environment This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 1046
def begin_stop_environment(user_name, environment_operations_payload, custom_headers:nil)
  response = begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
  nil
end
begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Stops an environment by stopping all resources inside the environment This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 1081
def begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
  request_content = @client.serialize(request_mapper,  environment_operations_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/stopEnvironment'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end
begin_stop_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Stops an environment by stopping all resources inside the environment This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 1064
def begin_stop_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil)
  begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
end
get_environment(user_name, environment_operations_payload, expand:nil, custom_headers:nil) click to toggle source

Gets the virtual machine details

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param expand [String] Specify the $expand query. Example: 'properties($expand=environment)' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [GetEnvironmentResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 38
def get_environment(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
  response = get_environment_async(user_name, environment_operations_payload, expand:expand, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_environment_async(user_name, environment_operations_payload, expand:nil, custom_headers:nil) click to toggle source

Gets the virtual machine details

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param expand [String] Specify the $expand query. Example: 'properties($expand=environment)' @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 75
def get_environment_async(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
  request_content = @client.serialize(request_mapper,  environment_operations_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/getEnvironment'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'$expand' => expand,'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GetEnvironmentResponse.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
get_environment_with_http_info(user_name, environment_operations_payload, expand:nil, custom_headers:nil) click to toggle source

Gets the virtual machine details

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param expand [String] Specify the $expand query. Example: 'properties($expand=environment)' @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 57
def get_environment_with_http_info(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
  get_environment_async(user_name, environment_operations_payload, expand:expand, custom_headers:custom_headers).value!
end
get_operation_batch_status(user_name, operation_batch_status_payload, custom_headers:nil) click to toggle source

Get batch operation status

@param user_name [String] The name of the user. @param operation_batch_status_payload [OperationBatchStatusPayload] Payload to get the status of an operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationBatchStatusResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 145
def get_operation_batch_status(user_name, operation_batch_status_payload, custom_headers:nil)
  response = get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:nil) click to toggle source

Get batch operation status

@param user_name [String] The name of the user. @param operation_batch_status_payload [OperationBatchStatusPayload] Payload to get the status of an 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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 176
def get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'operation_batch_status_payload is nil' if operation_batch_status_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationBatchStatusPayload.mapper()
  request_content = @client.serialize(request_mapper,  operation_batch_status_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationBatchStatusResponse.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
get_operation_batch_status_with_http_info(user_name, operation_batch_status_payload, custom_headers:nil) click to toggle source

Get batch operation status

@param user_name [String] The name of the user. @param operation_batch_status_payload [OperationBatchStatusPayload] Payload to get the status of an 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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 161
def get_operation_batch_status_with_http_info(user_name, operation_batch_status_payload, custom_headers:nil)
  get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
end
get_operation_status(user_name, operation_status_payload, custom_headers:nil) click to toggle source

Gets the status of long running operation

@param user_name [String] The name of the user. @param operation_status_payload [OperationStatusPayload] Payload to get the status of an operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationStatusResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 246
def get_operation_status(user_name, operation_status_payload, custom_headers:nil)
  response = get_operation_status_async(user_name, operation_status_payload, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_operation_status_async(user_name, operation_status_payload, custom_headers:nil) click to toggle source

Gets the status of long running operation

@param user_name [String] The name of the user. @param operation_status_payload [OperationStatusPayload] Payload to get the status of an 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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 277
def get_operation_status_async(user_name, operation_status_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'operation_status_payload is nil' if operation_status_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationStatusPayload.mapper()
  request_content = @client.serialize(request_mapper,  operation_status_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/getOperationStatus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationStatusResponse.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
get_operation_status_with_http_info(user_name, operation_status_payload, custom_headers:nil) click to toggle source

Gets the status of long running operation

@param user_name [String] The name of the user. @param operation_status_payload [OperationStatusPayload] Payload to get the status of an 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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 262
def get_operation_status_with_http_info(user_name, operation_status_payload, custom_headers:nil)
  get_operation_status_async(user_name, operation_status_payload, custom_headers:custom_headers).value!
end
get_personal_preferences(user_name, personal_preferences_operations_payload, custom_headers:nil) click to toggle source

Get personal preferences for a user

@param user_name [String] The name of the user. @param personal_preferences_operations_payload

PersonalPreferencesOperationsPayload

Represents payload for any Environment

operations like get, start, stop, connect @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [GetPersonalPreferencesResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 348
def get_personal_preferences(user_name, personal_preferences_operations_payload, custom_headers:nil)
  response = get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:nil) click to toggle source

Get personal preferences for a user

@param user_name [String] The name of the user. @param personal_preferences_operations_payload

PersonalPreferencesOperationsPayload

Represents payload for any Environment

operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 381
def get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'personal_preferences_operations_payload is nil' if personal_preferences_operations_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::PersonalPreferencesOperationsPayload.mapper()
  request_content = @client.serialize(request_mapper,  personal_preferences_operations_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GetPersonalPreferencesResponse.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
get_personal_preferences_with_http_info(user_name, personal_preferences_operations_payload, custom_headers:nil) click to toggle source

Get personal preferences for a user

@param user_name [String] The name of the user. @param personal_preferences_operations_payload

PersonalPreferencesOperationsPayload

Represents payload for any Environment

operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 365
def get_personal_preferences_with_http_info(user_name, personal_preferences_operations_payload, custom_headers:nil)
  get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:custom_headers).value!
end
list_environments(user_name, list_environments_payload, custom_headers:nil) click to toggle source

List Environments for the user

@param user_name [String] The name of the user. @param list_environments_payload [ListEnvironmentsPayload] Represents the payload to list environments owned by a user @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ListEnvironmentsResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 451
def list_environments(user_name, list_environments_payload, custom_headers:nil)
  response = list_environments_async(user_name, list_environments_payload, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_environments_async(user_name, list_environments_payload, custom_headers:nil) click to toggle source

List Environments for the user

@param user_name [String] The name of the user. @param list_environments_payload [ListEnvironmentsPayload] Represents the payload to list environments owned by a user @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 482
def list_environments_async(user_name, list_environments_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'list_environments_payload is nil' if list_environments_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListEnvironmentsPayload.mapper()
  request_content = @client.serialize(request_mapper,  list_environments_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/listEnvironments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListEnvironmentsResponse.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
list_environments_with_http_info(user_name, list_environments_payload, custom_headers:nil) click to toggle source

List Environments for the user

@param user_name [String] The name of the user. @param list_environments_payload [ListEnvironmentsPayload] Represents the payload to list environments owned by a user @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 467
def list_environments_with_http_info(user_name, list_environments_payload, custom_headers:nil)
  list_environments_async(user_name, list_environments_payload, custom_headers:custom_headers).value!
end
list_labs(user_name, custom_headers:nil) click to toggle source

List labs for the user.

@param user_name [String] The name of the user. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ListLabsResponse] operation results.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 550
def list_labs(user_name, custom_headers:nil)
  response = list_labs_async(user_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_labs_async(user_name, custom_headers:nil) click to toggle source

List labs for the user.

@param user_name [String] The name of the user. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 577
def list_labs_async(user_name, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.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 = 'providers/Microsoft.LabServices/users/{userName}/listLabs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListLabsResponse.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
list_labs_with_http_info(user_name, custom_headers:nil) click to toggle source

List labs for the user.

@param user_name [String] The name of the user. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 564
def list_labs_with_http_info(user_name, custom_headers:nil)
  list_labs_async(user_name, custom_headers:custom_headers).value!
end
register(user_name, register_payload, custom_headers:nil) click to toggle source

Register a user to a managed lab

@param user_name [String] The name of the user. @param register_payload [RegisterPayload] Represents payload for Register action. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 638
def register(user_name, register_payload, custom_headers:nil)
  response = register_async(user_name, register_payload, custom_headers:custom_headers).value!
  nil
end
register_async(user_name, register_payload, custom_headers:nil) click to toggle source

Register a user to a managed lab

@param user_name [String] The name of the user. @param register_payload [RegisterPayload] Represents payload for Register action. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 669
def register_async(user_name, register_payload, custom_headers:nil)
  fail ArgumentError, 'user_name is nil' if user_name.nil?
  fail ArgumentError, 'register_payload is nil' if register_payload.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?

  # Serialize Request
  request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::RegisterPayload.mapper()
  request_content = @client.serialize(request_mapper,  register_payload)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.LabServices/users/{userName}/register'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'userName' => user_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end
register_with_http_info(user_name, register_payload, custom_headers:nil) click to toggle source

Register a user to a managed lab

@param user_name [String] The name of the user. @param register_payload [RegisterPayload] Represents payload for Register action. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 654
def register_with_http_info(user_name, register_payload, custom_headers:nil)
  register_async(user_name, register_payload, custom_headers:custom_headers).value!
end
reset_password(user_name, reset_password_payload, custom_headers:nil) click to toggle source

Resets the user password on an environment This operation can take a while to complete

@param user_name [String] The name of the user. @param reset_password_payload [ResetPasswordPayload] Represents the payload for resetting passwords. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 728
def reset_password(user_name, reset_password_payload, custom_headers:nil)
  response = reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
  nil
end
reset_password_async(user_name, reset_password_payload, custom_headers:nil) click to toggle source

@param user_name [String] The name of the user. @param reset_password_payload [ResetPasswordPayload] Represents the payload for resetting passwords. @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 743
def reset_password_async(user_name, reset_password_payload, custom_headers:nil)
  # Send request
  promise = begin_reset_password_async(user_name, reset_password_payload, 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
start_environment(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Starts an environment by starting all resources inside the environment. This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 770
def start_environment(user_name, environment_operations_payload, custom_headers:nil)
  response = start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
  nil
end
start_environment_async(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 786
def start_environment_async(user_name, environment_operations_payload, custom_headers:nil)
  # Send request
  promise = begin_start_environment_async(user_name, environment_operations_payload, 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
stop_environment(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

Stops an environment by stopping all resources inside the environment This operation can take a while to complete

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 813
def stop_environment(user_name, environment_operations_payload, custom_headers:nil)
  response = stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
  nil
end
stop_environment_async(user_name, environment_operations_payload, custom_headers:nil) click to toggle source

@param user_name [String] The name of the user. @param environment_operations_payload [EnvironmentOperationsPayload] Represents payload for any Environment operations like get, start, stop, connect @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/2018-10-15/generated/azure_mgmt_labservices/global_users.rb, line 829
def stop_environment_async(user_name, environment_operations_payload, custom_headers:nil)
  # Send request
  promise = begin_stop_environment_async(user_name, environment_operations_payload, 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