diff --git a/docs/data-sources/load_balancer.md b/docs/data-sources/load_balancer.md
index 16732c1..e41445a 100644
--- a/docs/data-sources/load_balancer.md
+++ b/docs/data-sources/load_balancer.md
@@ -10,7 +10,13 @@ description: |-
+## Example Usage
+```terraform
+data "binarylane_load_balancer" "example" {
+ id = 123456
+}
+```
## Schema
@@ -21,7 +27,7 @@ description: |-
### Read-Only
-- `forwarding_rules` (List of Object) The rules that control which traffic the load balancer will forward to servers in the pool. Leave null to accept a default "HTTP" only forwarding rule. (see [below for nested schema](#nestedatt--forwarding_rules))
+- `forwarding_rules` (Attributes List) The rules that control which traffic the load balancer will forward to servers in the pool. Leave null to accept a default "HTTP" only forwarding rule. (see [below for nested schema](#nestedatt--forwarding_rules))
- `health_check` (Object) The rules that determine which servers are considered 'healthy' and in the server pool for the load balancer. Leave this null to accept appropriate defaults based on the forwarding_rules. (see [below for nested schema](#nestedatt--health_check))
- `name` (String) The hostname of the load balancer.
- `region` (String) Leave null to create an anycast load balancer.
@@ -32,7 +38,7 @@ description: |-
Read-Only:
-- `entry_protocol` (String)
+- `entry_protocol` (String) The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
diff --git a/docs/data-sources/server.md b/docs/data-sources/server.md
index e1795f6..f7e10fd 100644
--- a/docs/data-sources/server.md
+++ b/docs/data-sources/server.md
@@ -10,7 +10,13 @@ description: |-
Provides a Binary Lane Server data source. This can be used to read existing server details.
+## Example Usage
+```terraform
+data "binarylane_server" "example" {
+ id = 123456
+}
+```
## Schema
@@ -21,17 +27,17 @@ Provides a Binary Lane Server data source. This can be used to read existing ser
### Read-Only
-- `backups` (Boolean) If true this will enable two daily backups for the server. `options.daily_backups` will override this value if provided. Setting this to false has no effect.
+- `backups` (Boolean) If `true`, the server will be backed up twice per day. By default, backups are disabled.
- `disk` (Number) The amount of storage in GB assigned to the server.
- `image` (String) The slug of the selected operating system.
- `memory` (Number) The amount of memory in MB assigned to the server.
-- `name` (String) The hostname of your server, such as vps01.yourcompany.com. If not provided, the server will be created with a random name.
+- `name` (String) The hostname of your server, such as vps01.yourcompany.com.
- `permalink` (String) A randomly generated two-word identifier assigned to servers in regions that support this feature
- `port_blocking` (Boolean) Port blocking of outgoing connections for email, SSH and Remote Desktop (TCP ports 22, 25, and 3389) is enabled by default for all new servers. If this is false port blocking will be disabled. Disabling port blocking is only available to reviewed accounts.
- `private_ipv4_addresses` (List of String) The private IPv4 addresses assigned to the server.
- `public_ipv4_addresses` (List of String) The public IPv4 addresses assigned to the server.
- `region` (String) The slug of the selected region.
- `size` (String) The slug of the selected size.
-- `ssh_keys` (List of Number) This is a list of SSH key ids. If this is null or not provided, any SSH keys that have been marked as default will be deployed (assuming the operating system supports SSH Keys). Submit an empty list to disable deployment of default keys.
-- `user_data` (String) If provided this will be used to initialise the new server. This must be left null if the Image does not support UserData, see DistributionInfo.Features for more information.
-- `vpc_id` (Number) Leave null to use default (public) network for the selected region.
+- `ssh_keys` (List of Number) This is a list of SSH key ids that were added to the server during creation.
+- `user_data` (String) A script or cloud-config YAML file to configure the server.
+- `vpc_id` (Number) ID of the Virtual Private Cloud (VPC) the server is connected to.
diff --git a/docs/data-sources/server_firewall_rules.md b/docs/data-sources/server_firewall_rules.md
index 13cb1c2..4ec2476 100644
--- a/docs/data-sources/server_firewall_rules.md
+++ b/docs/data-sources/server_firewall_rules.md
@@ -10,7 +10,13 @@ description: |-
+## Example Usage
+```terraform
+data "binarylane_server_firewall_rules" "example" {
+ server_id = 123456
+}
+```
## Schema
@@ -21,16 +27,16 @@ description: |-
### Read-Only
-- `firewall_rules` (List of Object) A list of rules for the server. NB: that any existing rules that are not included will be removed. Submit an empty list to clear all rules. (see [below for nested schema](#nestedatt--firewall_rules))
+- `firewall_rules` (Attributes List) A list of rules for the server. NB: that any existing rules that are not included will be removed. Submit an empty list to clear all rules. (see [below for nested schema](#nestedatt--firewall_rules))
### Nested Schema for `firewall_rules`
Read-Only:
-- `action` (String)
-- `description` (String)
-- `destination_addresses` (List of String)
-- `destination_ports` (List of String)
-- `protocol` (String)
-- `source_addresses` (List of String)
+- `action` (String) The action to take when there is a match on this rule.
+- `description` (String) A description to assist in identifying this rule. Commonly used to record the reason for the rule or the intent behind it, e.g. "Block access to RDP" or "Allow access from HQ".
+- `destination_addresses` (List of String) The destination addresses to match for this rule. Each address may be an individual IPv4 address or a range in IPv4 CIDR notation.
+- `destination_ports` (List of String) The destination ports to match for this rule. Leave null or empty to match on all ports.
+- `protocol` (String) The protocol to match for this rule.
+- `source_addresses` (List of String) The source addresses to match for this rule. Each address may be an individual IPv4 address or a range in IPv4 CIDR notation.
diff --git a/docs/data-sources/ssh_key.md b/docs/data-sources/ssh_key.md
index a87eb2b..a6439e4 100644
--- a/docs/data-sources/ssh_key.md
+++ b/docs/data-sources/ssh_key.md
@@ -10,7 +10,13 @@ description: |-
+## Example Usage
+```terraform
+data "binarylane_ssh_key" "example" {
+ id = 123456
+}
+```
## Schema
@@ -21,7 +27,7 @@ description: |-
### Read-Only
-- `default` (Boolean) Optional: If true this will be added to all new server installations (if we support SSH Key injection for the server's operating system).
+- `default` (Boolean) If `true`, this SSH key will be included on all new server installations (if the operating system supports SSH key injection).
- `fingerprint` (String) The fingerprint of the SSH key.
- `name` (String) A name to help you identify the key.
- `public_key` (String) The public key in OpenSSH "authorized_keys" format.
diff --git a/docs/data-sources/vpc.md b/docs/data-sources/vpc.md
index fec5cd4..5d2e21e 100644
--- a/docs/data-sources/vpc.md
+++ b/docs/data-sources/vpc.md
@@ -10,7 +10,13 @@ description: |-
+## Example Usage
+```terraform
+data "binarylane_vpc" "example" {
+ id = 123456
+}
+```
## Schema
diff --git a/docs/data-sources/vpc_route_entries.md b/docs/data-sources/vpc_route_entries.md
index 4a1e292..ea4509b 100644
--- a/docs/data-sources/vpc_route_entries.md
+++ b/docs/data-sources/vpc_route_entries.md
@@ -10,7 +10,13 @@ description: |-
+## Example Usage
+```terraform
+data "binarylane_vpc_route_entries" "example" {
+ vpc_id = 123456
+}
+```
## Schema
@@ -21,13 +27,13 @@ description: |-
### Read-Only
-- `route_entries` (List of Object) Submit null to leave unaltered, submit an empty list to clear all route entries. It is not possible to PATCH individual route entries, to alter a route entry submit the entire list of route entries you wish to save. (see [below for nested schema](#nestedatt--route_entries))
+- `route_entries` (Attributes List) The route entries that control how network traffic is directed through the VPC environment. (see [below for nested schema](#nestedatt--route_entries))
### Nested Schema for `route_entries`
Read-Only:
-- `description` (String)
-- `destination` (String)
-- `router` (String)
+- `description` (String) An optional description for the route.
+- `destination` (String) The destination address for this route entry. This may be in CIDR format.
+- `router` (String) The server that will receive traffic sent to the destination property in this VPC.
diff --git a/docs/index.md b/docs/index.md
index 024986e..6306c5c 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -10,7 +10,31 @@ description: |-
+## Example Usage
+```terraform
+terraform {
+ required_providers {
+ binarylane = {
+ source = "oscarhermoso/binarylane"
+ }
+ }
+}
+
+provider "binarylane" {
+ # api_token = "" # Recommend setting with environment variable BINARYLANE_API_TOKEN
+}
+
+# Create a new server
+resource "binarylane_server" "example" {
+ name = "tf-example-basic"
+ region = "per" # or "syd", "mel", "bne", "sin"
+ image = "ubuntu-24.04"
+ size = "std-min"
+ public_ipv4_count = 1
+ # ...
+}
+```
## Schema
diff --git a/docs/resources/load_balancer.md b/docs/resources/load_balancer.md
index 62c1770..caa30cd 100644
--- a/docs/resources/load_balancer.md
+++ b/docs/resources/load_balancer.md
@@ -10,7 +10,23 @@ description: |-
+## Example Usage
+```terraform
+resource "binarylane_server" "example" {
+ count = 2
+ # ...
+}
+
+resource "binarylane_load_balancer" "example" {
+ name = "tf-example-lb"
+ forwarding_rules = [{ entry_protocol = "https" }]
+ server_ids = [
+ binarylane_server.example.0.id,
+ binarylane_server.example.1.id
+ ]
+}
+```
## Schema
@@ -36,7 +52,7 @@ description: |-
Required:
-- `entry_protocol` (String) The protocol that traffic must match for this load balancer to forward traffic according to this rule.
+- `entry_protocol` (String) The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
@@ -54,3 +70,11 @@ Optional:
Optional:
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_load_balancer.example ""
+```
diff --git a/docs/resources/server.md b/docs/resources/server.md
index 7b3cbd3..df2d556 100644
--- a/docs/resources/server.md
+++ b/docs/resources/server.md
@@ -3,49 +3,58 @@
page_title: "binarylane_server Resource - terraform-provider-binarylane"
subcategory: ""
description: |-
- Provides a Binary Lane Server resource. This can be used to create and delete servers.
+
---
# binarylane_server (Resource)
-Provides a Binary Lane Server resource. This can be used to create and delete servers.
+## Example Usage
+
+```terraform
+resource "binarylane_server" "example" {
+ name = "tf-example"
+ region = "per" # or "syd", "mel", "bne", "sin"
+ image = "ubuntu-24.04"
+ size = "std-min" # 1 VPCU, 1 GB Memory, 20 GB NVME Storage, 1000 GB Data Transfer
+ public_ipv4_count = 1
+
+ # Accepts a cloud-init script or cloud-config YAML file to configure the server
+ # See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
+ user_data = file("./init.sh")
+}
+```
## Schema
### Required
-- `image` (String) The slug of the selected operating system.
-- `public_ipv4_count` (Number) The number of public IPv4 addresses to assign to the server. If this is not provided, the server will be created with the default number of public IPv4 addresses.
+- `image` (String) The slug of the selected operating system, such as `debian-12`. You can fetch a full list of images from the BinaryLane API.
+- `public_ipv4_count` (Number) The number of public IPv4 addresses to assign to the server.
- `region` (String) The slug of the selected region.
- `size` (String) The slug of the selected size.
### Optional
-- `backups` (Boolean) If true this will enable two daily backups for the server. `options.daily_backups` will override this value if provided. Setting this to false has no effect.
-- `disk` (Number) The total storage in GB for this server. If specified this is the absolute value, not just the additional storage above what is included in the size.
-Leave null to accept the default for the size if this is a new server or a resize to a different base size,
-or to keep the current value if this a resize with the same base size but different options. Valid values:
+- `backups` (Boolean) If `true` this will enable two daily backups for the server. By default, backups are disabled.
+- `disk` (Number) The total storage in GB for this server. Leave null to accept the default for the size Valid values:
- must be a multiple of 5
- - \> 60GB must be a multiple of 10
- - \> 200GB must be a multiple of 100
-- `memory` (Number) The total memory in MB for this server. If specified this is the absolute value, not just the
-additional memory above what is included in the size. Leave null to accept the default for the size if this is a new
-server or a resize to a different base size, or to keep the current value if this a resize with the same base size
-but different options. Valid values:
+ - \> 60 GB must be a multiple of 10
+ - \> 200 GB must be a multiple of 100
+- `memory` (Number) The total memory in MB for this server. Leave null to accept the default size. Valid values:
- must be a multiple of 128
- - \> 2048MB must be a multiple of 1024
- - \> 16384MB must be a multiple of 2048
- - \> 24576MB must be a multiple of 4096
+ - \> 2048 MB must be a multiple of 1024
+ - \> 16384 MB must be a multiple of 2048
+ - \> 24576 MB must be a multiple of 4096
- `name` (String) The hostname of your server, such as vps01.yourcompany.com. If not provided, the server will be created with a random name.
- `password` (String, Sensitive) If this is provided the specified or default remote user's account password will be set to this value. Only valid if the server supports password change actions. If omitted and the server supports password change actions a random password will be generated and emailed to the account email address.
- `port_blocking` (Boolean) Port blocking of outgoing connections for email, SSH and Remote Desktop (TCP ports 22, 25, and 3389) is enabled by default for all new servers. If this is false port blocking will be disabled. Disabling port blocking is only available to reviewed accounts.
- `source_and_destination_check` (Boolean) This attribute can only be set if your server also has a `vpc_id` attribute set. When enabled (which is `true` by default), your server will only be able to send or receive packets that are directly addressed to one of the IP addresses associated with the Cloud Server. Generally, this is desirable behaviour because it prevents IP conflicts and other hard-to-diagnose networking faults due to incorrect network configuration. When `source_and_destination_check` is `false`, your Cloud Server will be able to send and receive packets addressed to any server. This is typically used when you want to use your Cloud Server as a VPN endpoint, a NAT server to provide internet access, or IP forwarding.
- `ssh_keys` (List of Number) This is a list of SSH key ids. If this is null or not provided, any SSH keys that have been marked as default will be deployed (assuming the operating system supports SSH Keys). Submit an empty list to disable deployment of default keys.
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
-- `user_data` (String) If provided this will be used to initialise the new server. This must be left null if the Image does not support UserData, see DistributionInfo.Features for more information.
+- `user_data` (String) A script or cloud-config YAML file to configure the server. Can only be specified if the OS image supports UserData (i.e. not Windows). See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
- `vpc_id` (Number) Leave null to use default (public) network for the selected region.
### Read-Only
@@ -63,3 +72,11 @@ Optional:
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_server.example ""
+```
diff --git a/docs/resources/server_firewall_rules.md b/docs/resources/server_firewall_rules.md
index 8b655d1..2ffdfcc 100644
--- a/docs/resources/server_firewall_rules.md
+++ b/docs/resources/server_firewall_rules.md
@@ -10,7 +10,27 @@ description: |-
+## Example Usage
+```terraform
+resource "binarylane_server" "example" {
+ # ...
+}
+
+resource "binarylane_server_firewall_rules" "example" {
+ server_id = binarylane_server.example.id
+ firewall_rules = [
+ {
+ description = "Allow SSH"
+ protocol = "tcp"
+ source_addresses = ["0.0.0.0/0"]
+ destination_addresses = [binarylane_server.example.private_ipv4_addresses.0]
+ destination_ports = ["22"]
+ action = "accept"
+ }
+ ]
+}
+```
## Schema
@@ -34,3 +54,11 @@ Optional:
- `description` (String) A description to assist in identifying this rule. Commonly used to record the reason for the rule or the intent behind it, e.g. "Block access to RDP" or "Allow access from HQ".
- `destination_ports` (List of String) The destination ports to match for this rule. Leave null or empty to match on all ports.
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_server_firewall_rules.example ""
+```
diff --git a/docs/resources/ssh_key.md b/docs/resources/ssh_key.md
index 245419e..9a3d40e 100644
--- a/docs/resources/ssh_key.md
+++ b/docs/resources/ssh_key.md
@@ -10,7 +10,21 @@ description: |-
+## Example Usage
+```terraform
+resource "binarylane_ssh_key" "example" {
+ name = "tf-example"
+
+ # Generate with: ssh-keygen -t ed25519 -C "name@example.com"
+ public_key = file("~/.ssh/id_ed25519.pub")
+}
+
+resource "binarylane_server" "example" {
+ # ...
+ ssh_keys = [binarylane_ssh_key.example.id]
+}
+```
## Schema
@@ -22,9 +36,17 @@ description: |-
### Optional
-- `default` (Boolean) Optional: If true this will be added to all new server installations (if we support SSH Key injection for the server's operating system).
-- `id` (Number) The ID or fingerprint of the SSH Key to fetch.
+- `default` (Boolean) If `true`, this SSH key will be included on all new server installations (if the operating system supports SSH key injection). Default is `false`.
### Read-Only
- `fingerprint` (String) The fingerprint of the SSH key.
+- `id` (Number) The numeric ID of the SSH key.
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_ssh_key.example ""
+```
diff --git a/docs/resources/vpc.md b/docs/resources/vpc.md
index c9c18ef..7d79619 100644
--- a/docs/resources/vpc.md
+++ b/docs/resources/vpc.md
@@ -10,7 +10,19 @@ description: |-
+## Example Usage
+```terraform
+resource "binarylane_vpc" "example" {
+ name = "tf-example-vpc"
+ ip_range = "10.240.0.0/16"
+}
+
+resource "binarylane_server" "example" {
+ # ...
+ vpc_id = binarylane_vpc.example.id
+}
+```
## Schema
@@ -26,3 +38,11 @@ description: |-
### Read-Only
- `id` (Number) The target vpc id.
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_vpc.example ""
+```
diff --git a/docs/resources/vpc_route_entries.md b/docs/resources/vpc_route_entries.md
index a4a0208..094e974 100644
--- a/docs/resources/vpc_route_entries.md
+++ b/docs/resources/vpc_route_entries.md
@@ -10,7 +10,35 @@ description: |-
+## Example Usage
+```terraform
+resource "binarylane_vpc" "example" {
+ name = "tf-example-vpc"
+ ip_range = "10.240.0.0/16"
+}
+
+resource "binarylane_server" "web" {
+ # ...
+ vpc_id = binarylane_vpc.example.id
+}
+
+resource "binarylane_vpc_route_entries" "example" {
+ vpc_id = binarylane_vpc.example.id
+ route_entries = [
+ {
+ description = "NAT"
+ destination = "0.0.0.0/0"
+ router = binarylane_server.web.private_ipv4_addresses.0
+ },
+ {
+ description = "VPN"
+ destination = "192.168.1.0/24"
+ router = binarylane_server.vpn.private_ipv4_addresses.0
+ }
+ ]
+}
+```
## Schema
@@ -34,3 +62,11 @@ Required:
Optional:
- `description` (String) An optional description for the route.
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import binarylane_vpc_route_entries.example ""
+```
diff --git a/examples/data-sources/binarylane_load_balancer/data-source.tf b/examples/data-sources/binarylane_load_balancer/data-source.tf
new file mode 100644
index 0000000..69c612b
--- /dev/null
+++ b/examples/data-sources/binarylane_load_balancer/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_load_balancer" "example" {
+ id = 123456
+}
diff --git a/examples/data-sources/binarylane_server/data-source.tf b/examples/data-sources/binarylane_server/data-source.tf
new file mode 100644
index 0000000..8c6e519
--- /dev/null
+++ b/examples/data-sources/binarylane_server/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_server" "example" {
+ id = 123456
+}
diff --git a/examples/data-sources/binarylane_server_firewall_rules/data-source.tf b/examples/data-sources/binarylane_server_firewall_rules/data-source.tf
new file mode 100644
index 0000000..8e87cb2
--- /dev/null
+++ b/examples/data-sources/binarylane_server_firewall_rules/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_server_firewall_rules" "example" {
+ server_id = 123456
+}
diff --git a/examples/data-sources/binarylane_ssh_key/data-source.tf b/examples/data-sources/binarylane_ssh_key/data-source.tf
new file mode 100644
index 0000000..32cecd9
--- /dev/null
+++ b/examples/data-sources/binarylane_ssh_key/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_ssh_key" "example" {
+ id = 123456
+}
diff --git a/examples/data-sources/binarylane_vpc/data-source.tf b/examples/data-sources/binarylane_vpc/data-source.tf
new file mode 100644
index 0000000..6591fc6
--- /dev/null
+++ b/examples/data-sources/binarylane_vpc/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_vpc" "example" {
+ id = 123456
+}
diff --git a/examples/data-sources/binarylane_vpc_route_entries/data-source.tf b/examples/data-sources/binarylane_vpc_route_entries/data-source.tf
new file mode 100644
index 0000000..8425dd8
--- /dev/null
+++ b/examples/data-sources/binarylane_vpc_route_entries/data-source.tf
@@ -0,0 +1,3 @@
+data "binarylane_vpc_route_entries" "example" {
+ vpc_id = 123456
+}
diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf
new file mode 100644
index 0000000..747a88d
--- /dev/null
+++ b/examples/provider/provider.tf
@@ -0,0 +1,21 @@
+terraform {
+ required_providers {
+ binarylane = {
+ source = "oscarhermoso/binarylane"
+ }
+ }
+}
+
+provider "binarylane" {
+ # api_token = "" # Recommend setting with environment variable BINARYLANE_API_TOKEN
+}
+
+# Create a new server
+resource "binarylane_server" "example" {
+ name = "tf-example-basic"
+ region = "per" # or "syd", "mel", "bne", "sin"
+ image = "ubuntu-24.04"
+ size = "std-min"
+ public_ipv4_count = 1
+ # ...
+}
diff --git a/examples/resources/binarylane_load_balancer/import.sh b/examples/resources/binarylane_load_balancer/import.sh
new file mode 100644
index 0000000..8ab7495
--- /dev/null
+++ b/examples/resources/binarylane_load_balancer/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_load_balancer.example ""
diff --git a/examples/resources/binarylane_load_balancer/resource.tf b/examples/resources/binarylane_load_balancer/resource.tf
new file mode 100644
index 0000000..896c033
--- /dev/null
+++ b/examples/resources/binarylane_load_balancer/resource.tf
@@ -0,0 +1,13 @@
+resource "binarylane_server" "example" {
+ count = 2
+ # ...
+}
+
+resource "binarylane_load_balancer" "example" {
+ name = "tf-example-lb"
+ forwarding_rules = [{ entry_protocol = "https" }]
+ server_ids = [
+ binarylane_server.example.0.id,
+ binarylane_server.example.1.id
+ ]
+}
diff --git a/examples/resources/binarylane_server/import.sh b/examples/resources/binarylane_server/import.sh
new file mode 100644
index 0000000..fe2b55d
--- /dev/null
+++ b/examples/resources/binarylane_server/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_server.example ""
diff --git a/examples/resources/binarylane_server/resource.tf b/examples/resources/binarylane_server/resource.tf
new file mode 100644
index 0000000..5f9f396
--- /dev/null
+++ b/examples/resources/binarylane_server/resource.tf
@@ -0,0 +1,11 @@
+resource "binarylane_server" "example" {
+ name = "tf-example"
+ region = "per" # or "syd", "mel", "bne", "sin"
+ image = "ubuntu-24.04"
+ size = "std-min" # 1 VPCU, 1 GB Memory, 20 GB NVME Storage, 1000 GB Data Transfer
+ public_ipv4_count = 1
+
+ # Accepts a cloud-init script or cloud-config YAML file to configure the server
+ # See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
+ user_data = file("./init.sh")
+}
diff --git a/examples/resources/binarylane_server_firewall_rules/import.sh b/examples/resources/binarylane_server_firewall_rules/import.sh
new file mode 100644
index 0000000..e43d01b
--- /dev/null
+++ b/examples/resources/binarylane_server_firewall_rules/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_server_firewall_rules.example ""
diff --git a/examples/resources/binarylane_server_firewall_rules/resource.tf b/examples/resources/binarylane_server_firewall_rules/resource.tf
new file mode 100644
index 0000000..d1e7198
--- /dev/null
+++ b/examples/resources/binarylane_server_firewall_rules/resource.tf
@@ -0,0 +1,17 @@
+resource "binarylane_server" "example" {
+ # ...
+}
+
+resource "binarylane_server_firewall_rules" "example" {
+ server_id = binarylane_server.example.id
+ firewall_rules = [
+ {
+ description = "Allow SSH"
+ protocol = "tcp"
+ source_addresses = ["0.0.0.0/0"]
+ destination_addresses = [binarylane_server.example.private_ipv4_addresses.0]
+ destination_ports = ["22"]
+ action = "accept"
+ }
+ ]
+}
diff --git a/examples/resources/binarylane_ssh_key/import.sh b/examples/resources/binarylane_ssh_key/import.sh
new file mode 100644
index 0000000..613c629
--- /dev/null
+++ b/examples/resources/binarylane_ssh_key/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_ssh_key.example ""
diff --git a/examples/resources/binarylane_ssh_key/resource.tf b/examples/resources/binarylane_ssh_key/resource.tf
new file mode 100644
index 0000000..e9239db
--- /dev/null
+++ b/examples/resources/binarylane_ssh_key/resource.tf
@@ -0,0 +1,11 @@
+resource "binarylane_ssh_key" "example" {
+ name = "tf-example"
+
+ # Generate with: ssh-keygen -t ed25519 -C "name@example.com"
+ public_key = file("~/.ssh/id_ed25519.pub")
+}
+
+resource "binarylane_server" "example" {
+ # ...
+ ssh_keys = [binarylane_ssh_key.example.id]
+}
diff --git a/examples/resources/binarylane_vpc/import.sh b/examples/resources/binarylane_vpc/import.sh
new file mode 100644
index 0000000..45d28b4
--- /dev/null
+++ b/examples/resources/binarylane_vpc/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_vpc.example ""
diff --git a/examples/resources/binarylane_vpc/resource.tf b/examples/resources/binarylane_vpc/resource.tf
new file mode 100644
index 0000000..9b8d648
--- /dev/null
+++ b/examples/resources/binarylane_vpc/resource.tf
@@ -0,0 +1,9 @@
+resource "binarylane_vpc" "example" {
+ name = "tf-example-vpc"
+ ip_range = "10.240.0.0/16"
+}
+
+resource "binarylane_server" "example" {
+ # ...
+ vpc_id = binarylane_vpc.example.id
+}
diff --git a/examples/resources/binarylane_vpc_route_entries/import.sh b/examples/resources/binarylane_vpc_route_entries/import.sh
new file mode 100644
index 0000000..9f6ad83
--- /dev/null
+++ b/examples/resources/binarylane_vpc_route_entries/import.sh
@@ -0,0 +1 @@
+terraform import binarylane_vpc_route_entries.example ""
diff --git a/examples/resources/binarylane_vpc_route_entries/resource.tf b/examples/resources/binarylane_vpc_route_entries/resource.tf
new file mode 100644
index 0000000..90e51d8
--- /dev/null
+++ b/examples/resources/binarylane_vpc_route_entries/resource.tf
@@ -0,0 +1,25 @@
+resource "binarylane_vpc" "example" {
+ name = "tf-example-vpc"
+ ip_range = "10.240.0.0/16"
+}
+
+resource "binarylane_server" "web" {
+ # ...
+ vpc_id = binarylane_vpc.example.id
+}
+
+resource "binarylane_vpc_route_entries" "example" {
+ vpc_id = binarylane_vpc.example.id
+ route_entries = [
+ {
+ description = "NAT"
+ destination = "0.0.0.0/0"
+ router = binarylane_server.web.private_ipv4_addresses.0
+ },
+ {
+ description = "VPN"
+ destination = "192.168.1.0/24"
+ router = binarylane_server.vpn.private_ipv4_addresses.0
+ }
+ ]
+}
diff --git a/internal/binarylane/client_gen.go b/internal/binarylane/client_gen.go
index 5e1d74c..d352662 100644
--- a/internal/binarylane/client_gen.go
+++ b/internal/binarylane/client_gen.go
@@ -9477,7 +9477,6 @@ type PostLoadBalancersResponse struct {
HTTPResponse *http.Response
JSON200 *CreateLoadBalancerResponse
JSON400 *ValidationProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9638,7 +9637,6 @@ type DeleteLoadBalancersLoadBalancerIdServersResponse struct {
HTTPResponse *http.Response
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9662,7 +9660,6 @@ type PostLoadBalancersLoadBalancerIdServersResponse struct {
HTTPResponse *http.Response
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9939,7 +9936,6 @@ type PostServersServerIdActionsResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9964,7 +9960,6 @@ type PostServersServerIdActionsAddDiskResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9989,7 +9984,6 @@ type PostServersServerIdActionsAttachBackupResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10014,7 +10008,6 @@ type PostServersServerIdActionsChangeAdvancedFeaturesResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10039,7 +10032,6 @@ type PostServersServerIdActionsChangeAdvancedFirewallRulesResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10064,7 +10056,6 @@ type PostServersServerIdActionsChangeBackupScheduleResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10089,7 +10080,6 @@ type PostServersServerIdActionsChangeIpv6Response struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10114,7 +10104,6 @@ type PostServersServerIdActionsChangeIpv6ReverseNameserversResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10139,7 +10128,6 @@ type PostServersServerIdActionsChangeKernelResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10164,7 +10152,6 @@ type PostServersServerIdActionsChangeManageOffsiteBackupCopiesResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10189,7 +10176,6 @@ type PostServersServerIdActionsChangeNetworkResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10214,7 +10200,6 @@ type PostServersServerIdActionsChangeOffsiteBackupLocationResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10239,7 +10224,6 @@ type PostServersServerIdActionsChangePartnerResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10264,7 +10248,6 @@ type PostServersServerIdActionsChangePortBlockingResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10289,7 +10272,6 @@ type PostServersServerIdActionsChangeReverseNameResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10314,7 +10296,6 @@ type PostServersServerIdActionsChangeSeparatePrivateNetworkInterfaceResponse str
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10339,7 +10320,6 @@ type PostServersServerIdActionsChangeSourceAndDestinationCheckResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10364,7 +10344,6 @@ type PostServersServerIdActionsChangeThresholdAlertsResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10389,7 +10368,6 @@ type PostServersServerIdActionsChangeVpcIpv4Response struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10414,7 +10392,6 @@ type PostServersServerIdActionsCloneUsingBackupResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10439,7 +10416,6 @@ type PostServersServerIdActionsDeleteDiskResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10464,7 +10440,6 @@ type PostServersServerIdActionsDetachBackupResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10489,7 +10464,6 @@ type PostServersServerIdActionsDisableBackupsResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10514,7 +10488,6 @@ type PostServersServerIdActionsDisableSelinuxResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10539,7 +10512,6 @@ type PostServersServerIdActionsEnableBackupsResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10564,7 +10536,6 @@ type PostServersServerIdActionsEnableIpv6Response struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10589,7 +10560,6 @@ type PostServersServerIdActionsIsRunningResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10614,7 +10584,6 @@ type PostServersServerIdActionsPasswordResetResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10639,7 +10608,6 @@ type PostServersServerIdActionsPingResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10664,7 +10632,6 @@ type PostServersServerIdActionsPowerCycleResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10689,7 +10656,6 @@ type PostServersServerIdActionsPowerOffResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10714,7 +10680,6 @@ type PostServersServerIdActionsPowerOnResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10739,7 +10704,6 @@ type PostServersServerIdActionsRebootResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10764,7 +10728,6 @@ type PostServersServerIdActionsRebuildResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10789,7 +10752,6 @@ type PostServersServerIdActionsRenameResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10814,7 +10776,6 @@ type PostServersServerIdActionsResizeResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10839,7 +10800,6 @@ type PostServersServerIdActionsResizeDiskResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10864,7 +10824,6 @@ type PostServersServerIdActionsRestoreResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10889,7 +10848,6 @@ type PostServersServerIdActionsShutdownResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10914,7 +10872,6 @@ type PostServersServerIdActionsTakeBackupResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10939,7 +10896,6 @@ type PostServersServerIdActionsUncancelResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10964,7 +10920,6 @@ type PostServersServerIdActionsUptimeResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11081,7 +11036,6 @@ type PostServersServerIdBackupsResponse struct {
JSON200 *ActionResponse
JSON400 *ValidationProblemDetails
JSON404 *ProblemDetails
- JSON422 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -13966,13 +13920,6 @@ func ParsePostLoadBalancersResponse(rsp *http.Response) (*PostLoadBalancersRespo
}
response.JSON400 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14197,13 +14144,6 @@ func ParseDeleteLoadBalancersLoadBalancerIdServersResponse(rsp *http.Response) (
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14237,13 +14177,6 @@ func ParsePostLoadBalancersLoadBalancerIdServersResponse(rsp *http.Response) (*P
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14640,13 +14573,6 @@ func ParsePostServersServerIdActionsResponse(rsp *http.Response) (*PostServersSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14687,13 +14613,6 @@ func ParsePostServersServerIdActionsAddDiskResponse(rsp *http.Response) (*PostSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14734,13 +14653,6 @@ func ParsePostServersServerIdActionsAttachBackupResponse(rsp *http.Response) (*P
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14781,13 +14693,6 @@ func ParsePostServersServerIdActionsChangeAdvancedFeaturesResponse(rsp *http.Res
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14828,13 +14733,6 @@ func ParsePostServersServerIdActionsChangeAdvancedFirewallRulesResponse(rsp *htt
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14875,13 +14773,6 @@ func ParsePostServersServerIdActionsChangeBackupScheduleResponse(rsp *http.Respo
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14922,13 +14813,6 @@ func ParsePostServersServerIdActionsChangeIpv6Response(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -14969,13 +14853,6 @@ func ParsePostServersServerIdActionsChangeIpv6ReverseNameserversResponse(rsp *ht
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15016,13 +14893,6 @@ func ParsePostServersServerIdActionsChangeKernelResponse(rsp *http.Response) (*P
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15063,13 +14933,6 @@ func ParsePostServersServerIdActionsChangeManageOffsiteBackupCopiesResponse(rsp
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15110,13 +14973,6 @@ func ParsePostServersServerIdActionsChangeNetworkResponse(rsp *http.Response) (*
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15157,13 +15013,6 @@ func ParsePostServersServerIdActionsChangeOffsiteBackupLocationResponse(rsp *htt
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15204,13 +15053,6 @@ func ParsePostServersServerIdActionsChangePartnerResponse(rsp *http.Response) (*
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15251,13 +15093,6 @@ func ParsePostServersServerIdActionsChangePortBlockingResponse(rsp *http.Respons
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15298,13 +15133,6 @@ func ParsePostServersServerIdActionsChangeReverseNameResponse(rsp *http.Response
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15345,13 +15173,6 @@ func ParsePostServersServerIdActionsChangeSeparatePrivateNetworkInterfaceRespons
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15392,13 +15213,6 @@ func ParsePostServersServerIdActionsChangeSourceAndDestinationCheckResponse(rsp
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15439,13 +15253,6 @@ func ParsePostServersServerIdActionsChangeThresholdAlertsResponse(rsp *http.Resp
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15486,13 +15293,6 @@ func ParsePostServersServerIdActionsChangeVpcIpv4Response(rsp *http.Response) (*
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15533,13 +15333,6 @@ func ParsePostServersServerIdActionsCloneUsingBackupResponse(rsp *http.Response)
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15580,13 +15373,6 @@ func ParsePostServersServerIdActionsDeleteDiskResponse(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15627,13 +15413,6 @@ func ParsePostServersServerIdActionsDetachBackupResponse(rsp *http.Response) (*P
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15674,13 +15453,6 @@ func ParsePostServersServerIdActionsDisableBackupsResponse(rsp *http.Response) (
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15721,13 +15493,6 @@ func ParsePostServersServerIdActionsDisableSelinuxResponse(rsp *http.Response) (
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15768,13 +15533,6 @@ func ParsePostServersServerIdActionsEnableBackupsResponse(rsp *http.Response) (*
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15815,13 +15573,6 @@ func ParsePostServersServerIdActionsEnableIpv6Response(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15862,13 +15613,6 @@ func ParsePostServersServerIdActionsIsRunningResponse(rsp *http.Response) (*Post
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15909,13 +15653,6 @@ func ParsePostServersServerIdActionsPasswordResetResponse(rsp *http.Response) (*
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -15956,13 +15693,6 @@ func ParsePostServersServerIdActionsPingResponse(rsp *http.Response) (*PostServe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16003,13 +15733,6 @@ func ParsePostServersServerIdActionsPowerCycleResponse(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16050,13 +15773,6 @@ func ParsePostServersServerIdActionsPowerOffResponse(rsp *http.Response) (*PostS
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16097,13 +15813,6 @@ func ParsePostServersServerIdActionsPowerOnResponse(rsp *http.Response) (*PostSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16144,13 +15853,6 @@ func ParsePostServersServerIdActionsRebootResponse(rsp *http.Response) (*PostSer
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16191,13 +15893,6 @@ func ParsePostServersServerIdActionsRebuildResponse(rsp *http.Response) (*PostSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16238,13 +15933,6 @@ func ParsePostServersServerIdActionsRenameResponse(rsp *http.Response) (*PostSer
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16285,13 +15973,6 @@ func ParsePostServersServerIdActionsResizeResponse(rsp *http.Response) (*PostSer
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16332,13 +16013,6 @@ func ParsePostServersServerIdActionsResizeDiskResponse(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16379,13 +16053,6 @@ func ParsePostServersServerIdActionsRestoreResponse(rsp *http.Response) (*PostSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16426,13 +16093,6 @@ func ParsePostServersServerIdActionsShutdownResponse(rsp *http.Response) (*PostS
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16473,13 +16133,6 @@ func ParsePostServersServerIdActionsTakeBackupResponse(rsp *http.Response) (*Pos
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16520,13 +16173,6 @@ func ParsePostServersServerIdActionsUncancelResponse(rsp *http.Response) (*PostS
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16567,13 +16213,6 @@ func ParsePostServersServerIdActionsUptimeResponse(rsp *http.Response) (*PostSer
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
@@ -16746,13 +16385,6 @@ func ParsePostServersServerIdBackupsResponse(rsp *http.Response) (*PostServersSe
}
response.JSON404 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON422 = &dest
-
}
return response, nil
diff --git a/internal/binarylane/fetch-openapi.sh b/internal/binarylane/fetch-openapi.sh
index 95abc00..afe38ec 100755
--- a/internal/binarylane/fetch-openapi.sh
+++ b/internal/binarylane/fetch-openapi.sh
@@ -44,3 +44,6 @@ cat <<<$(jq '.components.schemas.CreateLoadBalancerRequest.properties.forwarding
cat <<<$(jq '.components.schemas.ForwardingRule.properties.entry_protocol += {"x-oapi-codegen-extra-tags": {"tfsdk": "entry_protocol"}}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.LoadBalancer.properties.health_check += {"x-oapi-codegen-extra-tags": {"tfsdk": "health_check"}}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.HealthCheckProtocol |= del(.enum)' $OPENAPI_FILE) >$OPENAPI_FILE
+
+# Edit description here because it's hard to override nested schema properties
+cat <<<$(jq '.components.schemas.ForwardingRule.properties.entry_protocol.description = "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\"."' $OPENAPI_FILE) >$OPENAPI_FILE
diff --git a/internal/binarylane/openapi.json b/internal/binarylane/openapi.json
index 03ed508..7ff1541 100644
--- a/internal/binarylane/openapi.json
+++ b/internal/binarylane/openapi.json
@@ -8,7 +8,7 @@
"url": "https://support.binarylane.com.au",
"email": "support@binarylane.com.au"
},
- "version": "0.26.0",
+ "version": "0.28.0",
"x-logo": {
"url": "https://www.binarylane.com.au/res/images/binarylane/logo.png",
"backgroundColor": "#000000",
@@ -1955,16 +1955,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -2063,16 +2053,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -2139,16 +2119,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -2979,16 +2949,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -3527,16 +3487,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -4801,16 +4751,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -4886,16 +4826,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -4971,16 +4901,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5056,16 +4976,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5141,16 +5051,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5226,16 +5126,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5311,16 +5201,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5396,16 +5276,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5481,16 +5351,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5566,16 +5426,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5651,16 +5501,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5736,16 +5576,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5821,16 +5651,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5906,16 +5726,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -5991,16 +5801,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6076,16 +5876,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6161,16 +5951,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6246,16 +6026,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6331,16 +6101,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6416,16 +6176,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6501,16 +6251,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6586,16 +6326,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6671,16 +6401,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6756,16 +6476,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6841,16 +6551,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -6926,16 +6626,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7011,16 +6701,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7096,16 +6776,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7181,16 +6851,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7266,16 +6926,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7351,16 +7001,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7436,16 +7076,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7521,16 +7151,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7606,16 +7226,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7691,16 +7301,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7776,16 +7376,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7861,16 +7451,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -7946,16 +7526,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -8031,16 +7601,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -8116,16 +7676,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -8201,16 +7751,6 @@
}
}
},
- "422": {
- "description": "Unprocessable Entity",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
"401": {
"description": "Unauthorized"
}
@@ -8407,7 +7947,7 @@
},
"result_data": {
"type": "string",
- "description": "Returned information from a completed action. For example: a successful completed 'ping' action will have the ping value in ms in this field.",
+ "description": "Returned information from a completed action. For example: a successful completed 'uptime' action will have the uptime value in this field.",
"nullable": true,
"readOnly": true,
"x-cli-format": 7
@@ -10721,7 +10261,7 @@
"$ref": "#/components/schemas/LoadBalancerRuleProtocol"
}
],
- "description": "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
+ "description": "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
"x-oapi-codegen-extra-tags": {
"tfsdk": "entry_protocol"
}
@@ -14493,17 +14033,19 @@
"pc_i440fx_4point1",
"pc_i440fx_4point2",
"pc_i440fx_5point0",
- "pc_i440fx_5point1"
+ "pc_i440fx_5point1",
+ "pc_i440fx_7point2"
],
"type": "string",
- "description": "\n| Value | Description |\n| ----- | ----------- |\n| pc_i440fx_1point5 | PC I440 FX 1.5 |\n| pc_i440fx_2point11 | PC I440 FX 2.11 |\n| pc_i440fx_4point1 | PC I440 FX 4.1 |\n| pc_i440fx_4point2 | PC I440 FX 4.2 |\n| pc_i440fx_5point0 | PC I440 FX 5.0 |\n| pc_i440fx_5point1 | PC I440 FX 5.1 |\n\n",
+ "description": "\n| Value | Description |\n| ----- | ----------- |\n| pc_i440fx_1point5 | PC I440 FX 1.5 |\n| pc_i440fx_2point11 | PC I440 FX 2.11 |\n| pc_i440fx_4point1 | PC I440 FX 4.1 |\n| pc_i440fx_4point2 | PC I440 FX 4.2 |\n| pc_i440fx_5point0 | PC I440 FX 5.0 |\n| pc_i440fx_5point1 | PC I440 FX 5.1 |\n| pc_i440fx_7point2 | PC I440 FX 7.2 |\n\n",
"x-enum-descriptions": [
"PC I440 FX 1.5",
"PC I440 FX 2.11",
"PC I440 FX 4.1",
"PC I440 FX 4.2",
"PC I440 FX 5.0",
- "PC I440 FX 5.1"
+ "PC I440 FX 5.1",
+ "PC I440 FX 7.2"
]
},
"Vpc": {
diff --git a/internal/binarylane/types_gen.go b/internal/binarylane/types_gen.go
index 90eec6f..4334544 100644
--- a/internal/binarylane/types_gen.go
+++ b/internal/binarylane/types_gen.go
@@ -421,6 +421,7 @@ const (
PcI440fx4point2 VmMachineType = "pc_i440fx_4point2"
PcI440fx5point0 VmMachineType = "pc_i440fx_5point0"
PcI440fx5point1 VmMachineType = "pc_i440fx_5point1"
+ PcI440fx7point2 VmMachineType = "pc_i440fx_7point2"
)
// Account defines model for Account.
@@ -492,7 +493,7 @@ type Action struct {
// ResourceType The resource type (if any) associated with this action.
ResourceType *ResourceType `json:"resource_type"`
- // ResultData Returned information from a completed action. For example: a successful completed 'ping' action will have the ping value in ms in this field.
+ // ResultData Returned information from a completed action. For example: a successful completed 'uptime' action will have the uptime value in this field.
ResultData *string `json:"result_data"`
// StartedAt The timestamp in ISO8601 format of when processing of this action started.
@@ -1504,7 +1505,7 @@ type EnableIpv6Type string
// ForwardingRule defines model for ForwardingRule.
type ForwardingRule struct {
- // EntryProtocol The protocol that traffic must match for this load balancer to forward traffic according to this rule.
+ // EntryProtocol The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
EntryProtocol LoadBalancerRuleProtocol `json:"entry_protocol" tfsdk:"entry_protocol"`
}
@@ -3014,6 +3015,7 @@ type VideoDevice string
// | pc_i440fx_4point2 | PC I440 FX 4.2 |
// | pc_i440fx_5point0 | PC I440 FX 5.0 |
// | pc_i440fx_5point1 | PC I440 FX 5.1 |
+// | pc_i440fx_7point2 | PC I440 FX 7.2 |
type VmMachineType string
// Vpc defines model for Vpc.
diff --git a/internal/provider/server_data_source.go b/internal/provider/server_data_source.go
index 0924e5a..7804d09 100644
--- a/internal/provider/server_data_source.go
+++ b/internal/provider/server_data_source.go
@@ -78,10 +78,58 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
Required: true, // ID is required to find the server
}
+ nameDescription := "The hostname of your server, such as vps01.yourcompany.com."
+ resp.Schema.Attributes["name"] = &schema.StringAttribute{
+ Description: nameDescription,
+ MarkdownDescription: nameDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
+
+ backupsDescription := "If `true`, the server will be backed up twice per day. By default, backups are disabled."
+ resp.Schema.Attributes["backups"] = &schema.BoolAttribute{
+ Description: backupsDescription,
+ MarkdownDescription: backupsDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
+
+ sshKeysDescription := "This is a list of SSH key ids that were added to the server during creation."
+ resp.Schema.Attributes["ssh_keys"] = &schema.ListAttribute{
+ ElementType: types.Int64Type,
+ Description: sshKeysDescription,
+ MarkdownDescription: sshKeysDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
+
+ userDataDescription := "A script or cloud-config YAML file to configure the server."
+ resp.Schema.Attributes["user_data"] = &schema.StringAttribute{
+ Description: userDataDescription,
+ MarkdownDescription: userDataDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
+
+ vpcIdDescription := "ID of the Virtual Private Cloud (VPC) the server is connected to."
+ resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
+ Description: vpcIdDescription,
+ MarkdownDescription: vpcIdDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
+
// Additional attributes
resp.Schema.Attributes["permalink"] = &schema.StringAttribute{
Description: "A randomly generated two-word identifier assigned to servers in regions that support this feature",
MarkdownDescription: "A randomly generated two-word identifier assigned to servers in regions that support this feature",
+ Optional: false,
+ Required: false,
Computed: true,
}
@@ -90,6 +138,8 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
Description: publicIpv4AddressesDescription,
MarkdownDescription: publicIpv4AddressesDescription,
ElementType: types.StringType,
+ Optional: false,
+ Required: false,
Computed: true,
}
@@ -98,6 +148,8 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
Description: privateIpv4AddressesDescription,
MarkdownDescription: privateIpv4AddressesDescription,
ElementType: types.StringType,
+ Optional: false,
+ Required: false,
Computed: true,
}
@@ -105,6 +157,8 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
resp.Schema.Attributes["memory"] = &schema.Int32Attribute{
Description: memoryDescription,
MarkdownDescription: memoryDescription,
+ Optional: false,
+ Required: false,
Computed: true,
}
@@ -112,6 +166,8 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
resp.Schema.Attributes["disk"] = &schema.Int32Attribute{
Description: diskDescription,
MarkdownDescription: diskDescription,
+ Optional: false,
+ Required: false,
Computed: true,
}
}
diff --git a/internal/provider/server_firewall_rules_resource.go b/internal/provider/server_firewall_rules_resource.go
index 0769faa..edc7a17 100644
--- a/internal/provider/server_firewall_rules_resource.go
+++ b/internal/provider/server_firewall_rules_resource.go
@@ -59,7 +59,6 @@ func (r *serverFirewallRulesResource) Metadata(ctx context.Context, req resource
func (r *serverFirewallRulesResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = resources.ServerFirewallRulesResourceSchema(ctx)
- // resp.Schema.Description = "TODO"
// Overrides
serverId := resp.Schema.Attributes["server_id"]
diff --git a/internal/provider/server_resource.go b/internal/provider/server_resource.go
index 6762fc9..2f94bdd 100644
--- a/internal/provider/server_resource.go
+++ b/internal/provider/server_resource.go
@@ -84,7 +84,6 @@ func (r *serverResource) Metadata(ctx context.Context, req resource.MetadataRequ
func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = resources.ServerResourceSchema(ctx)
- resp.Schema.Description = "Provides a Binary Lane Server resource. This can be used to create and delete servers."
// Overrides
id := resp.Schema.Attributes["id"]
@@ -100,10 +99,11 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
},
}
+ imageDescription := "The slug of the selected operating system, such as `debian-12`. You can fetch a full list of images from the BinaryLane API."
image := resp.Schema.Attributes["image"]
resp.Schema.Attributes["image"] = &schema.StringAttribute{
- Description: image.GetDescription(),
- MarkdownDescription: image.GetMarkdownDescription(),
+ Description: imageDescription,
+ MarkdownDescription: imageDescription,
Required: image.IsRequired(),
Optional: image.IsOptional(),
Computed: image.IsComputed(),
@@ -112,10 +112,10 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
},
}
- backups := resp.Schema.Attributes["backups"]
+ backupsDescription := "If `true` this will enable two daily backups for the server. By default, backups are disabled."
resp.Schema.Attributes["backups"] = &schema.BoolAttribute{
- Description: backups.GetDescription(),
- MarkdownDescription: backups.GetMarkdownDescription(),
+ Description: backupsDescription,
+ MarkdownDescription: backupsDescription,
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false), // Add default to backups
@@ -134,7 +134,7 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
Description: vpcId.GetDescription(),
MarkdownDescription: vpcId.GetMarkdownDescription(),
Optional: vpcId.IsOptional(),
- Computed: false, // VPC ID is not computed, defined at creation
+ Computed: false, // vpc_id is not computed, defined at creation
}
portBlocking := resp.Schema.Attributes["port_blocking"]
@@ -171,6 +171,20 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
},
}
+ userDataDescription := "A script or cloud-config YAML file to configure the server. Can only be specified if the OS image supports UserData (i.e. not Windows)." +
+ " See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script"
+ userData := resp.Schema.Attributes["user_data"]
+ resp.Schema.Attributes["user_data"] = &schema.StringAttribute{
+ Description: userDataDescription,
+ MarkdownDescription: userDataDescription,
+ Required: userData.IsRequired(),
+ Optional: userData.IsOptional(),
+ Computed: userData.IsComputed(),
+ Validators: []validator.String{
+ stringvalidator.LengthAtMost(65536),
+ },
+ }
+
// Additional attributes
pwDescription :=
"If this is provided the specified or default remote user's account password will be set to this value. " +
@@ -184,15 +198,13 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
Sensitive: true, // Mark password as sensitive
}
- publicIpv4CountDescription := "The number of public IPv4 addresses to assign to the server. If this is not provided, the " +
- "server will be created with the default number of public IPv4 addresses."
+ publicIpv4CountDescription := "The number of public IPv4 addresses to assign to the server."
resp.Schema.Attributes["public_ipv4_count"] = &schema.Int32Attribute{
Description: publicIpv4CountDescription,
MarkdownDescription: publicIpv4CountDescription,
Required: true,
Optional: false,
Computed: false,
- // Default: int32default.StaticInt32(0), // TODO: Uncomment with 1.0 release (see issue #30)
Validators: []validator.Int32{
int32validator.AtLeast(0),
int32validator.AtMost(8),
@@ -271,18 +283,15 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
},
}
- memoryDescription := `The total memory in MB for this server. If specified this is the absolute value, not just the
-additional memory above what is included in the size. Leave null to accept the default for the size if this is a new
-server or a resize to a different base size, or to keep the current value if this a resize with the same base size
-but different options.`
- memoryValidValues := "Valid values must be a multiple of 128. If the value is greater than 2048MB, it must be a " +
- "multiple of 1024. If the value is greater than 16384MB, it must be a multiple of 2048. If the value is greater " +
- "than 24576MB, it must be a multiple of 4096."
+ memoryDescription := `The total memory in MB for this server. Leave null to accept the default size.`
+ memoryValidValues := "Valid values must be a multiple of 128. If the value is greater than 2048 MB, it must be a " +
+ "multiple of 1024. If the value is greater than 16384 MB, it must be a multiple of 2048. If the value is greater " +
+ "than 24576 MB, it must be a multiple of 4096."
memoryValidValuesMarkdown := ` Valid values:
- must be a multiple of 128
- - \> 2048MB must be a multiple of 1024
- - \> 16384MB must be a multiple of 2048
- - \> 24576MB must be a multiple of 4096`
+ - \> 2048 MB must be a multiple of 1024
+ - \> 16384 MB must be a multiple of 2048
+ - \> 24576 MB must be a multiple of 4096`
resp.Schema.Attributes["memory"] = &schema.Int32Attribute{
Description: memoryDescription + memoryValidValues,
@@ -299,15 +308,13 @@ but different options.`
},
}
- diskDescription := `The total storage in GB for this server. If specified this is the absolute value, not just the additional storage above what is included in the size.
-Leave null to accept the default for the size if this is a new server or a resize to a different base size,
-or to keep the current value if this a resize with the same base size but different options.`
- diskValidValues := "Valid values must be a multiple of 5. If the value is greater than 60GB, it must be a multiple of 10. " +
- "if the value is greater than 200GB, it must be a multiple of 100. "
+ diskDescription := `The total storage in GB for this server. Leave null to accept the default for the size`
+ diskValidValues := "Valid values must be a multiple of 5. If the value is greater than 60 GB, it must be a multiple of 10. " +
+ "if the value is greater than 200 GB, it must be a multiple of 100. "
diskValidValuesMarkdown := ` Valid values:
- must be a multiple of 5
- - \> 60GB must be a multiple of 10
- - \> 200GB must be a multiple of 100`
+ - \> 60 GB must be a multiple of 10
+ - \> 200 GB must be a multiple of 100`
resp.Schema.Attributes["disk"] = &schema.Int32Attribute{
Description: diskDescription + diskValidValues,
diff --git a/internal/provider/ssh_key_data_source.go b/internal/provider/ssh_key_data_source.go
index 059fce1..536cf8f 100644
--- a/internal/provider/ssh_key_data_source.go
+++ b/internal/provider/ssh_key_data_source.go
@@ -59,7 +59,17 @@ func (d *sshKeyDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
return
}
resp.Schema = *ds
- // resp.Schema.Description = "TODO"
+
+ // Overrides
+ defaultDescription := "If `true`, this SSH key will be included on all new server installations (if the operating " +
+ "system supports SSH key injection)."
+ resp.Schema.Attributes["default"] = schema.BoolAttribute{
+ Description: defaultDescription,
+ MarkdownDescription: defaultDescription,
+ Optional: false,
+ Required: false,
+ Computed: true,
+ }
// Additional attributes
fingerprintDescription := "The fingerprint of the SSH key."
diff --git a/internal/provider/ssh_key_resource.go b/internal/provider/ssh_key_resource.go
index 90e3151..ae8083b 100644
--- a/internal/provider/ssh_key_resource.go
+++ b/internal/provider/ssh_key_resource.go
@@ -61,15 +61,24 @@ func (r *sshKeyResource) Metadata(ctx context.Context, req resource.MetadataRequ
func (r *sshKeyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = resources.SshKeyResourceSchema(ctx)
- // resp.Schema.Description = "TODO"
// Overrides
- default_ := resp.Schema.Attributes["default"]
+ idDescription := "The numeric ID of the SSH key."
+ resp.Schema.Attributes["id"] = schema.Int64Attribute{
+ Required: false,
+ Optional: false,
+ Computed: true,
+ Description: idDescription,
+ MarkdownDescription: idDescription,
+ }
+
+ defaultDescription := "If `true`, this SSH key will be included on all new server installations (if the operating " +
+ "system supports SSH key injection). Default is `false`."
resp.Schema.Attributes["default"] = schema.BoolAttribute{
Optional: true,
Computed: true,
- Description: default_.GetDescription(),
- MarkdownDescription: default_.GetMarkdownDescription(),
+ Description: defaultDescription,
+ MarkdownDescription: defaultDescription,
Default: booldefault.StaticBool(false), // Add default to backups
}
@@ -265,7 +274,7 @@ func (r *sshKeyResource) ImportState(
sshResp, err := r.bc.client.GetAccountKeysWithResponse(ctx, ¶ms)
if err != nil {
- resp.Diagnostics.AddError(fmt.Sprintf("Error getting SSH key for import: fingerprint=%s", req.ID), err.Error())
+ resp.Diagnostics.AddError(fmt.Sprintf("Error getting SSH keys for import: fingerprint=%s", req.ID), err.Error())
return
}
diff --git a/internal/provider/util.go b/internal/provider/util.go
index b8c0560..d38bd96 100644
--- a/internal/provider/util.go
+++ b/internal/provider/util.go
@@ -32,129 +32,162 @@ func convertResourceSchemaToDataSourceSchema(rs r_schema.Schema, cfg AttributeCo
required := cfg.RequiredAttributes != nil && slices.Contains(*cfg.RequiredAttributes, name)
optional := cfg.OptionalAttributes != nil && slices.Contains(*cfg.OptionalAttributes, name)
- switch attribute.GetType() {
- case types.BoolType:
- ds.Attributes[name] = d_schema.BoolAttribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.DynamicType:
- ds.Attributes[name] = d_schema.DynamicAttribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.Float32Type:
- ds.Attributes[name] = d_schema.Float32Attribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.Float64Type:
- ds.Attributes[name] = d_schema.Float64Attribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.Int32Type:
- ds.Attributes[name] = d_schema.Int32Attribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.Int64Type:
- ds.Attributes[name] = d_schema.Int64Attribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.NumberType:
- ds.Attributes[name] = d_schema.NumberAttribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- case types.StringType:
- ds.Attributes[name] = d_schema.StringAttribute{
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- default:
- if listType, isList := attribute.GetType().(types.ListType); isList {
- ds.Attributes[name] = d_schema.ListAttribute{
- ElementType: listType.ElemType,
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- }
- continue
- }
- if objType, isObject := attribute.(r_schema.SingleNestedAttribute); isObject {
- attributeTypes := make(map[string]attr.Type, len(objType.GetAttributes()))
- for name, attribute := range objType.GetAttributes() {
- attributeTypes[name] = attribute.GetType()
- }
-
- ds.Attributes[name] = d_schema.ObjectAttribute{
- CustomType: objType.CustomType,
- Description: attribute.GetDescription(),
- Required: required,
- Optional: optional,
- Computed: !required,
- Sensitive: attribute.IsSensitive(),
- MarkdownDescription: attribute.GetMarkdownDescription(),
- DeprecationMessage: attribute.GetDeprecationMessage(),
- AttributeTypes: attributeTypes,
- }
- continue
- }
-
- return nil, fmt.Errorf("failed to convert resource schema attribute to data source schema attribute: name=%s, type=%s", name, attribute.GetType())
+ attr, err := convertResourceAttrToDataSourceAttr(name, attribute, required, optional)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert resource schema attribute to data source schema attribute: %w", err)
}
+ ds.Attributes[name] = attr
}
return &ds, nil
}
+func convertResourceAttrToDataSourceAttr(name string, attribute r_schema.Attribute, required, optional bool) (d_schema.Attribute, error) {
+ switch attribute.GetType() {
+ case types.BoolType:
+ return d_schema.BoolAttribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.DynamicType:
+ return d_schema.DynamicAttribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.Float32Type:
+ return d_schema.Float32Attribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.Float64Type:
+ return d_schema.Float64Attribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.Int32Type:
+ return d_schema.Int32Attribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.Int64Type:
+ return d_schema.Int64Attribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.NumberType:
+ return d_schema.NumberAttribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ case types.StringType:
+ return d_schema.StringAttribute{
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ default:
+ if t, isList := attribute.(r_schema.ListNestedAttribute); isList {
+ nestedObjectAttrs := make(map[string]d_schema.Attribute)
+ for name, attribute := range t.NestedObject.Attributes {
+ nestedAttribute, err := convertResourceAttrToDataSourceAttr(name, attribute, required, optional)
+ if err != nil {
+ return nil, err
+ }
+ nestedObjectAttrs[name] = nestedAttribute
+ }
+
+ return d_schema.ListNestedAttribute{
+ NestedObject: d_schema.NestedAttributeObject{
+ Attributes: nestedObjectAttrs,
+ CustomType: t.NestedObject.CustomType,
+ Validators: t.NestedObject.Validators,
+ },
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ }
+
+ if t, isList := attribute.GetType().(types.ListType); isList {
+ return d_schema.ListAttribute{
+ ElementType: t.ElemType,
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ }, nil
+ }
+
+ if t, isObject := attribute.(r_schema.SingleNestedAttribute); isObject {
+ attributeTypes := make(map[string]attr.Type, len(t.GetAttributes()))
+ for name, attribute := range t.GetAttributes() {
+ attributeTypes[name] = attribute.GetType()
+ }
+
+ return d_schema.ObjectAttribute{
+ CustomType: t.CustomType,
+ Description: attribute.GetDescription(),
+ Required: required,
+ Optional: optional,
+ Computed: !required,
+ Sensitive: attribute.IsSensitive(),
+ MarkdownDescription: attribute.GetMarkdownDescription(),
+ DeprecationMessage: attribute.GetDeprecationMessage(),
+ AttributeTypes: attributeTypes,
+ }, nil
+ }
+
+ return nil, fmt.Errorf("conversion of attribute type is not implemented: name=%s, type=%s", name, attribute.GetType())
+ }
+}
+
func listContainsUnknown(ctx context.Context, list types.List) bool {
// If the whole list is unknown, return true
if list.IsUnknown() {
diff --git a/internal/provider/vpc_route_entries_data_source.go b/internal/provider/vpc_route_entries_data_source.go
index f9b1225..173bf7d 100644
--- a/internal/provider/vpc_route_entries_data_source.go
+++ b/internal/provider/vpc_route_entries_data_source.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-binarylane/internal/resources"
"github.com/hashicorp/terraform-plugin-framework/datasource"
- "github.com/hashicorp/terraform-plugin-framework/provider/schema"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
var (
@@ -50,7 +50,20 @@ func (d *vpcRouteEntriesDataSource) Schema(ctx context.Context, req datasource.S
resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
Description: vpcId.GetDescription(),
MarkdownDescription: vpcId.GetMarkdownDescription(),
- Required: true, // VPC ID is required to define the route entries
+ Required: true, // vpc_id is required to define the route entries
+ }
+
+ vpcRouteEntries := resp.Schema.Attributes["route_entries"].(schema.ListNestedAttribute)
+ vpcRouteEntriesDescription := "The route entries that control how network traffic is directed through the VPC environment."
+ resp.Schema.Attributes["route_entries"] = &schema.ListNestedAttribute{
+ Description: vpcRouteEntriesDescription,
+ NestedObject: schema.NestedAttributeObject{
+ CustomType: vpcRouteEntries.NestedObject.CustomType,
+ Attributes: vpcRouteEntries.NestedObject.Attributes,
+ },
+ CustomType: vpcRouteEntries.CustomType,
+ Required: false,
+ Computed: true,
}
}
diff --git a/internal/provider/vpc_route_entries_resource.go b/internal/provider/vpc_route_entries_resource.go
index 6fbd0e7..334b8a1 100644
--- a/internal/provider/vpc_route_entries_resource.go
+++ b/internal/provider/vpc_route_entries_resource.go
@@ -50,7 +50,7 @@ func (r *vpcRouteEntriesResource) Schema(ctx context.Context, req resource.Schem
resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
Description: vpcId.GetDescription(),
MarkdownDescription: vpcId.GetMarkdownDescription(),
- Required: true, // VPC ID is required to define the route entries
+ Required: true, // vpc_id is required to define the route entries
Validators: []validator.Int64{
int64validator.AtLeast(1),
},
diff --git a/internal/resources/load_balancer_resource_gen.go b/internal/resources/load_balancer_resource_gen.go
index b3c9e95..601a360 100644
--- a/internal/resources/load_balancer_resource_gen.go
+++ b/internal/resources/load_balancer_resource_gen.go
@@ -26,8 +26,8 @@ func LoadBalancerResourceSchema(ctx context.Context) schema.Schema {
Attributes: map[string]schema.Attribute{
"entry_protocol": schema.StringAttribute{
Required: true,
- Description: "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
- MarkdownDescription: "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
+ Description: "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
+ MarkdownDescription: "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
Validators: []validator.String{
stringvalidator.OneOf(
"http",
diff --git a/provider_code_spec.json b/provider_code_spec.json
index b7e1f39..59d464e 100644
--- a/provider_code_spec.json
+++ b/provider_code_spec.json
@@ -17,7 +17,7 @@
"name": "entry_protocol",
"string": {
"computed_optional_required": "required",
- "description": "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
+ "description": "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
"validators": [
{
"custom": {