diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 69ddcfa..e87c6a7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -67,7 +67,7 @@ go generate
```sh
tfplugingen-framework scaffold resource \
--output-dir ./internal/provider \
- --name REPLACE_ME
+ --name REPLACE_ME # eg. server
```
```sh
@@ -163,8 +163,8 @@ Define the interfaces that the data source should implement:
Add the API client to the data source:
```diff
-- type exampleResource struct{}
-+ type exampleResource struct {
+- type exampleDataSource struct{}
++ type exampleDataSource struct {
+ bc *BinarylaneClient
+ }
```
diff --git a/docs/data-sources/images.md b/docs/data-sources/images.md
new file mode 100644
index 0000000..96d08f4
--- /dev/null
+++ b/docs/data-sources/images.md
@@ -0,0 +1,120 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "binarylane_images Data Source - terraform-provider-binarylane"
+subcategory: ""
+description: |-
+
+---
+
+# binarylane_images (Data Source)
+
+
+
+## Example Usage
+
+```terraform
+data "binarylane_images" "example" {
+}
+```
+
+
+## Schema
+
+### Optional
+
+- `type` (String) Queries for distribution will include images that have pre-installed applications.
+
+### Read-Only
+
+- `images` (Attributes List) (see [below for nested schema](#nestedatt--images))
+
+
+### Nested Schema for `images`
+
+Read-Only:
+
+- `backup_info` (Attributes) If this image is a backup, this object will provide further information. (see [below for nested schema](#nestedatt--images--backup_info))
+- `created_at` (String) If this is a backup image this is the date and time in ISO8601 format when the image was created.
+- `description` (String) A description that may provide further details or warnings about the image.
+- `distribution` (String) If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using.
+- `distribution_info` (Attributes) This object may provide further information about the distribution. (see [below for nested schema](#nestedatt--images--distribution_info))
+- `distribution_surcharges` (Attributes) If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$. (see [below for nested schema](#nestedatt--images--distribution_surcharges))
+- `error_message` (String) If the image creation failed this may provide further information.
+- `full_name` (String) If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image.
+- `id` (Number) The ID of this image.
+- `min_disk_size` (Number) For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup.
+- `min_memory_megabytes` (Number) This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image).
+- `name` (String) If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image.
+- `public` (Boolean) A public image is available to all users. A private image is available only to the account that created the image.
+- `regions` (List of String) The slugs of the regions where the image is available for use.
+- `size_gigabytes` (Number) For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB.
+- `slug` (String) If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference.
+- `status` (String) | Value | Description |
+| ----- | ----------- |
+| NEW | The image is new. |
+| available | The image is available for use. |
+| pending | The image is pending and is not yet available for use. |
+| deleted | The image has been deleted and is no longer available for use. |
+- `type` (String) | Value | Description |
+| ----- | ----------- |
+| custom | An image uploaded by a user. |
+| snapshot | A snapshot. Snapshot creation is not currently supported so only distribution images will have this value. |
+| backup | A backup of a server. |
+
+
+### Nested Schema for `images.backup_info`
+
+Read-Only:
+
+- `backup_disks` (Attributes List) A list of the individual disks that make up this backup. (see [below for nested schema](#nestedatt--images--backup_info--backup_disks))
+- `iso` (Boolean) If this is true the backup is an ISO image and cannot be restored or downloaded. ISO images may only be attached for use as a boot disk or an additional disk.
+- `locked` (Boolean) If this is true the backup is locked and cannot be replaced.
+- `offsite` (Boolean) If this is true, an attempt to create an offsite copy was made. This does not mean that the offsite copy attempt was successful or that the copy still exists.
+- `server_id` (Number) The server ID that was used to create this backup.
+- `type` (String) | Value | Description |
+| ----- | ----------- |
+| daily | A backup which is scheduled to be taken each day. |
+| weekly | A backup which is scheduled to be taken each week. |
+| monthly | A backup which is scheduled to be taken each month. |
+| temporary | A backup which is created on demand and only retained for a maximum of seven days. |
+
+
+### Nested Schema for `images.backup_info.backup_disks`
+
+Read-Only:
+
+- `description` (String) A description of this disk.
+- `id` (Number) The ID of this backup disk.
+- `min_disk_size` (Number) This is the minimum disk size in GB required to restore this disk image.
+- `size_gigabytes` (Number) This is the compressed size of the disk image in GB.
+
+
+
+
+### Nested Schema for `images.distribution_info`
+
+Read-Only:
+
+- `features` (List of String) Features supported by this distribution.
+- `image_id` (Number) If this is a backup image, the operating system ID of the server at the time the backup was created.
+- `password_recovery` (String) Supported methods of password recovery.
+
+| Value | Description |
+| ----- | ----------- |
+| manual | Password must be reset manually using the recovery console and rescue disk. |
+| offline-clear | Password can be cleared for the admin/root user only. New password needs to be provided on login via the console (Requires restart). |
+| offline-change | Password can be reset and new credentials sent (Requires restart). |
+| online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |
+- `remote_access_user` (String) User name to use when connecting via remote access (RDP or SSH).
+
+
+
+### Nested Schema for `images.distribution_surcharges`
+
+Read-Only:
+
+- `surcharge_base_cost` (Number) The additional cost for using this operating system as the base image for a size.
+- `surcharge_min_vcpu` (Number) The minimum vcpu count for surcharge calculations.
+- `surcharge_per_memory_max_megabytes` (Number) The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge.
+- `surcharge_per_memory_megabyte` (Number) The additional cost per MB for using this operating system as the base image for a size.
+- `surcharge_per_vcpu` (Number) The additional cost per vcpu for using this operating system as the base image for a size.
diff --git a/docs/data-sources/load_balancer.md b/docs/data-sources/load_balancer.md
index e41445a..c4d3ff6 100644
--- a/docs/data-sources/load_balancer.md
+++ b/docs/data-sources/load_balancer.md
@@ -3,12 +3,12 @@
page_title: "binarylane_load_balancer Data Source - terraform-provider-binarylane"
subcategory: ""
description: |-
-
+ Retrieve details about a BinaryLane Load Balancer.
---
# binarylane_load_balancer (Data Source)
-
+Retrieve details about a BinaryLane Load Balancer.
## Example Usage
diff --git a/docs/data-sources/regions.md b/docs/data-sources/regions.md
new file mode 100644
index 0000000..e2f6d93
--- /dev/null
+++ b/docs/data-sources/regions.md
@@ -0,0 +1,37 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "binarylane_regions Data Source - terraform-provider-binarylane"
+subcategory: ""
+description: |-
+
+---
+
+# binarylane_regions (Data Source)
+
+
+
+## Example Usage
+
+```terraform
+data "binarylane_regions" "example" {
+}
+```
+
+
+## Schema
+
+### Read-Only
+
+- `regions` (Attributes List) (see [below for nested schema](#nestedatt--regions))
+
+
+### Nested Schema for `regions`
+
+Read-Only:
+
+- `available` (Boolean) Whether this region is available for the allocation of new resources.
+- `features` (List of String) A list of features available for resources in this region.
+- `name` (String) The name of this region.
+- `name_servers` (List of String) A list of nameservers available for resources in this region.
+- `sizes` (List of String) The slugs of the sizes available in this region.
+- `slug` (String) The unique slug for this region.
diff --git a/docs/data-sources/server.md b/docs/data-sources/server.md
index f7e10fd..9025ea6 100644
--- a/docs/data-sources/server.md
+++ b/docs/data-sources/server.md
@@ -3,12 +3,12 @@
page_title: "binarylane_server Data Source - terraform-provider-binarylane"
subcategory: ""
description: |-
- Provides a Binary Lane Server data source. This can be used to read existing server details.
+ Retrieve details about a BinaryLane Server.
---
# binarylane_server (Data Source)
-Provides a Binary Lane Server data source. This can be used to read existing server details.
+Retrieve details about a BinaryLane Server.
## Example Usage
diff --git a/docs/data-sources/server_firewall_rules.md b/docs/data-sources/server_firewall_rules.md
index 4ec2476..a43d4b6 100644
--- a/docs/data-sources/server_firewall_rules.md
+++ b/docs/data-sources/server_firewall_rules.md
@@ -3,12 +3,12 @@
page_title: "binarylane_server_firewall_rules Data Source - terraform-provider-binarylane"
subcategory: ""
description: |-
-
+ Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
---
# binarylane_server_firewall_rules (Data Source)
-
+Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
## Example Usage
diff --git a/docs/data-sources/sizes.md b/docs/data-sources/sizes.md
new file mode 100644
index 0000000..5b6c24a
--- /dev/null
+++ b/docs/data-sources/sizes.md
@@ -0,0 +1,98 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "binarylane_sizes Data Source - terraform-provider-binarylane"
+subcategory: ""
+description: |-
+
+---
+
+# binarylane_sizes (Data Source)
+
+
+
+## Example Usage
+
+```terraform
+data "binarylane_sizes" "example" {
+}
+```
+
+
+## Schema
+
+### Optional
+
+- `image` (String) If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects.
+- `server_id` (Number) If supplied only sizes available for a resize the specified server will be returned. This parameter is only available when authenticated.
+
+### Read-Only
+
+- `sizes` (Attributes List) (see [below for nested schema](#nestedatt--sizes))
+
+
+### Nested Schema for `sizes`
+
+Read-Only:
+
+- `available` (Boolean) If this is false the size is not available for new servers.
+- `cpu_description` (String) A description of the CPU provided in this size.
+- `description` (String) A description of this size.
+- `disk` (Number) The included storage for this size in GB.
+- `excess_transfer_cost_per_gigabyte` (Number) The excess charged for any transfer above the included data transfer in AU$ per GB.
+- `memory` (Number) The included memory for this size in MB.
+- `options` (Attributes) Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated). (see [below for nested schema](#nestedatt--sizes--options))
+- `price_hourly` (Number) Hourly price in AU$.
+- `price_monthly` (Number) Monthly Price in AU$.
+- `regions` (List of String) A list of region slugs where this size is available regardless of stock.
+If this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,
+otherwise not all regions listed will support all operating systems on this size.
+- `regions_out_of_stock` (List of String) A list of region slugs where the size is normally available but is currently not available due to lack of stock.
+- `size_type` (Attributes) The type of this size, generally used to differentiate sizes optimized for different usages. (see [below for nested schema](#nestedatt--sizes--size_type))
+- `slug` (String) The slug of this size.
+- `storage_description` (String) A description of the storage provided in this size.
+- `transfer` (Number) The included data transfer for this size in TB.
+- `vcpu_units` (String) This is the unit that the vcpus field counts, e.g. "core" or "thread".
+- `vcpus` (Number) The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware.
+
+
+### Nested Schema for `sizes.options`
+
+Read-Only:
+
+- `backups_cost_per_backup_per_gigabyte` (Number) The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected.
+- `daily_backups` (Number) The number of daily backups included in the base size cost.
+- `discount_for_no_public_ipv4` (Number) This is the discount (if any) that is applied if no public IPv4 addresses are selected.
+- `disk_cost_per_additional_gigabyte` (Number) The additional cost per GB per month for additional storage space.
+- `disk_max` (Number) The maximum storage in GB permitted on this size.
+- `disk_min` (Number) The minimum storage in GB permitted on this size.
+- `ipv4_addresses_cost_per_address` (Number) The additional cost per public IPv4 address per month for additional IPv4 addresses.
+- `ipv4_addresses_max` (Number) The maximum number of IPv4 addresses permitted on this size.
+- `memory_cost_per_additional_megabyte` (Number) The additional cost per MB per month for additional memory.
+- `memory_max` (Number) The maximum memory in MB permitted on this size.
+- `monthly_backups` (Number) The number of monthly backups included in the base size cost.
+- `offsite_backup_frequency_cost` (Attributes) The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$. (see [below for nested schema](#nestedatt--sizes--options--offsite_backup_frequency_cost))
+- `offsite_backups_cost_per_gigabyte` (Number) The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected.
+- `restricted_disk_values` (List of Number) If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted.
+- `transfer_cost_per_additional_gigabyte` (Number) The additional cost per GB per month for additional included transfer.
+- `transfer_max` (Number) The maximum transfer in TB permitted for this size.
+- `weekly_backups` (Number) The number of weekly backups included in the base size cost.
+
+
+### Nested Schema for `sizes.options.offsite_backup_frequency_cost`
+
+Read-Only:
+
+- `daily_per_gigabyte` (Number) The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
+- `monthly_per_gigabyte` (Number) The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
+- `weekly_per_gigabyte` (Number) The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
+
+
+
+
+### Nested Schema for `sizes.size_type`
+
+Read-Only:
+
+- `description` (String) The description of this size type, generally used to indicate the intended use case for sizes of this type.
+- `name` (String) The name of this size type.
+- `slug` (String) The slug of this size type.
diff --git a/docs/index.md b/docs/index.md
index 6306c5c..adfe885 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -22,17 +22,9 @@ terraform {
}
provider "binarylane" {
- # api_token = "" # Recommend setting with environment variable BINARYLANE_API_TOKEN
-}
+ api_token = var.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
- # ...
+ # Or, set environment variable BINARYLANE_API_TOKEN
}
```
@@ -41,5 +33,5 @@ resource "binarylane_server" "example" {
### Optional
-- `api_endpoint` (String) Binary Lane API endpoint. If not set checks env for `BINARYLANE_API_ENDPOINT`. Default: `https://api.binarylane.com.au/v2`.
-- `api_token` (String, Sensitive) Binary Lane API token. If not set checks env for `BINARYLANE_API_TOKEN`.
+- `api_endpoint` (String) Binary Lane API endpoint. Defaults to `https://api.binarylane.com.au/v2`, but can be overridden by setting this attribute or the `BINARYLANE_API_ENDPOINT` environment variable.
+- `api_token` (String, Sensitive) Binary Lane API token. If not defined, will default to `BINARYLANE_API_TOKEN` environment variable.
diff --git a/docs/resources/load_balancer.md b/docs/resources/load_balancer.md
index caa30cd..f0c66cd 100644
--- a/docs/resources/load_balancer.md
+++ b/docs/resources/load_balancer.md
@@ -3,12 +3,12 @@
page_title: "binarylane_load_balancer Resource - terraform-provider-binarylane"
subcategory: ""
description: |-
-
+ Provides a BinaryLane Load Balancer resource. This can be used to create, update, and delete load balancers. See the docs https://support.binarylane.com.au/support/solutions/articles/1000025661-load-balancer for more information.
---
# binarylane_load_balancer (Resource)
-
+Provides a BinaryLane Load Balancer resource. This can be used to create, update, and delete load balancers. See [the docs](https://support.binarylane.com.au/support/solutions/articles/1000025661-load-balancer) for more information.
## Example Usage
diff --git a/docs/resources/server_firewall_rules.md b/docs/resources/server_firewall_rules.md
index 2ffdfcc..9f809b7 100644
--- a/docs/resources/server_firewall_rules.md
+++ b/docs/resources/server_firewall_rules.md
@@ -3,12 +3,12 @@
page_title: "binarylane_server_firewall_rules Resource - terraform-provider-binarylane"
subcategory: ""
description: |-
-
+ Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
---
# binarylane_server_firewall_rules (Resource)
-
+Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
## Example Usage
diff --git a/examples/README.md b/examples/README.md
index 66d89d1..92f9989 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -3,6 +3,7 @@
In order of increasing complexity, these examples show how to use the provider.
- [./basic](./basic/main.tf) - A basic example that creates a server.
+- [./offerings](./offerings/main.tf) - Use data sources to list available images, regions, and sizes.
- [./ssh](./ssh/main.tf) - Create a server and registers an SSH key as a global default.
- [./cloud-init](./cloud-init/main.tf) - Create a server with a cloud-init configuration.
- [./nix](./nix/main.tf) - WIP - Create a server with a NixOS configuration.
diff --git a/examples/data-sources/binarylane_images/data-source.tf b/examples/data-sources/binarylane_images/data-source.tf
new file mode 100644
index 0000000..e68ce79
--- /dev/null
+++ b/examples/data-sources/binarylane_images/data-source.tf
@@ -0,0 +1,2 @@
+data "binarylane_images" "example" {
+}
diff --git a/examples/data-sources/binarylane_regions/data-source.tf b/examples/data-sources/binarylane_regions/data-source.tf
new file mode 100644
index 0000000..3f0615a
--- /dev/null
+++ b/examples/data-sources/binarylane_regions/data-source.tf
@@ -0,0 +1,2 @@
+data "binarylane_regions" "example" {
+}
diff --git a/examples/data-sources/binarylane_sizes/data-source.tf b/examples/data-sources/binarylane_sizes/data-source.tf
new file mode 100644
index 0000000..9b53731
--- /dev/null
+++ b/examples/data-sources/binarylane_sizes/data-source.tf
@@ -0,0 +1,2 @@
+data "binarylane_sizes" "example" {
+}
diff --git a/examples/offerings/.gitignore b/examples/offerings/.gitignore
new file mode 100644
index 0000000..e895a5a
--- /dev/null
+++ b/examples/offerings/.gitignore
@@ -0,0 +1,37 @@
+# Local .terraform directories
+**/.terraform/*
+
+# .tfstate files
+*.tfstate
+*.tfstate.*
+
+# Crash log files
+crash.log
+crash.*.log
+
+# Exclude all .tfvars files, which are likely to contain sensitive data, such as
+# password, private keys, and other secrets. These should not be part of version
+# control as they are data points which are potentially sensitive and subject
+# to change depending on the environment.
+*.tfvars
+*.tfvars.json
+
+# Ignore override files as they are usually used to override resources locally and so
+# are not checked in
+override.tf
+override.tf.json
+*_override.tf
+*_override.tf.json
+
+# Ignore transient lock info files created by terraform apply
+.terraform.tfstate.lock.info
+
+# Include override files you do wish to add to version control using negated pattern
+# !example_override.tf
+
+# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
+# example: *tfplan*
+
+# Ignore CLI configuration files
+.terraformrc
+terraform.rc
diff --git a/examples/offerings/README.md b/examples/offerings/README.md
new file mode 100644
index 0000000..4725704
--- /dev/null
+++ b/examples/offerings/README.md
@@ -0,0 +1,69 @@
+# examples/offerings
+
+You can follow this example to list the available offerings for servers.
+
+Feel free to customize this example further to filter by specific regions, operating systems, or server sizes to suit your needs.
+
+
+```sh
+terraform init
+terraform apply -refresh-only
+terraform output -json | jq -r 'with_entries(.value |= .value)'
+```
+
+Example output:
+
+```json
+{
+ "images": [
+ "alma-8",
+ "alma-9",
+ "byo-os",
+ "byo-os-virtio-disabled",
+ "debian-12",
+ "ubuntu-20.04-neon-desktop",
+ "rocky-8",
+ "rocky-9",
+ "ubuntu-22.04",
+ "ubuntu-24.04",
+ "cpanel-plus-whm",
+ "debian-11",
+ "ubuntu-20.04.6",
+ "ubuntu-22.04-desktop",
+ "windows-2022",
+ "windows-2022-sql-2019-web",
+ "windows-2022-sql-2019-std",
+ "windows-2016",
+ "windows-2019",
+ "windows-2016-sql-2016-web",
+ "windows-2019-sql-2017-web",
+ "windows-2019-sql-2017-std"
+ ],
+ "regions": [
+ "syd",
+ "mel",
+ "bne",
+ "per",
+ "sin"
+ ],
+ "sizes": [
+ "std-min",
+ "std-1vcpu",
+ "std-2vcpu",
+ "std-4vcpu",
+ "std-6vcpu",
+ "std-8vcpu",
+ "cpu-2thr",
+ "cpu-4thr",
+ "cpu-6thr",
+ "cpu-8thr",
+ "hdd-500gb",
+ "hdd-1000gb",
+ "hdd-2000gb",
+ "ded-e2136-400gb",
+ "ded-e2136-800gb",
+ "ded-e2288g-800gb",
+ "ded-3900x-1600gb"
+ ]
+}
+```
diff --git a/examples/offerings/main.tf b/examples/offerings/main.tf
new file mode 100644
index 0000000..202a652
--- /dev/null
+++ b/examples/offerings/main.tf
@@ -0,0 +1,29 @@
+terraform {
+ required_providers {
+ binarylane = {
+ source = "oscarhermoso/binarylane"
+ }
+ }
+}
+
+provider "binarylane" {
+ # api_token = "" # Recommend setting with environment variable BINARYLANE_API_TOKEN
+}
+
+data "binarylane_images" "example" {}
+
+data "binarylane_sizes" "example" {}
+
+data "binarylane_regions" "example" {}
+
+output "images" {
+ value = data.binarylane_images.example.images[*].slug
+}
+
+output "sizes" {
+ value = data.binarylane_sizes.example.sizes[*].slug
+}
+
+output "regions" {
+ value = data.binarylane_regions.example.regions[*].slug
+}
diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf
index 747a88d..8748dad 100644
--- a/examples/provider/provider.tf
+++ b/examples/provider/provider.tf
@@ -7,15 +7,7 @@ terraform {
}
provider "binarylane" {
- # api_token = "" # Recommend setting with environment variable BINARYLANE_API_TOKEN
-}
+ api_token = var.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
- # ...
+ # Or, set environment variable BINARYLANE_API_TOKEN
}
diff --git a/generate.go b/generate.go
index aa4d6e9..4482ce9 100644
--- a/generate.go
+++ b/generate.go
@@ -4,7 +4,6 @@ package main
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=internal/binarylane/client.cfg.yml internal/binarylane/openapi.json
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=internal/binarylane/types.cfg.yml internal/binarylane/openapi.json
//go:generate go run github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi generate --config=./provider_gen_config.yml internal/binarylane/openapi.json --output=./provider_code_spec.json
-//go:generate ./provider-transform.sh
//go:generate mkdir -p internal/resources internal/data_sources
//go:generate go run github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework generate resources --input=./provider_code_spec.json --output=./internal/resources --package=resources
//go:generate go run github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework generate data-sources --input=./provider_code_spec.json --output=./internal/data_sources --package=data_sources
diff --git a/internal/binarylane/client_gen.go b/internal/binarylane/client_gen.go
index d352662..48e47a0 100644
--- a/internal/binarylane/client_gen.go
+++ b/internal/binarylane/client_gen.go
@@ -357,6 +357,11 @@ type ClientInterface interface {
PostServersServerIdActionsChangePortBlocking(ctx context.Context, serverId int64, body PostServersServerIdActionsChangePortBlockingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
+ // PostServersServerIdActionsChangeRegionWithBody request with any body
+ PostServersServerIdActionsChangeRegionWithBody(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
+
+ PostServersServerIdActionsChangeRegion(ctx context.Context, serverId int64, body PostServersServerIdActionsChangeRegionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
+
// PostServersServerIdActionsChangeReverseNameWithBody request with any body
PostServersServerIdActionsChangeReverseNameWithBody(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
@@ -1698,6 +1703,30 @@ func (c *Client) PostServersServerIdActionsChangePortBlocking(ctx context.Contex
return c.Client.Do(req)
}
+func (c *Client) PostServersServerIdActionsChangeRegionWithBody(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
+ req, err := NewPostServersServerIdActionsChangeRegionRequestWithBody(c.Server, serverId, contentType, body)
+ if err != nil {
+ return nil, err
+ }
+ req = req.WithContext(ctx)
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
+ return nil, err
+ }
+ return c.Client.Do(req)
+}
+
+func (c *Client) PostServersServerIdActionsChangeRegion(ctx context.Context, serverId int64, body PostServersServerIdActionsChangeRegionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
+ req, err := NewPostServersServerIdActionsChangeRegionRequest(c.Server, serverId, body)
+ if err != nil {
+ return nil, err
+ }
+ req = req.WithContext(ctx)
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
+ return nil, err
+ }
+ return c.Client.Do(req)
+}
+
func (c *Client) PostServersServerIdActionsChangeReverseNameWithBody(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostServersServerIdActionsChangeReverseNameRequestWithBody(c.Server, serverId, contentType, body)
if err != nil {
@@ -5777,6 +5806,53 @@ func NewPostServersServerIdActionsChangePortBlockingRequestWithBody(server strin
return req, nil
}
+// NewPostServersServerIdActionsChangeRegionRequest calls the generic PostServersServerIdActionsChangeRegion builder with application/json body
+func NewPostServersServerIdActionsChangeRegionRequest(server string, serverId int64, body PostServersServerIdActionsChangeRegionJSONRequestBody) (*http.Request, error) {
+ var bodyReader io.Reader
+ buf, err := json.Marshal(body)
+ if err != nil {
+ return nil, err
+ }
+ bodyReader = bytes.NewReader(buf)
+ return NewPostServersServerIdActionsChangeRegionRequestWithBody(server, serverId, "application/json", bodyReader)
+}
+
+// NewPostServersServerIdActionsChangeRegionRequestWithBody generates requests for PostServersServerIdActionsChangeRegion with any type of body
+func NewPostServersServerIdActionsChangeRegionRequestWithBody(server string, serverId int64, contentType string, body io.Reader) (*http.Request, error) {
+ var err error
+
+ var pathParam0 string
+
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "server_id", runtime.ParamLocationPath, serverId)
+ if err != nil {
+ return nil, err
+ }
+
+ serverURL, err := url.Parse(server)
+ if err != nil {
+ return nil, err
+ }
+
+ operationPath := fmt.Sprintf("/servers/%s/actions#ChangeRegion", pathParam0)
+ if operationPath[0] == '/' {
+ operationPath = "." + operationPath
+ }
+
+ queryURL, err := serverURL.Parse(operationPath)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequest("POST", queryURL.String(), body)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Add("Content-Type", contentType)
+
+ return req, nil
+}
+
// NewPostServersServerIdActionsChangeReverseNameRequest calls the generic PostServersServerIdActionsChangeReverseName builder with application/json body
func NewPostServersServerIdActionsChangeReverseNameRequest(server string, serverId int64, body PostServersServerIdActionsChangeReverseNameJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
@@ -8575,6 +8651,11 @@ type ClientWithResponsesInterface interface {
PostServersServerIdActionsChangePortBlockingWithResponse(ctx context.Context, serverId int64, body PostServersServerIdActionsChangePortBlockingJSONRequestBody, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangePortBlockingResponse, error)
+ // PostServersServerIdActionsChangeRegionWithBodyWithResponse request with any body
+ PostServersServerIdActionsChangeRegionWithBodyWithResponse(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeRegionResponse, error)
+
+ PostServersServerIdActionsChangeRegionWithResponse(ctx context.Context, serverId int64, body PostServersServerIdActionsChangeRegionJSONRequestBody, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeRegionResponse, error)
+
// PostServersServerIdActionsChangeReverseNameWithBodyWithResponse request with any body
PostServersServerIdActionsChangeReverseNameWithBodyWithResponse(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeReverseNameResponse, error)
@@ -8840,7 +8921,6 @@ type PostAccountKeysResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SshKeyResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -8862,7 +8942,6 @@ func (r PostAccountKeysResponse) StatusCode() int {
type DeleteAccountKeysKeyIdResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -8885,7 +8964,6 @@ type GetAccountKeysKeyIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SshKeyResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -8908,8 +8986,6 @@ type PutAccountKeysKeyIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SshKeyResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -8954,7 +9030,6 @@ type GetActionsActionIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -8976,7 +9051,6 @@ func (r GetActionsActionIdResponse) StatusCode() int {
type PostActionsActionIdProceedResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9043,7 +9117,6 @@ type GetCustomersMyInvoicesInvoiceIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *InvoiceResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9110,7 +9183,6 @@ type GetDataUsagesServerIdCurrentResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DataUsageResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9133,8 +9205,6 @@ type GetDomainsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainsResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9157,7 +9227,6 @@ type PostDomainsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9222,7 +9291,6 @@ func (r PostDomainsRefreshNameserverCacheResponse) StatusCode() int {
type DeleteDomainsDomainNameResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9245,7 +9313,6 @@ type GetDomainsDomainNameResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9268,7 +9335,6 @@ type GetDomainsDomainNameRecordsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainRecordsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9291,8 +9357,6 @@ type PostDomainsDomainNameRecordsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainRecordResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9314,7 +9378,6 @@ func (r PostDomainsDomainNameRecordsResponse) StatusCode() int {
type DeleteDomainsDomainNameRecordsRecordIdResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9337,7 +9400,6 @@ type GetDomainsDomainNameRecordsRecordIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainRecordResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9360,8 +9422,6 @@ type PutDomainsDomainNameRecordsRecordIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DomainRecordResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9384,7 +9444,6 @@ type GetImagesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImagesResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9407,7 +9466,6 @@ type GetImagesImageIdOrSlugResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImageResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9430,8 +9488,6 @@ type GetImagesImageIdDownloadResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImageDownloadResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9476,7 +9532,6 @@ type PostLoadBalancersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CreateLoadBalancerResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9520,7 +9575,6 @@ func (r GetLoadBalancersAvailabilityResponse) StatusCode() int {
type DeleteLoadBalancersLoadBalancerIdResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9543,7 +9597,6 @@ type GetLoadBalancersLoadBalancerIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *LoadBalancerResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9566,8 +9619,6 @@ type PutLoadBalancersLoadBalancerIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *UpdateLoadBalancerResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9589,8 +9640,6 @@ func (r PutLoadBalancersLoadBalancerIdResponse) StatusCode() int {
type DeleteLoadBalancersLoadBalancerIdForwardingRulesResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9612,8 +9661,6 @@ func (r DeleteLoadBalancersLoadBalancerIdForwardingRulesResponse) StatusCode() i
type PostLoadBalancersLoadBalancerIdForwardingRulesResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9635,8 +9682,6 @@ func (r PostLoadBalancersLoadBalancerIdForwardingRulesResponse) StatusCode() int
type DeleteLoadBalancersLoadBalancerIdServersResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9658,8 +9703,6 @@ func (r DeleteLoadBalancersLoadBalancerIdServersResponse) StatusCode() int {
type PostLoadBalancersLoadBalancerIdServersResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9704,7 +9747,6 @@ type GetReverseNamesIpv6Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ReverseNameServersResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9727,8 +9769,6 @@ type PostReverseNamesIpv6Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9751,8 +9791,6 @@ type GetSamplesetsServerIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SampleSetsResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9775,7 +9813,6 @@ type GetSamplesetsServerIdLatestResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SampleSetResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9820,7 +9857,6 @@ type PostServersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CreateServerResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9843,7 +9879,6 @@ type GetServersThresholdAlertsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CurrentServerAlertsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9865,7 +9900,6 @@ func (r GetServersThresholdAlertsResponse) StatusCode() int {
type DeleteServersServerIdResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9888,7 +9922,6 @@ type GetServersServerIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ServerResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9911,7 +9944,6 @@ type GetServersServerIdActionsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9934,8 +9966,6 @@ type PostServersServerIdActionsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9958,8 +9988,6 @@ type PostServersServerIdActionsAddDiskResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -9982,8 +10010,6 @@ type PostServersServerIdActionsAttachBackupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10006,8 +10032,6 @@ type PostServersServerIdActionsChangeAdvancedFeaturesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10030,8 +10054,6 @@ type PostServersServerIdActionsChangeAdvancedFirewallRulesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10054,8 +10076,6 @@ type PostServersServerIdActionsChangeBackupScheduleResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10078,8 +10098,6 @@ type PostServersServerIdActionsChangeIpv6Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10102,8 +10120,6 @@ type PostServersServerIdActionsChangeIpv6ReverseNameserversResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10126,8 +10142,6 @@ type PostServersServerIdActionsChangeKernelResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10150,8 +10164,6 @@ type PostServersServerIdActionsChangeManageOffsiteBackupCopiesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10174,8 +10186,6 @@ type PostServersServerIdActionsChangeNetworkResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10198,8 +10208,6 @@ type PostServersServerIdActionsChangeOffsiteBackupLocationResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10222,8 +10230,6 @@ type PostServersServerIdActionsChangePartnerResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10246,8 +10252,6 @@ type PostServersServerIdActionsChangePortBlockingResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10266,12 +10270,32 @@ func (r PostServersServerIdActionsChangePortBlockingResponse) StatusCode() int {
return 0
}
+type PostServersServerIdActionsChangeRegionResponse struct {
+ Body []byte
+ HTTPResponse *http.Response
+ JSON200 *ActionResponse
+}
+
+// Status returns HTTPResponse.Status
+func (r PostServersServerIdActionsChangeRegionResponse) Status() string {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.Status
+ }
+ return http.StatusText(0)
+}
+
+// StatusCode returns HTTPResponse.StatusCode
+func (r PostServersServerIdActionsChangeRegionResponse) StatusCode() int {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.StatusCode
+ }
+ return 0
+}
+
type PostServersServerIdActionsChangeReverseNameResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10294,8 +10318,6 @@ type PostServersServerIdActionsChangeSeparatePrivateNetworkInterfaceResponse str
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10318,8 +10340,6 @@ type PostServersServerIdActionsChangeSourceAndDestinationCheckResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10342,8 +10362,6 @@ type PostServersServerIdActionsChangeThresholdAlertsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10366,8 +10384,6 @@ type PostServersServerIdActionsChangeVpcIpv4Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10390,8 +10406,6 @@ type PostServersServerIdActionsCloneUsingBackupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10414,8 +10428,6 @@ type PostServersServerIdActionsDeleteDiskResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10438,8 +10450,6 @@ type PostServersServerIdActionsDetachBackupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10462,8 +10472,6 @@ type PostServersServerIdActionsDisableBackupsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10486,8 +10494,6 @@ type PostServersServerIdActionsDisableSelinuxResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10510,8 +10516,6 @@ type PostServersServerIdActionsEnableBackupsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10534,8 +10538,6 @@ type PostServersServerIdActionsEnableIpv6Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10558,8 +10560,6 @@ type PostServersServerIdActionsIsRunningResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10582,8 +10582,6 @@ type PostServersServerIdActionsPasswordResetResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10606,8 +10604,6 @@ type PostServersServerIdActionsPingResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10630,8 +10626,6 @@ type PostServersServerIdActionsPowerCycleResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10654,8 +10648,6 @@ type PostServersServerIdActionsPowerOffResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10678,8 +10670,6 @@ type PostServersServerIdActionsPowerOnResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10702,8 +10692,6 @@ type PostServersServerIdActionsRebootResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10726,8 +10714,6 @@ type PostServersServerIdActionsRebuildResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10750,8 +10736,6 @@ type PostServersServerIdActionsRenameResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10774,8 +10758,6 @@ type PostServersServerIdActionsResizeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10798,8 +10780,6 @@ type PostServersServerIdActionsResizeDiskResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10822,8 +10802,6 @@ type PostServersServerIdActionsRestoreResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10846,8 +10824,6 @@ type PostServersServerIdActionsShutdownResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10870,8 +10846,6 @@ type PostServersServerIdActionsTakeBackupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10894,8 +10868,6 @@ type PostServersServerIdActionsUncancelResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10918,8 +10890,6 @@ type PostServersServerIdActionsUptimeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10942,7 +10912,6 @@ type GetServersServerIdActionsActionIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10965,7 +10934,6 @@ type GetServersServerIdAdvancedFirewallRulesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *AdvancedFirewallRulesResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -10988,7 +10956,6 @@ type GetServersServerIdAvailableAdvancedFeaturesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *AvailableAdvancedServerFeaturesResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11011,7 +10978,6 @@ type GetServersServerIdBackupsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *BackupsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11034,8 +11000,6 @@ type PostServersServerIdBackupsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ActionResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11058,8 +11022,6 @@ type GetServersServerIdConsoleResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ConsoleResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11082,7 +11044,6 @@ type GetServersServerIdKernelsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *KernelsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11105,7 +11066,6 @@ type GetServersServerIdSnapshotsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SnapshotsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11128,7 +11088,6 @@ type GetServersServerIdSoftwareResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *LicensedSoftwaresResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11151,7 +11110,6 @@ type GetServersServerIdThresholdAlertsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ThresholdAlertsResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11174,7 +11132,6 @@ type GetServersServerIdUserDataResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *UserData
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11197,7 +11154,6 @@ type GetSizesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SizesResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11242,8 +11198,6 @@ type GetSoftwareOperatingSystemOperatingSystemIdOrSlugResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SoftwaresResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11266,7 +11220,6 @@ type GetSoftwareSoftwareIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SoftwareResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11311,7 +11264,6 @@ type PostVpcsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VpcResponse
- JSON400 *ValidationProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11333,8 +11285,6 @@ func (r PostVpcsResponse) StatusCode() int {
type DeleteVpcsVpcIdResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON403 *ProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11357,7 +11307,6 @@ type GetVpcsVpcIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VpcResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11380,8 +11329,6 @@ type PatchVpcsVpcIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VpcResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11404,8 +11351,6 @@ type PutVpcsVpcIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VpcResponse
- JSON400 *ValidationProblemDetails
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -11428,7 +11373,6 @@ type GetVpcsVpcIdMembersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VpcMembersResponse
- JSON404 *ProblemDetails
}
// Status returns HTTPResponse.Status
@@ -12267,6 +12211,23 @@ func (c *ClientWithResponses) PostServersServerIdActionsChangePortBlockingWithRe
return ParsePostServersServerIdActionsChangePortBlockingResponse(rsp)
}
+// PostServersServerIdActionsChangeRegionWithBodyWithResponse request with arbitrary body returning *PostServersServerIdActionsChangeRegionResponse
+func (c *ClientWithResponses) PostServersServerIdActionsChangeRegionWithBodyWithResponse(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeRegionResponse, error) {
+ rsp, err := c.PostServersServerIdActionsChangeRegionWithBody(ctx, serverId, contentType, body, reqEditors...)
+ if err != nil {
+ return nil, err
+ }
+ return ParsePostServersServerIdActionsChangeRegionResponse(rsp)
+}
+
+func (c *ClientWithResponses) PostServersServerIdActionsChangeRegionWithResponse(ctx context.Context, serverId int64, body PostServersServerIdActionsChangeRegionJSONRequestBody, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeRegionResponse, error) {
+ rsp, err := c.PostServersServerIdActionsChangeRegion(ctx, serverId, body, reqEditors...)
+ if err != nil {
+ return nil, err
+ }
+ return ParsePostServersServerIdActionsChangeRegionResponse(rsp)
+}
+
// PostServersServerIdActionsChangeReverseNameWithBodyWithResponse request with arbitrary body returning *PostServersServerIdActionsChangeReverseNameResponse
func (c *ClientWithResponses) PostServersServerIdActionsChangeReverseNameWithBodyWithResponse(ctx context.Context, serverId int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostServersServerIdActionsChangeReverseNameResponse, error) {
rsp, err := c.PostServersServerIdActionsChangeReverseNameWithBody(ctx, serverId, contentType, body, reqEditors...)
@@ -13048,13 +13009,6 @@ func ParsePostAccountKeysResponse(rsp *http.Response) (*PostAccountKeysResponse,
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -13073,16 +13027,6 @@ func ParseDeleteAccountKeysKeyIdResponse(rsp *http.Response) (*DeleteAccountKeys
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -13107,13 +13051,6 @@ func ParseGetAccountKeysKeyIdResponse(rsp *http.Response) (*GetAccountKeysKeyIdR
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13140,20 +13077,6 @@ func ParsePutAccountKeysKeyIdResponse(rsp *http.Response) (*PutAccountKeysKeyIdR
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13206,13 +13129,6 @@ func ParseGetActionsActionIdResponse(rsp *http.Response) (*GetActionsActionIdRes
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13231,16 +13147,6 @@ func ParsePostActionsActionIdProceedResponse(rsp *http.Response) (*PostActionsAc
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -13317,13 +13223,6 @@ func ParseGetCustomersMyInvoicesInvoiceIdResponse(rsp *http.Response) (*GetCusto
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13402,13 +13301,6 @@ func ParseGetDataUsagesServerIdCurrentResponse(rsp *http.Response) (*GetDataUsag
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13435,20 +13327,6 @@ func ParseGetDomainsResponse(rsp *http.Response) (*GetDomainsResponse, error) {
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13475,13 +13353,6 @@ func ParsePostDomainsResponse(rsp *http.Response) (*PostDomainsResponse, error)
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -13542,16 +13413,6 @@ func ParseDeleteDomainsDomainNameResponse(rsp *http.Response) (*DeleteDomainsDom
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -13576,13 +13437,6 @@ func ParseGetDomainsDomainNameResponse(rsp *http.Response) (*GetDomainsDomainNam
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13609,13 +13463,6 @@ func ParseGetDomainsDomainNameRecordsResponse(rsp *http.Response) (*GetDomainsDo
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13642,20 +13489,6 @@ func ParsePostDomainsDomainNameRecordsResponse(rsp *http.Response) (*PostDomains
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13674,16 +13507,6 @@ func ParseDeleteDomainsDomainNameRecordsRecordIdResponse(rsp *http.Response) (*D
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -13708,13 +13531,6 @@ func ParseGetDomainsDomainNameRecordsRecordIdResponse(rsp *http.Response) (*GetD
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13741,20 +13557,6 @@ func ParsePutDomainsDomainNameRecordsRecordIdResponse(rsp *http.Response) (*PutD
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13781,13 +13583,6 @@ func ParseGetImagesResponse(rsp *http.Response) (*GetImagesResponse, error) {
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -13814,13 +13609,6 @@ func ParseGetImagesImageIdOrSlugResponse(rsp *http.Response) (*GetImagesImageIdO
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13847,20 +13635,6 @@ func ParseGetImagesImageIdDownloadResponse(rsp *http.Response) (*GetImagesImageI
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -13913,13 +13687,6 @@ func ParsePostLoadBalancersResponse(rsp *http.Response) (*PostLoadBalancersRespo
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -13964,16 +13731,6 @@ func ParseDeleteLoadBalancersLoadBalancerIdResponse(rsp *http.Response) (*Delete
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -13998,13 +13755,6 @@ func ParseGetLoadBalancersLoadBalancerIdResponse(rsp *http.Response) (*GetLoadBa
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14031,20 +13781,6 @@ func ParsePutLoadBalancersLoadBalancerIdResponse(rsp *http.Response) (*PutLoadBa
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14063,23 +13799,6 @@ func ParseDeleteLoadBalancersLoadBalancerIdForwardingRulesResponse(rsp *http.Res
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -14096,23 +13815,6 @@ func ParsePostLoadBalancersLoadBalancerIdForwardingRulesResponse(rsp *http.Respo
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -14129,23 +13831,6 @@ func ParseDeleteLoadBalancersLoadBalancerIdServersResponse(rsp *http.Response) (
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -14162,23 +13847,6 @@ func ParsePostLoadBalancersLoadBalancerIdServersResponse(rsp *http.Response) (*P
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -14229,13 +13897,6 @@ func ParseGetReverseNamesIpv6Response(rsp *http.Response) (*GetReverseNamesIpv6R
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14262,20 +13923,6 @@ func ParsePostReverseNamesIpv6Response(rsp *http.Response) (*PostReverseNamesIpv
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14302,20 +13949,6 @@ func ParseGetSamplesetsServerIdResponse(rsp *http.Response) (*GetSamplesetsServe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14342,13 +13975,6 @@ func ParseGetSamplesetsServerIdLatestResponse(rsp *http.Response) (*GetSampleset
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14401,13 +14027,6 @@ func ParsePostServersResponse(rsp *http.Response) (*PostServersResponse, error)
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -14434,13 +14053,6 @@ func ParseGetServersThresholdAlertsResponse(rsp *http.Response) (*GetServersThre
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14459,16 +14071,6 @@ func ParseDeleteServersServerIdResponse(rsp *http.Response) (*DeleteServersServe
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -14493,13 +14095,6 @@ func ParseGetServersServerIdResponse(rsp *http.Response) (*GetServersServerIdRes
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14526,13 +14121,6 @@ func ParseGetServersServerIdActionsResponse(rsp *http.Response) (*GetServersServ
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14559,20 +14147,6 @@ func ParsePostServersServerIdActionsResponse(rsp *http.Response) (*PostServersSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14599,20 +14173,6 @@ func ParsePostServersServerIdActionsAddDiskResponse(rsp *http.Response) (*PostSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14639,20 +14199,6 @@ func ParsePostServersServerIdActionsAttachBackupResponse(rsp *http.Response) (*P
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14679,20 +14225,6 @@ func ParsePostServersServerIdActionsChangeAdvancedFeaturesResponse(rsp *http.Res
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14719,20 +14251,6 @@ func ParsePostServersServerIdActionsChangeAdvancedFirewallRulesResponse(rsp *htt
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14759,20 +14277,6 @@ func ParsePostServersServerIdActionsChangeBackupScheduleResponse(rsp *http.Respo
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14799,20 +14303,6 @@ func ParsePostServersServerIdActionsChangeIpv6Response(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14839,20 +14329,6 @@ func ParsePostServersServerIdActionsChangeIpv6ReverseNameserversResponse(rsp *ht
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14879,20 +14355,6 @@ func ParsePostServersServerIdActionsChangeKernelResponse(rsp *http.Response) (*P
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14919,20 +14381,6 @@ func ParsePostServersServerIdActionsChangeManageOffsiteBackupCopiesResponse(rsp
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14959,20 +14407,6 @@ func ParsePostServersServerIdActionsChangeNetworkResponse(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -14999,20 +14433,6 @@ func ParsePostServersServerIdActionsChangeOffsiteBackupLocationResponse(rsp *htt
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15039,20 +14459,6 @@ func ParsePostServersServerIdActionsChangePartnerResponse(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15079,19 +14485,31 @@ func ParsePostServersServerIdActionsChangePortBlockingResponse(rsp *http.Respons
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
+ }
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
+ return response, nil
+}
+
+// ParsePostServersServerIdActionsChangeRegionResponse parses an HTTP response from a PostServersServerIdActionsChangeRegionWithResponse call
+func ParsePostServersServerIdActionsChangeRegionResponse(rsp *http.Response) (*PostServersServerIdActionsChangeRegionResponse, error) {
+ bodyBytes, err := io.ReadAll(rsp.Body)
+ defer func() { _ = rsp.Body.Close() }()
+ if err != nil {
+ return nil, err
+ }
+
+ response := &PostServersServerIdActionsChangeRegionResponse{
+ Body: bodyBytes,
+ HTTPResponse: rsp,
+ }
+
+ switch {
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
+ var dest ActionResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
- response.JSON404 = &dest
+ response.JSON200 = &dest
}
@@ -15119,20 +14537,6 @@ func ParsePostServersServerIdActionsChangeReverseNameResponse(rsp *http.Response
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15159,20 +14563,6 @@ func ParsePostServersServerIdActionsChangeSeparatePrivateNetworkInterfaceRespons
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15199,20 +14589,6 @@ func ParsePostServersServerIdActionsChangeSourceAndDestinationCheckResponse(rsp
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15239,20 +14615,6 @@ func ParsePostServersServerIdActionsChangeThresholdAlertsResponse(rsp *http.Resp
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15279,20 +14641,6 @@ func ParsePostServersServerIdActionsChangeVpcIpv4Response(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15319,20 +14667,6 @@ func ParsePostServersServerIdActionsCloneUsingBackupResponse(rsp *http.Response)
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15359,20 +14693,6 @@ func ParsePostServersServerIdActionsDeleteDiskResponse(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15399,20 +14719,6 @@ func ParsePostServersServerIdActionsDetachBackupResponse(rsp *http.Response) (*P
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15439,20 +14745,6 @@ func ParsePostServersServerIdActionsDisableBackupsResponse(rsp *http.Response) (
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15479,20 +14771,6 @@ func ParsePostServersServerIdActionsDisableSelinuxResponse(rsp *http.Response) (
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15519,20 +14797,6 @@ func ParsePostServersServerIdActionsEnableBackupsResponse(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15559,20 +14823,6 @@ func ParsePostServersServerIdActionsEnableIpv6Response(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15599,20 +14849,6 @@ func ParsePostServersServerIdActionsIsRunningResponse(rsp *http.Response) (*Post
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15639,20 +14875,6 @@ func ParsePostServersServerIdActionsPasswordResetResponse(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15679,20 +14901,6 @@ func ParsePostServersServerIdActionsPingResponse(rsp *http.Response) (*PostServe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15719,20 +14927,6 @@ func ParsePostServersServerIdActionsPowerCycleResponse(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15759,20 +14953,6 @@ func ParsePostServersServerIdActionsPowerOffResponse(rsp *http.Response) (*PostS
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15799,20 +14979,6 @@ func ParsePostServersServerIdActionsPowerOnResponse(rsp *http.Response) (*PostSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15839,20 +15005,6 @@ func ParsePostServersServerIdActionsRebootResponse(rsp *http.Response) (*PostSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15879,20 +15031,6 @@ func ParsePostServersServerIdActionsRebuildResponse(rsp *http.Response) (*PostSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15919,20 +15057,6 @@ func ParsePostServersServerIdActionsRenameResponse(rsp *http.Response) (*PostSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15959,20 +15083,6 @@ func ParsePostServersServerIdActionsResizeResponse(rsp *http.Response) (*PostSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -15999,20 +15109,6 @@ func ParsePostServersServerIdActionsResizeDiskResponse(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16039,20 +15135,6 @@ func ParsePostServersServerIdActionsRestoreResponse(rsp *http.Response) (*PostSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16079,20 +15161,6 @@ func ParsePostServersServerIdActionsShutdownResponse(rsp *http.Response) (*PostS
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16119,20 +15187,6 @@ func ParsePostServersServerIdActionsTakeBackupResponse(rsp *http.Response) (*Pos
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16159,20 +15213,6 @@ func ParsePostServersServerIdActionsUncancelResponse(rsp *http.Response) (*PostS
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16199,20 +15239,6 @@ func ParsePostServersServerIdActionsUptimeResponse(rsp *http.Response) (*PostSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16239,13 +15265,6 @@ func ParseGetServersServerIdActionsActionIdResponse(rsp *http.Response) (*GetSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16272,13 +15291,6 @@ func ParseGetServersServerIdAdvancedFirewallRulesResponse(rsp *http.Response) (*
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16305,13 +15317,6 @@ func ParseGetServersServerIdAvailableAdvancedFeaturesResponse(rsp *http.Response
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16338,13 +15343,6 @@ func ParseGetServersServerIdBackupsResponse(rsp *http.Response) (*GetServersServ
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16371,20 +15369,6 @@ func ParsePostServersServerIdBackupsResponse(rsp *http.Response) (*PostServersSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16411,20 +15395,6 @@ func ParseGetServersServerIdConsoleResponse(rsp *http.Response) (*GetServersServ
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16451,13 +15421,6 @@ func ParseGetServersServerIdKernelsResponse(rsp *http.Response) (*GetServersServ
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16484,13 +15447,6 @@ func ParseGetServersServerIdSnapshotsResponse(rsp *http.Response) (*GetServersSe
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16517,13 +15473,6 @@ func ParseGetServersServerIdSoftwareResponse(rsp *http.Response) (*GetServersSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16550,13 +15499,6 @@ func ParseGetServersServerIdThresholdAlertsResponse(rsp *http.Response) (*GetSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16583,13 +15525,6 @@ func ParseGetServersServerIdUserDataResponse(rsp *http.Response) (*GetServersSer
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16616,13 +15551,6 @@ func ParseGetSizesResponse(rsp *http.Response) (*GetSizesResponse, error) {
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -16675,20 +15603,6 @@ func ParseGetSoftwareOperatingSystemOperatingSystemIdOrSlugResponse(rsp *http.Re
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16715,13 +15629,6 @@ func ParseGetSoftwareSoftwareIdResponse(rsp *http.Response) (*GetSoftwareSoftwar
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16774,13 +15681,6 @@ func ParsePostVpcsResponse(rsp *http.Response) (*PostVpcsResponse, error) {
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
}
return response, nil
@@ -16799,23 +15699,6 @@ func ParseDeleteVpcsVpcIdResponse(rsp *http.Response) (*DeleteVpcsVpcIdResponse,
HTTPResponse: rsp,
}
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON403 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
- }
-
return response, nil
}
@@ -16840,13 +15723,6 @@ func ParseGetVpcsVpcIdResponse(rsp *http.Response) (*GetVpcsVpcIdResponse, error
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16873,20 +15749,6 @@ func ParsePatchVpcsVpcIdResponse(rsp *http.Response) (*PatchVpcsVpcIdResponse, e
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16913,20 +15775,6 @@ func ParsePutVpcsVpcIdResponse(rsp *http.Response) (*PutVpcsVpcIdResponse, error
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest ValidationProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
-
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
@@ -16953,13 +15801,6 @@ func ParseGetVpcsVpcIdMembersResponse(rsp *http.Response) (*GetVpcsVpcIdMembersR
}
response.JSON200 = &dest
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
- var dest ProblemDetails
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON404 = &dest
-
}
return response, nil
diff --git a/internal/binarylane/fetch-openapi.sh b/internal/binarylane/fetch-openapi.sh
index afe38ec..f38ceac 100755
--- a/internal/binarylane/fetch-openapi.sh
+++ b/internal/binarylane/fetch-openapi.sh
@@ -9,7 +9,12 @@ curl https://api.binarylane.com.au/reference/openapi.json --output $OPENAPI_FILE
cat <<<$(jq '.servers[0].url = "https://api.binarylane.com.au/v2"' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.paths |= with_entries(.key |= sub("/v2/"; "/"))' $OPENAPI_FILE) >$OPENAPI_FILE
-# Terraform can't handle oneOf types, so we need to replace them with basic types
+# Remove all unhealthy responses, as they are not useful for Terraform
+cat <<<$(jq 'walk(if type == "object" and has("responses") then .responses |= with_entries(select(.key | tonumber <= 299)) else . end)' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq 'del(.components.schemas.ProblemDetails)' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq 'del(.components.schemas.ValidationProblemDetails)' $OPENAPI_FILE) >$OPENAPI_FILE
+
+# Terraform can't handle oneOf/allOf types, so we need to replace them with basic types
cat <<<$(jq '.components.schemas.CreateServerRequest.properties.image |= del(.oneOf) + {type:"string"}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.CreateServerRequest.properties.ssh_keys.items |= del(.oneOf) + {type:"integer"}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.Rebuild.properties.image |= del(.oneOf) + {type:"string"}' $OPENAPI_FILE) >$OPENAPI_FILE
@@ -20,6 +25,8 @@ cat <<<$(jq '.paths["/account/keys/{key_id}"].put.parameters[0].schema |= del(.o
cat <<<$(jq '.paths["/account/keys/{key_id}"].get.parameters[0].schema |= del(.oneOf) + {type:"integer"}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.paths["/account/keys/{key_id}"].delete.parameters[0].schema |= del(.oneOf) + {type:"integer"}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.paths["/account/keys/{key_id}"].delete.parameters[0].schema |= del(.oneOf) + {type:"integer"}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.paths["/images"].get.parameters[0].schema |= del(.allOf) + {type:"string"}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.paths["/sizes"].get.parameters[1].schema |= del(.oneOf) + {type:"string"}' $OPENAPI_FILE) >$OPENAPI_FILE
# Remove the "/paths/{image_id}" path because its duplicated by "/images/{image_id_or_slug}"
cat <<<$(jq 'del(.paths."/images/{image_id}")' $OPENAPI_FILE) >$OPENAPI_FILE
@@ -45,5 +52,84 @@ cat <<<$(jq '.components.schemas.ForwardingRule.properties.entry_protocol += {"x
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
+## Images
+cat <<<$(jq '.components.schemas.Image.properties.backup_info += {"x-oapi-codegen-extra-tags": {"tfsdk": "backup_info"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.created_at += {"x-oapi-codegen-extra-tags": {"tfsdk": "created_at"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.description += {"x-oapi-codegen-extra-tags": {"tfsdk": "description"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.distribution += {"x-oapi-codegen-extra-tags": {"tfsdk": "distribution"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.distribution_info += {"x-oapi-codegen-extra-tags": {"tfsdk": "distribution_info"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.distribution_surcharges += {"x-oapi-codegen-extra-tags": {"tfsdk": "distribution_surcharges"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.error_message += {"x-oapi-codegen-extra-tags": {"tfsdk": "error_message"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.full_name += {"x-oapi-codegen-extra-tags": {"tfsdk": "full_name"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.id += {"x-oapi-codegen-extra-tags": {"tfsdk": "id"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.min_disk_size += {"x-oapi-codegen-extra-tags": {"tfsdk": "min_disk_size"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.min_memory_megabytes += {"x-oapi-codegen-extra-tags": {"tfsdk": "min_memory_megabytes"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.name += {"x-oapi-codegen-extra-tags": {"tfsdk": "name"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.public += {"x-oapi-codegen-extra-tags": {"tfsdk": "public"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.regions += {"x-oapi-codegen-extra-tags": {"tfsdk": "regions"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.size_gigabytes += {"x-oapi-codegen-extra-tags": {"tfsdk": "size_gigabytes"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.slug += {"x-oapi-codegen-extra-tags": {"tfsdk": "slug"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.status += {"x-oapi-codegen-extra-tags": {"tfsdk": "status"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Image.properties.type += {"x-oapi-codegen-extra-tags": {"tfsdk": "type"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionInfo.properties.features += {"x-oapi-codegen-extra-tags": {"tfsdk": "features"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionInfo.properties.remote_access_user += {"x-oapi-codegen-extra-tags": {"tfsdk": "remote_access_user"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionInfo.properties.password_recovery += {"x-oapi-codegen-extra-tags": {"tfsdk": "password_recovery"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionInfo.properties.image_id += {"x-oapi-codegen-extra-tags": {"tfsdk": "image_id"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionSurcharges.properties.surcharge_base_cost += {"x-oapi-codegen-extra-tags": {"tfsdk": "surcharge_base_cost"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionSurcharges.properties.surcharge_per_memory_megabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "surcharge_per_memory_megabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionSurcharges.properties.surcharge_per_memory_max_megabytes += {"x-oapi-codegen-extra-tags": {"tfsdk": "surcharge_per_memory_max_megabytes"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionSurcharges.properties.surcharge_per_vcpu += {"x-oapi-codegen-extra-tags": {"tfsdk": "surcharge_per_vcpu"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.DistributionSurcharges.properties.surcharge_min_vcpu += {"x-oapi-codegen-extra-tags": {"tfsdk": "surcharge_min_vcpu"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+
+## Regions
+cat <<<$(jq '.components.schemas.Region.properties.available += {"x-oapi-codegen-extra-tags": {"tfsdk": "available"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Region.properties.features += {"x-oapi-codegen-extra-tags": {"tfsdk": "features"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Region.properties.name += {"x-oapi-codegen-extra-tags": {"tfsdk": "name"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Region.properties.name_servers += {"x-oapi-codegen-extra-tags": {"tfsdk": "name_servers"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Region.properties.sizes += {"x-oapi-codegen-extra-tags": {"tfsdk": "sizes"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Region.properties.slug += {"x-oapi-codegen-extra-tags": {"tfsdk": "slug"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+
+## Sizes
+cat <<<$(jq '.components.schemas.Size.properties.slug += {"x-oapi-codegen-extra-tags": {"tfsdk": "slug"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.description += {"x-oapi-codegen-extra-tags": {"tfsdk": "description"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.cpu_description += {"x-oapi-codegen-extra-tags": {"tfsdk": "cpu_description"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.storage_description += {"x-oapi-codegen-extra-tags": {"tfsdk": "storage_description"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.size_type += {"x-oapi-codegen-extra-tags": {"tfsdk": "size_type"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.available += {"x-oapi-codegen-extra-tags": {"tfsdk": "available"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.regions += {"x-oapi-codegen-extra-tags": {"tfsdk": "regions"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.regions_out_of_stock += {"x-oapi-codegen-extra-tags": {"tfsdk": "regions_out_of_stock"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.price_monthly += {"x-oapi-codegen-extra-tags": {"tfsdk": "price_monthly"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.price_hourly += {"x-oapi-codegen-extra-tags": {"tfsdk": "price_hourly"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.disk += {"x-oapi-codegen-extra-tags": {"tfsdk": "disk"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.memory += {"x-oapi-codegen-extra-tags": {"tfsdk": "memory"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.transfer += {"x-oapi-codegen-extra-tags": {"tfsdk": "transfer"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.excess_transfer_cost_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "excess_transfer_cost_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.vcpus += {"x-oapi-codegen-extra-tags": {"tfsdk": "vcpus"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.vcpu_units += {"x-oapi-codegen-extra-tags": {"tfsdk": "vcpu_units"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.Size.properties.options += {"x-oapi-codegen-extra-tags": {"tfsdk": "options"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.disk_min += {"x-oapi-codegen-extra-tags": {"tfsdk": "disk_min"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.disk_max += {"x-oapi-codegen-extra-tags": {"tfsdk": "disk_max"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.disk_cost_per_additional_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "disk_cost_per_additional_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.restricted_disk_values += {"x-oapi-codegen-extra-tags": {"tfsdk": "restricted_disk_values"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.memory_max += {"x-oapi-codegen-extra-tags": {"tfsdk": "memory_max"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.memory_cost_per_additional_megabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "memory_cost_per_additional_megabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.transfer_max += {"x-oapi-codegen-extra-tags": {"tfsdk": "transfer_max"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.transfer_cost_per_additional_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "transfer_cost_per_additional_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.ipv4_addresses_max += {"x-oapi-codegen-extra-tags": {"tfsdk": "ipv4_addresses_max"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.ipv4_addresses_cost_per_address += {"x-oapi-codegen-extra-tags": {"tfsdk": "ipv4_addresses_cost_per_address"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.discount_for_no_public_ipv4 += {"x-oapi-codegen-extra-tags": {"tfsdk": "discount_for_no_public_ipv4"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.daily_backups += {"x-oapi-codegen-extra-tags": {"tfsdk": "daily_backups"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.weekly_backups += {"x-oapi-codegen-extra-tags": {"tfsdk": "weekly_backups"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.monthly_backups += {"x-oapi-codegen-extra-tags": {"tfsdk": "monthly_backups"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.backups_cost_per_backup_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "backups_cost_per_backup_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.offsite_backups_cost_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "offsite_backups_cost_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeOptions.properties.offsite_backup_frequency_cost += {"x-oapi-codegen-extra-tags": {"tfsdk": "offsite_backup_frequency_cost"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.OffsiteBackupFrequencyCost.properties.daily_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "daily_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.OffsiteBackupFrequencyCost.properties.weekly_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "weekly_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.OffsiteBackupFrequencyCost.properties.monthly_per_gigabyte += {"x-oapi-codegen-extra-tags": {"tfsdk": "monthly_per_gigabyte"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeType.properties.slug += {"x-oapi-codegen-extra-tags": {"tfsdk": "slug"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeType.properties.name += {"x-oapi-codegen-extra-tags": {"tfsdk": "name"}}' $OPENAPI_FILE) >$OPENAPI_FILE
+cat <<<$(jq '.components.schemas.SizeType.properties.description += {"x-oapi-codegen-extra-tags": {"tfsdk": "description"}}' $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 7ff1541..5b6da03 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.28.0",
+ "version": "0.29.0",
"x-logo": {
"url": "https://www.binarylane.com.au/res/images/binarylane/logo.png",
"backgroundColor": "#000000",
@@ -38,9 +38,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -80,19 +77,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -148,9 +132,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -196,19 +177,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -236,9 +204,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -278,19 +243,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -346,9 +298,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -377,9 +326,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -420,19 +366,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -488,9 +421,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -518,9 +448,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -542,9 +469,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -600,29 +524,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -661,19 +562,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -720,19 +608,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -770,19 +645,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -875,19 +737,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -946,29 +795,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1025,19 +851,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1106,29 +919,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1176,19 +966,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1212,11 +989,7 @@
"in": "query",
"description": "Queries for distribution will include images that have pre-installed applications.",
"schema": {
- "allOf": [
- {
- "$ref": "#/components/schemas/ImageQueryType"
- }
- ]
+ "type": "string"
}
},
{
@@ -1264,19 +1037,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1323,19 +1083,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1376,29 +1123,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1439,19 +1163,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1503,29 +1214,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1557,19 +1245,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1625,9 +1300,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1666,19 +1338,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1718,19 +1377,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1782,29 +1428,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1835,19 +1458,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1903,9 +1513,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1944,19 +1551,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -1984,9 +1578,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2032,29 +1623,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2098,29 +1666,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2166,29 +1711,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2232,29 +1754,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2366,19 +1865,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2417,29 +1903,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2493,19 +1956,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2602,29 +2052,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2690,19 +2117,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2780,6 +2194,9 @@
{
"$ref": "#/components/schemas/ChangePortBlocking"
},
+ {
+ "$ref": "#/components/schemas/ChangeRegion"
+ },
{
"$ref": "#/components/schemas/ChangeReverseName"
},
@@ -2896,6 +2313,7 @@
"change_source_and_destination_check": "#/components/schemas/ChangeSourceAndDestinationCheck",
"change_separate_private_network_interface": "#/components/schemas/ChangeSeparatePrivateNetworkInterface",
"change_reverse_name": "#/components/schemas/ChangeReverseName",
+ "change_region": "#/components/schemas/ChangeRegion",
"change_port_blocking": "#/components/schemas/ChangePortBlocking",
"change_partner": "#/components/schemas/ChangePartner",
"change_offsite_backup_location": "#/components/schemas/ChangeOffsiteBackupLocation",
@@ -2928,29 +2346,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -2989,19 +2384,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3042,19 +2424,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3118,9 +2487,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3159,19 +2525,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3221,19 +2574,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3273,19 +2613,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3325,19 +2652,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3403,19 +2717,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3466,29 +2767,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3555,19 +2833,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3634,19 +2899,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3687,19 +2939,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3727,19 +2966,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3805,19 +3031,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3857,19 +3070,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3909,29 +3109,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -3964,15 +3141,8 @@
"in": "query",
"description": "If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects.",
"schema": {
- "oneOf": [
- {
- "type": "integer"
- },
- {
- "type": "string"
- }
- ],
- "example": 5
+ "example": 5,
+ "type": "string"
}
},
{
@@ -4012,16 +3182,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
}
},
"x-codeSamples": [
@@ -4061,16 +3221,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
}
},
"x-codeSamples": [
@@ -4199,26 +3349,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
}
},
"x-codeSamples": [
@@ -4259,19 +3389,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4325,29 +3442,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4400,29 +3494,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4454,29 +3525,6 @@
"responses": {
"204": {
"description": "No Content"
- },
- "403": {
- "description": "Forbidden",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4532,9 +3580,6 @@
}
}
}
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4573,19 +3618,6 @@
}
}
}
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4665,19 +3697,6 @@
}
}
}
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4730,29 +3749,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4805,29 +3801,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4880,29 +3853,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -4955,29 +3905,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5030,29 +3957,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5105,29 +4009,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5180,29 +4061,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5255,29 +4113,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5330,29 +4165,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5405,29 +4217,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5480,29 +4269,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5555,29 +4321,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5630,29 +4373,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5705,29 +4425,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5780,29 +4477,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5855,29 +4529,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -5930,29 +4581,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6005,29 +4633,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6080,29 +4685,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6155,29 +4737,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6230,29 +4789,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6305,29 +4841,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6380,29 +4893,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6455,29 +4945,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6530,29 +4997,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6564,6 +5008,58 @@
"x-cli-command": "server action change-partner"
}
},
+ "/servers/{server_id}/actions#ChangeRegion": {
+ "post": {
+ "tags": [
+ "ServerActions"
+ ],
+ "summary": "Change the Region of a Server",
+ "description": "This is used to move a server to a different region. \nPlease check our knowledge base article for the current requirements for servers to be able to move between regions. \n \n",
+ "parameters": [
+ {
+ "name": "server_id",
+ "in": "path",
+ "description": "The ID of the server on which the action should be performed.",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChangeRegion"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ActionResponse"
+ }
+ }
+ }
+ },
+ "202": {
+ "description": "Accepted"
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "Curl",
+ "source": "curl -X POST \"https://api.binarylane.com.au/v2/servers/${server_id}/actions\" \\\n-H \"Authorization: Bearer ${APITOKEN}\" \\\n-H \"Content-Type: application/json\" -d \"${PAYLOAD}\""
+ }
+ ],
+ "x-cli-command": "server action change-region"
+ }
+ },
"/servers/{server_id}/actions#DisableSelinux": {
"post": {
"tags": [
@@ -6605,29 +5101,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6680,29 +5153,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6755,29 +5205,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6830,29 +5257,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6905,29 +5309,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -6980,29 +5361,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7055,29 +5413,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7130,29 +5465,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7205,29 +5517,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7280,29 +5569,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7355,29 +5621,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7430,29 +5673,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7505,29 +5725,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7580,29 +5777,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7655,29 +5829,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -7730,29 +5881,6 @@
},
"202": {
"description": "Accepted"
- },
- "400": {
- "description": "Bad Request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ValidationProblemDetails"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ProblemDetails"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized"
}
},
"x-codeSamples": [
@@ -9033,6 +7161,28 @@
},
"description": "Change the Port Blocking for a Server"
},
+ "ChangeRegion": {
+ "required": [
+ "region",
+ "type"
+ ],
+ "type": "object",
+ "properties": {
+ "type": {
+ "minLength": 1,
+ "enum": [
+ "change_region"
+ ],
+ "type": "string"
+ },
+ "region": {
+ "minLength": 1,
+ "type": "string",
+ "description": "The slug of the selected region."
+ }
+ },
+ "description": "Change the Region of a Server"
+ },
"ChangeReverseName": {
"required": [
"ipv4_address",
@@ -9813,7 +7963,10 @@
"type": "integer",
"description": "If this is a backup image, the operating system ID of the server at the time the backup was created.",
"format": "int64",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "image_id"
+ }
},
"password_recovery": {
"allOf": [
@@ -9822,13 +7975,19 @@
}
],
"description": "Supported methods of password recovery.\n\n| Value | Description |\n| ----- | ----------- |\n| manual | Password must be reset manually using the recovery console and rescue disk. |\n| offline-clear | Password can be cleared for the admin/root user only. New password needs to be provided on login via the console (Requires restart). |\n| offline-change | Password can be reset and new credentials sent (Requires restart). |\n| online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |\n\n",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "password_recovery"
+ }
},
"remote_access_user": {
"type": "string",
"description": "User name to use when connecting via remote access (RDP or SSH).",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "remote_access_user"
+ }
},
"features": {
"type": "array",
@@ -9836,7 +7995,10 @@
"$ref": "#/components/schemas/DistributionFeature"
},
"description": "Features supported by this distribution.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "features"
+ }
}
}
},
@@ -9848,35 +8010,50 @@
"description": "The additional cost for using this operating system as the base image for a size.",
"format": "double",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "surcharge_base_cost"
+ }
},
"surcharge_per_memory_megabyte": {
"type": "number",
"description": "The additional cost per MB for using this operating system as the base image for a size.",
"format": "double",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "surcharge_per_memory_megabyte"
+ }
},
"surcharge_per_memory_max_megabytes": {
"type": "integer",
"description": "The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge.",
"format": "int32",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "surcharge_per_memory_max_megabytes"
+ }
},
"surcharge_per_vcpu": {
"type": "number",
"description": "The additional cost per vcpu for using this operating system as the base image for a size.",
"format": "double",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "surcharge_per_vcpu"
+ }
},
"surcharge_min_vcpu": {
"type": "integer",
"description": "The minimum vcpu count for surcharge calculations.",
"format": "int32",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "surcharge_min_vcpu"
+ }
}
}
},
@@ -10321,7 +8498,7 @@
"display_name": {
"minLength": 1,
"type": "string",
- "description": "The name for this host.",
+ "description": "The name for this host. If this is a dedicated host this property will be empty.",
"readOnly": true
},
"uptime_ms": {
@@ -10358,14 +8535,20 @@
"description": "The ID of this image.",
"format": "int64",
"readOnly": true,
- "x-cli-format": 1
+ "x-cli-format": 1,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "id"
+ }
},
"name": {
"minLength": 1,
"type": "string",
"description": "If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image.",
"readOnly": true,
- "x-cli-format": 4
+ "x-cli-format": 4,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "name"
+ }
},
"type": {
"allOf": [
@@ -10373,32 +8556,47 @@
"$ref": "#/components/schemas/ImageType"
}
],
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "type"
+ }
},
"distribution": {
"type": "string",
"description": "If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using.",
"nullable": true,
"readOnly": true,
- "x-cli-format": 3
+ "x-cli-format": 3,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "distribution"
+ }
},
"full_name": {
"type": "string",
"description": "If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "full_name"
+ }
},
"slug": {
"type": "string",
"description": "If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference.",
"nullable": true,
"readOnly": true,
- "x-cli-format": 2
+ "x-cli-format": 2,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "slug"
+ }
},
"public": {
"type": "boolean",
"description": "A public image is available to all users. A private image is available only to the account that created the image.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "public"
+ }
},
"regions": {
"type": "array",
@@ -10406,32 +8604,47 @@
"type": "string"
},
"description": "The slugs of the regions where the image is available for use.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "regions"
+ }
},
"created_at": {
"type": "string",
"description": "If this is a backup image this is the date and time in ISO8601 format when the image was created.",
"format": "date-time",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "created_at"
+ }
},
"min_disk_size": {
"type": "integer",
"description": "For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "min_disk_size"
+ }
},
"size_gigabytes": {
"type": "number",
"description": "For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "size_gigabytes"
+ }
},
"description": {
"type": "string",
"description": "A description that may provide further details or warnings about the image.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "description"
+ }
},
"status": {
"allOf": [
@@ -10439,19 +8652,28 @@
"$ref": "#/components/schemas/ImageStatus"
}
],
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "status"
+ }
},
"error_message": {
"type": "string",
"description": "If the image creation failed this may provide further information.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "error_message"
+ }
},
"min_memory_megabytes": {
"type": "integer",
"description": "This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image).",
"format": "int32",
- "nullable": true
+ "nullable": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "min_memory_megabytes"
+ }
},
"distribution_surcharges": {
"allOf": [
@@ -10461,7 +8683,10 @@
],
"description": "If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "distribution_surcharges"
+ }
},
"distribution_info": {
"allOf": [
@@ -10470,7 +8695,10 @@
}
],
"description": "This object may provide further information about the distribution.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "distribution_info"
+ }
},
"backup_info": {
"allOf": [
@@ -10480,7 +8708,10 @@
],
"description": "If this image is a backup, this object will provide further information.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "backup_info"
+ }
}
}
},
@@ -11404,19 +9635,28 @@
"type": "number",
"description": "The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "daily_per_gigabyte"
+ }
},
"weekly_per_gigabyte": {
"type": "number",
"description": "The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "weekly_per_gigabyte"
+ }
},
"monthly_per_gigabyte": {
"type": "number",
"description": "The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "monthly_per_gigabyte"
+ }
}
},
"description": "All costs are in AU$."
@@ -11645,36 +9885,6 @@
},
"description": "Power a Server On"
},
- "ProblemDetails": {
- "required": [
- "title"
- ],
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "nullable": true
- },
- "title": {
- "type": "string",
- "nullable": true
- },
- "status": {
- "type": "integer",
- "format": "int32",
- "nullable": true
- },
- "detail": {
- "type": "string",
- "nullable": true
- },
- "instance": {
- "type": "string",
- "nullable": true
- }
- },
- "additionalProperties": {}
- },
"ProceedRequest": {
"required": [
"proceed"
@@ -11777,14 +9987,20 @@
"type": "string",
"description": "The unique slug for this region.",
"readOnly": true,
- "x-cli-format": 1
+ "x-cli-format": 1,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "slug"
+ }
},
"name": {
"minLength": 1,
"type": "string",
"description": "The name of this region.",
"readOnly": true,
- "x-cli-format": 2
+ "x-cli-format": 2,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "name"
+ }
},
"sizes": {
"type": "array",
@@ -11792,12 +10008,18 @@
"type": "string"
},
"description": "The slugs of the sizes available in this region.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "sizes"
+ }
},
"available": {
"type": "boolean",
"description": "Whether this region is available for the allocation of new resources.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "available"
+ }
},
"features": {
"type": "array",
@@ -11805,7 +10027,10 @@
"type": "string"
},
"description": "A list of features available for resources in this region.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "features"
+ }
},
"name_servers": {
"type": "array",
@@ -11813,7 +10038,10 @@
"type": "string"
},
"description": "A list of nameservers available for resources in this region.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "name_servers"
+ }
}
}
},
@@ -12637,6 +10865,9 @@
{
"$ref": "#/components/schemas/ChangePortBlocking"
},
+ {
+ "$ref": "#/components/schemas/ChangeRegion"
+ },
{
"$ref": "#/components/schemas/ChangeReverseName"
},
@@ -12744,6 +10975,7 @@
"change_offsite_backup_location": "#/components/schemas/ChangeOffsiteBackupLocation",
"change_partner": "#/components/schemas/ChangePartner",
"change_port_blocking": "#/components/schemas/ChangePortBlocking",
+ "change_region": "#/components/schemas/ChangeRegion",
"change_reverse_name": "#/components/schemas/ChangeReverseName",
"change_separate_private_network_interface": "#/components/schemas/ChangeSeparatePrivateNetworkInterface",
"change_source_and_destination_check": "#/components/schemas/ChangeSourceAndDestinationCheck",
@@ -12893,25 +11125,37 @@
"type": "string",
"description": "The slug of this size.",
"readOnly": true,
- "x-cli-format": 1
+ "x-cli-format": 1,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "slug"
+ }
},
"description": {
"type": "string",
"description": "A description of this size.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "description"
+ }
},
"cpu_description": {
"type": "string",
"description": "A description of the CPU provided in this size.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "cpu_description"
+ }
},
"storage_description": {
"type": "string",
"description": "A description of the storage provided in this size.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "storage_description"
+ }
},
"size_type": {
"allOf": [
@@ -12921,12 +11165,18 @@
],
"description": "The type of this size, generally used to differentiate sizes optimized for different usages.",
"readOnly": true,
- "x-cli-format": 2
+ "x-cli-format": 2,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "size_type"
+ }
},
"available": {
"type": "boolean",
"description": "If this is false the size is not available for new servers.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "available"
+ }
},
"regions": {
"type": "array",
@@ -12934,7 +11184,10 @@
"type": "string"
},
"description": "A list of region slugs where this size is available regardless of stock.\nIf this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,\notherwise not all regions listed will support all operating systems on this size.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "regions"
+ }
},
"regions_out_of_stock": {
"type": "array",
@@ -12943,61 +11196,88 @@
},
"description": "A list of region slugs where the size is normally available but is currently not available due to lack of stock.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "regions_out_of_stock"
+ }
},
"price_monthly": {
"type": "number",
"description": "Monthly Price in AU$.",
"format": "double",
"readOnly": true,
- "x-cli-format": 8
+ "x-cli-format": 8,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "price_monthly"
+ }
},
"price_hourly": {
"type": "number",
"description": "Hourly price in AU$.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "price_hourly"
+ }
},
"disk": {
"type": "integer",
"description": "The included storage for this size in GB.",
"format": "int32",
"readOnly": true,
- "x-cli-format": 6
+ "x-cli-format": 6,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "disk"
+ }
},
"memory": {
"type": "integer",
"description": "The included memory for this size in MB.",
"format": "int32",
"readOnly": true,
- "x-cli-format": 5
+ "x-cli-format": 5,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "memory"
+ }
},
"transfer": {
"type": "number",
"description": "The included data transfer for this size in TB.",
"format": "double",
"readOnly": true,
- "x-cli-format": 7
+ "x-cli-format": 7,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "transfer"
+ }
},
"excess_transfer_cost_per_gigabyte": {
"type": "number",
"description": "The excess charged for any transfer above the included data transfer in AU$ per GB.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "excess_transfer_cost_per_gigabyte"
+ }
},
"vcpus": {
"type": "integer",
"description": "The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware.",
"format": "int32",
"readOnly": true,
- "x-cli-format": 3
+ "x-cli-format": 3,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "vcpus"
+ }
},
"vcpu_units": {
"minLength": 1,
"type": "string",
"description": "This is the unit that the vcpus field counts, e.g. \"core\" or \"thread\".",
"readOnly": true,
- "x-cli-format": 4
+ "x-cli-format": 4,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "vcpu_units"
+ }
},
"options": {
"allOf": [
@@ -13005,7 +11285,10 @@
"$ref": "#/components/schemas/SizeOptions"
}
],
- "description": "Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated)."
+ "description": "Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated).",
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "options"
+ }
}
}
},
@@ -13034,19 +11317,28 @@
"type": "integer",
"description": "The minimum storage in GB permitted on this size.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "disk_min"
+ }
},
"disk_max": {
"type": "integer",
"description": "The maximum storage in GB permitted on this size.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "disk_max"
+ }
},
"disk_cost_per_additional_gigabyte": {
"type": "number",
"description": "The additional cost per GB per month for additional storage space.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "disk_cost_per_additional_gigabyte"
+ }
},
"restricted_disk_values": {
"type": "array",
@@ -13056,79 +11348,118 @@
},
"description": "If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "restricted_disk_values"
+ }
},
"memory_max": {
"type": "integer",
"description": "The maximum memory in MB permitted on this size.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "memory_max"
+ }
},
"memory_cost_per_additional_megabyte": {
"type": "number",
"description": "The additional cost per MB per month for additional memory.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "memory_cost_per_additional_megabyte"
+ }
},
"transfer_max": {
"type": "number",
"description": "The maximum transfer in TB permitted for this size.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "transfer_max"
+ }
},
"transfer_cost_per_additional_gigabyte": {
"type": "number",
"description": "The additional cost per GB per month for additional included transfer.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "transfer_cost_per_additional_gigabyte"
+ }
},
"ipv4_addresses_max": {
"type": "integer",
"description": "The maximum number of IPv4 addresses permitted on this size.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "ipv4_addresses_max"
+ }
},
"ipv4_addresses_cost_per_address": {
"type": "number",
"description": "The additional cost per public IPv4 address per month for additional IPv4 addresses.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "ipv4_addresses_cost_per_address"
+ }
},
"discount_for_no_public_ipv4": {
"type": "number",
"description": "This is the discount (if any) that is applied if no public IPv4 addresses are selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "discount_for_no_public_ipv4"
+ }
},
"daily_backups": {
"type": "integer",
"description": "The number of daily backups included in the base size cost.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "daily_backups"
+ }
},
"weekly_backups": {
"type": "integer",
"description": "The number of weekly backups included in the base size cost.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "weekly_backups"
+ }
},
"monthly_backups": {
"type": "integer",
"description": "The number of monthly backups included in the base size cost.",
"format": "int32",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "monthly_backups"
+ }
},
"backups_cost_per_backup_per_gigabyte": {
"type": "number",
"description": "The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "backups_cost_per_backup_per_gigabyte"
+ }
},
"offsite_backups_cost_per_gigabyte": {
"type": "number",
"description": "The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected.",
"format": "double",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "offsite_backups_cost_per_gigabyte"
+ }
},
"offsite_backup_frequency_cost": {
"allOf": [
@@ -13137,7 +11468,10 @@
}
],
"description": "The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "offsite_backup_frequency_cost"
+ }
}
},
"description": "Available add-ons (optional features not included in the base price) for the size. All costs are per month (pro-rated)."
@@ -13213,19 +11547,28 @@
"minLength": 1,
"type": "string",
"description": "The slug of this size type.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "slug"
+ }
},
"name": {
"minLength": 1,
"type": "string",
"description": "The name of this size type.",
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "name"
+ }
},
"description": {
"type": "string",
"description": "The description of this size type, generally used to indicate the intended use case for sizes of this type.",
"nullable": true,
- "readOnly": true
+ "readOnly": true,
+ "x-oapi-codegen-extra-tags": {
+ "tfsdk": "description"
+ }
}
}
},
@@ -13969,47 +12312,6 @@
"Whether we are permitted to perform an un-clean power off after the server failed to perform a clean shutdown."
]
},
- "ValidationProblemDetails": {
- "required": [
- "errors",
- "title"
- ],
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "nullable": true
- },
- "title": {
- "type": "string",
- "nullable": true
- },
- "status": {
- "type": "integer",
- "format": "int32",
- "nullable": true
- },
- "detail": {
- "type": "string",
- "nullable": true
- },
- "instance": {
- "type": "string",
- "nullable": true
- },
- "errors": {
- "type": "object",
- "additionalProperties": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "nullable": true
- }
- },
- "additionalProperties": {}
- },
"VideoDevice": {
"enum": [
"cirrus-logic",
diff --git a/internal/binarylane/types_gen.go b/internal/binarylane/types_gen.go
index 4334544..56ed32b 100644
--- a/internal/binarylane/types_gen.go
+++ b/internal/binarylane/types_gen.go
@@ -140,6 +140,11 @@ const (
ChangePortBlockingTypeChangePortBlocking ChangePortBlockingType = "change_port_blocking"
)
+// Defines values for ChangeRegionType.
+const (
+ ChangeRegionTypeChangeRegion ChangeRegionType = "change_region"
+)
+
// Defines values for ChangeReverseNameType.
const (
ChangeReverseNameTypeChangeReverseName ChangeReverseNameType = "change_reverse_name"
@@ -230,12 +235,6 @@ const (
EnableIpv6TypeEnableIpv6 EnableIpv6Type = "enable_ipv6"
)
-// Defines values for ImageQueryType.
-const (
- ImageQueryTypeBackup ImageQueryType = "backup"
- ImageQueryTypeDistribution ImageQueryType = "distribution"
-)
-
// Defines values for ImageStatus.
const (
Available ImageStatus = "available"
@@ -246,9 +245,9 @@ const (
// Defines values for ImageType.
const (
- ImageTypeBackup ImageType = "backup"
- ImageTypeCustom ImageType = "custom"
- ImageTypeSnapshot ImageType = "snapshot"
+ Backup ImageType = "backup"
+ Custom ImageType = "custom"
+ Snapshot ImageType = "snapshot"
)
// Defines values for IsRunningType.
@@ -948,6 +947,16 @@ type ChangePortBlocking struct {
// ChangePortBlockingType defines model for ChangePortBlocking.Type.
type ChangePortBlockingType string
+// ChangeRegion Change the Region of a Server
+type ChangeRegion struct {
+ // Region The slug of the selected region.
+ Region string `json:"region"`
+ Type ChangeRegionType `json:"type"`
+}
+
+// ChangeRegionType defines model for ChangeRegion.Type.
+type ChangeRegionType string
+
// ChangeReverseName Change the Reverse Name for an IPv4 Address on a Server
type ChangeReverseName struct {
// Ipv4Address The IPv4 address to set or clear the reverse name for.
@@ -1304,10 +1313,10 @@ type DistributionFeature string
// DistributionInfo defines model for DistributionInfo.
type DistributionInfo struct {
// Features Features supported by this distribution.
- Features *[]DistributionFeature `json:"features,omitempty"`
+ Features *[]DistributionFeature `json:"features,omitempty" tfsdk:"features"`
// ImageId If this is a backup image, the operating system ID of the server at the time the backup was created.
- ImageId *int64 `json:"image_id,omitempty"`
+ ImageId *int64 `json:"image_id,omitempty" tfsdk:"image_id"`
// PasswordRecovery Supported methods of password recovery.
//
@@ -1318,28 +1327,28 @@ type DistributionInfo struct {
// | offline-change | Password can be reset and new credentials sent (Requires restart). |
// | online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |
//
- PasswordRecovery *PasswordRecoveryType `json:"password_recovery,omitempty"`
+ PasswordRecovery *PasswordRecoveryType `json:"password_recovery,omitempty" tfsdk:"password_recovery"`
// RemoteAccessUser User name to use when connecting via remote access (RDP or SSH).
- RemoteAccessUser *string `json:"remote_access_user"`
+ RemoteAccessUser *string `json:"remote_access_user" tfsdk:"remote_access_user"`
}
// DistributionSurcharges defines model for DistributionSurcharges.
type DistributionSurcharges struct {
// SurchargeBaseCost The additional cost for using this operating system as the base image for a size.
- SurchargeBaseCost *float64 `json:"surcharge_base_cost"`
+ SurchargeBaseCost *float64 `json:"surcharge_base_cost" tfsdk:"surcharge_base_cost"`
// SurchargeMinVcpu The minimum vcpu count for surcharge calculations.
- SurchargeMinVcpu *int32 `json:"surcharge_min_vcpu"`
+ SurchargeMinVcpu *int32 `json:"surcharge_min_vcpu" tfsdk:"surcharge_min_vcpu"`
// SurchargePerMemoryMaxMegabytes The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge.
- SurchargePerMemoryMaxMegabytes *int32 `json:"surcharge_per_memory_max_megabytes"`
+ SurchargePerMemoryMaxMegabytes *int32 `json:"surcharge_per_memory_max_megabytes" tfsdk:"surcharge_per_memory_max_megabytes"`
// SurchargePerMemoryMegabyte The additional cost per MB for using this operating system as the base image for a size.
- SurchargePerMemoryMegabyte *float64 `json:"surcharge_per_memory_megabyte"`
+ SurchargePerMemoryMegabyte *float64 `json:"surcharge_per_memory_megabyte" tfsdk:"surcharge_per_memory_megabyte"`
// SurchargePerVcpu The additional cost per vcpu for using this operating system as the base image for a size.
- SurchargePerVcpu *float64 `json:"surcharge_per_vcpu"`
+ SurchargePerVcpu *float64 `json:"surcharge_per_vcpu" tfsdk:"surcharge_per_vcpu"`
}
// Domain defines model for Domain.
@@ -1534,7 +1543,7 @@ type HealthCheckProtocol = string
// Host defines model for Host.
type Host struct {
- // DisplayName The name for this host.
+ // DisplayName The name for this host. If this is a dedicated host this property will be empty.
DisplayName *string `json:"display_name,omitempty"`
// StatusPage This is the URL of the status page of the host. This will normally only be set if the host is under maintenance.
@@ -1547,54 +1556,54 @@ type Host struct {
// Image defines model for Image.
type Image struct {
// BackupInfo If this image is a backup, this object will provide further information.
- BackupInfo *BackupInfo `json:"backup_info"`
+ BackupInfo *BackupInfo `json:"backup_info" tfsdk:"backup_info"`
// CreatedAt If this is a backup image this is the date and time in ISO8601 format when the image was created.
- CreatedAt *time.Time `json:"created_at"`
+ CreatedAt *time.Time `json:"created_at" tfsdk:"created_at"`
// Description A description that may provide further details or warnings about the image.
- Description *string `json:"description"`
+ Description *string `json:"description" tfsdk:"description"`
// Distribution If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using.
- Distribution *string `json:"distribution"`
+ Distribution *string `json:"distribution" tfsdk:"distribution"`
// DistributionInfo This object may provide further information about the distribution.
- DistributionInfo *DistributionInfo `json:"distribution_info,omitempty"`
+ DistributionInfo *DistributionInfo `json:"distribution_info,omitempty" tfsdk:"distribution_info"`
// DistributionSurcharges If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$.
- DistributionSurcharges *DistributionSurcharges `json:"distribution_surcharges"`
+ DistributionSurcharges *DistributionSurcharges `json:"distribution_surcharges" tfsdk:"distribution_surcharges"`
// ErrorMessage If the image creation failed this may provide further information.
- ErrorMessage *string `json:"error_message"`
+ ErrorMessage *string `json:"error_message" tfsdk:"error_message"`
// FullName If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image.
- FullName *string `json:"full_name"`
+ FullName *string `json:"full_name" tfsdk:"full_name"`
// Id The ID of this image.
- Id *int64 `json:"id,omitempty"`
+ Id *int64 `json:"id,omitempty" tfsdk:"id"`
// MinDiskSize For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup.
- MinDiskSize *int32 `json:"min_disk_size,omitempty"`
+ MinDiskSize *int32 `json:"min_disk_size,omitempty" tfsdk:"min_disk_size"`
// MinMemoryMegabytes This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image).
- MinMemoryMegabytes *int32 `json:"min_memory_megabytes"`
+ MinMemoryMegabytes *int32 `json:"min_memory_megabytes" tfsdk:"min_memory_megabytes"`
// Name If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image.
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty" tfsdk:"name"`
// Public A public image is available to all users. A private image is available only to the account that created the image.
- Public *bool `json:"public,omitempty"`
+ Public *bool `json:"public,omitempty" tfsdk:"public"`
// Regions The slugs of the regions where the image is available for use.
- Regions *[]string `json:"regions,omitempty"`
+ Regions *[]string `json:"regions,omitempty" tfsdk:"regions"`
// SizeGigabytes For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB.
- SizeGigabytes *float64 `json:"size_gigabytes,omitempty"`
+ SizeGigabytes *float64 `json:"size_gigabytes,omitempty" tfsdk:"size_gigabytes"`
// Slug If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference.
- Slug *string `json:"slug"`
- Status *ImageStatus `json:"status,omitempty"`
- Type *ImageType `json:"type,omitempty"`
+ Slug *string `json:"slug" tfsdk:"slug"`
+ Status *ImageStatus `json:"status,omitempty" tfsdk:"status"`
+ Type *ImageType `json:"type,omitempty" tfsdk:"type"`
}
// ImageDiskDownload defines model for ImageDiskDownload.
@@ -1643,13 +1652,6 @@ type ImageOptions struct {
UserData *string `json:"user_data"`
}
-// ImageQueryType
-// | Value | Description |
-// | ----- | ----------- |
-// | distribution | Base operating system images. |
-// | backup | A backup image of a server. |
-type ImageQueryType string
-
// ImageResponse defines model for ImageResponse.
type ImageResponse struct {
Image Image `json:"image"`
@@ -1967,13 +1969,13 @@ type Networks struct {
// OffsiteBackupFrequencyCost All costs are in AU$.
type OffsiteBackupFrequencyCost struct {
// DailyPerGigabyte The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
- DailyPerGigabyte *float64 `json:"daily_per_gigabyte,omitempty"`
+ DailyPerGigabyte *float64 `json:"daily_per_gigabyte,omitempty" tfsdk:"daily_per_gigabyte"`
// MonthlyPerGigabyte The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
- MonthlyPerGigabyte *float64 `json:"monthly_per_gigabyte,omitempty"`
+ MonthlyPerGigabyte *float64 `json:"monthly_per_gigabyte,omitempty" tfsdk:"monthly_per_gigabyte"`
// WeeklyPerGigabyte The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.
- WeeklyPerGigabyte *float64 `json:"weekly_per_gigabyte,omitempty"`
+ WeeklyPerGigabyte *float64 `json:"weekly_per_gigabyte,omitempty" tfsdk:"weekly_per_gigabyte"`
}
// OffsiteBackupSettings defines model for OffsiteBackupSettings.
@@ -2101,16 +2103,6 @@ type PowerOn struct {
// PowerOnType defines model for PowerOn.Type.
type PowerOnType string
-// ProblemDetails defines model for ProblemDetails.
-type ProblemDetails struct {
- Detail *string `json:"detail"`
- Instance *string `json:"instance"`
- Status *int32 `json:"status"`
- Title *string `json:"title"`
- Type *string `json:"type"`
- AdditionalProperties map[string]interface{} `json:"-"`
-}
-
// ProceedRequest defines model for ProceedRequest.
type ProceedRequest struct {
// Proceed Please see the documentation for each type of interaction for the effect of providing 'true' or 'false' here.
@@ -2153,22 +2145,22 @@ type RebuildType string
// Region defines model for Region.
type Region struct {
// Available Whether this region is available for the allocation of new resources.
- Available *bool `json:"available,omitempty"`
+ Available *bool `json:"available,omitempty" tfsdk:"available"`
// Features A list of features available for resources in this region.
- Features *[]string `json:"features,omitempty"`
+ Features *[]string `json:"features,omitempty" tfsdk:"features"`
// Name The name of this region.
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty" tfsdk:"name"`
// NameServers A list of nameservers available for resources in this region.
- NameServers *[]string `json:"name_servers,omitempty"`
+ NameServers *[]string `json:"name_servers,omitempty" tfsdk:"name_servers"`
// Sizes The slugs of the sizes available in this region.
- Sizes *[]string `json:"sizes,omitempty"`
+ Sizes *[]string `json:"sizes,omitempty" tfsdk:"sizes"`
// Slug The unique slug for this region.
- Slug *string `json:"slug,omitempty"`
+ Slug *string `json:"slug,omitempty" tfsdk:"slug"`
}
// RegionsResponse defines model for RegionsResponse.
@@ -2519,111 +2511,111 @@ type ShutdownType string
// Size defines model for Size.
type Size struct {
// Available If this is false the size is not available for new servers.
- Available *bool `json:"available,omitempty"`
+ Available *bool `json:"available,omitempty" tfsdk:"available"`
// CpuDescription A description of the CPU provided in this size.
- CpuDescription *string `json:"cpu_description"`
+ CpuDescription *string `json:"cpu_description" tfsdk:"cpu_description"`
// Description A description of this size.
- Description *string `json:"description"`
+ Description *string `json:"description" tfsdk:"description"`
// Disk The included storage for this size in GB.
- Disk *int32 `json:"disk,omitempty"`
+ Disk *int32 `json:"disk,omitempty" tfsdk:"disk"`
// ExcessTransferCostPerGigabyte The excess charged for any transfer above the included data transfer in AU$ per GB.
- ExcessTransferCostPerGigabyte *float64 `json:"excess_transfer_cost_per_gigabyte,omitempty"`
+ ExcessTransferCostPerGigabyte *float64 `json:"excess_transfer_cost_per_gigabyte,omitempty" tfsdk:"excess_transfer_cost_per_gigabyte"`
// Memory The included memory for this size in MB.
- Memory *int32 `json:"memory,omitempty"`
+ Memory *int32 `json:"memory,omitempty" tfsdk:"memory"`
// Options Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated).
- Options SizeOptions `json:"options"`
+ Options SizeOptions `json:"options" tfsdk:"options"`
// PriceHourly Hourly price in AU$.
- PriceHourly *float64 `json:"price_hourly,omitempty"`
+ PriceHourly *float64 `json:"price_hourly,omitempty" tfsdk:"price_hourly"`
// PriceMonthly Monthly Price in AU$.
- PriceMonthly *float64 `json:"price_monthly,omitempty"`
+ PriceMonthly *float64 `json:"price_monthly,omitempty" tfsdk:"price_monthly"`
// Regions A list of region slugs where this size is available regardless of stock.
// If this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,
// otherwise not all regions listed will support all operating systems on this size.
- Regions *[]string `json:"regions,omitempty"`
+ Regions *[]string `json:"regions,omitempty" tfsdk:"regions"`
// RegionsOutOfStock A list of region slugs where the size is normally available but is currently not available due to lack of stock.
- RegionsOutOfStock *[]string `json:"regions_out_of_stock"`
+ RegionsOutOfStock *[]string `json:"regions_out_of_stock" tfsdk:"regions_out_of_stock"`
// SizeType The type of this size, generally used to differentiate sizes optimized for different usages.
- SizeType *SizeType `json:"size_type,omitempty"`
+ SizeType *SizeType `json:"size_type,omitempty" tfsdk:"size_type"`
// Slug The slug of this size.
- Slug *string `json:"slug,omitempty"`
+ Slug *string `json:"slug,omitempty" tfsdk:"slug"`
// StorageDescription A description of the storage provided in this size.
- StorageDescription *string `json:"storage_description"`
+ StorageDescription *string `json:"storage_description" tfsdk:"storage_description"`
// Transfer The included data transfer for this size in TB.
- Transfer *float64 `json:"transfer,omitempty"`
+ Transfer *float64 `json:"transfer,omitempty" tfsdk:"transfer"`
// VcpuUnits This is the unit that the vcpus field counts, e.g. "core" or "thread".
- VcpuUnits *string `json:"vcpu_units,omitempty"`
+ VcpuUnits *string `json:"vcpu_units,omitempty" tfsdk:"vcpu_units"`
// Vcpus The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware.
- Vcpus *int32 `json:"vcpus,omitempty"`
+ Vcpus *int32 `json:"vcpus,omitempty" tfsdk:"vcpus"`
}
// SizeOptions Available add-ons (optional features not included in the base price) for the size. All costs are per month (pro-rated).
type SizeOptions struct {
// BackupsCostPerBackupPerGigabyte The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected.
- BackupsCostPerBackupPerGigabyte *float64 `json:"backups_cost_per_backup_per_gigabyte,omitempty"`
+ BackupsCostPerBackupPerGigabyte *float64 `json:"backups_cost_per_backup_per_gigabyte,omitempty" tfsdk:"backups_cost_per_backup_per_gigabyte"`
// DailyBackups The number of daily backups included in the base size cost.
- DailyBackups *int32 `json:"daily_backups,omitempty"`
+ DailyBackups *int32 `json:"daily_backups,omitempty" tfsdk:"daily_backups"`
// DiscountForNoPublicIpv4 This is the discount (if any) that is applied if no public IPv4 addresses are selected.
- DiscountForNoPublicIpv4 *float64 `json:"discount_for_no_public_ipv4,omitempty"`
+ DiscountForNoPublicIpv4 *float64 `json:"discount_for_no_public_ipv4,omitempty" tfsdk:"discount_for_no_public_ipv4"`
// DiskCostPerAdditionalGigabyte The additional cost per GB per month for additional storage space.
- DiskCostPerAdditionalGigabyte *float64 `json:"disk_cost_per_additional_gigabyte,omitempty"`
+ DiskCostPerAdditionalGigabyte *float64 `json:"disk_cost_per_additional_gigabyte,omitempty" tfsdk:"disk_cost_per_additional_gigabyte"`
// DiskMax The maximum storage in GB permitted on this size.
- DiskMax *int32 `json:"disk_max,omitempty"`
+ DiskMax *int32 `json:"disk_max,omitempty" tfsdk:"disk_max"`
// DiskMin The minimum storage in GB permitted on this size.
- DiskMin *int32 `json:"disk_min,omitempty"`
+ DiskMin *int32 `json:"disk_min,omitempty" tfsdk:"disk_min"`
// Ipv4AddressesCostPerAddress The additional cost per public IPv4 address per month for additional IPv4 addresses.
- Ipv4AddressesCostPerAddress *float64 `json:"ipv4_addresses_cost_per_address,omitempty"`
+ Ipv4AddressesCostPerAddress *float64 `json:"ipv4_addresses_cost_per_address,omitempty" tfsdk:"ipv4_addresses_cost_per_address"`
// Ipv4AddressesMax The maximum number of IPv4 addresses permitted on this size.
- Ipv4AddressesMax *int32 `json:"ipv4_addresses_max,omitempty"`
+ Ipv4AddressesMax *int32 `json:"ipv4_addresses_max,omitempty" tfsdk:"ipv4_addresses_max"`
// MemoryCostPerAdditionalMegabyte The additional cost per MB per month for additional memory.
- MemoryCostPerAdditionalMegabyte *float64 `json:"memory_cost_per_additional_megabyte,omitempty"`
+ MemoryCostPerAdditionalMegabyte *float64 `json:"memory_cost_per_additional_megabyte,omitempty" tfsdk:"memory_cost_per_additional_megabyte"`
// MemoryMax The maximum memory in MB permitted on this size.
- MemoryMax *int32 `json:"memory_max,omitempty"`
+ MemoryMax *int32 `json:"memory_max,omitempty" tfsdk:"memory_max"`
// MonthlyBackups The number of monthly backups included in the base size cost.
- MonthlyBackups *int32 `json:"monthly_backups,omitempty"`
+ MonthlyBackups *int32 `json:"monthly_backups,omitempty" tfsdk:"monthly_backups"`
// OffsiteBackupFrequencyCost The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$.
- OffsiteBackupFrequencyCost *OffsiteBackupFrequencyCost `json:"offsite_backup_frequency_cost,omitempty"`
+ OffsiteBackupFrequencyCost *OffsiteBackupFrequencyCost `json:"offsite_backup_frequency_cost,omitempty" tfsdk:"offsite_backup_frequency_cost"`
// OffsiteBackupsCostPerGigabyte The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected.
- OffsiteBackupsCostPerGigabyte *float64 `json:"offsite_backups_cost_per_gigabyte,omitempty"`
+ OffsiteBackupsCostPerGigabyte *float64 `json:"offsite_backups_cost_per_gigabyte,omitempty" tfsdk:"offsite_backups_cost_per_gigabyte"`
// RestrictedDiskValues If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted.
- RestrictedDiskValues *[]int32 `json:"restricted_disk_values"`
+ RestrictedDiskValues *[]int32 `json:"restricted_disk_values" tfsdk:"restricted_disk_values"`
// TransferCostPerAdditionalGigabyte The additional cost per GB per month for additional included transfer.
- TransferCostPerAdditionalGigabyte *float64 `json:"transfer_cost_per_additional_gigabyte,omitempty"`
+ TransferCostPerAdditionalGigabyte *float64 `json:"transfer_cost_per_additional_gigabyte,omitempty" tfsdk:"transfer_cost_per_additional_gigabyte"`
// TransferMax The maximum transfer in TB permitted for this size.
- TransferMax *float64 `json:"transfer_max,omitempty"`
+ TransferMax *float64 `json:"transfer_max,omitempty" tfsdk:"transfer_max"`
// WeeklyBackups The number of weekly backups included in the base size cost.
- WeeklyBackups *int32 `json:"weekly_backups,omitempty"`
+ WeeklyBackups *int32 `json:"weekly_backups,omitempty" tfsdk:"weekly_backups"`
}
// SizeOptionsRequest defines model for SizeOptionsRequest.
@@ -2679,13 +2671,13 @@ type SizeOptionsRequest struct {
// SizeType defines model for SizeType.
type SizeType struct {
// Description The description of this size type, generally used to indicate the intended use case for sizes of this type.
- Description *string `json:"description"`
+ Description *string `json:"description" tfsdk:"description"`
// Name The name of this size type.
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty" tfsdk:"name"`
// Slug The slug of this size type.
- Slug *string `json:"slug,omitempty"`
+ Slug *string `json:"slug,omitempty" tfsdk:"slug"`
}
// SizesResponse defines model for SizesResponse.
@@ -2986,17 +2978,6 @@ type UserInteractionRequired struct {
// | allow-unclean-power-off | Whether we are permitted to perform an un-clean power off after the server failed to perform a clean shutdown. |
type UserInteractionType string
-// ValidationProblemDetails defines model for ValidationProblemDetails.
-type ValidationProblemDetails struct {
- Detail *string `json:"detail"`
- Errors *map[string][]string `json:"errors"`
- Instance *string `json:"instance"`
- Status *int32 `json:"status"`
- Title *string `json:"title"`
- Type *string `json:"type"`
- AdditionalProperties map[string]interface{} `json:"-"`
-}
-
// VideoDevice
// | Value | Description |
// | ----- | ----------- |
@@ -3204,7 +3185,7 @@ type PutDomainsDomainNameRecordsRecordIdParamsDomainName1 = string
// GetImagesParams defines parameters for GetImages.
type GetImagesParams struct {
// Type Queries for distribution will include images that have pre-installed applications.
- Type *ImageQueryType `form:"type,omitempty" json:"type,omitempty"`
+ Type *string `form:"type,omitempty" json:"type,omitempty"`
// Private Provide 'true' to only list private images. 'false' has no effect.
Private *bool `form:"private,omitempty" json:"private,omitempty"`
@@ -3390,9 +3371,7 @@ type GetSizesParams struct {
ServerId *int64 `form:"server_id,omitempty" json:"server_id,omitempty"`
// Image If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects.
- Image *struct {
- union json.RawMessage
- } `form:"image,omitempty" json:"image,omitempty"`
+ Image *string `form:"image,omitempty" json:"image,omitempty"`
// Page The selected page. Page numbering starts at 1
Page *int32 `form:"page,omitempty" json:"page,omitempty"`
@@ -3401,12 +3380,6 @@ type GetSizesParams struct {
PerPage *int32 `form:"per_page,omitempty" json:"per_page,omitempty"`
}
-// GetSizesParamsImage0 defines parameters for GetSizes.
-type GetSizesParamsImage0 = int
-
-// GetSizesParamsImage1 defines parameters for GetSizes.
-type GetSizesParamsImage1 = string
-
// GetSoftwareParams defines parameters for GetSoftware.
type GetSoftwareParams struct {
// Page The selected page. Page numbering starts at 1
@@ -3554,6 +3527,9 @@ type PostServersServerIdActionsChangePartnerJSONRequestBody = ChangePartner
// PostServersServerIdActionsChangePortBlockingJSONRequestBody defines body for PostServersServerIdActionsChangePortBlocking for application/json ContentType.
type PostServersServerIdActionsChangePortBlockingJSONRequestBody = ChangePortBlocking
+// PostServersServerIdActionsChangeRegionJSONRequestBody defines body for PostServersServerIdActionsChangeRegion for application/json ContentType.
+type PostServersServerIdActionsChangeRegionJSONRequestBody = ChangeRegion
+
// PostServersServerIdActionsChangeReverseNameJSONRequestBody defines body for PostServersServerIdActionsChangeReverseName for application/json ContentType.
type PostServersServerIdActionsChangeReverseNameJSONRequestBody = ChangeReverseName
@@ -3650,271 +3626,6 @@ type PatchVpcsVpcIdJSONRequestBody = PatchVpcsVpcIdJSONBody
// PutVpcsVpcIdJSONRequestBody defines body for PutVpcsVpcId for application/json ContentType.
type PutVpcsVpcIdJSONRequestBody = PutVpcsVpcIdJSONBody
-// Getter for additional properties for ProblemDetails. Returns the specified
-// element and whether it was found
-func (a ProblemDetails) Get(fieldName string) (value interface{}, found bool) {
- if a.AdditionalProperties != nil {
- value, found = a.AdditionalProperties[fieldName]
- }
- return
-}
-
-// Setter for additional properties for ProblemDetails
-func (a *ProblemDetails) Set(fieldName string, value interface{}) {
- if a.AdditionalProperties == nil {
- a.AdditionalProperties = make(map[string]interface{})
- }
- a.AdditionalProperties[fieldName] = value
-}
-
-// Override default JSON handling for ProblemDetails to handle AdditionalProperties
-func (a *ProblemDetails) UnmarshalJSON(b []byte) error {
- object := make(map[string]json.RawMessage)
- err := json.Unmarshal(b, &object)
- if err != nil {
- return err
- }
-
- if raw, found := object["detail"]; found {
- err = json.Unmarshal(raw, &a.Detail)
- if err != nil {
- return fmt.Errorf("error reading 'detail': %w", err)
- }
- delete(object, "detail")
- }
-
- if raw, found := object["instance"]; found {
- err = json.Unmarshal(raw, &a.Instance)
- if err != nil {
- return fmt.Errorf("error reading 'instance': %w", err)
- }
- delete(object, "instance")
- }
-
- if raw, found := object["status"]; found {
- err = json.Unmarshal(raw, &a.Status)
- if err != nil {
- return fmt.Errorf("error reading 'status': %w", err)
- }
- delete(object, "status")
- }
-
- if raw, found := object["title"]; found {
- err = json.Unmarshal(raw, &a.Title)
- if err != nil {
- return fmt.Errorf("error reading 'title': %w", err)
- }
- delete(object, "title")
- }
-
- if raw, found := object["type"]; found {
- err = json.Unmarshal(raw, &a.Type)
- if err != nil {
- return fmt.Errorf("error reading 'type': %w", err)
- }
- delete(object, "type")
- }
-
- if len(object) != 0 {
- a.AdditionalProperties = make(map[string]interface{})
- for fieldName, fieldBuf := range object {
- var fieldVal interface{}
- err := json.Unmarshal(fieldBuf, &fieldVal)
- if err != nil {
- return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
- }
- a.AdditionalProperties[fieldName] = fieldVal
- }
- }
- return nil
-}
-
-// Override default JSON handling for ProblemDetails to handle AdditionalProperties
-func (a ProblemDetails) MarshalJSON() ([]byte, error) {
- var err error
- object := make(map[string]json.RawMessage)
-
- if a.Detail != nil {
- object["detail"], err = json.Marshal(a.Detail)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'detail': %w", err)
- }
- }
-
- if a.Instance != nil {
- object["instance"], err = json.Marshal(a.Instance)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'instance': %w", err)
- }
- }
-
- if a.Status != nil {
- object["status"], err = json.Marshal(a.Status)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'status': %w", err)
- }
- }
-
- object["title"], err = json.Marshal(a.Title)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'title': %w", err)
- }
-
- if a.Type != nil {
- object["type"], err = json.Marshal(a.Type)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'type': %w", err)
- }
- }
-
- for fieldName, field := range a.AdditionalProperties {
- object[fieldName], err = json.Marshal(field)
- if err != nil {
- return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
- }
- }
- return json.Marshal(object)
-}
-
-// Getter for additional properties for ValidationProblemDetails. Returns the specified
-// element and whether it was found
-func (a ValidationProblemDetails) Get(fieldName string) (value interface{}, found bool) {
- if a.AdditionalProperties != nil {
- value, found = a.AdditionalProperties[fieldName]
- }
- return
-}
-
-// Setter for additional properties for ValidationProblemDetails
-func (a *ValidationProblemDetails) Set(fieldName string, value interface{}) {
- if a.AdditionalProperties == nil {
- a.AdditionalProperties = make(map[string]interface{})
- }
- a.AdditionalProperties[fieldName] = value
-}
-
-// Override default JSON handling for ValidationProblemDetails to handle AdditionalProperties
-func (a *ValidationProblemDetails) UnmarshalJSON(b []byte) error {
- object := make(map[string]json.RawMessage)
- err := json.Unmarshal(b, &object)
- if err != nil {
- return err
- }
-
- if raw, found := object["detail"]; found {
- err = json.Unmarshal(raw, &a.Detail)
- if err != nil {
- return fmt.Errorf("error reading 'detail': %w", err)
- }
- delete(object, "detail")
- }
-
- if raw, found := object["errors"]; found {
- err = json.Unmarshal(raw, &a.Errors)
- if err != nil {
- return fmt.Errorf("error reading 'errors': %w", err)
- }
- delete(object, "errors")
- }
-
- if raw, found := object["instance"]; found {
- err = json.Unmarshal(raw, &a.Instance)
- if err != nil {
- return fmt.Errorf("error reading 'instance': %w", err)
- }
- delete(object, "instance")
- }
-
- if raw, found := object["status"]; found {
- err = json.Unmarshal(raw, &a.Status)
- if err != nil {
- return fmt.Errorf("error reading 'status': %w", err)
- }
- delete(object, "status")
- }
-
- if raw, found := object["title"]; found {
- err = json.Unmarshal(raw, &a.Title)
- if err != nil {
- return fmt.Errorf("error reading 'title': %w", err)
- }
- delete(object, "title")
- }
-
- if raw, found := object["type"]; found {
- err = json.Unmarshal(raw, &a.Type)
- if err != nil {
- return fmt.Errorf("error reading 'type': %w", err)
- }
- delete(object, "type")
- }
-
- if len(object) != 0 {
- a.AdditionalProperties = make(map[string]interface{})
- for fieldName, fieldBuf := range object {
- var fieldVal interface{}
- err := json.Unmarshal(fieldBuf, &fieldVal)
- if err != nil {
- return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
- }
- a.AdditionalProperties[fieldName] = fieldVal
- }
- }
- return nil
-}
-
-// Override default JSON handling for ValidationProblemDetails to handle AdditionalProperties
-func (a ValidationProblemDetails) MarshalJSON() ([]byte, error) {
- var err error
- object := make(map[string]json.RawMessage)
-
- if a.Detail != nil {
- object["detail"], err = json.Marshal(a.Detail)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'detail': %w", err)
- }
- }
-
- object["errors"], err = json.Marshal(a.Errors)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'errors': %w", err)
- }
-
- if a.Instance != nil {
- object["instance"], err = json.Marshal(a.Instance)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'instance': %w", err)
- }
- }
-
- if a.Status != nil {
- object["status"], err = json.Marshal(a.Status)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'status': %w", err)
- }
- }
-
- object["title"], err = json.Marshal(a.Title)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'title': %w", err)
- }
-
- if a.Type != nil {
- object["type"], err = json.Marshal(a.Type)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'type': %w", err)
- }
- }
-
- for fieldName, field := range a.AdditionalProperties {
- object[fieldName], err = json.Marshal(field)
- if err != nil {
- return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
- }
- }
- return json.Marshal(object)
-}
-
// AsNetworkNetmask0 returns the union data inside the Network_Netmask as a NetworkNetmask0
func (t Network_Netmask) AsNetworkNetmask0() (NetworkNetmask0, error) {
var body NetworkNetmask0
@@ -4429,6 +4140,36 @@ func (t *ServerAction) MergeChangePortBlocking(v ChangePortBlocking) error {
return err
}
+// AsChangeRegion returns the union data inside the ServerAction as a ChangeRegion
+func (t ServerAction) AsChangeRegion() (ChangeRegion, error) {
+ var body ChangeRegion
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromChangeRegion overwrites any union data inside the ServerAction as the provided ChangeRegion
+func (t *ServerAction) FromChangeRegion(v ChangeRegion) error {
+ t.Type = "change_region"
+
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeChangeRegion performs a merge with any union data inside the ServerAction, using the provided ChangeRegion
+func (t *ServerAction) MergeChangeRegion(v ChangeRegion) error {
+ t.Type = "change_region"
+
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
// AsChangeReverseName returns the union data inside the ServerAction as a ChangeReverseName
func (t ServerAction) AsChangeReverseName() (ChangeReverseName, error) {
var body ChangeReverseName
@@ -5309,6 +5050,8 @@ func (t ServerAction) ValueByDiscriminator() (interface{}, error) {
return t.AsChangePartner()
case "change_port_blocking":
return t.AsChangePortBlocking()
+ case "change_region":
+ return t.AsChangeRegion()
case "change_reverse_name":
return t.AsChangeReverseName()
case "change_separate_private_network_interface":
diff --git a/internal/data_sources/images_data_source_gen.go b/internal/data_sources/images_data_source_gen.go
new file mode 100644
index 0000000..fde1f31
--- /dev/null
+++ b/internal/data_sources/images_data_source_gen.go
@@ -0,0 +1,3837 @@
+// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
+
+package data_sources
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-framework/attr"
+ "github.com/hashicorp/terraform-plugin-framework/diag"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-framework/types/basetypes"
+ "github.com/hashicorp/terraform-plugin-go/tftypes"
+ "strings"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+)
+
+func ImagesDataSourceSchema(ctx context.Context) schema.Schema {
+ return schema.Schema{
+ Attributes: map[string]schema.Attribute{
+ "images": schema.ListNestedAttribute{
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "backup_info": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "backup_disks": schema.ListNestedAttribute{
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "description": schema.StringAttribute{
+ Computed: true,
+ Description: "A description of this disk.",
+ MarkdownDescription: "A description of this disk.",
+ },
+ "id": schema.Int64Attribute{
+ Computed: true,
+ Description: "The ID of this backup disk.",
+ MarkdownDescription: "The ID of this backup disk.",
+ },
+ "min_disk_size": schema.Int64Attribute{
+ Computed: true,
+ Description: "This is the minimum disk size in GB required to restore this disk image.",
+ MarkdownDescription: "This is the minimum disk size in GB required to restore this disk image.",
+ },
+ "size_gigabytes": schema.Float64Attribute{
+ Computed: true,
+ Description: "This is the compressed size of the disk image in GB.",
+ MarkdownDescription: "This is the compressed size of the disk image in GB.",
+ },
+ },
+ CustomType: BackupDisksType{
+ ObjectType: types.ObjectType{
+ AttrTypes: BackupDisksValue{}.AttributeTypes(ctx),
+ },
+ },
+ },
+ Computed: true,
+ Description: "A list of the individual disks that make up this backup.",
+ MarkdownDescription: "A list of the individual disks that make up this backup.",
+ },
+ "iso": schema.BoolAttribute{
+ Computed: true,
+ Description: "If this is true the backup is an ISO image and cannot be restored or downloaded. ISO images may only be attached for use as a boot disk or an additional disk.",
+ MarkdownDescription: "If this is true the backup is an ISO image and cannot be restored or downloaded. ISO images may only be attached for use as a boot disk or an additional disk.",
+ },
+ "locked": schema.BoolAttribute{
+ Computed: true,
+ Description: "If this is true the backup is locked and cannot be replaced.",
+ MarkdownDescription: "If this is true the backup is locked and cannot be replaced.",
+ },
+ "offsite": schema.BoolAttribute{
+ Computed: true,
+ Description: "If this is true, an attempt to create an offsite copy was made. This does not mean that the offsite copy attempt was successful or that the copy still exists.",
+ MarkdownDescription: "If this is true, an attempt to create an offsite copy was made. This does not mean that the offsite copy attempt was successful or that the copy still exists.",
+ },
+ "server_id": schema.Int64Attribute{
+ Computed: true,
+ Description: "The server ID that was used to create this backup.",
+ MarkdownDescription: "The server ID that was used to create this backup.",
+ },
+ "type": schema.StringAttribute{
+ Computed: true,
+ Description: "\n| Value | Description |\n| ----- | ----------- |\n| daily | A backup which is scheduled to be taken each day. |\n| weekly | A backup which is scheduled to be taken each week. |\n| monthly | A backup which is scheduled to be taken each month. |\n| temporary | A backup which is created on demand and only retained for a maximum of seven days. |\n\n",
+ MarkdownDescription: "\n| Value | Description |\n| ----- | ----------- |\n| daily | A backup which is scheduled to be taken each day. |\n| weekly | A backup which is scheduled to be taken each week. |\n| monthly | A backup which is scheduled to be taken each month. |\n| temporary | A backup which is created on demand and only retained for a maximum of seven days. |\n\n",
+ },
+ },
+ CustomType: BackupInfoType{
+ ObjectType: types.ObjectType{
+ AttrTypes: BackupInfoValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "If this image is a backup, this object will provide further information.",
+ MarkdownDescription: "If this image is a backup, this object will provide further information.",
+ },
+ "created_at": schema.StringAttribute{
+ Computed: true,
+ Description: "If this is a backup image this is the date and time in ISO8601 format when the image was created.",
+ MarkdownDescription: "If this is a backup image this is the date and time in ISO8601 format when the image was created.",
+ },
+ "description": schema.StringAttribute{
+ Computed: true,
+ Description: "A description that may provide further details or warnings about the image.",
+ MarkdownDescription: "A description that may provide further details or warnings about the image.",
+ },
+ "distribution": schema.StringAttribute{
+ Computed: true,
+ Description: "If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using.",
+ MarkdownDescription: "If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using.",
+ },
+ "distribution_info": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "features": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "Features supported by this distribution.",
+ MarkdownDescription: "Features supported by this distribution.",
+ },
+ "image_id": schema.Int64Attribute{
+ Computed: true,
+ Description: "If this is a backup image, the operating system ID of the server at the time the backup was created.",
+ MarkdownDescription: "If this is a backup image, the operating system ID of the server at the time the backup was created.",
+ },
+ "password_recovery": schema.StringAttribute{
+ Computed: true,
+ Description: "Supported methods of password recovery.\n\n| Value | Description |\n| ----- | ----------- |\n| manual | Password must be reset manually using the recovery console and rescue disk. |\n| offline-clear | Password can be cleared for the admin/root user only. New password needs to be provided on login via the console (Requires restart). |\n| offline-change | Password can be reset and new credentials sent (Requires restart). |\n| online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |\n\n",
+ MarkdownDescription: "Supported methods of password recovery.\n\n| Value | Description |\n| ----- | ----------- |\n| manual | Password must be reset manually using the recovery console and rescue disk. |\n| offline-clear | Password can be cleared for the admin/root user only. New password needs to be provided on login via the console (Requires restart). |\n| offline-change | Password can be reset and new credentials sent (Requires restart). |\n| online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |\n\n",
+ },
+ "remote_access_user": schema.StringAttribute{
+ Computed: true,
+ Description: "User name to use when connecting via remote access (RDP or SSH).",
+ MarkdownDescription: "User name to use when connecting via remote access (RDP or SSH).",
+ },
+ },
+ CustomType: DistributionInfoType{
+ ObjectType: types.ObjectType{
+ AttrTypes: DistributionInfoValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "This object may provide further information about the distribution.",
+ MarkdownDescription: "This object may provide further information about the distribution.",
+ },
+ "distribution_surcharges": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "surcharge_base_cost": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost for using this operating system as the base image for a size.",
+ MarkdownDescription: "The additional cost for using this operating system as the base image for a size.",
+ },
+ "surcharge_min_vcpu": schema.Int64Attribute{
+ Computed: true,
+ Description: "The minimum vcpu count for surcharge calculations.",
+ MarkdownDescription: "The minimum vcpu count for surcharge calculations.",
+ },
+ "surcharge_per_memory_max_megabytes": schema.Int64Attribute{
+ Computed: true,
+ Description: "The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge.",
+ MarkdownDescription: "The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge.",
+ },
+ "surcharge_per_memory_megabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per MB for using this operating system as the base image for a size.",
+ MarkdownDescription: "The additional cost per MB for using this operating system as the base image for a size.",
+ },
+ "surcharge_per_vcpu": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per vcpu for using this operating system as the base image for a size.",
+ MarkdownDescription: "The additional cost per vcpu for using this operating system as the base image for a size.",
+ },
+ },
+ CustomType: DistributionSurchargesType{
+ ObjectType: types.ObjectType{
+ AttrTypes: DistributionSurchargesValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$.",
+ MarkdownDescription: "If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$.",
+ },
+ "error_message": schema.StringAttribute{
+ Computed: true,
+ Description: "If the image creation failed this may provide further information.",
+ MarkdownDescription: "If the image creation failed this may provide further information.",
+ },
+ "full_name": schema.StringAttribute{
+ Computed: true,
+ Description: "If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image.",
+ MarkdownDescription: "If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image.",
+ },
+ "id": schema.Int64Attribute{
+ Computed: true,
+ Description: "The ID of this image.",
+ MarkdownDescription: "The ID of this image.",
+ },
+ "min_disk_size": schema.Int64Attribute{
+ Computed: true,
+ Description: "For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup.",
+ MarkdownDescription: "For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup.",
+ },
+ "min_memory_megabytes": schema.Int64Attribute{
+ Computed: true,
+ Description: "This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image).",
+ MarkdownDescription: "This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image).",
+ },
+ "name": schema.StringAttribute{
+ Computed: true,
+ Description: "If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image.",
+ MarkdownDescription: "If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image.",
+ },
+ "public": schema.BoolAttribute{
+ Computed: true,
+ Description: "A public image is available to all users. A private image is available only to the account that created the image.",
+ MarkdownDescription: "A public image is available to all users. A private image is available only to the account that created the image.",
+ },
+ "regions": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "The slugs of the regions where the image is available for use.",
+ MarkdownDescription: "The slugs of the regions where the image is available for use.",
+ },
+ "size_gigabytes": schema.Float64Attribute{
+ Computed: true,
+ Description: "For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB.",
+ MarkdownDescription: "For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB.",
+ },
+ "slug": schema.StringAttribute{
+ Computed: true,
+ Description: "If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference.",
+ MarkdownDescription: "If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference.",
+ },
+ "status": schema.StringAttribute{
+ Computed: true,
+ Description: "\n| Value | Description |\n| ----- | ----------- |\n| NEW | The image is new. |\n| available | The image is available for use. |\n| pending | The image is pending and is not yet available for use. |\n| deleted | The image has been deleted and is no longer available for use. |\n\n",
+ MarkdownDescription: "\n| Value | Description |\n| ----- | ----------- |\n| NEW | The image is new. |\n| available | The image is available for use. |\n| pending | The image is pending and is not yet available for use. |\n| deleted | The image has been deleted and is no longer available for use. |\n\n",
+ },
+ "type": schema.StringAttribute{
+ Computed: true,
+ Description: "\n| Value | Description |\n| ----- | ----------- |\n| custom | An image uploaded by a user. |\n| snapshot | A snapshot. Snapshot creation is not currently supported so only distribution images will have this value. |\n| backup | A backup of a server. |\n\n",
+ MarkdownDescription: "\n| Value | Description |\n| ----- | ----------- |\n| custom | An image uploaded by a user. |\n| snapshot | A snapshot. Snapshot creation is not currently supported so only distribution images will have this value. |\n| backup | A backup of a server. |\n\n",
+ },
+ },
+ CustomType: ImagesType{
+ ObjectType: types.ObjectType{
+ AttrTypes: ImagesValue{}.AttributeTypes(ctx),
+ },
+ },
+ },
+ Computed: true,
+ },
+ "type": schema.StringAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Queries for distribution will include images that have pre-installed applications.",
+ MarkdownDescription: "Queries for distribution will include images that have pre-installed applications.",
+ },
+ },
+ }
+}
+
+type ImagesModel struct {
+ Images types.List `tfsdk:"images"`
+ Type types.String `tfsdk:"type"`
+}
+
+var _ basetypes.ObjectTypable = ImagesType{}
+
+type ImagesType struct {
+ basetypes.ObjectType
+}
+
+func (t ImagesType) Equal(o attr.Type) bool {
+ other, ok := o.(ImagesType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t ImagesType) String() string {
+ return "ImagesType"
+}
+
+func (t ImagesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ backupInfoAttribute, ok := attributes["backup_info"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backup_info is missing from object`)
+
+ return nil, diags
+ }
+
+ backupInfoVal, ok := backupInfoAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backup_info expected to be basetypes.ObjectValue, was: %T`, backupInfoAttribute))
+ }
+
+ createdAtAttribute, ok := attributes["created_at"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `created_at is missing from object`)
+
+ return nil, diags
+ }
+
+ createdAtVal, ok := createdAtAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`created_at expected to be basetypes.StringValue, was: %T`, createdAtAttribute))
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return nil, diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ distributionAttribute, ok := attributes["distribution"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution is missing from object`)
+
+ return nil, diags
+ }
+
+ distributionVal, ok := distributionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution expected to be basetypes.StringValue, was: %T`, distributionAttribute))
+ }
+
+ distributionInfoAttribute, ok := attributes["distribution_info"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution_info is missing from object`)
+
+ return nil, diags
+ }
+
+ distributionInfoVal, ok := distributionInfoAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution_info expected to be basetypes.ObjectValue, was: %T`, distributionInfoAttribute))
+ }
+
+ distributionSurchargesAttribute, ok := attributes["distribution_surcharges"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution_surcharges is missing from object`)
+
+ return nil, diags
+ }
+
+ distributionSurchargesVal, ok := distributionSurchargesAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution_surcharges expected to be basetypes.ObjectValue, was: %T`, distributionSurchargesAttribute))
+ }
+
+ errorMessageAttribute, ok := attributes["error_message"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `error_message is missing from object`)
+
+ return nil, diags
+ }
+
+ errorMessageVal, ok := errorMessageAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`error_message expected to be basetypes.StringValue, was: %T`, errorMessageAttribute))
+ }
+
+ fullNameAttribute, ok := attributes["full_name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `full_name is missing from object`)
+
+ return nil, diags
+ }
+
+ fullNameVal, ok := fullNameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`full_name expected to be basetypes.StringValue, was: %T`, fullNameAttribute))
+ }
+
+ idAttribute, ok := attributes["id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `id is missing from object`)
+
+ return nil, diags
+ }
+
+ idVal, ok := idAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute))
+ }
+
+ minDiskSizeAttribute, ok := attributes["min_disk_size"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_disk_size is missing from object`)
+
+ return nil, diags
+ }
+
+ minDiskSizeVal, ok := minDiskSizeAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_disk_size expected to be basetypes.Int64Value, was: %T`, minDiskSizeAttribute))
+ }
+
+ minMemoryMegabytesAttribute, ok := attributes["min_memory_megabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_memory_megabytes is missing from object`)
+
+ return nil, diags
+ }
+
+ minMemoryMegabytesVal, ok := minMemoryMegabytesAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_memory_megabytes expected to be basetypes.Int64Value, was: %T`, minMemoryMegabytesAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return nil, diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ publicAttribute, ok := attributes["public"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `public is missing from object`)
+
+ return nil, diags
+ }
+
+ publicVal, ok := publicAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`public expected to be basetypes.BoolValue, was: %T`, publicAttribute))
+ }
+
+ regionsAttribute, ok := attributes["regions"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions is missing from object`)
+
+ return nil, diags
+ }
+
+ regionsVal, ok := regionsAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions expected to be basetypes.ListValue, was: %T`, regionsAttribute))
+ }
+
+ sizeGigabytesAttribute, ok := attributes["size_gigabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_gigabytes is missing from object`)
+
+ return nil, diags
+ }
+
+ sizeGigabytesVal, ok := sizeGigabytesAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_gigabytes expected to be basetypes.Float64Value, was: %T`, sizeGigabytesAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return nil, diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ statusAttribute, ok := attributes["status"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `status is missing from object`)
+
+ return nil, diags
+ }
+
+ statusVal, ok := statusAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute))
+ }
+
+ typeAttribute, ok := attributes["type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `type is missing from object`)
+
+ return nil, diags
+ }
+
+ typeVal, ok := typeAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`type expected to be basetypes.StringValue, was: %T`, typeAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return ImagesValue{
+ BackupInfo: backupInfoVal,
+ CreatedAt: createdAtVal,
+ Description: descriptionVal,
+ Distribution: distributionVal,
+ DistributionInfo: distributionInfoVal,
+ DistributionSurcharges: distributionSurchargesVal,
+ ErrorMessage: errorMessageVal,
+ FullName: fullNameVal,
+ Id: idVal,
+ MinDiskSize: minDiskSizeVal,
+ MinMemoryMegabytes: minMemoryMegabytesVal,
+ Name: nameVal,
+ Public: publicVal,
+ Regions: regionsVal,
+ SizeGigabytes: sizeGigabytesVal,
+ Slug: slugVal,
+ Status: statusVal,
+ ImagesType: typeVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewImagesValueNull() ImagesValue {
+ return ImagesValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewImagesValueUnknown() ImagesValue {
+ return ImagesValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewImagesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (ImagesValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing ImagesValue Attribute Value",
+ "While creating a ImagesValue value, a missing attribute value was detected. "+
+ "A ImagesValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("ImagesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid ImagesValue Attribute Type",
+ "While creating a ImagesValue value, an invalid attribute value was detected. "+
+ "A ImagesValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("ImagesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("ImagesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra ImagesValue Attribute Value",
+ "While creating a ImagesValue value, an extra attribute value was detected. "+
+ "A ImagesValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra ImagesValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewImagesValueUnknown(), diags
+ }
+
+ backupInfoAttribute, ok := attributes["backup_info"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backup_info is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ backupInfoVal, ok := backupInfoAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backup_info expected to be basetypes.ObjectValue, was: %T`, backupInfoAttribute))
+ }
+
+ createdAtAttribute, ok := attributes["created_at"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `created_at is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ createdAtVal, ok := createdAtAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`created_at expected to be basetypes.StringValue, was: %T`, createdAtAttribute))
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ distributionAttribute, ok := attributes["distribution"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ distributionVal, ok := distributionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution expected to be basetypes.StringValue, was: %T`, distributionAttribute))
+ }
+
+ distributionInfoAttribute, ok := attributes["distribution_info"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution_info is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ distributionInfoVal, ok := distributionInfoAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution_info expected to be basetypes.ObjectValue, was: %T`, distributionInfoAttribute))
+ }
+
+ distributionSurchargesAttribute, ok := attributes["distribution_surcharges"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `distribution_surcharges is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ distributionSurchargesVal, ok := distributionSurchargesAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`distribution_surcharges expected to be basetypes.ObjectValue, was: %T`, distributionSurchargesAttribute))
+ }
+
+ errorMessageAttribute, ok := attributes["error_message"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `error_message is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ errorMessageVal, ok := errorMessageAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`error_message expected to be basetypes.StringValue, was: %T`, errorMessageAttribute))
+ }
+
+ fullNameAttribute, ok := attributes["full_name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `full_name is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ fullNameVal, ok := fullNameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`full_name expected to be basetypes.StringValue, was: %T`, fullNameAttribute))
+ }
+
+ idAttribute, ok := attributes["id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `id is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ idVal, ok := idAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute))
+ }
+
+ minDiskSizeAttribute, ok := attributes["min_disk_size"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_disk_size is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ minDiskSizeVal, ok := minDiskSizeAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_disk_size expected to be basetypes.Int64Value, was: %T`, minDiskSizeAttribute))
+ }
+
+ minMemoryMegabytesAttribute, ok := attributes["min_memory_megabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_memory_megabytes is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ minMemoryMegabytesVal, ok := minMemoryMegabytesAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_memory_megabytes expected to be basetypes.Int64Value, was: %T`, minMemoryMegabytesAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ publicAttribute, ok := attributes["public"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `public is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ publicVal, ok := publicAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`public expected to be basetypes.BoolValue, was: %T`, publicAttribute))
+ }
+
+ regionsAttribute, ok := attributes["regions"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ regionsVal, ok := regionsAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions expected to be basetypes.ListValue, was: %T`, regionsAttribute))
+ }
+
+ sizeGigabytesAttribute, ok := attributes["size_gigabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_gigabytes is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ sizeGigabytesVal, ok := sizeGigabytesAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_gigabytes expected to be basetypes.Float64Value, was: %T`, sizeGigabytesAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ statusAttribute, ok := attributes["status"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `status is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ statusVal, ok := statusAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute))
+ }
+
+ typeAttribute, ok := attributes["type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `type is missing from object`)
+
+ return NewImagesValueUnknown(), diags
+ }
+
+ typeVal, ok := typeAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`type expected to be basetypes.StringValue, was: %T`, typeAttribute))
+ }
+
+ if diags.HasError() {
+ return NewImagesValueUnknown(), diags
+ }
+
+ return ImagesValue{
+ BackupInfo: backupInfoVal,
+ CreatedAt: createdAtVal,
+ Description: descriptionVal,
+ Distribution: distributionVal,
+ DistributionInfo: distributionInfoVal,
+ DistributionSurcharges: distributionSurchargesVal,
+ ErrorMessage: errorMessageVal,
+ FullName: fullNameVal,
+ Id: idVal,
+ MinDiskSize: minDiskSizeVal,
+ MinMemoryMegabytes: minMemoryMegabytesVal,
+ Name: nameVal,
+ Public: publicVal,
+ Regions: regionsVal,
+ SizeGigabytes: sizeGigabytesVal,
+ Slug: slugVal,
+ Status: statusVal,
+ ImagesType: typeVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewImagesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) ImagesValue {
+ object, diags := NewImagesValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewImagesValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t ImagesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewImagesValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewImagesValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewImagesValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewImagesValueMust(ImagesValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t ImagesType) ValueType(ctx context.Context) attr.Value {
+ return ImagesValue{}
+}
+
+var _ basetypes.ObjectValuable = ImagesValue{}
+
+type ImagesValue struct {
+ BackupInfo basetypes.ObjectValue `tfsdk:"backup_info"`
+ CreatedAt basetypes.StringValue `tfsdk:"created_at"`
+ Description basetypes.StringValue `tfsdk:"description"`
+ Distribution basetypes.StringValue `tfsdk:"distribution"`
+ DistributionInfo basetypes.ObjectValue `tfsdk:"distribution_info"`
+ DistributionSurcharges basetypes.ObjectValue `tfsdk:"distribution_surcharges"`
+ ErrorMessage basetypes.StringValue `tfsdk:"error_message"`
+ FullName basetypes.StringValue `tfsdk:"full_name"`
+ Id basetypes.Int64Value `tfsdk:"id"`
+ MinDiskSize basetypes.Int64Value `tfsdk:"min_disk_size"`
+ MinMemoryMegabytes basetypes.Int64Value `tfsdk:"min_memory_megabytes"`
+ Name basetypes.StringValue `tfsdk:"name"`
+ Public basetypes.BoolValue `tfsdk:"public"`
+ Regions basetypes.ListValue `tfsdk:"regions"`
+ SizeGigabytes basetypes.Float64Value `tfsdk:"size_gigabytes"`
+ Slug basetypes.StringValue `tfsdk:"slug"`
+ Status basetypes.StringValue `tfsdk:"status"`
+ ImagesType basetypes.StringValue `tfsdk:"type"`
+ state attr.ValueState
+}
+
+func (v ImagesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 18)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["backup_info"] = basetypes.ObjectType{
+ AttrTypes: BackupInfoValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["created_at"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["distribution"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["distribution_info"] = basetypes.ObjectType{
+ AttrTypes: DistributionInfoValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["distribution_surcharges"] = basetypes.ObjectType{
+ AttrTypes: DistributionSurchargesValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["error_message"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["full_name"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["min_disk_size"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["min_memory_megabytes"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["public"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["regions"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["size_gigabytes"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["slug"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["status"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["type"] = basetypes.StringType{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 18)
+
+ val, err = v.BackupInfo.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["backup_info"] = val
+
+ val, err = v.CreatedAt.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["created_at"] = val
+
+ val, err = v.Description.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["description"] = val
+
+ val, err = v.Distribution.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["distribution"] = val
+
+ val, err = v.DistributionInfo.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["distribution_info"] = val
+
+ val, err = v.DistributionSurcharges.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["distribution_surcharges"] = val
+
+ val, err = v.ErrorMessage.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["error_message"] = val
+
+ val, err = v.FullName.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["full_name"] = val
+
+ val, err = v.Id.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["id"] = val
+
+ val, err = v.MinDiskSize.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["min_disk_size"] = val
+
+ val, err = v.MinMemoryMegabytes.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["min_memory_megabytes"] = val
+
+ val, err = v.Name.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["name"] = val
+
+ val, err = v.Public.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["public"] = val
+
+ val, err = v.Regions.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["regions"] = val
+
+ val, err = v.SizeGigabytes.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["size_gigabytes"] = val
+
+ val, err = v.Slug.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["slug"] = val
+
+ val, err = v.Status.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["status"] = val
+
+ val, err = v.ImagesType.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["type"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v ImagesValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v ImagesValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v ImagesValue) String() string {
+ return "ImagesValue"
+}
+
+func (v ImagesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ var backupInfo basetypes.ObjectValue
+
+ if v.BackupInfo.IsNull() {
+ backupInfo = types.ObjectNull(
+ BackupInfoValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.BackupInfo.IsUnknown() {
+ backupInfo = types.ObjectUnknown(
+ BackupInfoValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.BackupInfo.IsNull() && !v.BackupInfo.IsUnknown() {
+ backupInfo = types.ObjectValueMust(
+ BackupInfoValue{}.AttributeTypes(ctx),
+ v.BackupInfo.Attributes(),
+ )
+ }
+
+ var distributionInfo basetypes.ObjectValue
+
+ if v.DistributionInfo.IsNull() {
+ distributionInfo = types.ObjectNull(
+ DistributionInfoValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.DistributionInfo.IsUnknown() {
+ distributionInfo = types.ObjectUnknown(
+ DistributionInfoValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.DistributionInfo.IsNull() && !v.DistributionInfo.IsUnknown() {
+ distributionInfo = types.ObjectValueMust(
+ DistributionInfoValue{}.AttributeTypes(ctx),
+ v.DistributionInfo.Attributes(),
+ )
+ }
+
+ var distributionSurcharges basetypes.ObjectValue
+
+ if v.DistributionSurcharges.IsNull() {
+ distributionSurcharges = types.ObjectNull(
+ DistributionSurchargesValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.DistributionSurcharges.IsUnknown() {
+ distributionSurcharges = types.ObjectUnknown(
+ DistributionSurchargesValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.DistributionSurcharges.IsNull() && !v.DistributionSurcharges.IsUnknown() {
+ distributionSurcharges = types.ObjectValueMust(
+ DistributionSurchargesValue{}.AttributeTypes(ctx),
+ v.DistributionSurcharges.Attributes(),
+ )
+ }
+
+ var regionsVal basetypes.ListValue
+ switch {
+ case v.Regions.IsUnknown():
+ regionsVal = types.ListUnknown(types.StringType)
+ case v.Regions.IsNull():
+ regionsVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ regionsVal, d = types.ListValue(types.StringType, v.Regions.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "backup_info": basetypes.ObjectType{
+ AttrTypes: BackupInfoValue{}.AttributeTypes(ctx),
+ },
+ "created_at": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "distribution": basetypes.StringType{},
+ "distribution_info": basetypes.ObjectType{
+ AttrTypes: DistributionInfoValue{}.AttributeTypes(ctx),
+ },
+ "distribution_surcharges": basetypes.ObjectType{
+ AttrTypes: DistributionSurchargesValue{}.AttributeTypes(ctx),
+ },
+ "error_message": basetypes.StringType{},
+ "full_name": basetypes.StringType{},
+ "id": basetypes.Int64Type{},
+ "min_disk_size": basetypes.Int64Type{},
+ "min_memory_megabytes": basetypes.Int64Type{},
+ "name": basetypes.StringType{},
+ "public": basetypes.BoolType{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_gigabytes": basetypes.Float64Type{},
+ "slug": basetypes.StringType{},
+ "status": basetypes.StringType{},
+ "type": basetypes.StringType{},
+ }), diags
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "backup_info": basetypes.ObjectType{
+ AttrTypes: BackupInfoValue{}.AttributeTypes(ctx),
+ },
+ "created_at": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "distribution": basetypes.StringType{},
+ "distribution_info": basetypes.ObjectType{
+ AttrTypes: DistributionInfoValue{}.AttributeTypes(ctx),
+ },
+ "distribution_surcharges": basetypes.ObjectType{
+ AttrTypes: DistributionSurchargesValue{}.AttributeTypes(ctx),
+ },
+ "error_message": basetypes.StringType{},
+ "full_name": basetypes.StringType{},
+ "id": basetypes.Int64Type{},
+ "min_disk_size": basetypes.Int64Type{},
+ "min_memory_megabytes": basetypes.Int64Type{},
+ "name": basetypes.StringType{},
+ "public": basetypes.BoolType{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_gigabytes": basetypes.Float64Type{},
+ "slug": basetypes.StringType{},
+ "status": basetypes.StringType{},
+ "type": basetypes.StringType{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "backup_info": backupInfo,
+ "created_at": v.CreatedAt,
+ "description": v.Description,
+ "distribution": v.Distribution,
+ "distribution_info": distributionInfo,
+ "distribution_surcharges": distributionSurcharges,
+ "error_message": v.ErrorMessage,
+ "full_name": v.FullName,
+ "id": v.Id,
+ "min_disk_size": v.MinDiskSize,
+ "min_memory_megabytes": v.MinMemoryMegabytes,
+ "name": v.Name,
+ "public": v.Public,
+ "regions": regionsVal,
+ "size_gigabytes": v.SizeGigabytes,
+ "slug": v.Slug,
+ "status": v.Status,
+ "type": v.ImagesType,
+ })
+
+ return objVal, diags
+}
+
+func (v ImagesValue) Equal(o attr.Value) bool {
+ other, ok := o.(ImagesValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.BackupInfo.Equal(other.BackupInfo) {
+ return false
+ }
+
+ if !v.CreatedAt.Equal(other.CreatedAt) {
+ return false
+ }
+
+ if !v.Description.Equal(other.Description) {
+ return false
+ }
+
+ if !v.Distribution.Equal(other.Distribution) {
+ return false
+ }
+
+ if !v.DistributionInfo.Equal(other.DistributionInfo) {
+ return false
+ }
+
+ if !v.DistributionSurcharges.Equal(other.DistributionSurcharges) {
+ return false
+ }
+
+ if !v.ErrorMessage.Equal(other.ErrorMessage) {
+ return false
+ }
+
+ if !v.FullName.Equal(other.FullName) {
+ return false
+ }
+
+ if !v.Id.Equal(other.Id) {
+ return false
+ }
+
+ if !v.MinDiskSize.Equal(other.MinDiskSize) {
+ return false
+ }
+
+ if !v.MinMemoryMegabytes.Equal(other.MinMemoryMegabytes) {
+ return false
+ }
+
+ if !v.Name.Equal(other.Name) {
+ return false
+ }
+
+ if !v.Public.Equal(other.Public) {
+ return false
+ }
+
+ if !v.Regions.Equal(other.Regions) {
+ return false
+ }
+
+ if !v.SizeGigabytes.Equal(other.SizeGigabytes) {
+ return false
+ }
+
+ if !v.Slug.Equal(other.Slug) {
+ return false
+ }
+
+ if !v.Status.Equal(other.Status) {
+ return false
+ }
+
+ if !v.ImagesType.Equal(other.ImagesType) {
+ return false
+ }
+
+ return true
+}
+
+func (v ImagesValue) Type(ctx context.Context) attr.Type {
+ return ImagesType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v ImagesValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "backup_info": basetypes.ObjectType{
+ AttrTypes: BackupInfoValue{}.AttributeTypes(ctx),
+ },
+ "created_at": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "distribution": basetypes.StringType{},
+ "distribution_info": basetypes.ObjectType{
+ AttrTypes: DistributionInfoValue{}.AttributeTypes(ctx),
+ },
+ "distribution_surcharges": basetypes.ObjectType{
+ AttrTypes: DistributionSurchargesValue{}.AttributeTypes(ctx),
+ },
+ "error_message": basetypes.StringType{},
+ "full_name": basetypes.StringType{},
+ "id": basetypes.Int64Type{},
+ "min_disk_size": basetypes.Int64Type{},
+ "min_memory_megabytes": basetypes.Int64Type{},
+ "name": basetypes.StringType{},
+ "public": basetypes.BoolType{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_gigabytes": basetypes.Float64Type{},
+ "slug": basetypes.StringType{},
+ "status": basetypes.StringType{},
+ "type": basetypes.StringType{},
+ }
+}
+
+var _ basetypes.ObjectTypable = BackupInfoType{}
+
+type BackupInfoType struct {
+ basetypes.ObjectType
+}
+
+func (t BackupInfoType) Equal(o attr.Type) bool {
+ other, ok := o.(BackupInfoType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t BackupInfoType) String() string {
+ return "BackupInfoType"
+}
+
+func (t BackupInfoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ backupDisksAttribute, ok := attributes["backup_disks"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backup_disks is missing from object`)
+
+ return nil, diags
+ }
+
+ backupDisksVal, ok := backupDisksAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backup_disks expected to be basetypes.ListValue, was: %T`, backupDisksAttribute))
+ }
+
+ isoAttribute, ok := attributes["iso"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `iso is missing from object`)
+
+ return nil, diags
+ }
+
+ isoVal, ok := isoAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`iso expected to be basetypes.BoolValue, was: %T`, isoAttribute))
+ }
+
+ lockedAttribute, ok := attributes["locked"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `locked is missing from object`)
+
+ return nil, diags
+ }
+
+ lockedVal, ok := lockedAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`locked expected to be basetypes.BoolValue, was: %T`, lockedAttribute))
+ }
+
+ offsiteAttribute, ok := attributes["offsite"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite is missing from object`)
+
+ return nil, diags
+ }
+
+ offsiteVal, ok := offsiteAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite expected to be basetypes.BoolValue, was: %T`, offsiteAttribute))
+ }
+
+ serverIdAttribute, ok := attributes["server_id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `server_id is missing from object`)
+
+ return nil, diags
+ }
+
+ serverIdVal, ok := serverIdAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`server_id expected to be basetypes.Int64Value, was: %T`, serverIdAttribute))
+ }
+
+ typeAttribute, ok := attributes["type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `type is missing from object`)
+
+ return nil, diags
+ }
+
+ typeVal, ok := typeAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`type expected to be basetypes.StringValue, was: %T`, typeAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return BackupInfoValue{
+ BackupDisks: backupDisksVal,
+ Iso: isoVal,
+ Locked: lockedVal,
+ Offsite: offsiteVal,
+ ServerId: serverIdVal,
+ BackupInfoType: typeVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewBackupInfoValueNull() BackupInfoValue {
+ return BackupInfoValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewBackupInfoValueUnknown() BackupInfoValue {
+ return BackupInfoValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewBackupInfoValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (BackupInfoValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing BackupInfoValue Attribute Value",
+ "While creating a BackupInfoValue value, a missing attribute value was detected. "+
+ "A BackupInfoValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("BackupInfoValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid BackupInfoValue Attribute Type",
+ "While creating a BackupInfoValue value, an invalid attribute value was detected. "+
+ "A BackupInfoValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("BackupInfoValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("BackupInfoValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra BackupInfoValue Attribute Value",
+ "While creating a BackupInfoValue value, an extra attribute value was detected. "+
+ "A BackupInfoValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra BackupInfoValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ backupDisksAttribute, ok := attributes["backup_disks"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backup_disks is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ backupDisksVal, ok := backupDisksAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backup_disks expected to be basetypes.ListValue, was: %T`, backupDisksAttribute))
+ }
+
+ isoAttribute, ok := attributes["iso"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `iso is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ isoVal, ok := isoAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`iso expected to be basetypes.BoolValue, was: %T`, isoAttribute))
+ }
+
+ lockedAttribute, ok := attributes["locked"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `locked is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ lockedVal, ok := lockedAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`locked expected to be basetypes.BoolValue, was: %T`, lockedAttribute))
+ }
+
+ offsiteAttribute, ok := attributes["offsite"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ offsiteVal, ok := offsiteAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite expected to be basetypes.BoolValue, was: %T`, offsiteAttribute))
+ }
+
+ serverIdAttribute, ok := attributes["server_id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `server_id is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ serverIdVal, ok := serverIdAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`server_id expected to be basetypes.Int64Value, was: %T`, serverIdAttribute))
+ }
+
+ typeAttribute, ok := attributes["type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `type is missing from object`)
+
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ typeVal, ok := typeAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`type expected to be basetypes.StringValue, was: %T`, typeAttribute))
+ }
+
+ if diags.HasError() {
+ return NewBackupInfoValueUnknown(), diags
+ }
+
+ return BackupInfoValue{
+ BackupDisks: backupDisksVal,
+ Iso: isoVal,
+ Locked: lockedVal,
+ Offsite: offsiteVal,
+ ServerId: serverIdVal,
+ BackupInfoType: typeVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewBackupInfoValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) BackupInfoValue {
+ object, diags := NewBackupInfoValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewBackupInfoValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t BackupInfoType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewBackupInfoValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewBackupInfoValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewBackupInfoValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewBackupInfoValueMust(BackupInfoValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t BackupInfoType) ValueType(ctx context.Context) attr.Value {
+ return BackupInfoValue{}
+}
+
+var _ basetypes.ObjectValuable = BackupInfoValue{}
+
+type BackupInfoValue struct {
+ BackupDisks basetypes.ListValue `tfsdk:"backup_disks"`
+ Iso basetypes.BoolValue `tfsdk:"iso"`
+ Locked basetypes.BoolValue `tfsdk:"locked"`
+ Offsite basetypes.BoolValue `tfsdk:"offsite"`
+ ServerId basetypes.Int64Value `tfsdk:"server_id"`
+ BackupInfoType basetypes.StringValue `tfsdk:"type"`
+ state attr.ValueState
+}
+
+func (v BackupInfoValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 6)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["backup_disks"] = basetypes.ListType{
+ ElemType: BackupDisksValue{}.Type(ctx),
+ }.TerraformType(ctx)
+ attrTypes["iso"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["locked"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["offsite"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["server_id"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["type"] = basetypes.StringType{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 6)
+
+ val, err = v.BackupDisks.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["backup_disks"] = val
+
+ val, err = v.Iso.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["iso"] = val
+
+ val, err = v.Locked.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["locked"] = val
+
+ val, err = v.Offsite.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["offsite"] = val
+
+ val, err = v.ServerId.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["server_id"] = val
+
+ val, err = v.BackupInfoType.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["type"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v BackupInfoValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v BackupInfoValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v BackupInfoValue) String() string {
+ return "BackupInfoValue"
+}
+
+func (v BackupInfoValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ backupDisks := types.ListValueMust(
+ BackupDisksType{
+ basetypes.ObjectType{
+ AttrTypes: BackupDisksValue{}.AttributeTypes(ctx),
+ },
+ },
+ v.BackupDisks.Elements(),
+ )
+
+ if v.BackupDisks.IsNull() {
+ backupDisks = types.ListNull(
+ BackupDisksType{
+ basetypes.ObjectType{
+ AttrTypes: BackupDisksValue{}.AttributeTypes(ctx),
+ },
+ },
+ )
+ }
+
+ if v.BackupDisks.IsUnknown() {
+ backupDisks = types.ListUnknown(
+ BackupDisksType{
+ basetypes.ObjectType{
+ AttrTypes: BackupDisksValue{}.AttributeTypes(ctx),
+ },
+ },
+ )
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "backup_disks": basetypes.ListType{
+ ElemType: BackupDisksValue{}.Type(ctx),
+ },
+ "iso": basetypes.BoolType{},
+ "locked": basetypes.BoolType{},
+ "offsite": basetypes.BoolType{},
+ "server_id": basetypes.Int64Type{},
+ "type": basetypes.StringType{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "backup_disks": backupDisks,
+ "iso": v.Iso,
+ "locked": v.Locked,
+ "offsite": v.Offsite,
+ "server_id": v.ServerId,
+ "type": v.BackupInfoType,
+ })
+
+ return objVal, diags
+}
+
+func (v BackupInfoValue) Equal(o attr.Value) bool {
+ other, ok := o.(BackupInfoValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.BackupDisks.Equal(other.BackupDisks) {
+ return false
+ }
+
+ if !v.Iso.Equal(other.Iso) {
+ return false
+ }
+
+ if !v.Locked.Equal(other.Locked) {
+ return false
+ }
+
+ if !v.Offsite.Equal(other.Offsite) {
+ return false
+ }
+
+ if !v.ServerId.Equal(other.ServerId) {
+ return false
+ }
+
+ if !v.BackupInfoType.Equal(other.BackupInfoType) {
+ return false
+ }
+
+ return true
+}
+
+func (v BackupInfoValue) Type(ctx context.Context) attr.Type {
+ return BackupInfoType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v BackupInfoValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "backup_disks": basetypes.ListType{
+ ElemType: BackupDisksValue{}.Type(ctx),
+ },
+ "iso": basetypes.BoolType{},
+ "locked": basetypes.BoolType{},
+ "offsite": basetypes.BoolType{},
+ "server_id": basetypes.Int64Type{},
+ "type": basetypes.StringType{},
+ }
+}
+
+var _ basetypes.ObjectTypable = BackupDisksType{}
+
+type BackupDisksType struct {
+ basetypes.ObjectType
+}
+
+func (t BackupDisksType) Equal(o attr.Type) bool {
+ other, ok := o.(BackupDisksType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t BackupDisksType) String() string {
+ return "BackupDisksType"
+}
+
+func (t BackupDisksType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return nil, diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ idAttribute, ok := attributes["id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `id is missing from object`)
+
+ return nil, diags
+ }
+
+ idVal, ok := idAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute))
+ }
+
+ minDiskSizeAttribute, ok := attributes["min_disk_size"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_disk_size is missing from object`)
+
+ return nil, diags
+ }
+
+ minDiskSizeVal, ok := minDiskSizeAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_disk_size expected to be basetypes.Int64Value, was: %T`, minDiskSizeAttribute))
+ }
+
+ sizeGigabytesAttribute, ok := attributes["size_gigabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_gigabytes is missing from object`)
+
+ return nil, diags
+ }
+
+ sizeGigabytesVal, ok := sizeGigabytesAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_gigabytes expected to be basetypes.Float64Value, was: %T`, sizeGigabytesAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return BackupDisksValue{
+ Description: descriptionVal,
+ Id: idVal,
+ MinDiskSize: minDiskSizeVal,
+ SizeGigabytes: sizeGigabytesVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewBackupDisksValueNull() BackupDisksValue {
+ return BackupDisksValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewBackupDisksValueUnknown() BackupDisksValue {
+ return BackupDisksValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewBackupDisksValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (BackupDisksValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing BackupDisksValue Attribute Value",
+ "While creating a BackupDisksValue value, a missing attribute value was detected. "+
+ "A BackupDisksValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("BackupDisksValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid BackupDisksValue Attribute Type",
+ "While creating a BackupDisksValue value, an invalid attribute value was detected. "+
+ "A BackupDisksValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("BackupDisksValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("BackupDisksValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra BackupDisksValue Attribute Value",
+ "While creating a BackupDisksValue value, an extra attribute value was detected. "+
+ "A BackupDisksValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra BackupDisksValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ idAttribute, ok := attributes["id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `id is missing from object`)
+
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ idVal, ok := idAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute))
+ }
+
+ minDiskSizeAttribute, ok := attributes["min_disk_size"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `min_disk_size is missing from object`)
+
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ minDiskSizeVal, ok := minDiskSizeAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`min_disk_size expected to be basetypes.Int64Value, was: %T`, minDiskSizeAttribute))
+ }
+
+ sizeGigabytesAttribute, ok := attributes["size_gigabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_gigabytes is missing from object`)
+
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ sizeGigabytesVal, ok := sizeGigabytesAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_gigabytes expected to be basetypes.Float64Value, was: %T`, sizeGigabytesAttribute))
+ }
+
+ if diags.HasError() {
+ return NewBackupDisksValueUnknown(), diags
+ }
+
+ return BackupDisksValue{
+ Description: descriptionVal,
+ Id: idVal,
+ MinDiskSize: minDiskSizeVal,
+ SizeGigabytes: sizeGigabytesVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewBackupDisksValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) BackupDisksValue {
+ object, diags := NewBackupDisksValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewBackupDisksValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t BackupDisksType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewBackupDisksValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewBackupDisksValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewBackupDisksValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewBackupDisksValueMust(BackupDisksValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t BackupDisksType) ValueType(ctx context.Context) attr.Value {
+ return BackupDisksValue{}
+}
+
+var _ basetypes.ObjectValuable = BackupDisksValue{}
+
+type BackupDisksValue struct {
+ Description basetypes.StringValue `tfsdk:"description"`
+ Id basetypes.Int64Value `tfsdk:"id"`
+ MinDiskSize basetypes.Int64Value `tfsdk:"min_disk_size"`
+ SizeGigabytes basetypes.Float64Value `tfsdk:"size_gigabytes"`
+ state attr.ValueState
+}
+
+func (v BackupDisksValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 4)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["min_disk_size"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["size_gigabytes"] = basetypes.Float64Type{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 4)
+
+ val, err = v.Description.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["description"] = val
+
+ val, err = v.Id.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["id"] = val
+
+ val, err = v.MinDiskSize.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["min_disk_size"] = val
+
+ val, err = v.SizeGigabytes.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["size_gigabytes"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v BackupDisksValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v BackupDisksValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v BackupDisksValue) String() string {
+ return "BackupDisksValue"
+}
+
+func (v BackupDisksValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributeTypes := map[string]attr.Type{
+ "description": basetypes.StringType{},
+ "id": basetypes.Int64Type{},
+ "min_disk_size": basetypes.Int64Type{},
+ "size_gigabytes": basetypes.Float64Type{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "description": v.Description,
+ "id": v.Id,
+ "min_disk_size": v.MinDiskSize,
+ "size_gigabytes": v.SizeGigabytes,
+ })
+
+ return objVal, diags
+}
+
+func (v BackupDisksValue) Equal(o attr.Value) bool {
+ other, ok := o.(BackupDisksValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.Description.Equal(other.Description) {
+ return false
+ }
+
+ if !v.Id.Equal(other.Id) {
+ return false
+ }
+
+ if !v.MinDiskSize.Equal(other.MinDiskSize) {
+ return false
+ }
+
+ if !v.SizeGigabytes.Equal(other.SizeGigabytes) {
+ return false
+ }
+
+ return true
+}
+
+func (v BackupDisksValue) Type(ctx context.Context) attr.Type {
+ return BackupDisksType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v BackupDisksValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "description": basetypes.StringType{},
+ "id": basetypes.Int64Type{},
+ "min_disk_size": basetypes.Int64Type{},
+ "size_gigabytes": basetypes.Float64Type{},
+ }
+}
+
+var _ basetypes.ObjectTypable = DistributionInfoType{}
+
+type DistributionInfoType struct {
+ basetypes.ObjectType
+}
+
+func (t DistributionInfoType) Equal(o attr.Type) bool {
+ other, ok := o.(DistributionInfoType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t DistributionInfoType) String() string {
+ return "DistributionInfoType"
+}
+
+func (t DistributionInfoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ featuresAttribute, ok := attributes["features"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `features is missing from object`)
+
+ return nil, diags
+ }
+
+ featuresVal, ok := featuresAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`features expected to be basetypes.ListValue, was: %T`, featuresAttribute))
+ }
+
+ imageIdAttribute, ok := attributes["image_id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `image_id is missing from object`)
+
+ return nil, diags
+ }
+
+ imageIdVal, ok := imageIdAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`image_id expected to be basetypes.Int64Value, was: %T`, imageIdAttribute))
+ }
+
+ passwordRecoveryAttribute, ok := attributes["password_recovery"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `password_recovery is missing from object`)
+
+ return nil, diags
+ }
+
+ passwordRecoveryVal, ok := passwordRecoveryAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`password_recovery expected to be basetypes.StringValue, was: %T`, passwordRecoveryAttribute))
+ }
+
+ remoteAccessUserAttribute, ok := attributes["remote_access_user"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `remote_access_user is missing from object`)
+
+ return nil, diags
+ }
+
+ remoteAccessUserVal, ok := remoteAccessUserAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`remote_access_user expected to be basetypes.StringValue, was: %T`, remoteAccessUserAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return DistributionInfoValue{
+ Features: featuresVal,
+ ImageId: imageIdVal,
+ PasswordRecovery: passwordRecoveryVal,
+ RemoteAccessUser: remoteAccessUserVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewDistributionInfoValueNull() DistributionInfoValue {
+ return DistributionInfoValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewDistributionInfoValueUnknown() DistributionInfoValue {
+ return DistributionInfoValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewDistributionInfoValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (DistributionInfoValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing DistributionInfoValue Attribute Value",
+ "While creating a DistributionInfoValue value, a missing attribute value was detected. "+
+ "A DistributionInfoValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("DistributionInfoValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid DistributionInfoValue Attribute Type",
+ "While creating a DistributionInfoValue value, an invalid attribute value was detected. "+
+ "A DistributionInfoValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("DistributionInfoValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("DistributionInfoValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra DistributionInfoValue Attribute Value",
+ "While creating a DistributionInfoValue value, an extra attribute value was detected. "+
+ "A DistributionInfoValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra DistributionInfoValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ featuresAttribute, ok := attributes["features"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `features is missing from object`)
+
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ featuresVal, ok := featuresAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`features expected to be basetypes.ListValue, was: %T`, featuresAttribute))
+ }
+
+ imageIdAttribute, ok := attributes["image_id"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `image_id is missing from object`)
+
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ imageIdVal, ok := imageIdAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`image_id expected to be basetypes.Int64Value, was: %T`, imageIdAttribute))
+ }
+
+ passwordRecoveryAttribute, ok := attributes["password_recovery"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `password_recovery is missing from object`)
+
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ passwordRecoveryVal, ok := passwordRecoveryAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`password_recovery expected to be basetypes.StringValue, was: %T`, passwordRecoveryAttribute))
+ }
+
+ remoteAccessUserAttribute, ok := attributes["remote_access_user"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `remote_access_user is missing from object`)
+
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ remoteAccessUserVal, ok := remoteAccessUserAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`remote_access_user expected to be basetypes.StringValue, was: %T`, remoteAccessUserAttribute))
+ }
+
+ if diags.HasError() {
+ return NewDistributionInfoValueUnknown(), diags
+ }
+
+ return DistributionInfoValue{
+ Features: featuresVal,
+ ImageId: imageIdVal,
+ PasswordRecovery: passwordRecoveryVal,
+ RemoteAccessUser: remoteAccessUserVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewDistributionInfoValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) DistributionInfoValue {
+ object, diags := NewDistributionInfoValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewDistributionInfoValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t DistributionInfoType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewDistributionInfoValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewDistributionInfoValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewDistributionInfoValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewDistributionInfoValueMust(DistributionInfoValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t DistributionInfoType) ValueType(ctx context.Context) attr.Value {
+ return DistributionInfoValue{}
+}
+
+var _ basetypes.ObjectValuable = DistributionInfoValue{}
+
+type DistributionInfoValue struct {
+ Features basetypes.ListValue `tfsdk:"features"`
+ ImageId basetypes.Int64Value `tfsdk:"image_id"`
+ PasswordRecovery basetypes.StringValue `tfsdk:"password_recovery"`
+ RemoteAccessUser basetypes.StringValue `tfsdk:"remote_access_user"`
+ state attr.ValueState
+}
+
+func (v DistributionInfoValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 4)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["features"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["image_id"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["password_recovery"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["remote_access_user"] = basetypes.StringType{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 4)
+
+ val, err = v.Features.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["features"] = val
+
+ val, err = v.ImageId.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["image_id"] = val
+
+ val, err = v.PasswordRecovery.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["password_recovery"] = val
+
+ val, err = v.RemoteAccessUser.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["remote_access_user"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v DistributionInfoValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v DistributionInfoValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v DistributionInfoValue) String() string {
+ return "DistributionInfoValue"
+}
+
+func (v DistributionInfoValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ var featuresVal basetypes.ListValue
+ switch {
+ case v.Features.IsUnknown():
+ featuresVal = types.ListUnknown(types.StringType)
+ case v.Features.IsNull():
+ featuresVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ featuresVal, d = types.ListValue(types.StringType, v.Features.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "image_id": basetypes.Int64Type{},
+ "password_recovery": basetypes.StringType{},
+ "remote_access_user": basetypes.StringType{},
+ }), diags
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "image_id": basetypes.Int64Type{},
+ "password_recovery": basetypes.StringType{},
+ "remote_access_user": basetypes.StringType{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "features": featuresVal,
+ "image_id": v.ImageId,
+ "password_recovery": v.PasswordRecovery,
+ "remote_access_user": v.RemoteAccessUser,
+ })
+
+ return objVal, diags
+}
+
+func (v DistributionInfoValue) Equal(o attr.Value) bool {
+ other, ok := o.(DistributionInfoValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.Features.Equal(other.Features) {
+ return false
+ }
+
+ if !v.ImageId.Equal(other.ImageId) {
+ return false
+ }
+
+ if !v.PasswordRecovery.Equal(other.PasswordRecovery) {
+ return false
+ }
+
+ if !v.RemoteAccessUser.Equal(other.RemoteAccessUser) {
+ return false
+ }
+
+ return true
+}
+
+func (v DistributionInfoValue) Type(ctx context.Context) attr.Type {
+ return DistributionInfoType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v DistributionInfoValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "image_id": basetypes.Int64Type{},
+ "password_recovery": basetypes.StringType{},
+ "remote_access_user": basetypes.StringType{},
+ }
+}
+
+var _ basetypes.ObjectTypable = DistributionSurchargesType{}
+
+type DistributionSurchargesType struct {
+ basetypes.ObjectType
+}
+
+func (t DistributionSurchargesType) Equal(o attr.Type) bool {
+ other, ok := o.(DistributionSurchargesType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t DistributionSurchargesType) String() string {
+ return "DistributionSurchargesType"
+}
+
+func (t DistributionSurchargesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ surchargeBaseCostAttribute, ok := attributes["surcharge_base_cost"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_base_cost is missing from object`)
+
+ return nil, diags
+ }
+
+ surchargeBaseCostVal, ok := surchargeBaseCostAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_base_cost expected to be basetypes.Float64Value, was: %T`, surchargeBaseCostAttribute))
+ }
+
+ surchargeMinVcpuAttribute, ok := attributes["surcharge_min_vcpu"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_min_vcpu is missing from object`)
+
+ return nil, diags
+ }
+
+ surchargeMinVcpuVal, ok := surchargeMinVcpuAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_min_vcpu expected to be basetypes.Int64Value, was: %T`, surchargeMinVcpuAttribute))
+ }
+
+ surchargePerMemoryMaxMegabytesAttribute, ok := attributes["surcharge_per_memory_max_megabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_memory_max_megabytes is missing from object`)
+
+ return nil, diags
+ }
+
+ surchargePerMemoryMaxMegabytesVal, ok := surchargePerMemoryMaxMegabytesAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_memory_max_megabytes expected to be basetypes.Int64Value, was: %T`, surchargePerMemoryMaxMegabytesAttribute))
+ }
+
+ surchargePerMemoryMegabyteAttribute, ok := attributes["surcharge_per_memory_megabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_memory_megabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ surchargePerMemoryMegabyteVal, ok := surchargePerMemoryMegabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_memory_megabyte expected to be basetypes.Float64Value, was: %T`, surchargePerMemoryMegabyteAttribute))
+ }
+
+ surchargePerVcpuAttribute, ok := attributes["surcharge_per_vcpu"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_vcpu is missing from object`)
+
+ return nil, diags
+ }
+
+ surchargePerVcpuVal, ok := surchargePerVcpuAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_vcpu expected to be basetypes.Float64Value, was: %T`, surchargePerVcpuAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return DistributionSurchargesValue{
+ SurchargeBaseCost: surchargeBaseCostVal,
+ SurchargeMinVcpu: surchargeMinVcpuVal,
+ SurchargePerMemoryMaxMegabytes: surchargePerMemoryMaxMegabytesVal,
+ SurchargePerMemoryMegabyte: surchargePerMemoryMegabyteVal,
+ SurchargePerVcpu: surchargePerVcpuVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewDistributionSurchargesValueNull() DistributionSurchargesValue {
+ return DistributionSurchargesValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewDistributionSurchargesValueUnknown() DistributionSurchargesValue {
+ return DistributionSurchargesValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewDistributionSurchargesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (DistributionSurchargesValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing DistributionSurchargesValue Attribute Value",
+ "While creating a DistributionSurchargesValue value, a missing attribute value was detected. "+
+ "A DistributionSurchargesValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("DistributionSurchargesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid DistributionSurchargesValue Attribute Type",
+ "While creating a DistributionSurchargesValue value, an invalid attribute value was detected. "+
+ "A DistributionSurchargesValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("DistributionSurchargesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("DistributionSurchargesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra DistributionSurchargesValue Attribute Value",
+ "While creating a DistributionSurchargesValue value, an extra attribute value was detected. "+
+ "A DistributionSurchargesValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra DistributionSurchargesValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargeBaseCostAttribute, ok := attributes["surcharge_base_cost"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_base_cost is missing from object`)
+
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargeBaseCostVal, ok := surchargeBaseCostAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_base_cost expected to be basetypes.Float64Value, was: %T`, surchargeBaseCostAttribute))
+ }
+
+ surchargeMinVcpuAttribute, ok := attributes["surcharge_min_vcpu"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_min_vcpu is missing from object`)
+
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargeMinVcpuVal, ok := surchargeMinVcpuAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_min_vcpu expected to be basetypes.Int64Value, was: %T`, surchargeMinVcpuAttribute))
+ }
+
+ surchargePerMemoryMaxMegabytesAttribute, ok := attributes["surcharge_per_memory_max_megabytes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_memory_max_megabytes is missing from object`)
+
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargePerMemoryMaxMegabytesVal, ok := surchargePerMemoryMaxMegabytesAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_memory_max_megabytes expected to be basetypes.Int64Value, was: %T`, surchargePerMemoryMaxMegabytesAttribute))
+ }
+
+ surchargePerMemoryMegabyteAttribute, ok := attributes["surcharge_per_memory_megabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_memory_megabyte is missing from object`)
+
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargePerMemoryMegabyteVal, ok := surchargePerMemoryMegabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_memory_megabyte expected to be basetypes.Float64Value, was: %T`, surchargePerMemoryMegabyteAttribute))
+ }
+
+ surchargePerVcpuAttribute, ok := attributes["surcharge_per_vcpu"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `surcharge_per_vcpu is missing from object`)
+
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ surchargePerVcpuVal, ok := surchargePerVcpuAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`surcharge_per_vcpu expected to be basetypes.Float64Value, was: %T`, surchargePerVcpuAttribute))
+ }
+
+ if diags.HasError() {
+ return NewDistributionSurchargesValueUnknown(), diags
+ }
+
+ return DistributionSurchargesValue{
+ SurchargeBaseCost: surchargeBaseCostVal,
+ SurchargeMinVcpu: surchargeMinVcpuVal,
+ SurchargePerMemoryMaxMegabytes: surchargePerMemoryMaxMegabytesVal,
+ SurchargePerMemoryMegabyte: surchargePerMemoryMegabyteVal,
+ SurchargePerVcpu: surchargePerVcpuVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewDistributionSurchargesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) DistributionSurchargesValue {
+ object, diags := NewDistributionSurchargesValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewDistributionSurchargesValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t DistributionSurchargesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewDistributionSurchargesValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewDistributionSurchargesValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewDistributionSurchargesValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewDistributionSurchargesValueMust(DistributionSurchargesValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t DistributionSurchargesType) ValueType(ctx context.Context) attr.Value {
+ return DistributionSurchargesValue{}
+}
+
+var _ basetypes.ObjectValuable = DistributionSurchargesValue{}
+
+type DistributionSurchargesValue struct {
+ SurchargeBaseCost basetypes.Float64Value `tfsdk:"surcharge_base_cost"`
+ SurchargeMinVcpu basetypes.Int64Value `tfsdk:"surcharge_min_vcpu"`
+ SurchargePerMemoryMaxMegabytes basetypes.Int64Value `tfsdk:"surcharge_per_memory_max_megabytes"`
+ SurchargePerMemoryMegabyte basetypes.Float64Value `tfsdk:"surcharge_per_memory_megabyte"`
+ SurchargePerVcpu basetypes.Float64Value `tfsdk:"surcharge_per_vcpu"`
+ state attr.ValueState
+}
+
+func (v DistributionSurchargesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 5)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["surcharge_base_cost"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["surcharge_min_vcpu"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["surcharge_per_memory_max_megabytes"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["surcharge_per_memory_megabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["surcharge_per_vcpu"] = basetypes.Float64Type{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 5)
+
+ val, err = v.SurchargeBaseCost.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["surcharge_base_cost"] = val
+
+ val, err = v.SurchargeMinVcpu.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["surcharge_min_vcpu"] = val
+
+ val, err = v.SurchargePerMemoryMaxMegabytes.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["surcharge_per_memory_max_megabytes"] = val
+
+ val, err = v.SurchargePerMemoryMegabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["surcharge_per_memory_megabyte"] = val
+
+ val, err = v.SurchargePerVcpu.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["surcharge_per_vcpu"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v DistributionSurchargesValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v DistributionSurchargesValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v DistributionSurchargesValue) String() string {
+ return "DistributionSurchargesValue"
+}
+
+func (v DistributionSurchargesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributeTypes := map[string]attr.Type{
+ "surcharge_base_cost": basetypes.Float64Type{},
+ "surcharge_min_vcpu": basetypes.Int64Type{},
+ "surcharge_per_memory_max_megabytes": basetypes.Int64Type{},
+ "surcharge_per_memory_megabyte": basetypes.Float64Type{},
+ "surcharge_per_vcpu": basetypes.Float64Type{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "surcharge_base_cost": v.SurchargeBaseCost,
+ "surcharge_min_vcpu": v.SurchargeMinVcpu,
+ "surcharge_per_memory_max_megabytes": v.SurchargePerMemoryMaxMegabytes,
+ "surcharge_per_memory_megabyte": v.SurchargePerMemoryMegabyte,
+ "surcharge_per_vcpu": v.SurchargePerVcpu,
+ })
+
+ return objVal, diags
+}
+
+func (v DistributionSurchargesValue) Equal(o attr.Value) bool {
+ other, ok := o.(DistributionSurchargesValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.SurchargeBaseCost.Equal(other.SurchargeBaseCost) {
+ return false
+ }
+
+ if !v.SurchargeMinVcpu.Equal(other.SurchargeMinVcpu) {
+ return false
+ }
+
+ if !v.SurchargePerMemoryMaxMegabytes.Equal(other.SurchargePerMemoryMaxMegabytes) {
+ return false
+ }
+
+ if !v.SurchargePerMemoryMegabyte.Equal(other.SurchargePerMemoryMegabyte) {
+ return false
+ }
+
+ if !v.SurchargePerVcpu.Equal(other.SurchargePerVcpu) {
+ return false
+ }
+
+ return true
+}
+
+func (v DistributionSurchargesValue) Type(ctx context.Context) attr.Type {
+ return DistributionSurchargesType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v DistributionSurchargesValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "surcharge_base_cost": basetypes.Float64Type{},
+ "surcharge_min_vcpu": basetypes.Int64Type{},
+ "surcharge_per_memory_max_megabytes": basetypes.Int64Type{},
+ "surcharge_per_memory_megabyte": basetypes.Float64Type{},
+ "surcharge_per_vcpu": basetypes.Float64Type{},
+ }
+}
diff --git a/internal/data_sources/regions_data_source_gen.go b/internal/data_sources/regions_data_source_gen.go
new file mode 100644
index 0000000..34fbffd
--- /dev/null
+++ b/internal/data_sources/regions_data_source_gen.go
@@ -0,0 +1,776 @@
+// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
+
+package data_sources
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-framework/attr"
+ "github.com/hashicorp/terraform-plugin-framework/diag"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-framework/types/basetypes"
+ "github.com/hashicorp/terraform-plugin-go/tftypes"
+ "strings"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+)
+
+func RegionsDataSourceSchema(ctx context.Context) schema.Schema {
+ return schema.Schema{
+ Attributes: map[string]schema.Attribute{
+ "regions": schema.ListNestedAttribute{
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "available": schema.BoolAttribute{
+ Computed: true,
+ Description: "Whether this region is available for the allocation of new resources.",
+ MarkdownDescription: "Whether this region is available for the allocation of new resources.",
+ },
+ "features": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "A list of features available for resources in this region.",
+ MarkdownDescription: "A list of features available for resources in this region.",
+ },
+ "name": schema.StringAttribute{
+ Computed: true,
+ Description: "The name of this region.",
+ MarkdownDescription: "The name of this region.",
+ },
+ "name_servers": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "A list of nameservers available for resources in this region.",
+ MarkdownDescription: "A list of nameservers available for resources in this region.",
+ },
+ "sizes": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "The slugs of the sizes available in this region.",
+ MarkdownDescription: "The slugs of the sizes available in this region.",
+ },
+ "slug": schema.StringAttribute{
+ Computed: true,
+ Description: "The unique slug for this region.",
+ MarkdownDescription: "The unique slug for this region.",
+ },
+ },
+ CustomType: RegionsType{
+ ObjectType: types.ObjectType{
+ AttrTypes: RegionsValue{}.AttributeTypes(ctx),
+ },
+ },
+ },
+ Computed: true,
+ },
+ },
+ }
+}
+
+type RegionsModel struct {
+ Regions types.List `tfsdk:"regions"`
+}
+
+var _ basetypes.ObjectTypable = RegionsType{}
+
+type RegionsType struct {
+ basetypes.ObjectType
+}
+
+func (t RegionsType) Equal(o attr.Type) bool {
+ other, ok := o.(RegionsType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t RegionsType) String() string {
+ return "RegionsType"
+}
+
+func (t RegionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ availableAttribute, ok := attributes["available"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `available is missing from object`)
+
+ return nil, diags
+ }
+
+ availableVal, ok := availableAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`available expected to be basetypes.BoolValue, was: %T`, availableAttribute))
+ }
+
+ featuresAttribute, ok := attributes["features"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `features is missing from object`)
+
+ return nil, diags
+ }
+
+ featuresVal, ok := featuresAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`features expected to be basetypes.ListValue, was: %T`, featuresAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return nil, diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ nameServersAttribute, ok := attributes["name_servers"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name_servers is missing from object`)
+
+ return nil, diags
+ }
+
+ nameServersVal, ok := nameServersAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name_servers expected to be basetypes.ListValue, was: %T`, nameServersAttribute))
+ }
+
+ sizesAttribute, ok := attributes["sizes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `sizes is missing from object`)
+
+ return nil, diags
+ }
+
+ sizesVal, ok := sizesAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`sizes expected to be basetypes.ListValue, was: %T`, sizesAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return nil, diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return RegionsValue{
+ Available: availableVal,
+ Features: featuresVal,
+ Name: nameVal,
+ NameServers: nameServersVal,
+ Sizes: sizesVal,
+ Slug: slugVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewRegionsValueNull() RegionsValue {
+ return RegionsValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewRegionsValueUnknown() RegionsValue {
+ return RegionsValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewRegionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (RegionsValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing RegionsValue Attribute Value",
+ "While creating a RegionsValue value, a missing attribute value was detected. "+
+ "A RegionsValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("RegionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid RegionsValue Attribute Type",
+ "While creating a RegionsValue value, an invalid attribute value was detected. "+
+ "A RegionsValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("RegionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("RegionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra RegionsValue Attribute Value",
+ "While creating a RegionsValue value, an extra attribute value was detected. "+
+ "A RegionsValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra RegionsValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewRegionsValueUnknown(), diags
+ }
+
+ availableAttribute, ok := attributes["available"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `available is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ availableVal, ok := availableAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`available expected to be basetypes.BoolValue, was: %T`, availableAttribute))
+ }
+
+ featuresAttribute, ok := attributes["features"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `features is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ featuresVal, ok := featuresAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`features expected to be basetypes.ListValue, was: %T`, featuresAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ nameServersAttribute, ok := attributes["name_servers"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name_servers is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ nameServersVal, ok := nameServersAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name_servers expected to be basetypes.ListValue, was: %T`, nameServersAttribute))
+ }
+
+ sizesAttribute, ok := attributes["sizes"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `sizes is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ sizesVal, ok := sizesAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`sizes expected to be basetypes.ListValue, was: %T`, sizesAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return NewRegionsValueUnknown(), diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ if diags.HasError() {
+ return NewRegionsValueUnknown(), diags
+ }
+
+ return RegionsValue{
+ Available: availableVal,
+ Features: featuresVal,
+ Name: nameVal,
+ NameServers: nameServersVal,
+ Sizes: sizesVal,
+ Slug: slugVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewRegionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) RegionsValue {
+ object, diags := NewRegionsValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewRegionsValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t RegionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewRegionsValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewRegionsValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewRegionsValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewRegionsValueMust(RegionsValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t RegionsType) ValueType(ctx context.Context) attr.Value {
+ return RegionsValue{}
+}
+
+var _ basetypes.ObjectValuable = RegionsValue{}
+
+type RegionsValue struct {
+ Available basetypes.BoolValue `tfsdk:"available"`
+ Features basetypes.ListValue `tfsdk:"features"`
+ Name basetypes.StringValue `tfsdk:"name"`
+ NameServers basetypes.ListValue `tfsdk:"name_servers"`
+ Sizes basetypes.ListValue `tfsdk:"sizes"`
+ Slug basetypes.StringValue `tfsdk:"slug"`
+ state attr.ValueState
+}
+
+func (v RegionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 6)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["available"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["features"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["name_servers"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["sizes"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["slug"] = basetypes.StringType{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 6)
+
+ val, err = v.Available.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["available"] = val
+
+ val, err = v.Features.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["features"] = val
+
+ val, err = v.Name.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["name"] = val
+
+ val, err = v.NameServers.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["name_servers"] = val
+
+ val, err = v.Sizes.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["sizes"] = val
+
+ val, err = v.Slug.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["slug"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v RegionsValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v RegionsValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v RegionsValue) String() string {
+ return "RegionsValue"
+}
+
+func (v RegionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ var featuresVal basetypes.ListValue
+ switch {
+ case v.Features.IsUnknown():
+ featuresVal = types.ListUnknown(types.StringType)
+ case v.Features.IsNull():
+ featuresVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ featuresVal, d = types.ListValue(types.StringType, v.Features.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "name": basetypes.StringType{},
+ "name_servers": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "sizes": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "slug": basetypes.StringType{},
+ }), diags
+ }
+
+ var nameServersVal basetypes.ListValue
+ switch {
+ case v.NameServers.IsUnknown():
+ nameServersVal = types.ListUnknown(types.StringType)
+ case v.NameServers.IsNull():
+ nameServersVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ nameServersVal, d = types.ListValue(types.StringType, v.NameServers.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "name": basetypes.StringType{},
+ "name_servers": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "sizes": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "slug": basetypes.StringType{},
+ }), diags
+ }
+
+ var sizesVal basetypes.ListValue
+ switch {
+ case v.Sizes.IsUnknown():
+ sizesVal = types.ListUnknown(types.StringType)
+ case v.Sizes.IsNull():
+ sizesVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ sizesVal, d = types.ListValue(types.StringType, v.Sizes.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "name": basetypes.StringType{},
+ "name_servers": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "sizes": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "slug": basetypes.StringType{},
+ }), diags
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "name": basetypes.StringType{},
+ "name_servers": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "sizes": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "slug": basetypes.StringType{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "available": v.Available,
+ "features": featuresVal,
+ "name": v.Name,
+ "name_servers": nameServersVal,
+ "sizes": sizesVal,
+ "slug": v.Slug,
+ })
+
+ return objVal, diags
+}
+
+func (v RegionsValue) Equal(o attr.Value) bool {
+ other, ok := o.(RegionsValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.Available.Equal(other.Available) {
+ return false
+ }
+
+ if !v.Features.Equal(other.Features) {
+ return false
+ }
+
+ if !v.Name.Equal(other.Name) {
+ return false
+ }
+
+ if !v.NameServers.Equal(other.NameServers) {
+ return false
+ }
+
+ if !v.Sizes.Equal(other.Sizes) {
+ return false
+ }
+
+ if !v.Slug.Equal(other.Slug) {
+ return false
+ }
+
+ return true
+}
+
+func (v RegionsValue) Type(ctx context.Context) attr.Type {
+ return RegionsType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v RegionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "features": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "name": basetypes.StringType{},
+ "name_servers": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "sizes": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "slug": basetypes.StringType{},
+ }
+}
diff --git a/internal/data_sources/sizes_data_source_gen.go b/internal/data_sources/sizes_data_source_gen.go
new file mode 100644
index 0000000..e3ceaac
--- /dev/null
+++ b/internal/data_sources/sizes_data_source_gen.go
@@ -0,0 +1,3774 @@
+// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
+
+package data_sources
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-framework/attr"
+ "github.com/hashicorp/terraform-plugin-framework/diag"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-framework/types/basetypes"
+ "github.com/hashicorp/terraform-plugin-go/tftypes"
+ "strings"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+)
+
+func SizesDataSourceSchema(ctx context.Context) schema.Schema {
+ return schema.Schema{
+ Attributes: map[string]schema.Attribute{
+ "image": schema.StringAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects.",
+ MarkdownDescription: "If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects.",
+ },
+ "server_id": schema.Int64Attribute{
+ Optional: true,
+ Computed: true,
+ Description: "If supplied only sizes available for a resize the specified server will be returned. This parameter is only available when authenticated.",
+ MarkdownDescription: "If supplied only sizes available for a resize the specified server will be returned. This parameter is only available when authenticated.",
+ },
+ "sizes": schema.ListNestedAttribute{
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "available": schema.BoolAttribute{
+ Computed: true,
+ Description: "If this is false the size is not available for new servers.",
+ MarkdownDescription: "If this is false the size is not available for new servers.",
+ },
+ "cpu_description": schema.StringAttribute{
+ Computed: true,
+ Description: "A description of the CPU provided in this size.",
+ MarkdownDescription: "A description of the CPU provided in this size.",
+ },
+ "description": schema.StringAttribute{
+ Computed: true,
+ Description: "A description of this size.",
+ MarkdownDescription: "A description of this size.",
+ },
+ "disk": schema.Int64Attribute{
+ Computed: true,
+ Description: "The included storage for this size in GB.",
+ MarkdownDescription: "The included storage for this size in GB.",
+ },
+ "excess_transfer_cost_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The excess charged for any transfer above the included data transfer in AU$ per GB.",
+ MarkdownDescription: "The excess charged for any transfer above the included data transfer in AU$ per GB.",
+ },
+ "memory": schema.Int64Attribute{
+ Computed: true,
+ Description: "The included memory for this size in MB.",
+ MarkdownDescription: "The included memory for this size in MB.",
+ },
+ "options": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "backups_cost_per_backup_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ MarkdownDescription: "The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ },
+ "daily_backups": schema.Int64Attribute{
+ Computed: true,
+ Description: "The number of daily backups included in the base size cost.",
+ MarkdownDescription: "The number of daily backups included in the base size cost.",
+ },
+ "discount_for_no_public_ipv4": schema.Float64Attribute{
+ Computed: true,
+ Description: "This is the discount (if any) that is applied if no public IPv4 addresses are selected.",
+ MarkdownDescription: "This is the discount (if any) that is applied if no public IPv4 addresses are selected.",
+ },
+ "disk_cost_per_additional_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB per month for additional storage space.",
+ MarkdownDescription: "The additional cost per GB per month for additional storage space.",
+ },
+ "disk_max": schema.Int64Attribute{
+ Computed: true,
+ Description: "The maximum storage in GB permitted on this size.",
+ MarkdownDescription: "The maximum storage in GB permitted on this size.",
+ },
+ "disk_min": schema.Int64Attribute{
+ Computed: true,
+ Description: "The minimum storage in GB permitted on this size.",
+ MarkdownDescription: "The minimum storage in GB permitted on this size.",
+ },
+ "ipv4_addresses_cost_per_address": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per public IPv4 address per month for additional IPv4 addresses.",
+ MarkdownDescription: "The additional cost per public IPv4 address per month for additional IPv4 addresses.",
+ },
+ "ipv4_addresses_max": schema.Int64Attribute{
+ Computed: true,
+ Description: "The maximum number of IPv4 addresses permitted on this size.",
+ MarkdownDescription: "The maximum number of IPv4 addresses permitted on this size.",
+ },
+ "memory_cost_per_additional_megabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per MB per month for additional memory.",
+ MarkdownDescription: "The additional cost per MB per month for additional memory.",
+ },
+ "memory_max": schema.Int64Attribute{
+ Computed: true,
+ Description: "The maximum memory in MB permitted on this size.",
+ MarkdownDescription: "The maximum memory in MB permitted on this size.",
+ },
+ "monthly_backups": schema.Int64Attribute{
+ Computed: true,
+ Description: "The number of monthly backups included in the base size cost.",
+ MarkdownDescription: "The number of monthly backups included in the base size cost.",
+ },
+ "offsite_backup_frequency_cost": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "daily_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ MarkdownDescription: "The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ },
+ "monthly_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ MarkdownDescription: "The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ },
+ "weekly_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ MarkdownDescription: "The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ },
+ },
+ CustomType: OffsiteBackupFrequencyCostType{
+ ObjectType: types.ObjectType{
+ AttrTypes: OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$.",
+ MarkdownDescription: "The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$.",
+ },
+ "offsite_backups_cost_per_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ MarkdownDescription: "The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected.",
+ },
+ "restricted_disk_values": schema.ListAttribute{
+ ElementType: types.Int64Type,
+ Computed: true,
+ Description: "If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted.",
+ MarkdownDescription: "If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted.",
+ },
+ "transfer_cost_per_additional_gigabyte": schema.Float64Attribute{
+ Computed: true,
+ Description: "The additional cost per GB per month for additional included transfer.",
+ MarkdownDescription: "The additional cost per GB per month for additional included transfer.",
+ },
+ "transfer_max": schema.Float64Attribute{
+ Computed: true,
+ Description: "The maximum transfer in TB permitted for this size.",
+ MarkdownDescription: "The maximum transfer in TB permitted for this size.",
+ },
+ "weekly_backups": schema.Int64Attribute{
+ Computed: true,
+ Description: "The number of weekly backups included in the base size cost.",
+ MarkdownDescription: "The number of weekly backups included in the base size cost.",
+ },
+ },
+ CustomType: OptionsType{
+ ObjectType: types.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated).",
+ MarkdownDescription: "Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated).",
+ },
+ "price_hourly": schema.Float64Attribute{
+ Computed: true,
+ Description: "Hourly price in AU$.",
+ MarkdownDescription: "Hourly price in AU$.",
+ },
+ "price_monthly": schema.Float64Attribute{
+ Computed: true,
+ Description: "Monthly Price in AU$.",
+ MarkdownDescription: "Monthly Price in AU$.",
+ },
+ "regions": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "A list of region slugs where this size is available regardless of stock.\nIf this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,\notherwise not all regions listed will support all operating systems on this size.",
+ MarkdownDescription: "A list of region slugs where this size is available regardless of stock.\nIf this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,\notherwise not all regions listed will support all operating systems on this size.",
+ },
+ "regions_out_of_stock": schema.ListAttribute{
+ ElementType: types.StringType,
+ Computed: true,
+ Description: "A list of region slugs where the size is normally available but is currently not available due to lack of stock.",
+ MarkdownDescription: "A list of region slugs where the size is normally available but is currently not available due to lack of stock.",
+ },
+ "size_type": schema.SingleNestedAttribute{
+ Attributes: map[string]schema.Attribute{
+ "description": schema.StringAttribute{
+ Computed: true,
+ Description: "The description of this size type, generally used to indicate the intended use case for sizes of this type.",
+ MarkdownDescription: "The description of this size type, generally used to indicate the intended use case for sizes of this type.",
+ },
+ "name": schema.StringAttribute{
+ Computed: true,
+ Description: "The name of this size type.",
+ MarkdownDescription: "The name of this size type.",
+ },
+ "slug": schema.StringAttribute{
+ Computed: true,
+ Description: "The slug of this size type.",
+ MarkdownDescription: "The slug of this size type.",
+ },
+ },
+ CustomType: SizeTypeType{
+ ObjectType: types.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ },
+ },
+ Computed: true,
+ Description: "The type of this size, generally used to differentiate sizes optimized for different usages.",
+ MarkdownDescription: "The type of this size, generally used to differentiate sizes optimized for different usages.",
+ },
+ "slug": schema.StringAttribute{
+ Computed: true,
+ Description: "The slug of this size.",
+ MarkdownDescription: "The slug of this size.",
+ },
+ "storage_description": schema.StringAttribute{
+ Computed: true,
+ Description: "A description of the storage provided in this size.",
+ MarkdownDescription: "A description of the storage provided in this size.",
+ },
+ "transfer": schema.Float64Attribute{
+ Computed: true,
+ Description: "The included data transfer for this size in TB.",
+ MarkdownDescription: "The included data transfer for this size in TB.",
+ },
+ "vcpu_units": schema.StringAttribute{
+ Computed: true,
+ Description: "This is the unit that the vcpus field counts, e.g. \"core\" or \"thread\".",
+ MarkdownDescription: "This is the unit that the vcpus field counts, e.g. \"core\" or \"thread\".",
+ },
+ "vcpus": schema.Int64Attribute{
+ Computed: true,
+ Description: "The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware.",
+ MarkdownDescription: "The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware.",
+ },
+ },
+ CustomType: SizesType{
+ ObjectType: types.ObjectType{
+ AttrTypes: SizesValue{}.AttributeTypes(ctx),
+ },
+ },
+ },
+ Computed: true,
+ },
+ },
+ }
+}
+
+type SizesModel struct {
+ Image types.String `tfsdk:"image"`
+ ServerId types.Int64 `tfsdk:"server_id"`
+ Sizes types.List `tfsdk:"sizes"`
+}
+
+var _ basetypes.ObjectTypable = SizesType{}
+
+type SizesType struct {
+ basetypes.ObjectType
+}
+
+func (t SizesType) Equal(o attr.Type) bool {
+ other, ok := o.(SizesType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t SizesType) String() string {
+ return "SizesType"
+}
+
+func (t SizesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ availableAttribute, ok := attributes["available"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `available is missing from object`)
+
+ return nil, diags
+ }
+
+ availableVal, ok := availableAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`available expected to be basetypes.BoolValue, was: %T`, availableAttribute))
+ }
+
+ cpuDescriptionAttribute, ok := attributes["cpu_description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `cpu_description is missing from object`)
+
+ return nil, diags
+ }
+
+ cpuDescriptionVal, ok := cpuDescriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`cpu_description expected to be basetypes.StringValue, was: %T`, cpuDescriptionAttribute))
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return nil, diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ diskAttribute, ok := attributes["disk"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk is missing from object`)
+
+ return nil, diags
+ }
+
+ diskVal, ok := diskAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk expected to be basetypes.Int64Value, was: %T`, diskAttribute))
+ }
+
+ excessTransferCostPerGigabyteAttribute, ok := attributes["excess_transfer_cost_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `excess_transfer_cost_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ excessTransferCostPerGigabyteVal, ok := excessTransferCostPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`excess_transfer_cost_per_gigabyte expected to be basetypes.Float64Value, was: %T`, excessTransferCostPerGigabyteAttribute))
+ }
+
+ memoryAttribute, ok := attributes["memory"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory is missing from object`)
+
+ return nil, diags
+ }
+
+ memoryVal, ok := memoryAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute))
+ }
+
+ optionsAttribute, ok := attributes["options"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `options is missing from object`)
+
+ return nil, diags
+ }
+
+ optionsVal, ok := optionsAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`options expected to be basetypes.ObjectValue, was: %T`, optionsAttribute))
+ }
+
+ priceHourlyAttribute, ok := attributes["price_hourly"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `price_hourly is missing from object`)
+
+ return nil, diags
+ }
+
+ priceHourlyVal, ok := priceHourlyAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`price_hourly expected to be basetypes.Float64Value, was: %T`, priceHourlyAttribute))
+ }
+
+ priceMonthlyAttribute, ok := attributes["price_monthly"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `price_monthly is missing from object`)
+
+ return nil, diags
+ }
+
+ priceMonthlyVal, ok := priceMonthlyAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`price_monthly expected to be basetypes.Float64Value, was: %T`, priceMonthlyAttribute))
+ }
+
+ regionsAttribute, ok := attributes["regions"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions is missing from object`)
+
+ return nil, diags
+ }
+
+ regionsVal, ok := regionsAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions expected to be basetypes.ListValue, was: %T`, regionsAttribute))
+ }
+
+ regionsOutOfStockAttribute, ok := attributes["regions_out_of_stock"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions_out_of_stock is missing from object`)
+
+ return nil, diags
+ }
+
+ regionsOutOfStockVal, ok := regionsOutOfStockAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions_out_of_stock expected to be basetypes.ListValue, was: %T`, regionsOutOfStockAttribute))
+ }
+
+ sizeTypeAttribute, ok := attributes["size_type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_type is missing from object`)
+
+ return nil, diags
+ }
+
+ sizeTypeVal, ok := sizeTypeAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_type expected to be basetypes.ObjectValue, was: %T`, sizeTypeAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return nil, diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ storageDescriptionAttribute, ok := attributes["storage_description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `storage_description is missing from object`)
+
+ return nil, diags
+ }
+
+ storageDescriptionVal, ok := storageDescriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`storage_description expected to be basetypes.StringValue, was: %T`, storageDescriptionAttribute))
+ }
+
+ transferAttribute, ok := attributes["transfer"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer is missing from object`)
+
+ return nil, diags
+ }
+
+ transferVal, ok := transferAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer expected to be basetypes.Float64Value, was: %T`, transferAttribute))
+ }
+
+ vcpuUnitsAttribute, ok := attributes["vcpu_units"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `vcpu_units is missing from object`)
+
+ return nil, diags
+ }
+
+ vcpuUnitsVal, ok := vcpuUnitsAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`vcpu_units expected to be basetypes.StringValue, was: %T`, vcpuUnitsAttribute))
+ }
+
+ vcpusAttribute, ok := attributes["vcpus"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `vcpus is missing from object`)
+
+ return nil, diags
+ }
+
+ vcpusVal, ok := vcpusAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`vcpus expected to be basetypes.Int64Value, was: %T`, vcpusAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return SizesValue{
+ Available: availableVal,
+ CpuDescription: cpuDescriptionVal,
+ Description: descriptionVal,
+ Disk: diskVal,
+ ExcessTransferCostPerGigabyte: excessTransferCostPerGigabyteVal,
+ Memory: memoryVal,
+ Options: optionsVal,
+ PriceHourly: priceHourlyVal,
+ PriceMonthly: priceMonthlyVal,
+ Regions: regionsVal,
+ RegionsOutOfStock: regionsOutOfStockVal,
+ SizeType: sizeTypeVal,
+ Slug: slugVal,
+ StorageDescription: storageDescriptionVal,
+ Transfer: transferVal,
+ VcpuUnits: vcpuUnitsVal,
+ Vcpus: vcpusVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewSizesValueNull() SizesValue {
+ return SizesValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewSizesValueUnknown() SizesValue {
+ return SizesValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewSizesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (SizesValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing SizesValue Attribute Value",
+ "While creating a SizesValue value, a missing attribute value was detected. "+
+ "A SizesValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("SizesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid SizesValue Attribute Type",
+ "While creating a SizesValue value, an invalid attribute value was detected. "+
+ "A SizesValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("SizesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("SizesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra SizesValue Attribute Value",
+ "While creating a SizesValue value, an extra attribute value was detected. "+
+ "A SizesValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra SizesValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewSizesValueUnknown(), diags
+ }
+
+ availableAttribute, ok := attributes["available"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `available is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ availableVal, ok := availableAttribute.(basetypes.BoolValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`available expected to be basetypes.BoolValue, was: %T`, availableAttribute))
+ }
+
+ cpuDescriptionAttribute, ok := attributes["cpu_description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `cpu_description is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ cpuDescriptionVal, ok := cpuDescriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`cpu_description expected to be basetypes.StringValue, was: %T`, cpuDescriptionAttribute))
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ diskAttribute, ok := attributes["disk"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ diskVal, ok := diskAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk expected to be basetypes.Int64Value, was: %T`, diskAttribute))
+ }
+
+ excessTransferCostPerGigabyteAttribute, ok := attributes["excess_transfer_cost_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `excess_transfer_cost_per_gigabyte is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ excessTransferCostPerGigabyteVal, ok := excessTransferCostPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`excess_transfer_cost_per_gigabyte expected to be basetypes.Float64Value, was: %T`, excessTransferCostPerGigabyteAttribute))
+ }
+
+ memoryAttribute, ok := attributes["memory"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ memoryVal, ok := memoryAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute))
+ }
+
+ optionsAttribute, ok := attributes["options"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `options is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ optionsVal, ok := optionsAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`options expected to be basetypes.ObjectValue, was: %T`, optionsAttribute))
+ }
+
+ priceHourlyAttribute, ok := attributes["price_hourly"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `price_hourly is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ priceHourlyVal, ok := priceHourlyAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`price_hourly expected to be basetypes.Float64Value, was: %T`, priceHourlyAttribute))
+ }
+
+ priceMonthlyAttribute, ok := attributes["price_monthly"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `price_monthly is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ priceMonthlyVal, ok := priceMonthlyAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`price_monthly expected to be basetypes.Float64Value, was: %T`, priceMonthlyAttribute))
+ }
+
+ regionsAttribute, ok := attributes["regions"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ regionsVal, ok := regionsAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions expected to be basetypes.ListValue, was: %T`, regionsAttribute))
+ }
+
+ regionsOutOfStockAttribute, ok := attributes["regions_out_of_stock"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `regions_out_of_stock is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ regionsOutOfStockVal, ok := regionsOutOfStockAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`regions_out_of_stock expected to be basetypes.ListValue, was: %T`, regionsOutOfStockAttribute))
+ }
+
+ sizeTypeAttribute, ok := attributes["size_type"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `size_type is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ sizeTypeVal, ok := sizeTypeAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`size_type expected to be basetypes.ObjectValue, was: %T`, sizeTypeAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ storageDescriptionAttribute, ok := attributes["storage_description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `storage_description is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ storageDescriptionVal, ok := storageDescriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`storage_description expected to be basetypes.StringValue, was: %T`, storageDescriptionAttribute))
+ }
+
+ transferAttribute, ok := attributes["transfer"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ transferVal, ok := transferAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer expected to be basetypes.Float64Value, was: %T`, transferAttribute))
+ }
+
+ vcpuUnitsAttribute, ok := attributes["vcpu_units"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `vcpu_units is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ vcpuUnitsVal, ok := vcpuUnitsAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`vcpu_units expected to be basetypes.StringValue, was: %T`, vcpuUnitsAttribute))
+ }
+
+ vcpusAttribute, ok := attributes["vcpus"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `vcpus is missing from object`)
+
+ return NewSizesValueUnknown(), diags
+ }
+
+ vcpusVal, ok := vcpusAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`vcpus expected to be basetypes.Int64Value, was: %T`, vcpusAttribute))
+ }
+
+ if diags.HasError() {
+ return NewSizesValueUnknown(), diags
+ }
+
+ return SizesValue{
+ Available: availableVal,
+ CpuDescription: cpuDescriptionVal,
+ Description: descriptionVal,
+ Disk: diskVal,
+ ExcessTransferCostPerGigabyte: excessTransferCostPerGigabyteVal,
+ Memory: memoryVal,
+ Options: optionsVal,
+ PriceHourly: priceHourlyVal,
+ PriceMonthly: priceMonthlyVal,
+ Regions: regionsVal,
+ RegionsOutOfStock: regionsOutOfStockVal,
+ SizeType: sizeTypeVal,
+ Slug: slugVal,
+ StorageDescription: storageDescriptionVal,
+ Transfer: transferVal,
+ VcpuUnits: vcpuUnitsVal,
+ Vcpus: vcpusVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewSizesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) SizesValue {
+ object, diags := NewSizesValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewSizesValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t SizesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewSizesValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewSizesValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewSizesValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewSizesValueMust(SizesValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t SizesType) ValueType(ctx context.Context) attr.Value {
+ return SizesValue{}
+}
+
+var _ basetypes.ObjectValuable = SizesValue{}
+
+type SizesValue struct {
+ Available basetypes.BoolValue `tfsdk:"available"`
+ CpuDescription basetypes.StringValue `tfsdk:"cpu_description"`
+ Description basetypes.StringValue `tfsdk:"description"`
+ Disk basetypes.Int64Value `tfsdk:"disk"`
+ ExcessTransferCostPerGigabyte basetypes.Float64Value `tfsdk:"excess_transfer_cost_per_gigabyte"`
+ Memory basetypes.Int64Value `tfsdk:"memory"`
+ Options basetypes.ObjectValue `tfsdk:"options"`
+ PriceHourly basetypes.Float64Value `tfsdk:"price_hourly"`
+ PriceMonthly basetypes.Float64Value `tfsdk:"price_monthly"`
+ Regions basetypes.ListValue `tfsdk:"regions"`
+ RegionsOutOfStock basetypes.ListValue `tfsdk:"regions_out_of_stock"`
+ SizeType basetypes.ObjectValue `tfsdk:"size_type"`
+ Slug basetypes.StringValue `tfsdk:"slug"`
+ StorageDescription basetypes.StringValue `tfsdk:"storage_description"`
+ Transfer basetypes.Float64Value `tfsdk:"transfer"`
+ VcpuUnits basetypes.StringValue `tfsdk:"vcpu_units"`
+ Vcpus basetypes.Int64Value `tfsdk:"vcpus"`
+ state attr.ValueState
+}
+
+func (v SizesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 17)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["available"] = basetypes.BoolType{}.TerraformType(ctx)
+ attrTypes["cpu_description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["disk"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["excess_transfer_cost_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["memory"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["options"] = basetypes.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["price_hourly"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["price_monthly"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["regions"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["regions_out_of_stock"] = basetypes.ListType{
+ ElemType: types.StringType,
+ }.TerraformType(ctx)
+ attrTypes["size_type"] = basetypes.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["slug"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["storage_description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["transfer"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["vcpu_units"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["vcpus"] = basetypes.Int64Type{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 17)
+
+ val, err = v.Available.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["available"] = val
+
+ val, err = v.CpuDescription.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["cpu_description"] = val
+
+ val, err = v.Description.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["description"] = val
+
+ val, err = v.Disk.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["disk"] = val
+
+ val, err = v.ExcessTransferCostPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["excess_transfer_cost_per_gigabyte"] = val
+
+ val, err = v.Memory.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["memory"] = val
+
+ val, err = v.Options.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["options"] = val
+
+ val, err = v.PriceHourly.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["price_hourly"] = val
+
+ val, err = v.PriceMonthly.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["price_monthly"] = val
+
+ val, err = v.Regions.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["regions"] = val
+
+ val, err = v.RegionsOutOfStock.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["regions_out_of_stock"] = val
+
+ val, err = v.SizeType.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["size_type"] = val
+
+ val, err = v.Slug.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["slug"] = val
+
+ val, err = v.StorageDescription.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["storage_description"] = val
+
+ val, err = v.Transfer.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["transfer"] = val
+
+ val, err = v.VcpuUnits.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["vcpu_units"] = val
+
+ val, err = v.Vcpus.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["vcpus"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v SizesValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v SizesValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v SizesValue) String() string {
+ return "SizesValue"
+}
+
+func (v SizesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ var options basetypes.ObjectValue
+
+ if v.Options.IsNull() {
+ options = types.ObjectNull(
+ OptionsValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.Options.IsUnknown() {
+ options = types.ObjectUnknown(
+ OptionsValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.Options.IsNull() && !v.Options.IsUnknown() {
+ options = types.ObjectValueMust(
+ OptionsValue{}.AttributeTypes(ctx),
+ v.Options.Attributes(),
+ )
+ }
+
+ var sizeType basetypes.ObjectValue
+
+ if v.SizeType.IsNull() {
+ sizeType = types.ObjectNull(
+ SizeTypeValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.SizeType.IsUnknown() {
+ sizeType = types.ObjectUnknown(
+ SizeTypeValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.SizeType.IsNull() && !v.SizeType.IsUnknown() {
+ sizeType = types.ObjectValueMust(
+ SizeTypeValue{}.AttributeTypes(ctx),
+ v.SizeType.Attributes(),
+ )
+ }
+
+ var regionsVal basetypes.ListValue
+ switch {
+ case v.Regions.IsUnknown():
+ regionsVal = types.ListUnknown(types.StringType)
+ case v.Regions.IsNull():
+ regionsVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ regionsVal, d = types.ListValue(types.StringType, v.Regions.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "cpu_description": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "disk": basetypes.Int64Type{},
+ "excess_transfer_cost_per_gigabyte": basetypes.Float64Type{},
+ "memory": basetypes.Int64Type{},
+ "options": basetypes.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ },
+ "price_hourly": basetypes.Float64Type{},
+ "price_monthly": basetypes.Float64Type{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "regions_out_of_stock": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_type": basetypes.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ },
+ "slug": basetypes.StringType{},
+ "storage_description": basetypes.StringType{},
+ "transfer": basetypes.Float64Type{},
+ "vcpu_units": basetypes.StringType{},
+ "vcpus": basetypes.Int64Type{},
+ }), diags
+ }
+
+ var regionsOutOfStockVal basetypes.ListValue
+ switch {
+ case v.RegionsOutOfStock.IsUnknown():
+ regionsOutOfStockVal = types.ListUnknown(types.StringType)
+ case v.RegionsOutOfStock.IsNull():
+ regionsOutOfStockVal = types.ListNull(types.StringType)
+ default:
+ var d diag.Diagnostics
+ regionsOutOfStockVal, d = types.ListValue(types.StringType, v.RegionsOutOfStock.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "cpu_description": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "disk": basetypes.Int64Type{},
+ "excess_transfer_cost_per_gigabyte": basetypes.Float64Type{},
+ "memory": basetypes.Int64Type{},
+ "options": basetypes.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ },
+ "price_hourly": basetypes.Float64Type{},
+ "price_monthly": basetypes.Float64Type{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "regions_out_of_stock": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_type": basetypes.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ },
+ "slug": basetypes.StringType{},
+ "storage_description": basetypes.StringType{},
+ "transfer": basetypes.Float64Type{},
+ "vcpu_units": basetypes.StringType{},
+ "vcpus": basetypes.Int64Type{},
+ }), diags
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "cpu_description": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "disk": basetypes.Int64Type{},
+ "excess_transfer_cost_per_gigabyte": basetypes.Float64Type{},
+ "memory": basetypes.Int64Type{},
+ "options": basetypes.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ },
+ "price_hourly": basetypes.Float64Type{},
+ "price_monthly": basetypes.Float64Type{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "regions_out_of_stock": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_type": basetypes.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ },
+ "slug": basetypes.StringType{},
+ "storage_description": basetypes.StringType{},
+ "transfer": basetypes.Float64Type{},
+ "vcpu_units": basetypes.StringType{},
+ "vcpus": basetypes.Int64Type{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "available": v.Available,
+ "cpu_description": v.CpuDescription,
+ "description": v.Description,
+ "disk": v.Disk,
+ "excess_transfer_cost_per_gigabyte": v.ExcessTransferCostPerGigabyte,
+ "memory": v.Memory,
+ "options": options,
+ "price_hourly": v.PriceHourly,
+ "price_monthly": v.PriceMonthly,
+ "regions": regionsVal,
+ "regions_out_of_stock": regionsOutOfStockVal,
+ "size_type": sizeType,
+ "slug": v.Slug,
+ "storage_description": v.StorageDescription,
+ "transfer": v.Transfer,
+ "vcpu_units": v.VcpuUnits,
+ "vcpus": v.Vcpus,
+ })
+
+ return objVal, diags
+}
+
+func (v SizesValue) Equal(o attr.Value) bool {
+ other, ok := o.(SizesValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.Available.Equal(other.Available) {
+ return false
+ }
+
+ if !v.CpuDescription.Equal(other.CpuDescription) {
+ return false
+ }
+
+ if !v.Description.Equal(other.Description) {
+ return false
+ }
+
+ if !v.Disk.Equal(other.Disk) {
+ return false
+ }
+
+ if !v.ExcessTransferCostPerGigabyte.Equal(other.ExcessTransferCostPerGigabyte) {
+ return false
+ }
+
+ if !v.Memory.Equal(other.Memory) {
+ return false
+ }
+
+ if !v.Options.Equal(other.Options) {
+ return false
+ }
+
+ if !v.PriceHourly.Equal(other.PriceHourly) {
+ return false
+ }
+
+ if !v.PriceMonthly.Equal(other.PriceMonthly) {
+ return false
+ }
+
+ if !v.Regions.Equal(other.Regions) {
+ return false
+ }
+
+ if !v.RegionsOutOfStock.Equal(other.RegionsOutOfStock) {
+ return false
+ }
+
+ if !v.SizeType.Equal(other.SizeType) {
+ return false
+ }
+
+ if !v.Slug.Equal(other.Slug) {
+ return false
+ }
+
+ if !v.StorageDescription.Equal(other.StorageDescription) {
+ return false
+ }
+
+ if !v.Transfer.Equal(other.Transfer) {
+ return false
+ }
+
+ if !v.VcpuUnits.Equal(other.VcpuUnits) {
+ return false
+ }
+
+ if !v.Vcpus.Equal(other.Vcpus) {
+ return false
+ }
+
+ return true
+}
+
+func (v SizesValue) Type(ctx context.Context) attr.Type {
+ return SizesType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v SizesValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "available": basetypes.BoolType{},
+ "cpu_description": basetypes.StringType{},
+ "description": basetypes.StringType{},
+ "disk": basetypes.Int64Type{},
+ "excess_transfer_cost_per_gigabyte": basetypes.Float64Type{},
+ "memory": basetypes.Int64Type{},
+ "options": basetypes.ObjectType{
+ AttrTypes: OptionsValue{}.AttributeTypes(ctx),
+ },
+ "price_hourly": basetypes.Float64Type{},
+ "price_monthly": basetypes.Float64Type{},
+ "regions": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "regions_out_of_stock": basetypes.ListType{
+ ElemType: types.StringType,
+ },
+ "size_type": basetypes.ObjectType{
+ AttrTypes: SizeTypeValue{}.AttributeTypes(ctx),
+ },
+ "slug": basetypes.StringType{},
+ "storage_description": basetypes.StringType{},
+ "transfer": basetypes.Float64Type{},
+ "vcpu_units": basetypes.StringType{},
+ "vcpus": basetypes.Int64Type{},
+ }
+}
+
+var _ basetypes.ObjectTypable = OptionsType{}
+
+type OptionsType struct {
+ basetypes.ObjectType
+}
+
+func (t OptionsType) Equal(o attr.Type) bool {
+ other, ok := o.(OptionsType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t OptionsType) String() string {
+ return "OptionsType"
+}
+
+func (t OptionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ backupsCostPerBackupPerGigabyteAttribute, ok := attributes["backups_cost_per_backup_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backups_cost_per_backup_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ backupsCostPerBackupPerGigabyteVal, ok := backupsCostPerBackupPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backups_cost_per_backup_per_gigabyte expected to be basetypes.Float64Value, was: %T`, backupsCostPerBackupPerGigabyteAttribute))
+ }
+
+ dailyBackupsAttribute, ok := attributes["daily_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `daily_backups is missing from object`)
+
+ return nil, diags
+ }
+
+ dailyBackupsVal, ok := dailyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`daily_backups expected to be basetypes.Int64Value, was: %T`, dailyBackupsAttribute))
+ }
+
+ discountForNoPublicIpv4Attribute, ok := attributes["discount_for_no_public_ipv4"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `discount_for_no_public_ipv4 is missing from object`)
+
+ return nil, diags
+ }
+
+ discountForNoPublicIpv4Val, ok := discountForNoPublicIpv4Attribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`discount_for_no_public_ipv4 expected to be basetypes.Float64Value, was: %T`, discountForNoPublicIpv4Attribute))
+ }
+
+ diskCostPerAdditionalGigabyteAttribute, ok := attributes["disk_cost_per_additional_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_cost_per_additional_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ diskCostPerAdditionalGigabyteVal, ok := diskCostPerAdditionalGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_cost_per_additional_gigabyte expected to be basetypes.Float64Value, was: %T`, diskCostPerAdditionalGigabyteAttribute))
+ }
+
+ diskMaxAttribute, ok := attributes["disk_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_max is missing from object`)
+
+ return nil, diags
+ }
+
+ diskMaxVal, ok := diskMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_max expected to be basetypes.Int64Value, was: %T`, diskMaxAttribute))
+ }
+
+ diskMinAttribute, ok := attributes["disk_min"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_min is missing from object`)
+
+ return nil, diags
+ }
+
+ diskMinVal, ok := diskMinAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_min expected to be basetypes.Int64Value, was: %T`, diskMinAttribute))
+ }
+
+ ipv4AddressesCostPerAddressAttribute, ok := attributes["ipv4_addresses_cost_per_address"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `ipv4_addresses_cost_per_address is missing from object`)
+
+ return nil, diags
+ }
+
+ ipv4AddressesCostPerAddressVal, ok := ipv4AddressesCostPerAddressAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`ipv4_addresses_cost_per_address expected to be basetypes.Float64Value, was: %T`, ipv4AddressesCostPerAddressAttribute))
+ }
+
+ ipv4AddressesMaxAttribute, ok := attributes["ipv4_addresses_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `ipv4_addresses_max is missing from object`)
+
+ return nil, diags
+ }
+
+ ipv4AddressesMaxVal, ok := ipv4AddressesMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`ipv4_addresses_max expected to be basetypes.Int64Value, was: %T`, ipv4AddressesMaxAttribute))
+ }
+
+ memoryCostPerAdditionalMegabyteAttribute, ok := attributes["memory_cost_per_additional_megabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory_cost_per_additional_megabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ memoryCostPerAdditionalMegabyteVal, ok := memoryCostPerAdditionalMegabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory_cost_per_additional_megabyte expected to be basetypes.Float64Value, was: %T`, memoryCostPerAdditionalMegabyteAttribute))
+ }
+
+ memoryMaxAttribute, ok := attributes["memory_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory_max is missing from object`)
+
+ return nil, diags
+ }
+
+ memoryMaxVal, ok := memoryMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory_max expected to be basetypes.Int64Value, was: %T`, memoryMaxAttribute))
+ }
+
+ monthlyBackupsAttribute, ok := attributes["monthly_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `monthly_backups is missing from object`)
+
+ return nil, diags
+ }
+
+ monthlyBackupsVal, ok := monthlyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`monthly_backups expected to be basetypes.Int64Value, was: %T`, monthlyBackupsAttribute))
+ }
+
+ offsiteBackupFrequencyCostAttribute, ok := attributes["offsite_backup_frequency_cost"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite_backup_frequency_cost is missing from object`)
+
+ return nil, diags
+ }
+
+ offsiteBackupFrequencyCostVal, ok := offsiteBackupFrequencyCostAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite_backup_frequency_cost expected to be basetypes.ObjectValue, was: %T`, offsiteBackupFrequencyCostAttribute))
+ }
+
+ offsiteBackupsCostPerGigabyteAttribute, ok := attributes["offsite_backups_cost_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite_backups_cost_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ offsiteBackupsCostPerGigabyteVal, ok := offsiteBackupsCostPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite_backups_cost_per_gigabyte expected to be basetypes.Float64Value, was: %T`, offsiteBackupsCostPerGigabyteAttribute))
+ }
+
+ restrictedDiskValuesAttribute, ok := attributes["restricted_disk_values"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `restricted_disk_values is missing from object`)
+
+ return nil, diags
+ }
+
+ restrictedDiskValuesVal, ok := restrictedDiskValuesAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`restricted_disk_values expected to be basetypes.ListValue, was: %T`, restrictedDiskValuesAttribute))
+ }
+
+ transferCostPerAdditionalGigabyteAttribute, ok := attributes["transfer_cost_per_additional_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer_cost_per_additional_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ transferCostPerAdditionalGigabyteVal, ok := transferCostPerAdditionalGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer_cost_per_additional_gigabyte expected to be basetypes.Float64Value, was: %T`, transferCostPerAdditionalGigabyteAttribute))
+ }
+
+ transferMaxAttribute, ok := attributes["transfer_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer_max is missing from object`)
+
+ return nil, diags
+ }
+
+ transferMaxVal, ok := transferMaxAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer_max expected to be basetypes.Float64Value, was: %T`, transferMaxAttribute))
+ }
+
+ weeklyBackupsAttribute, ok := attributes["weekly_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `weekly_backups is missing from object`)
+
+ return nil, diags
+ }
+
+ weeklyBackupsVal, ok := weeklyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`weekly_backups expected to be basetypes.Int64Value, was: %T`, weeklyBackupsAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return OptionsValue{
+ BackupsCostPerBackupPerGigabyte: backupsCostPerBackupPerGigabyteVal,
+ DailyBackups: dailyBackupsVal,
+ DiscountForNoPublicIpv4: discountForNoPublicIpv4Val,
+ DiskCostPerAdditionalGigabyte: diskCostPerAdditionalGigabyteVal,
+ DiskMax: diskMaxVal,
+ DiskMin: diskMinVal,
+ Ipv4AddressesCostPerAddress: ipv4AddressesCostPerAddressVal,
+ Ipv4AddressesMax: ipv4AddressesMaxVal,
+ MemoryCostPerAdditionalMegabyte: memoryCostPerAdditionalMegabyteVal,
+ MemoryMax: memoryMaxVal,
+ MonthlyBackups: monthlyBackupsVal,
+ OffsiteBackupFrequencyCost: offsiteBackupFrequencyCostVal,
+ OffsiteBackupsCostPerGigabyte: offsiteBackupsCostPerGigabyteVal,
+ RestrictedDiskValues: restrictedDiskValuesVal,
+ TransferCostPerAdditionalGigabyte: transferCostPerAdditionalGigabyteVal,
+ TransferMax: transferMaxVal,
+ WeeklyBackups: weeklyBackupsVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewOptionsValueNull() OptionsValue {
+ return OptionsValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewOptionsValueUnknown() OptionsValue {
+ return OptionsValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewOptionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (OptionsValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing OptionsValue Attribute Value",
+ "While creating a OptionsValue value, a missing attribute value was detected. "+
+ "A OptionsValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("OptionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid OptionsValue Attribute Type",
+ "While creating a OptionsValue value, an invalid attribute value was detected. "+
+ "A OptionsValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("OptionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("OptionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra OptionsValue Attribute Value",
+ "While creating a OptionsValue value, an extra attribute value was detected. "+
+ "A OptionsValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra OptionsValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewOptionsValueUnknown(), diags
+ }
+
+ backupsCostPerBackupPerGigabyteAttribute, ok := attributes["backups_cost_per_backup_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `backups_cost_per_backup_per_gigabyte is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ backupsCostPerBackupPerGigabyteVal, ok := backupsCostPerBackupPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`backups_cost_per_backup_per_gigabyte expected to be basetypes.Float64Value, was: %T`, backupsCostPerBackupPerGigabyteAttribute))
+ }
+
+ dailyBackupsAttribute, ok := attributes["daily_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `daily_backups is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ dailyBackupsVal, ok := dailyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`daily_backups expected to be basetypes.Int64Value, was: %T`, dailyBackupsAttribute))
+ }
+
+ discountForNoPublicIpv4Attribute, ok := attributes["discount_for_no_public_ipv4"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `discount_for_no_public_ipv4 is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ discountForNoPublicIpv4Val, ok := discountForNoPublicIpv4Attribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`discount_for_no_public_ipv4 expected to be basetypes.Float64Value, was: %T`, discountForNoPublicIpv4Attribute))
+ }
+
+ diskCostPerAdditionalGigabyteAttribute, ok := attributes["disk_cost_per_additional_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_cost_per_additional_gigabyte is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ diskCostPerAdditionalGigabyteVal, ok := diskCostPerAdditionalGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_cost_per_additional_gigabyte expected to be basetypes.Float64Value, was: %T`, diskCostPerAdditionalGigabyteAttribute))
+ }
+
+ diskMaxAttribute, ok := attributes["disk_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_max is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ diskMaxVal, ok := diskMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_max expected to be basetypes.Int64Value, was: %T`, diskMaxAttribute))
+ }
+
+ diskMinAttribute, ok := attributes["disk_min"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `disk_min is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ diskMinVal, ok := diskMinAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`disk_min expected to be basetypes.Int64Value, was: %T`, diskMinAttribute))
+ }
+
+ ipv4AddressesCostPerAddressAttribute, ok := attributes["ipv4_addresses_cost_per_address"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `ipv4_addresses_cost_per_address is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ ipv4AddressesCostPerAddressVal, ok := ipv4AddressesCostPerAddressAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`ipv4_addresses_cost_per_address expected to be basetypes.Float64Value, was: %T`, ipv4AddressesCostPerAddressAttribute))
+ }
+
+ ipv4AddressesMaxAttribute, ok := attributes["ipv4_addresses_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `ipv4_addresses_max is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ ipv4AddressesMaxVal, ok := ipv4AddressesMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`ipv4_addresses_max expected to be basetypes.Int64Value, was: %T`, ipv4AddressesMaxAttribute))
+ }
+
+ memoryCostPerAdditionalMegabyteAttribute, ok := attributes["memory_cost_per_additional_megabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory_cost_per_additional_megabyte is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ memoryCostPerAdditionalMegabyteVal, ok := memoryCostPerAdditionalMegabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory_cost_per_additional_megabyte expected to be basetypes.Float64Value, was: %T`, memoryCostPerAdditionalMegabyteAttribute))
+ }
+
+ memoryMaxAttribute, ok := attributes["memory_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `memory_max is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ memoryMaxVal, ok := memoryMaxAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`memory_max expected to be basetypes.Int64Value, was: %T`, memoryMaxAttribute))
+ }
+
+ monthlyBackupsAttribute, ok := attributes["monthly_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `monthly_backups is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ monthlyBackupsVal, ok := monthlyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`monthly_backups expected to be basetypes.Int64Value, was: %T`, monthlyBackupsAttribute))
+ }
+
+ offsiteBackupFrequencyCostAttribute, ok := attributes["offsite_backup_frequency_cost"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite_backup_frequency_cost is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ offsiteBackupFrequencyCostVal, ok := offsiteBackupFrequencyCostAttribute.(basetypes.ObjectValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite_backup_frequency_cost expected to be basetypes.ObjectValue, was: %T`, offsiteBackupFrequencyCostAttribute))
+ }
+
+ offsiteBackupsCostPerGigabyteAttribute, ok := attributes["offsite_backups_cost_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `offsite_backups_cost_per_gigabyte is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ offsiteBackupsCostPerGigabyteVal, ok := offsiteBackupsCostPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`offsite_backups_cost_per_gigabyte expected to be basetypes.Float64Value, was: %T`, offsiteBackupsCostPerGigabyteAttribute))
+ }
+
+ restrictedDiskValuesAttribute, ok := attributes["restricted_disk_values"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `restricted_disk_values is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ restrictedDiskValuesVal, ok := restrictedDiskValuesAttribute.(basetypes.ListValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`restricted_disk_values expected to be basetypes.ListValue, was: %T`, restrictedDiskValuesAttribute))
+ }
+
+ transferCostPerAdditionalGigabyteAttribute, ok := attributes["transfer_cost_per_additional_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer_cost_per_additional_gigabyte is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ transferCostPerAdditionalGigabyteVal, ok := transferCostPerAdditionalGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer_cost_per_additional_gigabyte expected to be basetypes.Float64Value, was: %T`, transferCostPerAdditionalGigabyteAttribute))
+ }
+
+ transferMaxAttribute, ok := attributes["transfer_max"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `transfer_max is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ transferMaxVal, ok := transferMaxAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`transfer_max expected to be basetypes.Float64Value, was: %T`, transferMaxAttribute))
+ }
+
+ weeklyBackupsAttribute, ok := attributes["weekly_backups"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `weekly_backups is missing from object`)
+
+ return NewOptionsValueUnknown(), diags
+ }
+
+ weeklyBackupsVal, ok := weeklyBackupsAttribute.(basetypes.Int64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`weekly_backups expected to be basetypes.Int64Value, was: %T`, weeklyBackupsAttribute))
+ }
+
+ if diags.HasError() {
+ return NewOptionsValueUnknown(), diags
+ }
+
+ return OptionsValue{
+ BackupsCostPerBackupPerGigabyte: backupsCostPerBackupPerGigabyteVal,
+ DailyBackups: dailyBackupsVal,
+ DiscountForNoPublicIpv4: discountForNoPublicIpv4Val,
+ DiskCostPerAdditionalGigabyte: diskCostPerAdditionalGigabyteVal,
+ DiskMax: diskMaxVal,
+ DiskMin: diskMinVal,
+ Ipv4AddressesCostPerAddress: ipv4AddressesCostPerAddressVal,
+ Ipv4AddressesMax: ipv4AddressesMaxVal,
+ MemoryCostPerAdditionalMegabyte: memoryCostPerAdditionalMegabyteVal,
+ MemoryMax: memoryMaxVal,
+ MonthlyBackups: monthlyBackupsVal,
+ OffsiteBackupFrequencyCost: offsiteBackupFrequencyCostVal,
+ OffsiteBackupsCostPerGigabyte: offsiteBackupsCostPerGigabyteVal,
+ RestrictedDiskValues: restrictedDiskValuesVal,
+ TransferCostPerAdditionalGigabyte: transferCostPerAdditionalGigabyteVal,
+ TransferMax: transferMaxVal,
+ WeeklyBackups: weeklyBackupsVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewOptionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) OptionsValue {
+ object, diags := NewOptionsValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewOptionsValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t OptionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewOptionsValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewOptionsValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewOptionsValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewOptionsValueMust(OptionsValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t OptionsType) ValueType(ctx context.Context) attr.Value {
+ return OptionsValue{}
+}
+
+var _ basetypes.ObjectValuable = OptionsValue{}
+
+type OptionsValue struct {
+ BackupsCostPerBackupPerGigabyte basetypes.Float64Value `tfsdk:"backups_cost_per_backup_per_gigabyte"`
+ DailyBackups basetypes.Int64Value `tfsdk:"daily_backups"`
+ DiscountForNoPublicIpv4 basetypes.Float64Value `tfsdk:"discount_for_no_public_ipv4"`
+ DiskCostPerAdditionalGigabyte basetypes.Float64Value `tfsdk:"disk_cost_per_additional_gigabyte"`
+ DiskMax basetypes.Int64Value `tfsdk:"disk_max"`
+ DiskMin basetypes.Int64Value `tfsdk:"disk_min"`
+ Ipv4AddressesCostPerAddress basetypes.Float64Value `tfsdk:"ipv4_addresses_cost_per_address"`
+ Ipv4AddressesMax basetypes.Int64Value `tfsdk:"ipv4_addresses_max"`
+ MemoryCostPerAdditionalMegabyte basetypes.Float64Value `tfsdk:"memory_cost_per_additional_megabyte"`
+ MemoryMax basetypes.Int64Value `tfsdk:"memory_max"`
+ MonthlyBackups basetypes.Int64Value `tfsdk:"monthly_backups"`
+ OffsiteBackupFrequencyCost basetypes.ObjectValue `tfsdk:"offsite_backup_frequency_cost"`
+ OffsiteBackupsCostPerGigabyte basetypes.Float64Value `tfsdk:"offsite_backups_cost_per_gigabyte"`
+ RestrictedDiskValues basetypes.ListValue `tfsdk:"restricted_disk_values"`
+ TransferCostPerAdditionalGigabyte basetypes.Float64Value `tfsdk:"transfer_cost_per_additional_gigabyte"`
+ TransferMax basetypes.Float64Value `tfsdk:"transfer_max"`
+ WeeklyBackups basetypes.Int64Value `tfsdk:"weekly_backups"`
+ state attr.ValueState
+}
+
+func (v OptionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 17)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["backups_cost_per_backup_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["daily_backups"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["discount_for_no_public_ipv4"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["disk_cost_per_additional_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["disk_max"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["disk_min"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["ipv4_addresses_cost_per_address"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["ipv4_addresses_max"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["memory_cost_per_additional_megabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["memory_max"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["monthly_backups"] = basetypes.Int64Type{}.TerraformType(ctx)
+ attrTypes["offsite_backup_frequency_cost"] = basetypes.ObjectType{
+ AttrTypes: OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ }.TerraformType(ctx)
+ attrTypes["offsite_backups_cost_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["restricted_disk_values"] = basetypes.ListType{
+ ElemType: types.Int64Type,
+ }.TerraformType(ctx)
+ attrTypes["transfer_cost_per_additional_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["transfer_max"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["weekly_backups"] = basetypes.Int64Type{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 17)
+
+ val, err = v.BackupsCostPerBackupPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["backups_cost_per_backup_per_gigabyte"] = val
+
+ val, err = v.DailyBackups.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["daily_backups"] = val
+
+ val, err = v.DiscountForNoPublicIpv4.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["discount_for_no_public_ipv4"] = val
+
+ val, err = v.DiskCostPerAdditionalGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["disk_cost_per_additional_gigabyte"] = val
+
+ val, err = v.DiskMax.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["disk_max"] = val
+
+ val, err = v.DiskMin.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["disk_min"] = val
+
+ val, err = v.Ipv4AddressesCostPerAddress.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["ipv4_addresses_cost_per_address"] = val
+
+ val, err = v.Ipv4AddressesMax.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["ipv4_addresses_max"] = val
+
+ val, err = v.MemoryCostPerAdditionalMegabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["memory_cost_per_additional_megabyte"] = val
+
+ val, err = v.MemoryMax.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["memory_max"] = val
+
+ val, err = v.MonthlyBackups.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["monthly_backups"] = val
+
+ val, err = v.OffsiteBackupFrequencyCost.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["offsite_backup_frequency_cost"] = val
+
+ val, err = v.OffsiteBackupsCostPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["offsite_backups_cost_per_gigabyte"] = val
+
+ val, err = v.RestrictedDiskValues.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["restricted_disk_values"] = val
+
+ val, err = v.TransferCostPerAdditionalGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["transfer_cost_per_additional_gigabyte"] = val
+
+ val, err = v.TransferMax.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["transfer_max"] = val
+
+ val, err = v.WeeklyBackups.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["weekly_backups"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v OptionsValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v OptionsValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v OptionsValue) String() string {
+ return "OptionsValue"
+}
+
+func (v OptionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ var offsiteBackupFrequencyCost basetypes.ObjectValue
+
+ if v.OffsiteBackupFrequencyCost.IsNull() {
+ offsiteBackupFrequencyCost = types.ObjectNull(
+ OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if v.OffsiteBackupFrequencyCost.IsUnknown() {
+ offsiteBackupFrequencyCost = types.ObjectUnknown(
+ OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ )
+ }
+
+ if !v.OffsiteBackupFrequencyCost.IsNull() && !v.OffsiteBackupFrequencyCost.IsUnknown() {
+ offsiteBackupFrequencyCost = types.ObjectValueMust(
+ OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ v.OffsiteBackupFrequencyCost.Attributes(),
+ )
+ }
+
+ var restrictedDiskValuesVal basetypes.ListValue
+ switch {
+ case v.RestrictedDiskValues.IsUnknown():
+ restrictedDiskValuesVal = types.ListUnknown(types.Int64Type)
+ case v.RestrictedDiskValues.IsNull():
+ restrictedDiskValuesVal = types.ListNull(types.Int64Type)
+ default:
+ var d diag.Diagnostics
+ restrictedDiskValuesVal, d = types.ListValue(types.Int64Type, v.RestrictedDiskValues.Elements())
+ diags.Append(d...)
+ }
+
+ if diags.HasError() {
+ return types.ObjectUnknown(map[string]attr.Type{
+ "backups_cost_per_backup_per_gigabyte": basetypes.Float64Type{},
+ "daily_backups": basetypes.Int64Type{},
+ "discount_for_no_public_ipv4": basetypes.Float64Type{},
+ "disk_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "disk_max": basetypes.Int64Type{},
+ "disk_min": basetypes.Int64Type{},
+ "ipv4_addresses_cost_per_address": basetypes.Float64Type{},
+ "ipv4_addresses_max": basetypes.Int64Type{},
+ "memory_cost_per_additional_megabyte": basetypes.Float64Type{},
+ "memory_max": basetypes.Int64Type{},
+ "monthly_backups": basetypes.Int64Type{},
+ "offsite_backup_frequency_cost": basetypes.ObjectType{
+ AttrTypes: OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ },
+ "offsite_backups_cost_per_gigabyte": basetypes.Float64Type{},
+ "restricted_disk_values": basetypes.ListType{
+ ElemType: types.Int64Type,
+ },
+ "transfer_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "transfer_max": basetypes.Float64Type{},
+ "weekly_backups": basetypes.Int64Type{},
+ }), diags
+ }
+
+ attributeTypes := map[string]attr.Type{
+ "backups_cost_per_backup_per_gigabyte": basetypes.Float64Type{},
+ "daily_backups": basetypes.Int64Type{},
+ "discount_for_no_public_ipv4": basetypes.Float64Type{},
+ "disk_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "disk_max": basetypes.Int64Type{},
+ "disk_min": basetypes.Int64Type{},
+ "ipv4_addresses_cost_per_address": basetypes.Float64Type{},
+ "ipv4_addresses_max": basetypes.Int64Type{},
+ "memory_cost_per_additional_megabyte": basetypes.Float64Type{},
+ "memory_max": basetypes.Int64Type{},
+ "monthly_backups": basetypes.Int64Type{},
+ "offsite_backup_frequency_cost": basetypes.ObjectType{
+ AttrTypes: OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ },
+ "offsite_backups_cost_per_gigabyte": basetypes.Float64Type{},
+ "restricted_disk_values": basetypes.ListType{
+ ElemType: types.Int64Type,
+ },
+ "transfer_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "transfer_max": basetypes.Float64Type{},
+ "weekly_backups": basetypes.Int64Type{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "backups_cost_per_backup_per_gigabyte": v.BackupsCostPerBackupPerGigabyte,
+ "daily_backups": v.DailyBackups,
+ "discount_for_no_public_ipv4": v.DiscountForNoPublicIpv4,
+ "disk_cost_per_additional_gigabyte": v.DiskCostPerAdditionalGigabyte,
+ "disk_max": v.DiskMax,
+ "disk_min": v.DiskMin,
+ "ipv4_addresses_cost_per_address": v.Ipv4AddressesCostPerAddress,
+ "ipv4_addresses_max": v.Ipv4AddressesMax,
+ "memory_cost_per_additional_megabyte": v.MemoryCostPerAdditionalMegabyte,
+ "memory_max": v.MemoryMax,
+ "monthly_backups": v.MonthlyBackups,
+ "offsite_backup_frequency_cost": offsiteBackupFrequencyCost,
+ "offsite_backups_cost_per_gigabyte": v.OffsiteBackupsCostPerGigabyte,
+ "restricted_disk_values": restrictedDiskValuesVal,
+ "transfer_cost_per_additional_gigabyte": v.TransferCostPerAdditionalGigabyte,
+ "transfer_max": v.TransferMax,
+ "weekly_backups": v.WeeklyBackups,
+ })
+
+ return objVal, diags
+}
+
+func (v OptionsValue) Equal(o attr.Value) bool {
+ other, ok := o.(OptionsValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.BackupsCostPerBackupPerGigabyte.Equal(other.BackupsCostPerBackupPerGigabyte) {
+ return false
+ }
+
+ if !v.DailyBackups.Equal(other.DailyBackups) {
+ return false
+ }
+
+ if !v.DiscountForNoPublicIpv4.Equal(other.DiscountForNoPublicIpv4) {
+ return false
+ }
+
+ if !v.DiskCostPerAdditionalGigabyte.Equal(other.DiskCostPerAdditionalGigabyte) {
+ return false
+ }
+
+ if !v.DiskMax.Equal(other.DiskMax) {
+ return false
+ }
+
+ if !v.DiskMin.Equal(other.DiskMin) {
+ return false
+ }
+
+ if !v.Ipv4AddressesCostPerAddress.Equal(other.Ipv4AddressesCostPerAddress) {
+ return false
+ }
+
+ if !v.Ipv4AddressesMax.Equal(other.Ipv4AddressesMax) {
+ return false
+ }
+
+ if !v.MemoryCostPerAdditionalMegabyte.Equal(other.MemoryCostPerAdditionalMegabyte) {
+ return false
+ }
+
+ if !v.MemoryMax.Equal(other.MemoryMax) {
+ return false
+ }
+
+ if !v.MonthlyBackups.Equal(other.MonthlyBackups) {
+ return false
+ }
+
+ if !v.OffsiteBackupFrequencyCost.Equal(other.OffsiteBackupFrequencyCost) {
+ return false
+ }
+
+ if !v.OffsiteBackupsCostPerGigabyte.Equal(other.OffsiteBackupsCostPerGigabyte) {
+ return false
+ }
+
+ if !v.RestrictedDiskValues.Equal(other.RestrictedDiskValues) {
+ return false
+ }
+
+ if !v.TransferCostPerAdditionalGigabyte.Equal(other.TransferCostPerAdditionalGigabyte) {
+ return false
+ }
+
+ if !v.TransferMax.Equal(other.TransferMax) {
+ return false
+ }
+
+ if !v.WeeklyBackups.Equal(other.WeeklyBackups) {
+ return false
+ }
+
+ return true
+}
+
+func (v OptionsValue) Type(ctx context.Context) attr.Type {
+ return OptionsType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v OptionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "backups_cost_per_backup_per_gigabyte": basetypes.Float64Type{},
+ "daily_backups": basetypes.Int64Type{},
+ "discount_for_no_public_ipv4": basetypes.Float64Type{},
+ "disk_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "disk_max": basetypes.Int64Type{},
+ "disk_min": basetypes.Int64Type{},
+ "ipv4_addresses_cost_per_address": basetypes.Float64Type{},
+ "ipv4_addresses_max": basetypes.Int64Type{},
+ "memory_cost_per_additional_megabyte": basetypes.Float64Type{},
+ "memory_max": basetypes.Int64Type{},
+ "monthly_backups": basetypes.Int64Type{},
+ "offsite_backup_frequency_cost": basetypes.ObjectType{
+ AttrTypes: OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx),
+ },
+ "offsite_backups_cost_per_gigabyte": basetypes.Float64Type{},
+ "restricted_disk_values": basetypes.ListType{
+ ElemType: types.Int64Type,
+ },
+ "transfer_cost_per_additional_gigabyte": basetypes.Float64Type{},
+ "transfer_max": basetypes.Float64Type{},
+ "weekly_backups": basetypes.Int64Type{},
+ }
+}
+
+var _ basetypes.ObjectTypable = OffsiteBackupFrequencyCostType{}
+
+type OffsiteBackupFrequencyCostType struct {
+ basetypes.ObjectType
+}
+
+func (t OffsiteBackupFrequencyCostType) Equal(o attr.Type) bool {
+ other, ok := o.(OffsiteBackupFrequencyCostType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t OffsiteBackupFrequencyCostType) String() string {
+ return "OffsiteBackupFrequencyCostType"
+}
+
+func (t OffsiteBackupFrequencyCostType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ dailyPerGigabyteAttribute, ok := attributes["daily_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `daily_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ dailyPerGigabyteVal, ok := dailyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`daily_per_gigabyte expected to be basetypes.Float64Value, was: %T`, dailyPerGigabyteAttribute))
+ }
+
+ monthlyPerGigabyteAttribute, ok := attributes["monthly_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `monthly_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ monthlyPerGigabyteVal, ok := monthlyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`monthly_per_gigabyte expected to be basetypes.Float64Value, was: %T`, monthlyPerGigabyteAttribute))
+ }
+
+ weeklyPerGigabyteAttribute, ok := attributes["weekly_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `weekly_per_gigabyte is missing from object`)
+
+ return nil, diags
+ }
+
+ weeklyPerGigabyteVal, ok := weeklyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`weekly_per_gigabyte expected to be basetypes.Float64Value, was: %T`, weeklyPerGigabyteAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return OffsiteBackupFrequencyCostValue{
+ DailyPerGigabyte: dailyPerGigabyteVal,
+ MonthlyPerGigabyte: monthlyPerGigabyteVal,
+ WeeklyPerGigabyte: weeklyPerGigabyteVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewOffsiteBackupFrequencyCostValueNull() OffsiteBackupFrequencyCostValue {
+ return OffsiteBackupFrequencyCostValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewOffsiteBackupFrequencyCostValueUnknown() OffsiteBackupFrequencyCostValue {
+ return OffsiteBackupFrequencyCostValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewOffsiteBackupFrequencyCostValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (OffsiteBackupFrequencyCostValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing OffsiteBackupFrequencyCostValue Attribute Value",
+ "While creating a OffsiteBackupFrequencyCostValue value, a missing attribute value was detected. "+
+ "A OffsiteBackupFrequencyCostValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("OffsiteBackupFrequencyCostValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid OffsiteBackupFrequencyCostValue Attribute Type",
+ "While creating a OffsiteBackupFrequencyCostValue value, an invalid attribute value was detected. "+
+ "A OffsiteBackupFrequencyCostValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("OffsiteBackupFrequencyCostValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("OffsiteBackupFrequencyCostValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra OffsiteBackupFrequencyCostValue Attribute Value",
+ "While creating a OffsiteBackupFrequencyCostValue value, an extra attribute value was detected. "+
+ "A OffsiteBackupFrequencyCostValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra OffsiteBackupFrequencyCostValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewOffsiteBackupFrequencyCostValueUnknown(), diags
+ }
+
+ dailyPerGigabyteAttribute, ok := attributes["daily_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `daily_per_gigabyte is missing from object`)
+
+ return NewOffsiteBackupFrequencyCostValueUnknown(), diags
+ }
+
+ dailyPerGigabyteVal, ok := dailyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`daily_per_gigabyte expected to be basetypes.Float64Value, was: %T`, dailyPerGigabyteAttribute))
+ }
+
+ monthlyPerGigabyteAttribute, ok := attributes["monthly_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `monthly_per_gigabyte is missing from object`)
+
+ return NewOffsiteBackupFrequencyCostValueUnknown(), diags
+ }
+
+ monthlyPerGigabyteVal, ok := monthlyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`monthly_per_gigabyte expected to be basetypes.Float64Value, was: %T`, monthlyPerGigabyteAttribute))
+ }
+
+ weeklyPerGigabyteAttribute, ok := attributes["weekly_per_gigabyte"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `weekly_per_gigabyte is missing from object`)
+
+ return NewOffsiteBackupFrequencyCostValueUnknown(), diags
+ }
+
+ weeklyPerGigabyteVal, ok := weeklyPerGigabyteAttribute.(basetypes.Float64Value)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`weekly_per_gigabyte expected to be basetypes.Float64Value, was: %T`, weeklyPerGigabyteAttribute))
+ }
+
+ if diags.HasError() {
+ return NewOffsiteBackupFrequencyCostValueUnknown(), diags
+ }
+
+ return OffsiteBackupFrequencyCostValue{
+ DailyPerGigabyte: dailyPerGigabyteVal,
+ MonthlyPerGigabyte: monthlyPerGigabyteVal,
+ WeeklyPerGigabyte: weeklyPerGigabyteVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewOffsiteBackupFrequencyCostValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) OffsiteBackupFrequencyCostValue {
+ object, diags := NewOffsiteBackupFrequencyCostValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewOffsiteBackupFrequencyCostValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t OffsiteBackupFrequencyCostType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewOffsiteBackupFrequencyCostValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewOffsiteBackupFrequencyCostValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewOffsiteBackupFrequencyCostValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewOffsiteBackupFrequencyCostValueMust(OffsiteBackupFrequencyCostValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t OffsiteBackupFrequencyCostType) ValueType(ctx context.Context) attr.Value {
+ return OffsiteBackupFrequencyCostValue{}
+}
+
+var _ basetypes.ObjectValuable = OffsiteBackupFrequencyCostValue{}
+
+type OffsiteBackupFrequencyCostValue struct {
+ DailyPerGigabyte basetypes.Float64Value `tfsdk:"daily_per_gigabyte"`
+ MonthlyPerGigabyte basetypes.Float64Value `tfsdk:"monthly_per_gigabyte"`
+ WeeklyPerGigabyte basetypes.Float64Value `tfsdk:"weekly_per_gigabyte"`
+ state attr.ValueState
+}
+
+func (v OffsiteBackupFrequencyCostValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 3)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["daily_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["monthly_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+ attrTypes["weekly_per_gigabyte"] = basetypes.Float64Type{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 3)
+
+ val, err = v.DailyPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["daily_per_gigabyte"] = val
+
+ val, err = v.MonthlyPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["monthly_per_gigabyte"] = val
+
+ val, err = v.WeeklyPerGigabyte.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["weekly_per_gigabyte"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v OffsiteBackupFrequencyCostValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v OffsiteBackupFrequencyCostValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v OffsiteBackupFrequencyCostValue) String() string {
+ return "OffsiteBackupFrequencyCostValue"
+}
+
+func (v OffsiteBackupFrequencyCostValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributeTypes := map[string]attr.Type{
+ "daily_per_gigabyte": basetypes.Float64Type{},
+ "monthly_per_gigabyte": basetypes.Float64Type{},
+ "weekly_per_gigabyte": basetypes.Float64Type{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "daily_per_gigabyte": v.DailyPerGigabyte,
+ "monthly_per_gigabyte": v.MonthlyPerGigabyte,
+ "weekly_per_gigabyte": v.WeeklyPerGigabyte,
+ })
+
+ return objVal, diags
+}
+
+func (v OffsiteBackupFrequencyCostValue) Equal(o attr.Value) bool {
+ other, ok := o.(OffsiteBackupFrequencyCostValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.DailyPerGigabyte.Equal(other.DailyPerGigabyte) {
+ return false
+ }
+
+ if !v.MonthlyPerGigabyte.Equal(other.MonthlyPerGigabyte) {
+ return false
+ }
+
+ if !v.WeeklyPerGigabyte.Equal(other.WeeklyPerGigabyte) {
+ return false
+ }
+
+ return true
+}
+
+func (v OffsiteBackupFrequencyCostValue) Type(ctx context.Context) attr.Type {
+ return OffsiteBackupFrequencyCostType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v OffsiteBackupFrequencyCostValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "daily_per_gigabyte": basetypes.Float64Type{},
+ "monthly_per_gigabyte": basetypes.Float64Type{},
+ "weekly_per_gigabyte": basetypes.Float64Type{},
+ }
+}
+
+var _ basetypes.ObjectTypable = SizeTypeType{}
+
+type SizeTypeType struct {
+ basetypes.ObjectType
+}
+
+func (t SizeTypeType) Equal(o attr.Type) bool {
+ other, ok := o.(SizeTypeType)
+
+ if !ok {
+ return false
+ }
+
+ return t.ObjectType.Equal(other.ObjectType)
+}
+
+func (t SizeTypeType) String() string {
+ return "SizeTypeType"
+}
+
+func (t SizeTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributes := in.Attributes()
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return nil, diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return nil, diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return nil, diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ if diags.HasError() {
+ return nil, diags
+ }
+
+ return SizeTypeValue{
+ Description: descriptionVal,
+ Name: nameVal,
+ Slug: slugVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewSizeTypeValueNull() SizeTypeValue {
+ return SizeTypeValue{
+ state: attr.ValueStateNull,
+ }
+}
+
+func NewSizeTypeValueUnknown() SizeTypeValue {
+ return SizeTypeValue{
+ state: attr.ValueStateUnknown,
+ }
+}
+
+func NewSizeTypeValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (SizeTypeValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
+ ctx := context.Background()
+
+ for name, attributeType := range attributeTypes {
+ attribute, ok := attributes[name]
+
+ if !ok {
+ diags.AddError(
+ "Missing SizeTypeValue Attribute Value",
+ "While creating a SizeTypeValue value, a missing attribute value was detected. "+
+ "A SizeTypeValue must contain values for all attributes, even if null or unknown. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("SizeTypeValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
+ )
+
+ continue
+ }
+
+ if !attributeType.Equal(attribute.Type(ctx)) {
+ diags.AddError(
+ "Invalid SizeTypeValue Attribute Type",
+ "While creating a SizeTypeValue value, an invalid attribute value was detected. "+
+ "A SizeTypeValue must use a matching attribute type for the value. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("SizeTypeValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
+ fmt.Sprintf("SizeTypeValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
+ )
+ }
+ }
+
+ for name := range attributes {
+ _, ok := attributeTypes[name]
+
+ if !ok {
+ diags.AddError(
+ "Extra SizeTypeValue Attribute Value",
+ "While creating a SizeTypeValue value, an extra attribute value was detected. "+
+ "A SizeTypeValue must not contain values beyond the expected attribute types. "+
+ "This is always an issue with the provider and should be reported to the provider developers.\n\n"+
+ fmt.Sprintf("Extra SizeTypeValue Attribute Name: %s", name),
+ )
+ }
+ }
+
+ if diags.HasError() {
+ return NewSizeTypeValueUnknown(), diags
+ }
+
+ descriptionAttribute, ok := attributes["description"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `description is missing from object`)
+
+ return NewSizeTypeValueUnknown(), diags
+ }
+
+ descriptionVal, ok := descriptionAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute))
+ }
+
+ nameAttribute, ok := attributes["name"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `name is missing from object`)
+
+ return NewSizeTypeValueUnknown(), diags
+ }
+
+ nameVal, ok := nameAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute))
+ }
+
+ slugAttribute, ok := attributes["slug"]
+
+ if !ok {
+ diags.AddError(
+ "Attribute Missing",
+ `slug is missing from object`)
+
+ return NewSizeTypeValueUnknown(), diags
+ }
+
+ slugVal, ok := slugAttribute.(basetypes.StringValue)
+
+ if !ok {
+ diags.AddError(
+ "Attribute Wrong Type",
+ fmt.Sprintf(`slug expected to be basetypes.StringValue, was: %T`, slugAttribute))
+ }
+
+ if diags.HasError() {
+ return NewSizeTypeValueUnknown(), diags
+ }
+
+ return SizeTypeValue{
+ Description: descriptionVal,
+ Name: nameVal,
+ Slug: slugVal,
+ state: attr.ValueStateKnown,
+ }, diags
+}
+
+func NewSizeTypeValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) SizeTypeValue {
+ object, diags := NewSizeTypeValue(attributeTypes, attributes)
+
+ if diags.HasError() {
+ // This could potentially be added to the diag package.
+ diagsStrings := make([]string, 0, len(diags))
+
+ for _, diagnostic := range diags {
+ diagsStrings = append(diagsStrings, fmt.Sprintf(
+ "%s | %s | %s",
+ diagnostic.Severity(),
+ diagnostic.Summary(),
+ diagnostic.Detail()))
+ }
+
+ panic("NewSizeTypeValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
+ }
+
+ return object
+}
+
+func (t SizeTypeType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
+ if in.Type() == nil {
+ return NewSizeTypeValueNull(), nil
+ }
+
+ if !in.Type().Equal(t.TerraformType(ctx)) {
+ return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
+ }
+
+ if !in.IsKnown() {
+ return NewSizeTypeValueUnknown(), nil
+ }
+
+ if in.IsNull() {
+ return NewSizeTypeValueNull(), nil
+ }
+
+ attributes := map[string]attr.Value{}
+
+ val := map[string]tftypes.Value{}
+
+ err := in.As(&val)
+
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range val {
+ a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
+
+ if err != nil {
+ return nil, err
+ }
+
+ attributes[k] = a
+ }
+
+ return NewSizeTypeValueMust(SizeTypeValue{}.AttributeTypes(ctx), attributes), nil
+}
+
+func (t SizeTypeType) ValueType(ctx context.Context) attr.Value {
+ return SizeTypeValue{}
+}
+
+var _ basetypes.ObjectValuable = SizeTypeValue{}
+
+type SizeTypeValue struct {
+ Description basetypes.StringValue `tfsdk:"description"`
+ Name basetypes.StringValue `tfsdk:"name"`
+ Slug basetypes.StringValue `tfsdk:"slug"`
+ state attr.ValueState
+}
+
+func (v SizeTypeValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
+ attrTypes := make(map[string]tftypes.Type, 3)
+
+ var val tftypes.Value
+ var err error
+
+ attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx)
+ attrTypes["slug"] = basetypes.StringType{}.TerraformType(ctx)
+
+ objectType := tftypes.Object{AttributeTypes: attrTypes}
+
+ switch v.state {
+ case attr.ValueStateKnown:
+ vals := make(map[string]tftypes.Value, 3)
+
+ val, err = v.Description.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["description"] = val
+
+ val, err = v.Name.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["name"] = val
+
+ val, err = v.Slug.ToTerraformValue(ctx)
+
+ if err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ vals["slug"] = val
+
+ if err := tftypes.ValidateValue(objectType, vals); err != nil {
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), err
+ }
+
+ return tftypes.NewValue(objectType, vals), nil
+ case attr.ValueStateNull:
+ return tftypes.NewValue(objectType, nil), nil
+ case attr.ValueStateUnknown:
+ return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
+ default:
+ panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
+ }
+}
+
+func (v SizeTypeValue) IsNull() bool {
+ return v.state == attr.ValueStateNull
+}
+
+func (v SizeTypeValue) IsUnknown() bool {
+ return v.state == attr.ValueStateUnknown
+}
+
+func (v SizeTypeValue) String() string {
+ return "SizeTypeValue"
+}
+
+func (v SizeTypeValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
+ var diags diag.Diagnostics
+
+ attributeTypes := map[string]attr.Type{
+ "description": basetypes.StringType{},
+ "name": basetypes.StringType{},
+ "slug": basetypes.StringType{},
+ }
+
+ if v.IsNull() {
+ return types.ObjectNull(attributeTypes), diags
+ }
+
+ if v.IsUnknown() {
+ return types.ObjectUnknown(attributeTypes), diags
+ }
+
+ objVal, diags := types.ObjectValue(
+ attributeTypes,
+ map[string]attr.Value{
+ "description": v.Description,
+ "name": v.Name,
+ "slug": v.Slug,
+ })
+
+ return objVal, diags
+}
+
+func (v SizeTypeValue) Equal(o attr.Value) bool {
+ other, ok := o.(SizeTypeValue)
+
+ if !ok {
+ return false
+ }
+
+ if v.state != other.state {
+ return false
+ }
+
+ if v.state != attr.ValueStateKnown {
+ return true
+ }
+
+ if !v.Description.Equal(other.Description) {
+ return false
+ }
+
+ if !v.Name.Equal(other.Name) {
+ return false
+ }
+
+ if !v.Slug.Equal(other.Slug) {
+ return false
+ }
+
+ return true
+}
+
+func (v SizeTypeValue) Type(ctx context.Context) attr.Type {
+ return SizeTypeType{
+ basetypes.ObjectType{
+ AttrTypes: v.AttributeTypes(ctx),
+ },
+ }
+}
+
+func (v SizeTypeValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
+ return map[string]attr.Type{
+ "description": basetypes.StringType{},
+ "name": basetypes.StringType{},
+ "slug": basetypes.StringType{},
+ }
+}
diff --git a/internal/provider/images_data_source.go b/internal/provider/images_data_source.go
new file mode 100644
index 0000000..aa78bfd
--- /dev/null
+++ b/internal/provider/images_data_source.go
@@ -0,0 +1,104 @@
+package provider
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "terraform-provider-binarylane/internal/binarylane"
+ "terraform-provider-binarylane/internal/data_sources"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+)
+
+var (
+ _ datasource.DataSource = &imagesDataSource{}
+ _ datasource.DataSourceWithConfigure = &imagesDataSource{}
+)
+
+func NewImagesDataSource() datasource.DataSource {
+ return &imagesDataSource{}
+}
+
+type imagesDataSource struct {
+ bc *BinarylaneClient
+}
+
+type imagesDataSourceModel struct {
+ data_sources.ImagesModel
+}
+
+func (d *imagesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_images"
+}
+
+func (d *imagesDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ bc, ok := req.ProviderData.(BinarylaneClient)
+ if !ok {
+ resp.Diagnostics.AddError(
+ "Unexpected Data Source Configure Type",
+ fmt.Sprintf("Expected *BinarylaneClient, got: %T.", req.ProviderData))
+ return
+ }
+
+ d.bc = &bc
+}
+
+func (d *imagesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = data_sources.ImagesDataSourceSchema(ctx)
+}
+
+func (d *imagesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var data imagesDataSourceModel
+
+ // Read Terraform configuration data into the model
+ resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ // Read API call logic
+ var page int32 = 1
+ perPage := int32(200)
+ var nextPage bool = true
+ var imgResults []binarylane.Image
+
+ for nextPage {
+ params := binarylane.GetImagesParams{
+ Page: &page,
+ PerPage: &perPage,
+ Type: data.Type.ValueStringPointer(),
+ }
+ listResp, err := d.bc.client.GetImagesWithResponse(ctx, ¶ms)
+ if err != nil {
+ resp.Diagnostics.AddError("Error listing images", err.Error())
+ return
+ }
+ if listResp.StatusCode() != http.StatusOK {
+ resp.Diagnostics.AddError("Unexpected status code listing images", string(listResp.Body))
+ return
+ }
+ imgResults = append(imgResults, *listResp.JSON200.Images...)
+
+ if listResp.JSON200.Links == nil || listResp.JSON200.Links.Pages == nil || listResp.JSON200.Links.Pages.Next == nil {
+ nextPage = false
+ break
+ }
+ page++
+ }
+
+ images, diags := types.ListValueFrom(ctx, data.Images.ElementType(ctx), imgResults)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ data.Images = images
+
+ // Save data into Terraform state
+ resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
+}
diff --git a/internal/provider/images_data_source_test.go b/internal/provider/images_data_source_test.go
new file mode 100644
index 0000000..06d943f
--- /dev/null
+++ b/internal/provider/images_data_source_test.go
@@ -0,0 +1,38 @@
+package provider
+
+import (
+ "fmt"
+ "strconv"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+func TestImagesDataSource(t *testing.T) {
+ resource.ParallelTest(t, resource.TestCase{
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ // Create and Read testing
+ {
+ Config: providerConfig + `
+data "binarylane_images" "test" {
+}
+`,
+ Check: resource.ComposeAggregateTestCheckFunc(
+ // Verify data source values
+ resource.TestCheckResourceAttrWith("data.binarylane_images.test", "images.#", func(value string) error {
+ count, err := strconv.Atoi(value)
+ if err != nil {
+ return err
+ }
+ if count < 1 {
+ return fmt.Errorf("expected at least one image, got: %d", count)
+ }
+ return nil
+ }),
+ resource.TestCheckResourceAttrSet("data.binarylane_images.test", "images.0.id"),
+ ),
+ },
+ },
+ })
+}
diff --git a/internal/provider/load_balancer_data_source.go b/internal/provider/load_balancer_data_source.go
index 5a3b1d5..94f0ae7 100644
--- a/internal/provider/load_balancer_data_source.go
+++ b/internal/provider/load_balancer_data_source.go
@@ -62,7 +62,7 @@ func (d *loadBalancerDataSource) Schema(ctx context.Context, req datasource.Sche
return
}
resp.Schema = *ds
- // resp.Schema.Description = "TODO"
+ resp.Schema.Description = "Retrieve details about a BinaryLane Load Balancer."
}
func (d *loadBalancerDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
diff --git a/internal/provider/load_balancer_resource.go b/internal/provider/load_balancer_resource.go
index cd1c5d3..7536dd0 100644
--- a/internal/provider/load_balancer_resource.go
+++ b/internal/provider/load_balancer_resource.go
@@ -62,7 +62,9 @@ func (d *loadBalancerResource) Configure(_ context.Context, req resource.Configu
func (r *loadBalancerResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = resources.LoadBalancerResourceSchema(ctx)
- // resp.Schema.Description = "TODO"
+ resp.Schema.Description = "Provides a BinaryLane Load Balancer resource. This can be used to create, update, and delete load balancers."
+ resp.Schema.MarkdownDescription = resp.Schema.Description +
+ " See [the docs](https://support.binarylane.com.au/support/solutions/articles/1000025661-load-balancer) for more information."
// Overrides
id := resp.Schema.Attributes["id"]
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
index 29cc31b..d8da0f9 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
@@ -41,12 +41,12 @@ func (p *binarylaneProvider) Schema(_ context.Context, _ provider.SchemaRequest,
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"api_endpoint": schema.StringAttribute{
- MarkdownDescription: "Binary Lane API endpoint. If not set checks env for `BINARYLANE_API_ENDPOINT`. " +
- "Default: `https://api.binarylane.com.au/v2`.",
+ MarkdownDescription: "Binary Lane API endpoint. Defaults to `https://api.binarylane.com.au/v2`, but can be " +
+ "overridden by setting this attribute or the `BINARYLANE_API_ENDPOINT` environment variable.",
Optional: true,
},
"api_token": schema.StringAttribute{
- MarkdownDescription: "Binary Lane API token. If not set checks env for `BINARYLANE_API_TOKEN`.",
+ MarkdownDescription: "Binary Lane API token. If not defined, will default to `BINARYLANE_API_TOKEN` environment variable.",
Optional: true,
Sensitive: true,
},
@@ -93,6 +93,9 @@ func (p *binarylaneProvider) DataSources(_ context.Context) []func() datasource.
NewVpcDataSource,
NewVpcRouteEntriesDataSource,
NewLoadBalancerDataSource,
+ NewImagesDataSource,
+ NewRegionsDataSource,
+ NewSizesDataSource,
}
}
diff --git a/internal/provider/regions_data_source.go b/internal/provider/regions_data_source.go
new file mode 100644
index 0000000..223d5fc
--- /dev/null
+++ b/internal/provider/regions_data_source.go
@@ -0,0 +1,103 @@
+package provider
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "terraform-provider-binarylane/internal/binarylane"
+ "terraform-provider-binarylane/internal/data_sources"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+)
+
+var (
+ _ datasource.DataSource = ®ionsDataSource{}
+ _ datasource.DataSourceWithConfigure = ®ionsDataSource{}
+)
+
+func NewRegionsDataSource() datasource.DataSource {
+ return ®ionsDataSource{}
+}
+
+type regionsDataSource struct {
+ bc *BinarylaneClient
+}
+
+type regionsDataSourceModel struct {
+ data_sources.RegionsModel
+}
+
+func (d *regionsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_regions"
+}
+
+func (d *regionsDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ bc, ok := req.ProviderData.(BinarylaneClient)
+ if !ok {
+ resp.Diagnostics.AddError(
+ "Unexpected Data Source Configure Type",
+ fmt.Sprintf("Expected *BinarylaneClient, got: %T.", req.ProviderData))
+ return
+ }
+
+ d.bc = &bc
+}
+
+func (d *regionsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = data_sources.RegionsDataSourceSchema(ctx)
+}
+
+func (d *regionsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var data regionsDataSourceModel
+
+ // Read Terraform configuration data into the model
+ resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ // Read API call logic
+ var page int32 = 1
+ perPage := int32(200)
+ var nextPage bool = true
+ var regResults []binarylane.Region
+
+ for nextPage {
+ params := binarylane.GetRegionsParams{
+ Page: &page,
+ PerPage: &perPage,
+ }
+ listResp, err := d.bc.client.GetRegionsWithResponse(ctx, ¶ms)
+ if err != nil {
+ resp.Diagnostics.AddError("Error listing regions", err.Error())
+ return
+ }
+ if listResp.StatusCode() != http.StatusOK {
+ resp.Diagnostics.AddError("Unexpected status code listing regions", string(listResp.Body))
+ return
+ }
+ regResults = append(regResults, listResp.JSON200.Regions...)
+
+ if listResp.JSON200.Links == nil || listResp.JSON200.Links.Pages == nil || listResp.JSON200.Links.Pages.Next == nil {
+ nextPage = false
+ break
+ }
+ page++
+ }
+
+ regions, diags := types.ListValueFrom(ctx, data.Regions.ElementType(ctx), regResults)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ data.Regions = regions
+
+ // Save data into Terraform state
+ resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
+}
diff --git a/internal/provider/regions_data_source_test.go b/internal/provider/regions_data_source_test.go
new file mode 100644
index 0000000..6f8307c
--- /dev/null
+++ b/internal/provider/regions_data_source_test.go
@@ -0,0 +1,38 @@
+package provider
+
+import (
+ "fmt"
+ "strconv"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+func TestRegionsDataSource(t *testing.T) {
+ resource.ParallelTest(t, resource.TestCase{
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ // Create and Read testing
+ {
+ Config: providerConfig + `
+data "binarylane_regions" "test" {
+}
+`,
+ Check: resource.ComposeAggregateTestCheckFunc(
+ // Verify data source values
+ resource.TestCheckResourceAttrWith("data.binarylane_regions.test", "regions.#", func(value string) error {
+ count, err := strconv.Atoi(value)
+ if err != nil {
+ return err
+ }
+ if count < 1 {
+ return fmt.Errorf("expected at least one region, got: %d", count)
+ }
+ return nil
+ }),
+ resource.TestCheckResourceAttrSet("data.binarylane_regions.test", "regions.0.slug"),
+ ),
+ },
+ },
+ })
+}
diff --git a/internal/provider/server_data_source.go b/internal/provider/server_data_source.go
index 7804d09..3580b18 100644
--- a/internal/provider/server_data_source.go
+++ b/internal/provider/server_data_source.go
@@ -68,7 +68,7 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
return
}
resp.Schema = *ds
- resp.Schema.Description = "Provides a Binary Lane Server data source. This can be used to read existing server details."
+ resp.Schema.Description = "Retrieve details about a BinaryLane Server."
// Overrides
id := resp.Schema.Attributes["id"]
diff --git a/internal/provider/server_firewall_rules_data_source.go b/internal/provider/server_firewall_rules_data_source.go
index 7ee6b7f..1acc271 100644
--- a/internal/provider/server_firewall_rules_data_source.go
+++ b/internal/provider/server_firewall_rules_data_source.go
@@ -43,7 +43,7 @@ func (d *serverFirewallRulesDataSource) Schema(ctx context.Context, req datasour
return
}
resp.Schema = *ds
- // resp.Schema.Description = "TODO"
+ resp.Schema.Description = "Retrieve details about the External Firewall Rules assigned to a BinaryLane server."
}
func (d *serverFirewallRulesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
diff --git a/internal/provider/server_firewall_rules_resource.go b/internal/provider/server_firewall_rules_resource.go
index edc7a17..d046f87 100644
--- a/internal/provider/server_firewall_rules_resource.go
+++ b/internal/provider/server_firewall_rules_resource.go
@@ -59,6 +59,7 @@ 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 = "Retrieve details about the External Firewall Rules assigned to a BinaryLane server."
// Overrides
serverId := resp.Schema.Attributes["server_id"]
@@ -265,6 +266,7 @@ func GetFirewallRulesState(ctx context.Context, firewallRules *[]binarylane.Adva
return basetypes.NewListUnknown(firewallRulesValue.Type(ctx)), diags
}
+ // TODO: This panics if invalid, should be handled better
ruleValue := resources.NewFirewallRulesValueMust(firewallRulesValue.AttributeTypes(ctx), map[string]attr.Value{
"description": types.StringPointerValue(rule.Description),
"action": types.StringValue(string(rule.Action)),
diff --git a/internal/provider/server_firewall_rules_resource_test.go b/internal/provider/server_firewall_rules_resource_test.go
index 3e7f510..9332738 100644
--- a/internal/provider/server_firewall_rules_resource_test.go
+++ b/internal/provider/server_firewall_rules_resource_test.go
@@ -78,11 +78,6 @@ data "binarylane_server_firewall_rules" "test" {
),
},
// ImportState testing
- // {
- // ResourceName: "binarylane_server.test",
- // ImportState: true,
- // ImportStateVerify: true,
- // },
{
ResourceName: "binarylane_server_firewall_rules.test",
ImportState: true,
diff --git a/internal/provider/sizes_data_source.go b/internal/provider/sizes_data_source.go
new file mode 100644
index 0000000..a09a413
--- /dev/null
+++ b/internal/provider/sizes_data_source.go
@@ -0,0 +1,103 @@
+package provider
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "terraform-provider-binarylane/internal/binarylane"
+ "terraform-provider-binarylane/internal/data_sources"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+)
+
+var (
+ _ datasource.DataSource = &sizesDataSource{}
+ _ datasource.DataSourceWithConfigure = &sizesDataSource{}
+)
+
+func NewSizesDataSource() datasource.DataSource {
+ return &sizesDataSource{}
+}
+
+type sizesDataSource struct {
+ bc *BinarylaneClient
+}
+
+type sizesDataSourceModel struct {
+ data_sources.SizesModel
+}
+
+func (d *sizesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_sizes"
+}
+
+func (d *sizesDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ bc, ok := req.ProviderData.(BinarylaneClient)
+ if !ok {
+ resp.Diagnostics.AddError(
+ "Unexpected Data Source Configure Type",
+ fmt.Sprintf("Expected *BinarylaneClient, got: %T.", req.ProviderData))
+ return
+ }
+
+ d.bc = &bc
+}
+
+func (d *sizesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = data_sources.SizesDataSourceSchema(ctx)
+}
+
+func (d *sizesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var data sizesDataSourceModel
+
+ // Read Terraform configuration data into the model
+ resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ // Read API call logic
+ var page int32 = 1
+ perPage := int32(200)
+ var nextPage bool = true
+ var regResults []binarylane.Size
+
+ for nextPage {
+ params := binarylane.GetSizesParams{
+ Page: &page,
+ PerPage: &perPage,
+ }
+ listResp, err := d.bc.client.GetSizesWithResponse(ctx, ¶ms)
+ if err != nil {
+ resp.Diagnostics.AddError("Error listing sizes", err.Error())
+ return
+ }
+ if listResp.StatusCode() != http.StatusOK {
+ resp.Diagnostics.AddError("Unexpected status code listing sizes", string(listResp.Body))
+ return
+ }
+ regResults = append(regResults, listResp.JSON200.Sizes...)
+
+ if listResp.JSON200.Links == nil || listResp.JSON200.Links.Pages == nil || listResp.JSON200.Links.Pages.Next == nil {
+ nextPage = false
+ break
+ }
+ page++
+ }
+
+ sizes, diags := types.ListValueFrom(ctx, data.Sizes.ElementType(ctx), regResults)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ data.Sizes = sizes
+
+ // Save data into Terraform state
+ resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
+}
diff --git a/internal/provider/sizes_data_source_test.go b/internal/provider/sizes_data_source_test.go
new file mode 100644
index 0000000..144859b
--- /dev/null
+++ b/internal/provider/sizes_data_source_test.go
@@ -0,0 +1,38 @@
+package provider
+
+import (
+ "fmt"
+ "strconv"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+func TestSizesDataSource(t *testing.T) {
+ resource.ParallelTest(t, resource.TestCase{
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ // Create and Read testing
+ {
+ Config: providerConfig + `
+data "binarylane_sizes" "test" {
+}
+`,
+ Check: resource.ComposeAggregateTestCheckFunc(
+ // Verify data source values
+ resource.TestCheckResourceAttrWith("data.binarylane_sizes.test", "sizes.#", func(value string) error {
+ count, err := strconv.Atoi(value)
+ if err != nil {
+ return err
+ }
+ if count < 1 {
+ return fmt.Errorf("expected at least one size, got: %d", count)
+ }
+ return nil
+ }),
+ resource.TestCheckResourceAttrSet("data.binarylane_sizes.test", "sizes.0.slug"),
+ ),
+ },
+ },
+ })
+}
diff --git a/internal/provider/vpc_route_entries_resource.go b/internal/provider/vpc_route_entries_resource.go
index 334b8a1..657c6d7 100644
--- a/internal/provider/vpc_route_entries_resource.go
+++ b/internal/provider/vpc_route_entries_resource.go
@@ -244,6 +244,7 @@ func GetRouteEntriesState(ctx context.Context, routeEntries *[]binarylane.RouteE
routeEntriesValues = []resources.RouteEntriesValue{}
} else {
for _, route := range *routeEntries {
+ // TODO: This panics if invalid, should be handled better
r := resources.NewRouteEntriesValueMust(routeEntriesValue.AttributeTypes(ctx), map[string]attr.Value{
"description": types.StringValue(*route.Description),
"destination": types.StringValue(*route.Destination),
diff --git a/provider-transform.sh b/provider-transform.sh
deleted file mode 100755
index 07ad639..0000000
--- a/provider-transform.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-# The current provider generator will generate duplicate `OptionsType`s, so we
-# need to fix that by replacing `"name": "options"` with `"name": "options1"`,
-# `"name": "options2"`, etc. in the provider_code_spec.json file.
-
-sed -i '0,/"name": "options"/ s/"name": "options"/"name": "options1"/' provider_code_spec.json
-sed -i '0,/"name": "options"/ s/"name": "options"/"name": "options2"/' provider_code_spec.json
-sed -i '0,/"name": "options"/ s/"name": "options"/"name": "options3"/' provider_code_spec.json
diff --git a/provider_code_spec.json b/provider_code_spec.json
index 59d464e..0673ab4 100644
--- a/provider_code_spec.json
+++ b/provider_code_spec.json
@@ -1,4 +1,699 @@
{
+ "datasources": [
+ {
+ "name": "images",
+ "schema": {
+ "attributes": [
+ {
+ "name": "type",
+ "string": {
+ "computed_optional_required": "computed_optional",
+ "description": "Queries for distribution will include images that have pre-installed applications."
+ }
+ },
+ {
+ "name": "images",
+ "list_nested": {
+ "computed_optional_required": "computed",
+ "nested_object": {
+ "attributes": [
+ {
+ "name": "backup_info",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "backup_disks",
+ "list_nested": {
+ "computed_optional_required": "computed",
+ "nested_object": {
+ "attributes": [
+ {
+ "name": "description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "A description of this disk."
+ }
+ },
+ {
+ "name": "id",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The ID of this backup disk."
+ }
+ },
+ {
+ "name": "min_disk_size",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "This is the minimum disk size in GB required to restore this disk image."
+ }
+ },
+ {
+ "name": "size_gigabytes",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "This is the compressed size of the disk image in GB."
+ }
+ }
+ ]
+ },
+ "description": "A list of the individual disks that make up this backup."
+ }
+ },
+ {
+ "name": "iso",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "If this is true the backup is an ISO image and cannot be restored or downloaded. ISO images may only be attached for use as a boot disk or an additional disk."
+ }
+ },
+ {
+ "name": "locked",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "If this is true the backup is locked and cannot be replaced."
+ }
+ },
+ {
+ "name": "offsite",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "If this is true, an attempt to create an offsite copy was made. This does not mean that the offsite copy attempt was successful or that the copy still exists."
+ }
+ },
+ {
+ "name": "server_id",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The server ID that was used to create this backup."
+ }
+ },
+ {
+ "name": "type",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "\n| Value | Description |\n| ----- | ----------- |\n| daily | A backup which is scheduled to be taken each day. |\n| weekly | A backup which is scheduled to be taken each week. |\n| monthly | A backup which is scheduled to be taken each month. |\n| temporary | A backup which is created on demand and only retained for a maximum of seven days. |\n\n"
+ }
+ }
+ ],
+ "description": "If this image is a backup, this object will provide further information."
+ }
+ },
+ {
+ "name": "created_at",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If this is a backup image this is the date and time in ISO8601 format when the image was created."
+ }
+ },
+ {
+ "name": "description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "A description that may provide further details or warnings about the image."
+ }
+ },
+ {
+ "name": "distribution",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If this is an operating system image, this is the name of the distribution. If this is a backup image, this is the name of the distribution the server is using."
+ }
+ },
+ {
+ "name": "distribution_info",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "features",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "Features supported by this distribution."
+ }
+ },
+ {
+ "name": "image_id",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "If this is a backup image, the operating system ID of the server at the time the backup was created."
+ }
+ },
+ {
+ "name": "password_recovery",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "Supported methods of password recovery.\n\n| Value | Description |\n| ----- | ----------- |\n| manual | Password must be reset manually using the recovery console and rescue disk. |\n| offline-clear | Password can be cleared for the admin/root user only. New password needs to be provided on login via the console (Requires restart). |\n| offline-change | Password can be reset and new credentials sent (Requires restart). |\n| online-change | Password may be reset without requiring a reboot via installed QEMU Guest Agent. |\n\n"
+ }
+ },
+ {
+ "name": "remote_access_user",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "User name to use when connecting via remote access (RDP or SSH)."
+ }
+ }
+ ],
+ "description": "This object may provide further information about the distribution."
+ }
+ },
+ {
+ "name": "distribution_surcharges",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "surcharge_base_cost",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost for using this operating system as the base image for a size."
+ }
+ },
+ {
+ "name": "surcharge_min_vcpu",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The minimum vcpu count for surcharge calculations."
+ }
+ },
+ {
+ "name": "surcharge_per_memory_max_megabytes",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The maximum memory in MB that counts towards the surcharge_per_memory_mb. Any memory above this cap does not attract the surcharge."
+ }
+ },
+ {
+ "name": "surcharge_per_memory_megabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per MB for using this operating system as the base image for a size."
+ }
+ },
+ {
+ "name": "surcharge_per_vcpu",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per vcpu for using this operating system as the base image for a size."
+ }
+ }
+ ],
+ "description": "If this is not null the use of this image may incur surcharges above the base cost of the server. All costs are in AU$."
+ }
+ },
+ {
+ "name": "error_message",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If the image creation failed this may provide further information."
+ }
+ },
+ {
+ "name": "full_name",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If this is an operating system image, this is the name and version of the distribution. If this is a backup image, this is the server hostname and label of the backup if it exists, otherwise it is the server hostname and UTC timestamp of the creation of the image."
+ }
+ },
+ {
+ "name": "id",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The ID of this image."
+ }
+ },
+ {
+ "name": "min_disk_size",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "For a distribution image this is the minimum disk size in GB required to install the operating system. For a backup image this is the minimum total disk size in GB required to restore the backup."
+ }
+ },
+ {
+ "name": "min_memory_megabytes",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "This is minimum memory in MB necessary to support this operating system (or the base operating system for a backup image)."
+ }
+ },
+ {
+ "name": "name",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If this is an operating system image, this is the name of the operating system version. If this is a backup image, this is the label of the backup if it exists, otherwise it is the UTC timestamp of the creation of the image."
+ }
+ },
+ {
+ "name": "public",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "A public image is available to all users. A private image is available only to the account that created the image."
+ }
+ },
+ {
+ "name": "regions",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "The slugs of the regions where the image is available for use."
+ }
+ },
+ {
+ "name": "size_gigabytes",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "For a distribution image this is the disk size used in GB by the operating system on initial install. For a backup image this is the size of the compressed backup image in GB."
+ }
+ },
+ {
+ "name": "slug",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "If this is an operating system image this is a slug which may be used as an alternative to the ID as a reference."
+ }
+ },
+ {
+ "name": "status",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "\n| Value | Description |\n| ----- | ----------- |\n| NEW | The image is new. |\n| available | The image is available for use. |\n| pending | The image is pending and is not yet available for use. |\n| deleted | The image has been deleted and is no longer available for use. |\n\n"
+ }
+ },
+ {
+ "name": "type",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "\n| Value | Description |\n| ----- | ----------- |\n| custom | An image uploaded by a user. |\n| snapshot | A snapshot. Snapshot creation is not currently supported so only distribution images will have this value. |\n| backup | A backup of a server. |\n\n"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "regions",
+ "schema": {
+ "attributes": [
+ {
+ "name": "regions",
+ "list_nested": {
+ "computed_optional_required": "computed",
+ "nested_object": {
+ "attributes": [
+ {
+ "name": "available",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "Whether this region is available for the allocation of new resources."
+ }
+ },
+ {
+ "name": "features",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "A list of features available for resources in this region."
+ }
+ },
+ {
+ "name": "name",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The name of this region."
+ }
+ },
+ {
+ "name": "name_servers",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "A list of nameservers available for resources in this region."
+ }
+ },
+ {
+ "name": "sizes",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "The slugs of the sizes available in this region."
+ }
+ },
+ {
+ "name": "slug",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The unique slug for this region."
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "sizes",
+ "schema": {
+ "attributes": [
+ {
+ "name": "server_id",
+ "int64": {
+ "computed_optional_required": "computed_optional",
+ "description": "If supplied only sizes available for a resize the specified server will be returned. This parameter is only available when authenticated."
+ }
+ },
+ {
+ "name": "image",
+ "string": {
+ "computed_optional_required": "computed_optional",
+ "description": "If null or not provided regions that support the size are included in the returned objects regardless of operating system. If this is provided it must be the id or slug of an operating system image and will cause only valid regions for the size and operating system to be included in the returned objects."
+ }
+ },
+ {
+ "name": "sizes",
+ "list_nested": {
+ "computed_optional_required": "computed",
+ "nested_object": {
+ "attributes": [
+ {
+ "name": "available",
+ "bool": {
+ "computed_optional_required": "computed",
+ "description": "If this is false the size is not available for new servers."
+ }
+ },
+ {
+ "name": "cpu_description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "A description of the CPU provided in this size."
+ }
+ },
+ {
+ "name": "description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "A description of this size."
+ }
+ },
+ {
+ "name": "disk",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The included storage for this size in GB."
+ }
+ },
+ {
+ "name": "excess_transfer_cost_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The excess charged for any transfer above the included data transfer in AU$ per GB."
+ }
+ },
+ {
+ "name": "memory",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The included memory for this size in MB."
+ }
+ },
+ {
+ "name": "options",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "backups_cost_per_backup_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The cost per GB of storage of each selected backup. See the API support document for how to calculate the final cost of backups based on the options selected."
+ }
+ },
+ {
+ "name": "daily_backups",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The number of daily backups included in the base size cost."
+ }
+ },
+ {
+ "name": "discount_for_no_public_ipv4",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "This is the discount (if any) that is applied if no public IPv4 addresses are selected."
+ }
+ },
+ {
+ "name": "disk_cost_per_additional_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB per month for additional storage space."
+ }
+ },
+ {
+ "name": "disk_max",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The maximum storage in GB permitted on this size."
+ }
+ },
+ {
+ "name": "disk_min",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The minimum storage in GB permitted on this size."
+ }
+ },
+ {
+ "name": "ipv4_addresses_cost_per_address",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per public IPv4 address per month for additional IPv4 addresses."
+ }
+ },
+ {
+ "name": "ipv4_addresses_max",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The maximum number of IPv4 addresses permitted on this size."
+ }
+ },
+ {
+ "name": "memory_cost_per_additional_megabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per MB per month for additional memory."
+ }
+ },
+ {
+ "name": "memory_max",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The maximum memory in MB permitted on this size."
+ }
+ },
+ {
+ "name": "monthly_backups",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The number of monthly backups included in the base size cost."
+ }
+ },
+ {
+ "name": "offsite_backup_frequency_cost",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "daily_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB per month for enabling daily offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected."
+ }
+ },
+ {
+ "name": "monthly_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB per month for enabling monthly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected."
+ }
+ },
+ {
+ "name": "weekly_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB per month for enabling weekly offsite backups. Only the highest value of the daily, weekly and monthly is applied. See the API support document for how to calculate the final cost of backups based on the options selected."
+ }
+ }
+ ],
+ "description": "The additional cost per GB of storage for enabling offsite backups based on highest frequency of backups currently enabled. All costs are in AU$."
+ }
+ },
+ {
+ "name": "offsite_backups_cost_per_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB of storage for enabling offsite backups. See the API support document for how to calculate the final cost of backups based on the options selected."
+ }
+ },
+ {
+ "name": "restricted_disk_values",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "int64": {}
+ },
+ "description": "If this is null the normal valid values in the documentation for SizeOptionsRequest are used, otherwise only these values (in GB) are permitted."
+ }
+ },
+ {
+ "name": "transfer_cost_per_additional_gigabyte",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The additional cost per GB per month for additional included transfer."
+ }
+ },
+ {
+ "name": "transfer_max",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The maximum transfer in TB permitted for this size."
+ }
+ },
+ {
+ "name": "weekly_backups",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The number of weekly backups included in the base size cost."
+ }
+ }
+ ],
+ "description": "Available add-ons (optional features not included in the base price) for the size. All costs are in AU$ per month (pro-rated)."
+ }
+ },
+ {
+ "name": "price_hourly",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "Hourly price in AU$."
+ }
+ },
+ {
+ "name": "price_monthly",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "Monthly Price in AU$."
+ }
+ },
+ {
+ "name": "regions",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "A list of region slugs where this size is available regardless of stock.\nIf this a response to a query that included a selected operating system this response will only include regions where that operating system is available on this size,\notherwise not all regions listed will support all operating systems on this size."
+ }
+ },
+ {
+ "name": "regions_out_of_stock",
+ "list": {
+ "computed_optional_required": "computed",
+ "element_type": {
+ "string": {}
+ },
+ "description": "A list of region slugs where the size is normally available but is currently not available due to lack of stock."
+ }
+ },
+ {
+ "name": "size_type",
+ "single_nested": {
+ "computed_optional_required": "computed",
+ "attributes": [
+ {
+ "name": "description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The description of this size type, generally used to indicate the intended use case for sizes of this type."
+ }
+ },
+ {
+ "name": "name",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The name of this size type."
+ }
+ },
+ {
+ "name": "slug",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The slug of this size type."
+ }
+ }
+ ],
+ "description": "The type of this size, generally used to differentiate sizes optimized for different usages."
+ }
+ },
+ {
+ "name": "slug",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "The slug of this size."
+ }
+ },
+ {
+ "name": "storage_description",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "A description of the storage provided in this size."
+ }
+ },
+ {
+ "name": "transfer",
+ "float64": {
+ "computed_optional_required": "computed",
+ "description": "The included data transfer for this size in TB."
+ }
+ },
+ {
+ "name": "vcpu_units",
+ "string": {
+ "computed_optional_required": "computed",
+ "description": "This is the unit that the vcpus field counts, e.g. \"core\" or \"thread\"."
+ }
+ },
+ {
+ "name": "vcpus",
+ "int64": {
+ "computed_optional_required": "computed",
+ "description": "The count of virtual CPUs for this size. See vcpu_units for a description of how each virtual CPU maps to the underlying hardware."
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
"provider": {
"name": "binarylane"
},
diff --git a/provider_gen_config.yml b/provider_gen_config.yml
index d63ea8a..cd2d589 100644
--- a/provider_gen_config.yml
+++ b/provider_gen_config.yml
@@ -136,5 +136,35 @@ resources:
ignores:
- name
- vpc
-# data_sources:
-# Currently, don't need to generate data sources as they use the same schema as resources
+data_sources:
+ images:
+ read:
+ path: /images
+ method: GET
+ schema:
+ ignores:
+ - links
+ - meta
+ - page
+ - per_page
+ - private
+ regions:
+ read:
+ path: /regions
+ method: GET
+ schema:
+ ignores:
+ - links
+ - meta
+ - page
+ - per_page
+ sizes:
+ read:
+ path: /sizes
+ method: GET
+ schema:
+ ignores:
+ - links
+ - meta
+ - page
+ - per_page