class Haipa::Client::Compute::V1_0::Subnets

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 Subnets class. @param client service class for accessing basic functionality.

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

Public Instance Methods

list(select:nil, expand:nil, 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 custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/1.0/generated/haipa_compute/subnets.rb, line 32
def list(select:nil, expand:nil, custom_headers:nil)
  response = list_async(select:select, expand:expand, custom_headers:custom_headers).value!
  nil
end
list_async(select:nil, expand:nil, 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 [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/subnets.rb, line 59
def list_async(select:nil, expand:nil, 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'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
      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?

    result
  end

  promise.execute
end
list_with_http_info(select:nil, expand:nil, 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 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/subnets.rb, line 46
def list_with_http_info(select:nil, expand:nil, custom_headers:nil)
  list_async(select:select, expand:expand, custom_headers:custom_headers).value!
end