class Bfwd::UsagesessionsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/bf_ruby2/api/usagesessions_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_active_sessions_for_subscription(subscription_id, opts = {}) click to toggle source

Get active by subscription {"nickname":"Get active by subscription","response":"getActiveSessions.html"} @param subscription_id The subscriptionID of the subscription whose active sessions you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. (default to 0) @option opts [Integer] :records The maximum number of amendments to return. (default to 8766) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to ASC) @return [UsageSessionPagedMetadata]

# File lib/bf_ruby2/api/usagesessions_api.rb, line 33
def get_active_sessions_for_subscription(subscription_id, opts = {})
  data, _status_code, _headers = get_active_sessions_for_subscription_with_http_info(subscription_id, opts)
  return data
end
get_active_sessions_for_subscription_with_http_info(subscription_id, opts = {}) click to toggle source

Get active by subscription {&quot;nickname&quot;:&quot;Get active by subscription&quot;,&quot;response&quot;:&quot;getActiveSessions.html&quot;} @param subscription_id The subscriptionID of the subscription whose active sessions you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. @option opts [Integer] :records The maximum number of amendments to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(UsageSessionPagedMetadata, Fixnum, Hash)>] UsageSessionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usagesessions_api.rb, line 48
def get_active_sessions_for_subscription_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsagesessionsApi.get_active_sessions_for_subscription ..."
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling UsagesessionsApi.get_active_sessions_for_subscription"
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/usage-sessions/{subscription-id}/active".sub('{' + 'subscription-id' + '}', subscription_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsageSessionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsagesessionsApi#get_active_sessions_for_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_list_for_usage_session(subscription_id, opts = {}) click to toggle source

Retrieve by subscription {"nickname":"Retrieve by subscription","response":"getAllSessions.html"} @param subscription_id The subscriptionID of the subscription whose sessions you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. (default to 0) @option opts [Integer] :records The maximum number of amendments to return. (default to 8766) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to ASC) @return [UsageSessionPagedMetadata]

# File lib/bf_ruby2/api/usagesessions_api.rb, line 104
def get_usage_list_for_usage_session(subscription_id, opts = {})
  data, _status_code, _headers = get_usage_list_for_usage_session_with_http_info(subscription_id, opts)
  return data
end
get_usage_list_for_usage_session_with_http_info(subscription_id, opts = {}) click to toggle source

Retrieve by subscription {&quot;nickname&quot;:&quot;Retrieve by subscription&quot;,&quot;response&quot;:&quot;getAllSessions.html&quot;} @param subscription_id The subscriptionID of the subscription whose sessions you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. @option opts [Integer] :records The maximum number of amendments to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(UsageSessionPagedMetadata, Fixnum, Hash)>] UsageSessionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usagesessions_api.rb, line 119
def get_usage_list_for_usage_session_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsagesessionsApi.get_usage_list_for_usage_session ..."
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling UsagesessionsApi.get_usage_list_for_usage_session"
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/usage-sessions/{subscription-id}".sub('{' + 'subscription-id' + '}', subscription_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsageSessionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsagesessionsApi#get_usage_list_for_usage_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
start_usage_session(usage_sessions, opts = {}) click to toggle source

Start a new session {"nickname":"Start a new session","request":"createStartUsageSessionRequest.html","response":"createStartUsageSessionResponse.html"} @param usage_sessions An array of &#39;Usage Session&#39; objects whose sessions you wish to start. @param [Hash] opts the optional parameters @return [UsageSessionPagedMetadata]

# File lib/bf_ruby2/api/usagesessions_api.rb, line 170
def start_usage_session(usage_sessions, opts = {})
  data, _status_code, _headers = start_usage_session_with_http_info(usage_sessions, opts)
  return data
end
start_usage_session_with_http_info(usage_sessions, opts = {}) click to toggle source

Start a new session {&quot;nickname&quot;:&quot;Start a new session&quot;,&quot;request&quot;:&quot;createStartUsageSessionRequest.html&quot;,&quot;response&quot;:&quot;createStartUsageSessionResponse.html&quot;} @param usage_sessions An array of &#39;Usage Session&#39; objects whose sessions you wish to start. @param [Hash] opts the optional parameters @return [Array<(UsageSessionPagedMetadata, Fixnum, Hash)>] UsageSessionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usagesessions_api.rb, line 180
def start_usage_session_with_http_info(usage_sessions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsagesessionsApi.start_usage_session ..."
  end
  # verify the required parameter 'usage_sessions' is set
  if @api_client.config.client_side_validation && usage_sessions.nil?
    fail ArgumentError, "Missing the required parameter 'usage_sessions' when calling UsagesessionsApi.start_usage_session"
  end
  # resource path
  local_var_path = "/usage-sessions/start"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(usage_sessions)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsageSessionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsagesessionsApi#start_usage_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
stop_usage_session(usage_sessions, opts = {}) click to toggle source

Stop a specified session {"nickname":"Stop a specified session","request":"createStopUsageSessionRequest.html","response":"createStopUsageSessionResponse.html"} @param usage_sessions An array of &#39;Usage Session&#39; objects whose sessions you wish to stop. @param [Hash] opts the optional parameters @return [UsageSessionPagedMetadata]

# File lib/bf_ruby2/api/usagesessions_api.rb, line 225
def stop_usage_session(usage_sessions, opts = {})
  data, _status_code, _headers = stop_usage_session_with_http_info(usage_sessions, opts)
  return data
end
stop_usage_session_with_http_info(usage_sessions, opts = {}) click to toggle source

Stop a specified session {&quot;nickname&quot;:&quot;Stop a specified session&quot;,&quot;request&quot;:&quot;createStopUsageSessionRequest.html&quot;,&quot;response&quot;:&quot;createStopUsageSessionResponse.html&quot;} @param usage_sessions An array of &#39;Usage Session&#39; objects whose sessions you wish to stop. @param [Hash] opts the optional parameters @return [Array<(UsageSessionPagedMetadata, Fixnum, Hash)>] UsageSessionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usagesessions_api.rb, line 235
def stop_usage_session_with_http_info(usage_sessions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsagesessionsApi.stop_usage_session ..."
  end
  # verify the required parameter 'usage_sessions' is set
  if @api_client.config.client_side_validation && usage_sessions.nil?
    fail ArgumentError, "Missing the required parameter 'usage_sessions' when calling UsagesessionsApi.stop_usage_session"
  end
  # resource path
  local_var_path = "/usage-sessions/stop"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(usage_sessions)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsageSessionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsagesessionsApi#stop_usage_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end