OpenAPI English gyrohosting.com ↗
Markdown olarak görClaude'da aç ↗

API anahtarları

Hizmet, eylem ya da bayi uç-müşterisiyle daraltılmış alt hesap anahtarları. Yalnız GyroAPI /cloud uçlarında geçerlidir.

#GET/cloud/keys

Alt hesap anahtarlarını listele (token göstermez)Kapsam: keyslistApiKeysBu işlemin OpenAPI parçası

Yanıtlar

200Keys — data: array<ApiKey>
403Key lacks the scope, IP not allowed, or feature disabled

Örnekler

curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/keys' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro key list
# kaynak gyro_api_key: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/api_key
# A key for the reseller's end-customer: sees only Acme's services, cannot reach billing
resource "gyro_api_key" "acme_ci" {
  name        = "acme-ci"
  customer_id = tonumber(gyro_reseller_customer.acme.id)
  scopes      = ["cloud_read", "cloud_write", "services_read", "services_write"]
  actions     = ["reboot", "poweron", "snapshots:*"]
  rate_limit  = 60
}

output "acme_token" {
  value     = gyro_api_key.acme_ci.token
  sensitive = true
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/keys", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/keys", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#POST/cloud/keys

Alt hesap anahtarı oluştur (token bir kez döner)Kapsam: keyscreateApiKeyBu işlemin OpenAPI parçası

İstek gövdesi

AlanTürAçıklama
name zorunlustring
scopesarray<string (cloud_read, cloud_write, cloud_order, cloud_delete, services_read, services_write, webhooks)>
servicesarray<integer>Optional service allow list
actionsarray<string>Optional action allow list: server actions (reboot) or tool:action / tool:* / method:name
ipsarray<string>
rate_limitintegerRequests per minute (<= your own limit; 0 = default)

Yanıtlar

201Created — data: object
403Key lacks the scope, IP not allowed, or feature disabled
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Örnekler

curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/keys' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci-reboot-only", "scopes": ["cloud_read", "cloud_write"], "services": [47466], "actions": ["reboot", "poweron"], "ips": ["203.0.113.10"], "rate_limit": 30}'
gyro key create --help    # tüm seçenekler
# kaynak gyro_api_key: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/api_key
# A key for the reseller's end-customer: sees only Acme's services, cannot reach billing
resource "gyro_api_key" "acme_ci" {
  name        = "acme-ci"
  customer_id = tonumber(gyro_reseller_customer.acme.id)
  scopes      = ["cloud_read", "cloud_write", "services_read", "services_write"]
  actions     = ["reboot", "poweron", "snapshots:*"]
  rate_limit  = 60
}

output "acme_token" {
  value     = gyro_api_key.acme_ci.token
  sensitive = true
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/keys", headers=h, json={"name": "ci-reboot-only", "scopes": ["cloud_read", "cloud_write"], "services": [47466], "actions": ["reboot", "poweron"], "ips": ["203.0.113.10"], "rate_limit": 30}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/keys", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"name": "ci-reboot-only", "scopes": ["cloud_read", "cloud_write"], "services": [47466], "actions": ["reboot", "poweron"], "ips": ["203.0.113.10"], "rate_limit": 30}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#DELETE/cloud/keys/{id}

Alt hesap anahtarını silKapsam: keysdeleteApiKeyBu işlemin OpenAPI parçası

Parametreler

AlaninTürAçıklama
id zorunlupathinteger

Yanıtlar

200Deleted
404Not found — also returned for objects owned by someone else

Örnekler

curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/keys/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro key delete 12345
# kaynak gyro_api_key: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/api_key
# A key for the reseller's end-customer: sees only Acme's services, cannot reach billing
resource "gyro_api_key" "acme_ci" {
  name        = "acme-ci"
  customer_id = tonumber(gyro_reseller_customer.acme.id)
  scopes      = ["cloud_read", "cloud_write", "services_read", "services_write"]
  actions     = ["reboot", "poweron", "snapshots:*"]
  rate_limit  = 60
}

output "acme_token" {
  value     = gyro_api_key.acme_ci.token
  sensitive = true
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/keys/12345", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/keys/12345", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);