OpenAPI Türkçe gyrohosting.com ↗

Security groups

Reusable allow lists (AWS security group model) for servers with the network firewall add-on. Up to 5 groups per server, evaluated after Gyro rules and your advanced ordered rules; with groups and no advanced rules inbound traffic is denied by default. Rules count against the server's rule allowance. A change that could cut SSH/RDP access runs as a 5 minute trial: confirm it.

#GET/cloud/security-groups

List security groupsScope: cloud_readlistSecurityGroupsOpenAPI for this operation

Responses

200Groups — data: array<SecurityGroup>
401Missing, invalid or revoked key

Examples

curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group list
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/security-groups", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups", {
  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/security-groups

Create a security groupScope: cloud_writecreateSecurityGroupOpenAPI for this operation

Name unique per account (2-64 characters). Without rules the group has one outbound rule (all traffic) and no inbound rule.

Request body

FieldTypeDescription
name requiredstring
descriptionstring
rulesarray<SecurityGroupRule>

Responses

201Created — data: SecurityGroup
401Missing, invalid or revoked key
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "string", "description": "string", "rules": [{"id": "string", "direction": "in", "type": "ssh", "protocol": "tcp", "port": "8080", "source": ["203.0.113.10/32"], "description": "string"}]}'
gyro security-group create --help    # all flags
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/security-groups", headers=h, json={"name": "string", "description": "string", "rules": [{"id": "string", "direction": "in", "type": "ssh", "protocol": "tcp", "port": "8080", "source": ["203.0.113.10/32"], "description": "string"}]}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"name": "string", "description": "string", "rules": [{"id": "string", "direction": "in", "type": "ssh", "protocol": "tcp", "port": "8080", "source": ["203.0.113.10/32"], "description": "string"}]}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#GET/cloud/security-groups/{sg}

Get a security groupScope: cloud_readgetSecurityGroupOpenAPI for this operation

Parameters

FieldinTypeDescription
sg requiredpathstring

Responses

200Group — data: SecurityGroup
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else

Examples

curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group get
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", {
  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}`);

#PATCH/cloud/security-groups/{sg}

Rename / describe a security groupScope: cloud_writeupdateSecurityGroupOpenAPI for this operation

Only the display name and description change; the group id and its rules stay.

Parameters

FieldinTypeDescription
sg requiredpathstring

Request body

FieldTypeDescription
namestring
descriptionstring

Responses

200Group — data: SecurityGroup
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X PATCH 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "string", "description": "string"}'
gyro security-group update --help    # all flags
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.patch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", headers=h, json={"name": "string", "description": "string"}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", {
  method: "PATCH",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"name": "string", "description": "string"}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#DELETE/cloud/security-groups/{sg}

Delete a security groupScope: cloud_writedeleteSecurityGroupOpenAPI for this operation

Only a group that is attached to no server (422 err_sg_attached).

Parameters

FieldinTypeDescription
sg requiredpathstring

Responses

200Deleted — data: object
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group delete
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1", {
  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}`);

#PUT/cloud/security-groups/{sg}/rules

Replace the rules of a security groupScope: cloud_writeputSecurityGroupRulesOpenAPI for this operation

Full replace (inbound + outbound), max 60 rules. Applied to every attached server. If the change removes or narrows SSH (22) / RDP (3389) access for any source on an attached server, or cuts the calling address, it runs as a 5 minute trial (trial: true, trial_seconds_left) - the same rule as the panel, CLI and Terraform: confirm with POST .../confirm, otherwise the previous rules return. A server's rules (own + all attached groups) must fit its allowance (422 err_sg_quota).

Parameters

FieldinTypeDescription
sg requiredpathstring

Request body

FieldTypeDescription
rules requiredarray<SecurityGroupRule>

Responses

