-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,247 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ module ManagementConsole | |
# @see https://docs.github.com/en/[email protected]/rest/enterprise-admin/management-console#create-a-github-license | ||
# @return nil | ||
def upload_license(license, settings = nil) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
conn = faraday_configuration | ||
|
||
params = {} | ||
|
@@ -28,6 +29,7 @@ def upload_license(license, settings = nil) | |
# | ||
# @return nil | ||
def start_configuration | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
post '/setup/api/configure', password_hash | ||
end | ||
|
||
|
@@ -37,6 +39,7 @@ def start_configuration | |
# | ||
# @return nil | ||
def upgrade(license) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
conn = faraday_configuration | ||
|
||
params = {} | ||
|
@@ -49,6 +52,7 @@ def upgrade(license) | |
# | ||
# @return [Sawyer::Resource] The installation information | ||
def config_status | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
get '/setup/api/configcheck', password_hash | ||
end | ||
alias config_check config_status | ||
|
@@ -57,6 +61,7 @@ def config_status | |
# | ||
# @return [Sawyer::Resource] The settings | ||
def settings | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
get '/setup/api/settings', password_hash | ||
end | ||
alias get_settings settings | ||
|
@@ -67,6 +72,7 @@ def settings | |
# | ||
# @return [nil] | ||
def edit_settings(settings) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
queries = password_hash | ||
queries[:query][:settings] = settings.to_json.to_s | ||
put '/setup/api/settings', queries | ||
|
@@ -76,6 +82,7 @@ def edit_settings(settings) | |
# | ||
# @return [Sawyer::Resource] The maintenance status | ||
def maintenance_status | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
get '/setup/api/maintenance', password_hash | ||
end | ||
alias get_maintenance_status maintenance_status | ||
|
@@ -85,6 +92,7 @@ def maintenance_status | |
# @param maintenance [Hash] A hash configuration of the maintenance settings | ||
# @return [nil] | ||
def set_maintenance_status(maintenance) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
queries = password_hash | ||
queries[:query][:maintenance] = maintenance.to_json.to_s | ||
post '/setup/api/maintenance', queries | ||
|
@@ -95,6 +103,7 @@ def set_maintenance_status(maintenance) | |
# | ||
# @return [Sawyer::Resource] An array of authorized SSH keys | ||
def authorized_keys | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
get '/setup/api/settings/authorized-keys', password_hash | ||
end | ||
alias get_authorized_keys authorized_keys | ||
|
@@ -104,6 +113,7 @@ def authorized_keys | |
# @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 | ||
def add_authorized_key(key) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
queries = password_hash | ||
case key | ||
when String | ||
|
@@ -128,6 +138,7 @@ def add_authorized_key(key) | |
# @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 | ||
def remove_authorized_key(key) | ||
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.14.0, please use the ManageGHES client instead.') | ||
queries = password_hash | ||
case key | ||
when String | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'octokit/configurable' | ||
require 'octokit/connection' | ||
require 'octokit/warnable' | ||
require 'octokit/manage_ghes_client/manage_ghes' | ||
|
||
module Octokit | ||
# ManageGHESClient is only meant to be used by GitHub Enterprise Server (GHES) operators | ||
# and provides access to the Manage GHES API endpoints. | ||
# | ||
# @see Octokit::Client Use Octokit::Client for regular API use for GitHub | ||
# and GitHub Enterprise. | ||
# @see https://developer.github.com/v3/enterprise-admin/manage-ghes/ | ||
class ManageGHESClient | ||
include Octokit::Configurable | ||
include Octokit::Connection | ||
include Octokit::Warnable | ||
include Octokit::ManageGHESClient::ManageAPI | ||
|
||
def initialize(options = {}) | ||
# Use options passed in, but fall back to module defaults | ||
# rubocop:disable Style/HashEachMethods | ||
# | ||
# This may look like a `.keys.each` which should be replaced with `#each_key`, but | ||
# this doesn't actually work, since `#keys` is just a method we've defined ourselves. | ||
# The class doesn't fulfill the whole `Enumerable` contract. | ||
Octokit::Configurable.keys.each do |key| | ||
# rubocop:enable Style/HashEachMethods | ||
instance_variable_set(:"@#{key}", options[key] || Octokit.instance_variable_get(:"@#{key}")) | ||
end | ||
end | ||
|
||
protected | ||
|
||
def endpoint | ||
manage_ghes_endpoint | ||
end | ||
|
||
# Set Manage GHES API endpoint | ||
# | ||
# @param value [String] Manage GHES API endpoint | ||
def manage_ghes_endpoint=(value) | ||
reset_agent | ||
@manage_ghes_endpoint = value | ||
end | ||
|
||
# Set Manage GHES API username | ||
# | ||
# @param value [String] Manage GHES API username | ||
def manage_ghes_username=(value) | ||
reset_agent | ||
@manage_ghes_username = value | ||
end | ||
|
||
# Set Manage GHES API password | ||
# | ||
# @param value [String] Manage GHES API password | ||
def manage_ghes_password=(value) | ||
reset_agent | ||
@manage_ghes_password = value | ||
end | ||
end | ||
end |
Oops, something went wrong.