module Octokit::EnterpriseManagementConsoleClient::ManagementConsole

Methods for the Enterprise Management Console API

@see developer.github.com/v3/enterprise-admin/management_console/

Public Instance Methods

add_authorized_key(key) click to toggle source

Add an authorized SSH keys on the Enterprise install

@param key Either the file path to a key, a File handler to the key, or the contents of the key itself @return [Sawyer::Resource] An array of authorized SSH keys

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 115
def add_authorized_key(key)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  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_keys() click to toggle source

Fetch the authorized SSH keys on the Enterprise install

@return [Sawyer::Resource] An array of authorized SSH keys

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 105
def authorized_keys
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  get '/setup/api/settings/authorized-keys', password_hash
end
Also aliased as: get_authorized_keys
config_check()
Alias for: config_status
config_status() click to toggle source

Get information about the Enterprise installation

@return [Sawyer::Resource] The installation information

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 54
def config_status
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  get '/setup/api/configcheck', password_hash
end
Also aliased as: config_check
delete_authorized_key(key)
edit_maintenance_status(maintenance)
edit_settings(settings) click to toggle source

Modify the Enterprise settings

@param settings [Hash] A hash configuration of the new settings

@return [nil]

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 74
def edit_settings(settings)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  queries = password_hash
  queries[:query][:settings] = settings.to_json.to_s
  put '/setup/api/settings', queries
end
get_authorized_keys()
Alias for: authorized_keys
get_maintenance_status()
Alias for: maintenance_status
get_settings()
Alias for: settings
maintenance_status() click to toggle source

Get information about the Enterprise maintenance status

@return [Sawyer::Resource] The maintenance status

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 84
def maintenance_status
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  get '/setup/api/maintenance', password_hash
end
Also aliased as: get_maintenance_status
remove_authorized_key(key) click to toggle source

Removes an authorized SSH keys from the Enterprise install

@param key Either the file path to a key, a File handler to the key, or the contents of the key itself @return [Sawyer::Resource] An array of authorized SSH keys

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 140
def remove_authorized_key(key)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  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
Also aliased as: delete_authorized_key
set_maintenance_status(maintenance) click to toggle source

Start (or turn off) the Enterprise maintenance mode

@param maintenance [Hash] A hash configuration of the maintenance settings @return [nil]

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 94
def set_maintenance_status(maintenance)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  queries = password_hash
  queries[:query][:maintenance] = maintenance.to_json.to_s
  post '/setup/api/maintenance', queries
end
Also aliased as: edit_maintenance_status
settings() click to toggle source

Get information about the Enterprise installation

@return [Sawyer::Resource] The settings

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 63
def settings
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  get '/setup/api/settings', password_hash
end
Also aliased as: get_settings
start_configuration() click to toggle source

Start a configuration process.

@return nil

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 31
def start_configuration
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  post '/setup/api/configure', password_hash
end
upgrade(license) click to toggle source

Upgrade an Enterprise installation

@param license [String] The path to your .ghl license file.

@return nil

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 41
def upgrade(license)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  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) click to toggle source

Uploads a license for the first time

@param license [String] The path to your .ghl license file. @param settings [Hash] A hash configuration of the initial settings.

@see docs.github.com/en/enterprise-server@3.4/rest/enterprise-admin/management-console#create-a-github-license @return nil

# File lib/octokit/enterprise_management_console_client/management_console.rb, line 16
def upload_license(license, settings = nil)
  octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
  conn = faraday_configuration

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

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