Skip to content

Commit

Permalink
Adding ghe-manage-v1-upload-an-enterprise-license.sh for #178 (#180)
Browse files Browse the repository at this point in the history
* Adding ghe-manage-v1-upload-an-enterprise-license.sh for #178

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

* Adding ghe-manage-v1-get-ghes-node-metadata-for-all-nodes.sh for #178

* Adding ghe-manage-v1-get-the-ghes-settings.sh for #178

* Fixing 3.14 and adding ghe-manage-v1-get-the-status-of-maintenance-mode.sh

* Adding ghe-manage-v1-set-the-status-of-maintenance-mode.sh for #178

* Adding 	ghe-manage-v1-get-all-ghes-release-versions-for-all-nodes.sh for #178
  • Loading branch information
gm3dmo authored Nov 15, 2024
1 parent 6297242 commit 896a25a
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ghe-manage-v1-check-a-license.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/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#check-a-license
# 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


Expand Down
10 changes: 10 additions & 0 deletions ghe-manage-v1-get-all-ghes-release-versions-for-all-nodes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/[email protected]/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#get-all-ghes-release-versions-for-all-nodes
# GET /manage/v1/version


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

10 changes: 10 additions & 0 deletions ghe-manage-v1-get-ghes-node-metadata-for-all-nodes.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-ghes-node-metadata-for-all-nodes
# GET /manage/v1/config/nodes


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

10 changes: 10 additions & 0 deletions ghe-manage-v1-get-the-ghes-settings.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-ghes-settings
# GET /manage/v1/config/settings


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

10 changes: 10 additions & 0 deletions ghe-manage-v1-get-the-status-of-maintenance-mode.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-status-of-maintenance-mode
# GET /manage/v1/maintenance


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

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#initialize-instance-configuration-with-license-upload
# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#initialize-instance-configuration-with-license-upload
# POST /manage/v1/config/init


Expand Down
27 changes: 27 additions & 0 deletions ghe-manage-v1-set-the-status-of-maintenance-mode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/manage-ghes?apiVersion=2022-11-28#set-the-status-of-maintenance-mode
# POST /manage/v1/maintenance


json_file=tmp/set-the-status-of-maintenance-mode.json

enabled=false

jq -n \
--argjson enabled "${enabled}" \
'{
enabled : $enabled
}' > ${json_file}


echo json file being submitted:
echo

cat ${json_file} | jq -r

set -x
curl -L ${curl_custom_flags} \
-u "api_key:${mgmt_password}" \
"https://${hostname}:${mgmt_port}/manage/v1/maintenance" --data @${json_file}

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

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

# Note the documentation says: Uploads an enterprise license. This operation does not automatically activate the license.


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


apply=true

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

0 comments on commit 896a25a

Please sign in to comment.