Module: Octokit::EnterpriseManagementConsoleClient::ManagementConsole

Included in:
Octokit::EnterpriseManagementConsoleClient
Defined in:
lib/octokit/enterprise_management_console_client/management_console.rb

Overview

Methods for the Enterprise Management Console API

Instance Method Summary collapse

Instance Method Details

#add_authorized_key(key) ⇒ Sawyer::Resource

Add an authorized SSH keys on the Enterprise install


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 106

def add_authorized_key(key)
  queries = password_hash
  case key
  when String
    if File.exist?(key)
      key = File.open(key, "r")
      content = key.read.strip
      key.close
    else
      content = key
    end
  when File
    content = key.read.strip
    key.close
  end

  queries[:query][:authorized_key] = content
  post "/setup/api/settings/authorized-keys", queries
end

#authorized_keysSawyer::Resource Also known as: get_authorized_keys

Fetch the authorized SSH keys on the Enterprise install


97
98
99
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 97

def authorized_keys
  get "/setup/api/settings/authorized-keys", password_hash
end

#config_statusSawyer::Resource Also known as: config_check

Get information about the Enterprise installation


51
52
53
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 51

def config_status
  get "/setup/api/configcheck", password_hash
end

#edit_settings(settings) ⇒ nil

Modify the Enterprise settings


69
70
71
72
73
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 69

def edit_settings(settings)
  queries = password_hash
  queries[:query][:settings] = "#{settings.to_json}"
  put "/setup/api/settings", queries
end

#maintenance_statusSawyer::Resource Also known as: get_maintenance_status

Get information about the Enterprise maintenance status


78
79
80
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 78

def maintenance_status
  get "/setup/api/maintenance", password_hash
end

#remove_authorized_key(key) ⇒ Sawyer::Resource Also known as: delete_authorized_key

Removes an authorized SSH keys from the Enterprise install


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 130

def remove_authorized_key(key)
  queries = password_hash
  case key
  when String
    if File.exist?(key)
      key = File.open(key, "r")
      content = key.read.strip
      key.close
    else
      content = key
    end
  when File
    content = key.read.strip
    key.close
  end

  queries[:query][:authorized_key] = content
  delete "/setup/api/settings/authorized-keys", queries
end

#set_maintenance_status(maintenance) ⇒ nil Also known as: edit_maintenance_status

Start (or turn off) the Enterprise maintenance mode


87
88
89
90
91
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 87

def set_maintenance_status(maintenance)
  queries = password_hash
  queries[:query][:maintenance] = "#{maintenance.to_json}"
  post "/setup/api/maintenance", queries
end

#settingsSawyer::Resource Also known as: get_settings

Get information about the Enterprise installation


59
60
61
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 59

def settings
  get "/setup/api/settings", password_hash
end

#start_configurationObject

Start a configuration process.


30
31
32
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 30

def start_configuration
  post "/setup/api/configure", password_hash
end

#upgrade(license) ⇒ Object

Upgrade an Enterprise installation


39
40
41
42
43
44
45
46
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 39

def upgrade(license)
  conn = faraday_configuration

  params = { }
  params[:license] = Faraday::UploadIO.new(license, 'binary')
  params[:api_key] = @management_console_password
  @last_response = conn.post("/setup/api/upgrade", params)
end

#upload_license(license, settings = nil) ⇒ Object

Uploads a license for the first time

See Also:

  • //git.io/j5NT

16
17
18
19
20
21
22
23
24
25
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 16

def upload_license(license, settings = nil)
  conn = faraday_configuration

  params = { }
  params[:license] = Faraday::UploadIO.new(license, 'binary')
  params[:password] = @management_console_password
  params[:settings] = "#{settings.to_json}" unless settings.nil?

  @last_response = conn.post("/setup/api/start", params)
end