Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Metrics/PerceivedComplexity:
# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- 'lib/octokit/enterprise_management_console_client/management_console.rb'

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
Expand All @@ -121,7 +120,6 @@ Style/Documentation:
- 'spec/**/*'
- 'test/**/*'
- 'lib/octokit/client/users.rb'
- 'lib/octokit/enterprise_management_console_client/management_console.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Expand Down Expand Up @@ -159,7 +157,6 @@ Style/IfUnlessModifier:
- 'lib/octokit/client/commits.rb'
- 'lib/octokit/client/organizations.rb'
- 'lib/octokit/client/repositories.rb'
- 'lib/octokit/enterprise_management_console_client/management_console.rb'
- 'lib/octokit/error.rb'
- 'lib/octokit/repository.rb'
- 'spec/spec_helper.rb'
Expand Down
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
10. [Working with GitHub Enterprise](#working-with-github-enterprise)
1. [Interacting with the GitHub.com APIs in GitHub Enterprise](#interacting-with-the-githubcom-apis-in-github-enterprise)
2. [Interacting with the GitHub Enterprise Admin APIs](#interacting-with-the-github-enterprise-admin-apis)
3. [Interacting with the GitHub Enterprise Management Console APIs](#interacting-with-the-github-enterprise-management-console-apis)
3. [Interacting with the GHES Manage API](#interacting-with-the-ghes-manage-api)
4. [SSL Connection Errors](#ssl-connection-errors)
11. [Configuration and defaults](#configuration-and-defaults)
1. [Configuring module defaults](#configuring-module-defaults)
Expand Down Expand Up @@ -160,7 +160,7 @@ When the API returns an error response, Octokit will raise a Ruby exception.
A range of different exceptions can be raised depending on the error returned
by the API - for example:

* A `400 Bad Request` response will lead to an `Octokit::BadRequest` error
* A `400 Bad Request` response will lead to an `Octokit::BadRequest` error
* A `403 Forbidden` error with a "rate limited exceeded" message will lead
to a `Octokit::TooManyRequests` error

Expand Down Expand Up @@ -369,26 +369,30 @@ Octokit.configure do |c|
c.access_token = "<your 40 char token>"
end

admin_client = Octokit.enterprise_admin_client.new
admin_client = Octokit.enterprise_admin_client
```

### Interacting with the GitHub Enterprise Management Console APIs
### Interacting with the GHES (GitHub Enterprise Server) Manage API

The GitHub Enterprise Management Console APIs are also under a separate client: `EnterpriseManagementConsoleClient`. In order to use it, you'll need to provide both your management console password as well as the endpoint to your management console. This is different from the API endpoint provided above.
The GHES Manage API is also under a separate client: `ManageGHESClient`. In order to use it, you'll need to provide your username and password, along with the endpoint to your ghes instance. This is different from the API endpoint provided above.

If you do not provide a username, the root site administrator account will be used.

```ruby
management_console_client = Octokit::EnterpriseManagementConsoleClient.new(
:management_console_password => "secret",
:management_console_endpoint = "https://hostname:8633"
ghes_client = Octokit::ManageGHESClient.new(
:manage_ghes_endpoint = "https://hostname:8443"
:manage_ghes_username => "username",
:manage_ghes_password => "password",
)

# or
Octokit.configure do |c|
c.management_console_endpoint = "https://hostname:8633"
c.management_console_password = "secret"
c.manage_ghes_endpoint = "https://hostname:8443"
c.manage_ghes_username => "username"
c.manage_ghes_password => "password"
end

management_console_client = Octokit.enterprise_management_console_client.new
ghes_client = Octokit.manage_ghes_client
```

### SSL Connection Errors
Expand Down Expand Up @@ -532,7 +536,11 @@ construction currently used throughout the client.

## Upgrading guide

Version 4.0
### Management Console API Removal

[In GHES 3.15, the management console API was removed](https://docs.github.com/en/[email protected]/admin/release-notes#3.15.0-retired). If you have any tooling that is using this API, you should transition to using the [Manage GHES API](#interacting-with-the-ghes-manage-api) instead.

### Version 4.0

- **removes support for a [long-deprecated overload][list-pulls] for
passing state as a positional argument** when listing pull requests. Instead,
Expand Down Expand Up @@ -706,9 +714,7 @@ Octokit:
| `OCTOKIT_TEST_GITHUB_ORGANIZATION` | Test organization. |
| `OCTOKIT_TEST_GITHUB_ENTERPRISE_LOGIN` | GitHub Enterprise login name. |
| `OCTOKIT_TEST_GITHUB_ENTERPRISE_TOKEN` | GitHub Enterprise token. |
| `OCTOKIT_TEST_GITHUB_ENTERPRISE_MANAGEMENT_CONSOLE_PASSWORD` | GitHub Enterprise management console password. |
| `OCTOKIT_TEST_GITHUB_ENTERPRISE_ENDPOINT` | GitHub Enterprise hostname. |
| `OCTOKIT_TEST_GITHUB_ENTERPRISE_MANAGEMENT_CONSOLE_ENDPOINT` | GitHub Enterprise Management Console endpoint. |
| `OCTOKIT_TEST_GITHUB_MANAGE_GHES_ENDPOINT` | GitHub Enterprise Server GHES Manage Endpoint. |
| `OCTOKIT_TEST_GITHUB_MANAGE_GHES_USERNAME` | GitHub Enterprise Server GHES Manage Username. |
| `OCTOKIT_TEST_GITHUB_MANAGE_GHES_PASSWORD` | GitHub Enterprise Server GHES Manage Password. |
Expand Down
15 changes: 0 additions & 15 deletions lib/octokit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'octokit/default'
require 'octokit/client'
require 'octokit/enterprise_admin_client'
require 'octokit/enterprise_management_console_client'
require 'octokit/manage_ghes_client'

# Ruby toolkit for the GitHub API
Expand Down Expand Up @@ -31,17 +30,6 @@ def enterprise_admin_client
@enterprise_admin_client = Octokit::EnterpriseAdminClient.new(options)
end

# EnterpriseManagementConsoleClient client based on configured options {Configurable}
#
# @return [Octokit::EnterpriseManagementConsoleClient] API wrapper
def enterprise_management_console_client
if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options)
return @enterprise_management_console_client
end

@enterprise_management_console_client = Octokit::EnterpriseManagementConsoleClient.new(options)
end

# ManageGHESClient client based on configured options {Configurable}
#
# @return [Octokit::ManageGHESClient] API wrapper
Expand All @@ -58,7 +46,6 @@ def manage_ghes_client
def respond_to_missing?(method_name, include_private = false)
client.respond_to?(method_name, include_private) ||
enterprise_admin_client.respond_to?(method_name, include_private) ||
enterprise_management_console_client.respond_to?(method_name, include_private) ||
manage_ghes_client.respond_to?(method_name, include_private)
end

Expand All @@ -67,8 +54,6 @@ def method_missing(method_name, *args, &block)
return client.send(method_name, *args, &block)
elsif enterprise_admin_client.respond_to?(method_name)
return enterprise_admin_client.send(method_name, *args, &block)
elsif enterprise_management_console_client.respond_to?(method_name)
return enterprise_management_console_client.send(method_name, *args, &block)
elsif manage_ghes_client.respond_to?(method_name)
return manage_ghes_client.send(method_name, *args, &block)
end
Expand Down
3 changes: 0 additions & 3 deletions lib/octokit/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ def inspect

# mask password
inspected.gsub! @password, '*******' if @password
if @management_console_password
inspected.gsub! @management_console_password, '*******'
end
inspected.gsub! @bearer_token, '********' if @bearer_token
# Only show last 4 of token, secret
if @access_token
Expand Down
11 changes: 0 additions & 11 deletions lib/octokit/configurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ module Configurable
# @return [Hash] Configure connection options for Faraday
# @!attribute login
# @return [String] GitHub username for Basic Authentication
# @!attribute management_console_password
# @return [String] An admin password set up for your GitHub Enterprise management console
# @!attribute management_console_endpoint
# @return [String] Base URL for API requests to the GitHub Enterprise management console
# @!attribute manage_ghes_endpoint
# @return [String] Base URL for API requests to the GitHub Enterprise Server Manage API
# @!attribute manage_ghes_username
Expand Down Expand Up @@ -65,7 +61,6 @@ module Configurable
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :ssl_verify_mode, :user_agent
attr_writer :password, :web_endpoint, :api_endpoint, :login,
:management_console_endpoint, :management_console_password,
:manage_ghes_endpoint,
:manage_ghes_username,
:manage_ghes_password
Expand All @@ -84,8 +79,6 @@ def keys
connection_options
default_media_type
login
management_console_endpoint
management_console_password
manage_ghes_endpoint
manage_ghes_username
manage_ghes_password
Expand Down Expand Up @@ -134,10 +127,6 @@ def api_endpoint
File.join(@api_endpoint, '')
end

def management_console_endpoint
File.join(@management_console_endpoint, '')
end

def manage_ghes_endpoint
File.join(@manage_ghes_endpoint, '')
end
Expand Down
12 changes: 0 additions & 12 deletions lib/octokit/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ def client_secret
ENV.fetch('OCTOKIT_SECRET', nil)
end

# Default management console password from ENV
# @return [String]
def management_console_password
ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_PASSWORD', nil)
end

# Default management console endpoint from ENV
# @return [String]
def management_console_endpoint
ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_ENDPOINT', nil)
end

# Default GHES Manage API endpoint from ENV
# @return [String]
def manage_ghes_endpoint
Expand Down
56 changes: 0 additions & 56 deletions lib/octokit/enterprise_management_console_client.rb

This file was deleted.

Loading
Loading