Class: Morpheus::SetupInterface

Inherits:
APIClient show all
Defined in:
lib/morpheus/api/setup_interface.rb

Overview

There is no authentication required for this API.

Instance Method Summary collapse

Methods inherited from APIClient

#accounts, #app_templates, #apps, #auth, #clouds, #custom_instance_types, #dashboard, #deploy, #deployments, #dry, #dry_run, #execute, #groups, #instance_types, #instances, #key_pairs, #license, #load_balancers, #logs, #options, #provision_types, #roles, #security_group_rules, #security_groups, #servers, #setup, #task_sets, #tasks, #users, #virtual_images, #whoami

Constructor Details

#initialize(base_url) ⇒ SetupInterface

def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)

@access_token = access_token
@refresh_token = refresh_token
@base_url = base_url
@expires_at = expires_at

end



11
12
13
# File 'lib/morpheus/api/setup_interface.rb', line 11

def initialize(base_url)
  @base_url = base_url
end

Instance Method Details

#get(options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/morpheus/api/setup_interface.rb', line 15

def get(options={})
  url = "#{@base_url}/api/setup"
  # headers = {:params => {}, authorization: "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers = {:params => {}, 'Content-Type' => 'application/json' }
  headers[:params].merge!(options)
  execute(method: :get, url: url, headers: headers)
end

#init(options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/morpheus/api/setup_interface.rb', line 23

def init(options={})
  url = "#{@base_url}/api/setup/init"
  # headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers = { 'Content-Type' => 'application/json' }
  payload = options
  execute(method: :post, url: url, timeout: 30, headers: headers, payload: payload.to_json)
end