200Group (trial, corrections) — data: SecurityGroup
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X PUT 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1/rules' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"rules": [{"type": "https", "source": ["0.0.0.0/0"]}, {"type": "ssh", "source": ["203.0.113.10/32"], "description": "office"}, {"direction": "out", "type": "all", "source": ["0.0.0.0/0"]}]}'
gyro security-group rules set --help    # all flags
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.put("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1/rules", headers=h, json={"rules": [{"type": "https", "source": ["0.0.0.0/0"]}, {"type": "ssh", "source": ["203.0.113.10/32"], "description": "office"}, {"direction": "out", "type": "all", "source": ["0.0.0.0/0"]}]}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1/rules", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"rules": [{"type": "https", "source": ["0.0.0.0/0"]}, {"type": "ssh", "source": ["203.0.113.10/32"], "description": "office"}, {"direction": "out", "type": "all", "source": ["0.0.0.0/0"]}]}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#POST/cloud/security-groups/{sg}/confirm

Make the running rule trial permanentScope: cloud_writeconfirmSecurityGroupOpenAPI for this operation

Parameters

FieldinTypeDescription
sg requiredpathstring

Responses

200Group — data: SecurityGroup
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/security-groups/1/confirm' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group confirm
# resource gyro_security_group: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/security_group
# Reusable allow lists (AWS security group model). Stateful: replies to allowed connections pass automatically.
resource "gyro_security_group" "web" {
  name        = "web"
  description = "HTTP/HTTPS for everyone"

  rule {
    type = "http"
  }
  rule {
    type = "https"
  }
}

resource "gyro_security_group" "admin" {
  name = "admin"

  rule {
    type        = "ssh"
    source      = ["203.0.113.10/32"]
    description = "office"
  }
  rule {
    type   = "custom_tcp"
    port   = "8000-8100"
    source = ["198.51.100.0/24"]
  }
  # outbound: a group without outbound rules does not restrict outbound traffic
  rule {
    direction = "out"
    type      = "all"
  }
}
import os, uuid, requests

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

#GET/cloud/servers/{id}/security-groups

Security groups attached to a serverScope: cloud_readlistServerSecurityGroupsOpenAPI for this operation

Parameters

FieldinTypeDescription
id requiredpathintegerServer id (= service id in the client area)

Responses

200Attached groups — data: ServerSecurityGroups
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
409firewall_not_enabled

Examples

curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group server list 12345
# resource gyro_server_security_groups: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_security_groups
# Attach both groups to a server (order = evaluation order, max 5). Without gyro_firewall rules, inbound traffic
# that no group allows is denied.
resource "gyro_server_security_groups" "web1" {
  server_id          = 1234
  security_group_ids = [gyro_security_group.web.id, gyro_security_group.admin.id]
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups", {
  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}`);

#PUT/cloud/servers/{id}/security-groups

Set the exact list of attached groupsScope: cloud_writesetServerSecurityGroupsOpenAPI for this operation

Attaches / detaches in one change (order = evaluation order, max 5). Answers 422 err_busy while the previous change of the server is being applied: retry after a few seconds.

Parameters

FieldinTypeDescription
id requiredpathintegerServer id (= service id in the client area)

Request body

FieldTypeDescription
security_groups requiredarray<string>

Responses

200Attached groups — data: ServerSecurityGroups
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
409firewall_not_enabled
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X PUT 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"security_groups": ["string"]}'
gyro security-group server set 12345 --help    # all flags
# resource gyro_server_security_groups: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_security_groups
# Attach both groups to a server (order = evaluation order, max 5). Without gyro_firewall rules, inbound traffic
# that no group allows is denied.
resource "gyro_server_security_groups" "web1" {
  server_id          = 1234
  security_group_ids = [gyro_security_group.web.id, gyro_security_group.admin.id]
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.put("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups", headers=h, json={"security_groups": ["string"]}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"security_groups": ["string"]}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);

#POST/cloud/servers/{id}/security-groups/{sg}

Attach a security group to a serverScope: cloud_writeattachSecurityGroupOpenAPI for this operation

Parameters

FieldinTypeDescription
id requiredpathintegerServer id (= service id in the client area)
sg requiredpathstring

Responses

200Attached groups — data: ServerSecurityGroups
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
409firewall_not_enabled
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group attach 12345
# resource gyro_server_security_groups: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_security_groups
# Attach both groups to a server (order = evaluation order, max 5). Without gyro_firewall rules, inbound traffic
# that no group allows is denied.
resource "gyro_server_security_groups" "web1" {
  server_id          = 1234
  security_group_ids = [gyro_security_group.web.id, gyro_security_group.admin.id]
}
import os, uuid, requests

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

#DELETE/cloud/servers/{id}/security-groups/{sg}

Detach a security group from a serverScope: cloud_writedetachSecurityGroupOpenAPI for this operation

Parameters

FieldinTypeDescription
id requiredpathintegerServer id (= service id in the client area)
sg requiredpathstring

Responses

200Attached groups — data: ServerSecurityGroups
401Missing, invalid or revoked key
404Not found — also returned for objects owned by someone else
409firewall_not_enabled
422Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...)

Examples

curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
gyro security-group detach 12345
# resource gyro_server_security_groups: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_security_groups
# Attach both groups to a server (order = evaluation order, max 5). Without gyro_firewall rules, inbound traffic
# that no group allows is denied.
resource "gyro_server_security_groups" "web1" {
  server_id          = 1234
  security_group_ids = [gyro_security_group.web.id, gyro_security_group.admin.id]
}
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups/1", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/security-groups/1", {
  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}`);