Skip to content

Commit

Permalink
Add scripts for ghe manage api (#179)
Browse files Browse the repository at this point in the history
* Adding ssh script for #178

* Adding get system requirements script for #178

* Adding services status script for #178

* Adding ghe-manage-v1-get-the-status-of-a-ghe-config-apply-run.sh for #178

* Adding ghe-manage-v1-get-the-status-of-services-running-on-all-cluster-nodes.sh for #178

* Adding ghe-manage-v1-list-events-from-ghe-config-apply.sh for #178

* Adding ghe-manage-v1-get-the-enterprise-license-information.sh for #178

* Adding ghe-manage-v1-check-a-license.sh for #178

* Adding ghe-manage-v1-initialize-instance-configuration-with-license-upload.sh for #178
  • Loading branch information
gm3dmo authored Nov 15, 2024
1 parent 404a132 commit 6297242
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ghe-manage-v1-check-a-license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#check-a-license
# GET /manage/v1/config/license/check


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/config/license/check"

10 changes: 10 additions & 0 deletions ghe-manage-v1-get-the-configured-ssh-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-the-configured-ssh-keys
# GET /manage/v1/access/ssh


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/access/ssh"

10 changes: 10 additions & 0 deletions ghe-manage-v1-get-the-enterprise-license-information.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-the-enterprise-license-information
# GET /manage/v1/config/license


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/config/license"

9 changes: 9 additions & 0 deletions ghe-manage-v1-get-the-status-of-a-ghe-config-apply-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-the-status-of-a-ghe-config-apply-run
# GET /manage/v1/config/apply

curl ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/config/apply"

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-the-status-of-services-running-on-all-cluster-nodes
# GET /manage/v1/cluster/status

curl ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/cluster/status"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-the-system-requirement-check-results-for-configured-cluster-nodes
# GET /manage/v1/checks/system-requirements


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/checks/system-requirements"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/[email protected]/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#initialize-instance-configuration-with-license-upload
# POST /manage/v1/config/init


if [ -z "$1" ]
then
license_file="tmp/enterprise.ghl"
else
license_file=$1
fi


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
-H "Content-Type: multipart/form-data" \
"https://${hostname}:${mgmt_port}/manage/v1/config/init" --form "license=@${license_file}"

# This fails
# "https://${hostname}:${mgmt_port}/manage/v1/config/init" --form "license=@${license_file}" --form "password=${mgmt_password}"
# The error message:
# {"error":{"message":"failed to initialize config: invalid request: password already set","request_id":"602e3c4a-4a50-4d9b-8539-f0dfe794d3b4"}}
curl: (22) The requested URL returned error: 400


10 changes: 10 additions & 0 deletions ghe-manage-v1-list-events-from-ghe-config-apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#list-events-from-ghe-config-apply
# get /manage/v1/config/apply/events


curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/config/apply/events"

2 changes: 1 addition & 1 deletion ghe-manage-v1-trigger-a-ghe-config-apply-run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server@3.14/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#trigger-a-ghe-config-apply-run
# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#trigger-a-ghe-config-apply-run
# POST /manage/v1/config/apply

curl -L ${curl_custom_flags} \
Expand Down

0 comments on commit 6297242

Please sign in to comment.