class Haipa::Client::Compute::V1_0::Operations

Haipa management API

Attributes

client[R]

@return [HaipaCompute] reference to the HaipaCompute

Public Class Methods

new(client) click to toggle source

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

# File lib/1.0/generated/haipa_compute/operations.rb, line 17
def initialize(client)
  @client = client
end

Public Instance Methods

get(key, select:nil, expand:nil, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Operation] operation results.

# File lib/1.0/generated/haipa_compute/operations.rb, line 147
def get(key, select:nil, expand:nil, custom_headers:nil)
  response = get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(key, select:nil, expand:nil, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @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/1.0/generated/haipa_compute/operations.rb, line 176
def get_async(key, select:nil, expand:nil, custom_headers:nil)
  fail ArgumentError, 'key is nil' if key.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 = 'odata/v1/Operations({key})'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
      path_params: {'key' => key},
      query_params: {'$select' => select,'$expand' => expand},
      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 Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.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_log_entries(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ODataValueIEnumerableOperationLogEntry] operation results.

# File lib/1.0/generated/haipa_compute/operations.rb, line 247
def get_log_entries(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
  response = get_log_entries_async(key, select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_log_entries_async(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @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/1.0/generated/haipa_compute/operations.rb, line 294
def get_log_entries_async(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
  fail ArgumentError, 'key is nil' if key.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 = 'odata/v1/Operations({key})/logEntries'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
      path_params: {'key' => key},
      query_params: {'$select' => select,'$expand' => expand,'$filter' => filter,'$orderby' => orderby,'$top' => top,'$skip' => skip,'$count' => count},
      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 Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Haipa::Client::Compute::V1_0::Models::ODataValueIEnumerableOperationLogEntry.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_log_entries_with_http_info(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Haipa::Client::HaipaOperationResponse] HTTP response information.

# File lib/1.0/generated/haipa_compute/operations.rb, line 271
def get_log_entries_with_http_info(key, select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
  get_log_entries_async(key, select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
end
get_with_http_info(key, select:nil, expand:nil, custom_headers:nil) click to toggle source

@param key @param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Haipa::Client::HaipaOperationResponse] HTTP response information.

# File lib/1.0/generated/haipa_compute/operations.rb, line 162
def get_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
  get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
end
list(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ODataValueIEnumerableOperation] operation results.

# File lib/1.0/generated/haipa_compute/operations.rb, line 42
def list(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
  response = list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_async(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @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/1.0/generated/haipa_compute/operations.rb, line 87
def list_async(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers: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 = 'odata/v1/Operations'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
      query_params: {'$select' => select,'$expand' => expand,'$filter' => filter,'$orderby' => orderby,'$top' => top,'$skip' => skip,'$count' => count},
      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 Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Haipa::Client::Compute::V1_0::Models::ODataValueIEnumerableOperation.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_with_http_info(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil) click to toggle source

@param select [String] Limits the properties returned in the result. @param expand [String] Indicates the related entities to be represented inline. The maximum depth is 2. @param filter [String] Restricts the set of items returned. The maximum number of expressions is 100. The allowed functions are: allfunctions. @param orderby [String] Specifies the order in which items are returned. The maximum number of expressions is 5. @param top [Integer] Limits the number of items returned from a collection. @param skip [Integer] Excludes the specified number of items of the queried collection from the result. @param count [Boolean] Indicates whether the total count of items within a collection are returned in the result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Haipa::Client::HaipaOperationResponse] HTTP response information.

# File lib/1.0/generated/haipa_compute/operations.rb, line 65
def list_with_http_info(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
  list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
end