Конечные точки REST API для управления GitHub Enterprise Server
Используйте REST API для управления экземпляром GitHub Enterprise Server.
Сведения об API управления данными GitHub Enterprise Server
Вы можете управлять ваш экземпляр GitHub Enterprise Server с помощью API управления GitHub Enterprise Server . Например, можно получить сведения о версии программного обеспечения GitHub Enterprise Server на экземпляре или на экземплярах с несколькими узлами, просмотреть состояние репликации.
Tip
Этот API можно использовать для замены функциональности API консоли управления, которая была удалена в GitHub Enterprise Server версии 3.15. Сопоставление между конечными точками см. в статье "Конечные точки REST API для консоли управления" версии 3.14 документации.{ % else %}"Конечные точки REST API для консоли управления".
Укажите номер порта при вызове API конечных точек для API Управления api GitHub Enterprise Server API. Если экземпляр использует TLS, номер порта равен 8443. В противном случае номер порта равен 8080. Если вы не можете указать номер порта, необходимо настроить клиент для автоматического выполнения перенаправлений. Дополнительные сведения см. в разделе Настройка TLS.
Можно также использовать расширение {variables.product.prodname_cli% данных variables.product.prodname_ghe_server %} для вызова конечных точек в API управления GitHub Enterprise Server. Дополнительные сведения см. в репозитории github/gh-es
.
Проверка подлинности
Чтобы проверить подлинность запросов к конечным точкам для API управления GitHub Enterprise Server укажите пароль для учетной записи администратора корневого сайта экземпляра в качестве маркера проверки подлинности. Используйте стандартную проверку подлинности HTTP для отправки пароля. Пользователь api_key
определяет корневого администратора сайта. В следующем примере показана проверка подлинности для этого API. Замените ROOT-SITE-ADMINISTRATOR-PASSWORD паролем и ADMINISTRATION-PORT либо 8443, либо 8080.
curl -L -u "api_key:ROOT-SITE-ADMINISTRATOR-PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage'
Проверка подлинности в качестве пользователя Консоль управления
Учетные записи пользователей Консоль управления также могут проходить проверку подлинности для доступа к этим конечным точкам. Дополнительные сведения см. в разделе Управление доступом к консоли управления.
Для проверки подлинности с помощью пароля для учетной записи пользователя Консоль управления используйте стандартную проверку подлинности HTTP. В следующем примере замените YOUR_USER_NAME и YOUR_PASSWORD именем пользователя и паролем учетной записи.
curl -L -u "YOUR_USER_NAME:YOUR_PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage'
Параметры запроса
По умолчанию ответ содержит сведения обо всех настроенных узлах для экземпляра. В экземпляре с несколькими узлами данные, полученные из /data/user/common/cluster.conf
. Чтобы отфильтровать ответ по конкретным узлам, можно использовать следующие параметры запроса.
Параметр запроса | Description |
---|---|
uuid | Уникальный идентификатор узла. |
cluster_role | Для узлов в кластере роли, которые применяются к узлу. Дополнительные сведения см. в разделе "[AUTOTITLE)(/admin/enterprise-management/configuring-clustering/about-cluster-nodes)." |
Можно указать несколько значений для параметра запроса, разделив значения запятой. Например, следующий запрос использует curl для возврата всех узлов с web-server
ролью или storage-server
ролью.
curl -L -u "api_key:ROOT-SITE-ADMINISTRATOR-PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage/v1/config/nodes?cluster_role=WebServer,StorageServer'
Get the configured SSH keys
Gets the configured SSH keys on all available nodes. For more information, see "Accessing the administrative shell (SSH)."
Коды состояния http-ответа для "Get the configured SSH keys"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
Примеры кода для "Get the configured SSH keys"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/access/ssh
Response
Status: 200
[
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCwcd9tu20xsJVBMWbIs+JDVQTvkLtrJ8A7eblSwC+zECver22QExC9d6zHy10MAyk1Ck7Bu6/0Z+rr/31vMcAOmNOLjExzWxBCXbtDf3758Qfw7FuvkaTE1sHztwSFi/yNhZSw7uPEWeGQiRY4UldSKG9zZvrZmxpnP8mNZzPriQ==",
"fingeprint": "bd:26:d3:a2:ad:97:c0:7c:2d:57:a4:64:f3:fb:44:45"
},
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCg73sgCdLL9rWcmVTmvcOgAWZaokZTeNnMFEoaZWZcVtsP4Ed+ICuSbT1wDuyL/XXzr0O2u2bKwx8Np/3UGHb4R9Re+qiz//l5OCBd3KonO2GFICQwKGmVeZ+ki89aN2JDKgfemHbvclHYBD/r56lnbt/kinw7JqGPp+ndzH8nBw==",
"fingeprint": "e1:1e:a0:f1:3f:a9:70:2d:99:dd:02:9d:39:1c:8b:a4"
}
]
Set a new SSH key
Adds a SSH key to the authorized_keys
file for your GitHub Enterprise Server instance. This will grant access via SSH to your instance. For more information, see "Accessing the administrative shell (SSH)."
Параметры для "Set a new SSH key"
Имя., Тип, Description |
---|
key string Обязательное полеThe public SSH key to add to the |
Коды состояния http-ответа для "Set a new SSH key"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Set a new SSH key"
Пример запроса
curl -L \
-X POST \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/access/ssh \
-d '{"key":"ssh-rsa AAAAB3NzaC1yc2EAAAADCIABAAAAgQCY/ZiDDOFWcZnYXPwMbvwQDofXPdHxLfxPK+HWGVPd1DLcDncYBUSB0bmCU2g9Sc+oHKLoHhXp0ivau9h+EpmQJ7V8vqsRdD9pc4aL/WAnUyF4o3Y7xL94rlRpVbVo/tNjzcvqxxyzBiYyy3GciCMpYQh/uKt56B94/5PNyIGEEw=="}'
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"message": "SSH key added successfully",
"modified": true
}
]
Delete a SSH key
Deletes a SSH key from the authorized_keys
file for your GitHub Enterprise Server instance. This will remove access via SSH to your instance. For more information, see "Accessing the administrative shell (SSH)."
Параметры для "Delete a SSH key"
Имя., Тип, Description |
---|
key string Обязательное полеThe public SSH key to remove from the |
Коды состояния http-ответа для "Delete a SSH key"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Delete a SSH key"
Пример запроса
curl -L \
-X DELETE \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/access/ssh \
-d '{"key":"ssh-rsa AAAAB3NzaC1yc2EAAAADCIABAAAAgQCY/ZiDDOFWcZnYXPwMbvwQDofXPdHxLfxPK+HWGVPd1DLcDncYBUSB0bmCU2g9Sc+oHKLoHhXp0ivau9h+EpmQJ7V8vqsRdD9pc4aL/WAnUyF4o3Y7xL94rlRpVbVo/tNjzcvqxxyzBiYyy3GciCMpYQh/uKt56B94/5PNyIGEEw=="}'
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"message": "SSH key removed successfully"
}
]
Get the system requirement check results for configured cluster nodes
Checks if the minimum requirements for system hardware resources are met on each configured cluster node. This endpoint may take several seconds to reply.
Коды состояния http-ответа для "Get the system requirement check results for configured cluster nodes"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
500 | Internal error |
Примеры кода для "Get the system requirement check results for configured cluster nodes"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/checks/system-requirements
Response
Status: 200
{
"status": "OK",
"nodes": [
{
"hostname": "ghe-local-app",
"status": "OK",
"roles_status": [
{
"status": "OK",
"role": "ConsulServer"
},
{
"status": "OK",
"role": "JobServer"
},
{
"status": "OK",
"role": "WebServer"
}
]
},
{
"hostname": "ghe-local-app2",
"status": "OK",
"roles_status": [
{
"status": "OK",
"role": "ConsulServer"
},
{
"status": "OK",
"role": "GitServer"
}
]
}
]
}
Get the status of services running on all cluster nodes
Gets the status of all services running on each cluster node. This endpoint may take several seconds to reply.
Коды состояния http-ответа для "Get the status of services running on all cluster nodes"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get the status of services running on all cluster nodes"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/cluster/status
Response
Status: 200
{
"status": "OK",
"nodes": [
{
"hostname": "ghe-local-app",
"status": "OK",
"services": [
{
"status": "OK",
"name": "es",
"details": "Elasticsearch cluster is in sync (0 shards initializing, 0 shards unassigned)"
},
{
"status": "OK",
"name": "git-replication",
"details": "Git replication is in sync"
},
{
"status": "OK",
"name": "kafka-lite-admin-healthcheck",
"details": ""
},
{
"status": "OK",
"name": "kafka-lite-broker-is-reachable",
"details": ""
},
{
"status": "OK",
"name": "memcache",
"details": ""
},
{
"status": "OK",
"name": "metrics",
"details": ""
},
{
"status": "OK",
"name": "mysql-replication",
"details": "Replication is running"
},
{
"status": "OK",
"name": "mysql-failover",
"details": ""
},
{
"status": "OK",
"name": "pages",
"details": "Pages replication is in sync"
},
{
"status": "OK",
"name": "redis",
"details": "Redis is OK"
},
{
"status": "OK",
"name": "storage",
"details": "Storage replication is in sync"
}
]
},
{
"hostname": "ghe-local-app2",
"status": "OK",
"services": [
{
"status": "OK",
"name": "kafka-lite-admin-healthcheck",
"details": ""
},
{
"status": "OK",
"name": "kafka-lite-broker-is-reachable",
"details": ""
}
]
}
]
}
Get the status of a ghe-config-apply run
Displays the current status of ghe-config-apply
in the environment or the status of a historical run by ID.
Параметры для "Get the status of a ghe-config-apply run"
Имя., Тип, Description |
---|
run_id string The unique run ID of the |
Коды состояния http-ответа для "Get the status of a ghe-config-apply run"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
Примеры кода для "Get the status of a ghe-config-apply run"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/apply
Response
Status: 200
{
"running": true,
"successful": false,
"nodes": [
{
"run_id": "d34db33f",
"hostname": "ghes-01.lan",
"running": true,
"successful": false
}
]
}
Trigger a ghe-config-apply run
Triggers a run of ghe-config-apply
from the ghes-manage
agent on your Nomad Delegate instance.
You can provide a run ID or allow one to be generated randomly.
Параметры для "Trigger a ghe-config-apply run"
Имя., Тип, Description |
---|
run_id string The run ID to execute |
Коды состояния http-ответа для "Trigger a ghe-config-apply run"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
Примеры кода для "Trigger a ghe-config-apply run"
Пример запроса
curl -L \
-X POST \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/apply \
-d '{"run_id":"d34db33f"}'
Response
Status: 200
{
"run_id": "d34db33f"
}
List events from ghe-config-apply
Lists events from an in-process ghe-config-apply
run on your Github Enterprise Server instance.
Параметры для "List events from ghe-config-apply"
Имя., Тип, Description |
---|
last_request_id string The unique ID of the last response from a host, used for pagination. |
Коды состояния http-ответа для "List events from ghe-config-apply"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
Примеры кода для "List events from ghe-config-apply"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/apply/events
Response
Status: 200
{
"nodes": [
{
"node": "ghes-01.lan",
"last_request_id": "387cd628c06d606700e79be368e5e574:0cde553750689c76:0000000000000000",
"events": [
{
"timestamp": "2023-01-01T13:00:00+00:00",
"severity_text": "INFO",
"body": "Validating services",
"event_name": "Enterprise::ConfigApply::PhaseValidation#config_phase_validation",
"topology": "multinode",
"hostname": "ghes-01.lan",
"config_run_id": "d34db33f",
"trace_id": "387cd628c06d606700e79be368e5e574",
"span_id": "0cde553750689c76",
"span_parent_id": 0,
"span_depth": 0
}
]
}
]
}
Initialize instance configuration with license upload
When you boot a GitHub instance for the first time, you can use this endpoint to upload a license.
Note that you afterwards need to POST
to /manage/v1/config/apply
to start the actual configuration process.
This endpoint also sets the root site administrator password which is used to authenticate with the GHES Manage API and the Management Console.
Note
The request body for this operation must be submitted as multipart/form-data
data. You can can reference the license file by prefixing the filename with the @
symbol using curl
. For more information, see the curl
documentation.
Параметры для "Initialize instance configuration with license upload"
Имя., Тип, Description |
---|
license string Обязательное полеThe content of your .ghl license file. |
password string Обязательное полеThe root site administrator password. |
Коды состояния http-ответа для "Initialize instance configuration with license upload"
Код состояния | Описание |
---|---|
202 | Accepted |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Initialize instance configuration with license upload"
Пример запроса
curl -L \
-X POST \
-u "api_key:your-password" \
-H "Content-Type: multipart/form-data" \
http(s)://HOSTNAME/manage/v1/config/init \
--form 'license=@enterprise.ghl' --form 'password=secret-password!'
Response
Status: 202
Get the enterprise license information
Gets information about the license that is currently set for the enterprise.
Коды состояния http-ответа для "Get the enterprise license information"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get the enterprise license information"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/license
Response
Status: 200
[
{
"advancedSecurityEnabled": true,
"advancedSecuritySeats": 0,
"clusterSupport": false,
"company": "GitHub",
"croquetSupport": true,
"customTerms": true,
"evaluation": false,
"expireAt": "2025-01-02T07:59:59Z",
"insightsEnabled": true,
"insightsExpireAt": "2025-01-02T07:59:59.999Z",
"learningLabEvaluationExpires": "2023-01-02T07:59:59Z",
"learningLabSeats": 100,
"perpetual": false,
"referenceNumber": "32a145",
"seats": 0,
"sshAllowed": true,
"supportKey\"": "",
"unlimitedSeating": true
}
]
Upload an enterprise license
Uploads an enterprise license. This operation does not automatically activate the license.
Note
The request body for this operation must be submitted as multipart/form-data
data. You can can reference the license file by prefixing the filename with the @
symbol using curl
. For more information, see the curl
documentation.
Параметры для "Upload an enterprise license"
Имя., Тип, Description |
---|
apply boolean Whether to apply changes from the license. Uploading a license does not automatically apply changes. To make the changes effective, you can specify to apply the license too. |
Имя., Тип, Description |
---|
license string Обязательное полеThe content of your .ghl license file. |
Коды состояния http-ответа для "Upload an enterprise license"
Код состояния | Описание |
---|---|
201 | Created |
202 | Accepted |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Upload an enterprise license"
Примеры запросов
curl -L \
-X PUT \
-u "api_key:your-password" \
-H "Content-Type: multipart/form-data" \
http(s)://HOSTNAME/manage/v1/config/license \
--form 'license=@enterprise.ghl'
Created
Status: 201
Check a license
Check the status of the license that is currently set for the enterprise.
Коды состояния http-ответа для "Check a license"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Check a license"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/license/check
Response
Status: 200
[
{
"status": "valid"
}
]
Get GHES node metadata for all nodes
Get node metadata for all configured nodes in the current cluster. For more information, see "About clustering."
Параметры для "Get GHES node metadata for all nodes"
Имя., Тип, Description |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
Коды состояния http-ответа для "Get GHES node metadata for all nodes"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get GHES node metadata for all nodes"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/nodes
Response
Status: 200
{
"topology": "Cluster",
"nodes": [
{
"hostname": "data1",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"cluster_roles": [
"ConsulServer",
"ElasticsearchServer",
"GitServer",
"StorageServer"
]
},
{
"hostname": "data2",
"uuid": "228406d4-f97c-11ed-ab01-062281bbcf03",
"cluster_roles": [
"ElasticsearchServer",
"StorageServer",
"PagesServer"
]
}
]
}
Get the GHES settings
Gets a list of settings for a GitHub Enterprise Server instance.
Коды состояния http-ответа для "Get the GHES settings"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
Примеры кода для "Get the GHES settings"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/settings
Response
Status: 200
{
"private_mode": false,
"public_pages": false,
"subdomain_isolation": true,
"signup_enabled": false,
"github_hostname": "ghe.local",
"identicons_host": "dotcom",
"http_proxy": null,
"auth_mode": "default",
"expire_sessions": false,
"admin_password": null,
"configuration_id": 1401777404,
"configuration_run_count": 4,
"avatar": {
"enabled": false,
"uri": ""
},
"customer": {
"name": "GitHub",
"email": "stannis@themannis.biz",
"uuid": "af6cac80-e4e1-012e-d822-1231380e52e9",
"secret_key_data": "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nlQcYBE5TCgsBEACk4yHpUcapplebaumBMXYMiLF+nCQ0lxpx...\n-----END PGP PRIVATE KEY BLOCK-----\n",
"public_key_data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nmI0ETqzZYgEEALSe6snowdenXyqvLfSQ34HWD6C7....\n-----END PGP PUBLIC KEY BLOCK-----\n"
},
"license": {
"seats": 0,
"evaluation": false,
"perpetual": false,
"unlimited_seating": true,
"support_key": "ssh-rsa AAAAB3N....",
"ssh_allowed": true,
"cluster_support": false,
"expire_at": "2016-04-27T00:00:00-07:00"
},
"github_ssl": {
"enabled": false,
"cert": null,
"key": null
},
"ldap": {
"host": null,
"port": 0,
"base": [],
"uid": null,
"bind_dn": null,
"password": null,
"method": "Plain",
"search_strategy": "detect",
"user_groups": [],
"admin_group": null,
"virtual_attribute_enabled": false,
"recursive_group_search": false,
"posix_support": true,
"user_sync_emails": false,
"user_sync_keys": false,
"user_sync_interval": 4,
"team_sync_interval": 4,
"sync_enabled": false,
"reconciliation": {
"user": null,
"org": null
},
"profile": {
"uid": "uid",
"name": null,
"mail": null,
"key": null
}
},
"cas": {
"url": null
},
"saml": {
"sso_url": null,
"certificate": null,
"certificate_path": null,
"issuer": null,
"idp_initiated_sso": false,
"disable_admin_demote": false
},
"github_oauth": {
"client_id": "12313412",
"client_secret": "kj123131132",
"organization_name": "Homestar Runners",
"organization_team": "homestarrunners/characters"
},
"smtp": {
"enabled": true,
"address": "smtp.example.com",
"authentication": "plain",
"port": "1234",
"domain": "blah",
"username": "foo",
"user_name": "mr_foo",
"enable_starttls_auto": true,
"password": "bar",
"discard-to-noreply-address": true,
"support_address": "enterprise@github.com",
"support_address_type": "email",
"noreply_address": "noreply@github.com"
},
"ntp": {
"primary_server": "0.pool.ntp.org",
"secondary_server": "1.pool.ntp.org"
},
"timezone": null,
"snmp": {
"enabled": false,
"community": ""
},
"syslog": {
"enabled": false,
"server": null,
"protocol_name": "udp"
},
"assets": null,
"pages": {
"enabled": true
},
"collectd": {
"enabled": false,
"server": null,
"port": 0,
"encryption": null,
"username": null,
"password": null
},
"mapping": {
"enabled": true,
"tileserver": null,
"basemap": "company.map-qsz2zrvs",
"token": null
},
"load_balancer": null
}
Set settings
Updates the settings on your instance. For a list of the available settings, see the Get settings endpoint.
Notes:
- The request body only requires the settings parameters that should be updated to be specified, all other parameters will be unmodified or populated from the default values.
- You cannot set the Management Console root site administrator password with this API endpoint. Use the
ghe-set-password
utility to change the management console password. For more information, see "Command-line utilities."
Коды состояния http-ответа для "Set settings"
Код состояния | Описание |
---|---|
204 | No Content |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Set settings"
Пример запроса
curl -L \
-X PUT \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/settings \
-d '{"public_pages":true}'
Response
Status: 204
Get the status of maintenance mode
Gets the status and details of maintenance mode on all available nodes. For more information, see "Enabling and scheduling maintenance mode."
Параметры для "Get the status of maintenance mode"
Имя., Тип, Description |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
Коды состояния http-ответа для "Get the status of maintenance mode"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get the status of maintenance mode"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/maintenance
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"status": "scheduled",
"scheduled_time": "2006-01-02T15:04:05+00:00",
"connection_services": [
{
"name": "git operations",
"number": 15
},
{
"name": "mysql queries",
"number": 6
},
{
"name": "resque jobs",
"number": 10
},
{
"name": "aqueduct jobs",
"number": 0
}
],
"can_unset_maintenance": true,
"ip_exception_list": [
"1.1.1.1"
],
"maintenance_mode_message": "Scheduled maintenance for upgrading."
}
]
Set the status of maintenance mode
Sets or schedules the maintenance mode. For more information, see "Enabling and scheduling maintenance mode."
Параметры для "Set the status of maintenance mode"
Имя., Тип, Description |
---|
enabled boolean Обязательное полеWhether to enable maintenance mode. |
uuid string The UUID of the node to target. This parameter is incompatible with maintenance mode scheduling. Only use |
when string The time to enable maintenance mode. If this parameter is empty or set to |
ip_exception_list array of strings The list of IP addresses to exclude from maintenance mode. IPv4, IPv6, and CIDR addresses are supported. |
maintenance_mode_message string The message to display to users when maintenance mode is enabled. |
Коды состояния http-ответа для "Set the status of maintenance mode"
Код состояния | Описание |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Set the status of maintenance mode"
Пример запроса
curl -L \
-X POST \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/maintenance \
-d '{"enabled":true,"when":"2006-01-02T15:04:05+00:00","ip_exception_list":["192.168.1.0/24","1.1.1.1"]}'
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"message": "maintenance mode scheduled with exception list [1.1.1.1]"
}
]
Get the status of services running on all replica nodes
Gets the status of all services running on each replica node. This endpoint may take several seconds to reply.
Параметры для "Get the status of services running on all replica nodes"
Имя., Тип, Description |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
Коды состояния http-ответа для "Get the status of services running on all replica nodes"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get the status of services running on all replica nodes"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/replication/status
Response
Status: 200
{
"status": "OK",
"nodes": [
{
"hostname": "ghe-local-primary",
"status": "OK",
"services": []
},
{
"hostname": "ghe-local-replica",
"status": "OK",
"services": [
{
"status": "OK",
"name": "redis",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "elasticsearch",
"details": "cluster is in sync (0 shards initializing, 0 shards unassigned)"
},
{
"status": "OK",
"name": "git",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "pages",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "alambic",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "git-hooks",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "consul",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "mysql",
"details": "replication is in sync"
}
]
}
]
}
Get all GHES release versions for all nodes
Gets the GitHub Enterprise Server release versions that are currently installed on all available nodes. For more information, see "GitHub Enterprise Server releases."
Параметры для "Get all GHES release versions for all nodes"
Имя., Тип, Description |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
Коды состояния http-ответа для "Get all GHES release versions for all nodes"
Код состояния | Описание |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
Примеры кода для "Get all GHES release versions for all nodes"
Пример запроса
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/version
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"version": {
"version": "3.9.0",
"platform": "azure",
"build_id": "fc542058b5",
"build_date": "2023-05-02"
}
}
]