forked from mirrors/terraform-provider-binarylane
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75a387e19d | |||
| 11e0302e71 | |||
| 4677e34166 | |||
| 3f518b2ca3 | |||
| 90b94254f1 | |||
| 46117cf31d | |||
| 394638ff57 | |||
| 239e48e940 | |||
| 2221f8c853 | |||
| 95487045c4 | |||
| 7f5bae6b15 |
+3
-3
@@ -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
|
||||
+ }
|
||||
```
|
||||
|
||||
@@ -18,8 +18,8 @@ Planned features:
|
||||
- [x] Servers
|
||||
- [x] Firewall Rules
|
||||
- [x] Cloud Init
|
||||
- [ ] Updating server properties
|
||||
- [ ] Backups
|
||||
- [x] Updating server properties
|
||||
- [ ] Customised Backups
|
||||
- [ ] Software
|
||||
- [ ] IPV6
|
||||
- [ ] Alerts
|
||||
|
||||
@@ -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 generated by tfplugindocs -->
|
||||
## 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))
|
||||
|
||||
<a id="nestedatt--images"></a>
|
||||
### 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. |
|
||||
|
||||
<a id="nestedatt--images--backup_info"></a>
|
||||
### 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. |
|
||||
|
||||
<a id="nestedatt--images--backup_info--backup_disks"></a>
|
||||
### 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.
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--images--distribution_info"></a>
|
||||
### 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).
|
||||
|
||||
|
||||
<a id="nestedatt--images--distribution_surcharges"></a>
|
||||
### 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.
|
||||
@@ -3,14 +3,20 @@
|
||||
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
|
||||
|
||||
|
||||
```terraform
|
||||
data "binarylane_load_balancer" "example" {
|
||||
id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -21,7 +27,7 @@ description: |-
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `forwarding_rules` (List of Object) The rules that control which traffic the load balancer will forward to servers in the pool. Leave null to accept a default "HTTP" only forwarding rule. (see [below for nested schema](#nestedatt--forwarding_rules))
|
||||
- `forwarding_rules` (Attributes List) The rules that control which traffic the load balancer will forward to servers in the pool. Leave null to accept a default "HTTP" only forwarding rule. (see [below for nested schema](#nestedatt--forwarding_rules))
|
||||
- `health_check` (Object) The rules that determine which servers are considered 'healthy' and in the server pool for the load balancer. Leave this null to accept appropriate defaults based on the forwarding_rules. (see [below for nested schema](#nestedatt--health_check))
|
||||
- `name` (String) The hostname of the load balancer.
|
||||
- `region` (String) Leave null to create an anycast load balancer.
|
||||
@@ -32,7 +38,7 @@ description: |-
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `entry_protocol` (String)
|
||||
- `entry_protocol` (String) The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
|
||||
|
||||
|
||||
<a id="nestedatt--health_check"></a>
|
||||
|
||||
@@ -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 generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `regions` (Attributes List) (see [below for nested schema](#nestedatt--regions))
|
||||
|
||||
<a id="nestedatt--regions"></a>
|
||||
### 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.
|
||||
@@ -3,14 +3,20 @@
|
||||
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
|
||||
|
||||
```terraform
|
||||
data "binarylane_server" "example" {
|
||||
id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -21,15 +27,17 @@ Provides a Binary Lane Server data source. This can be used to read existing ser
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `backups` (Boolean) If true this will enable two daily backups for the server. `options.daily_backups` will override this value if provided. Setting this to false has no effect.
|
||||
- `backups` (Boolean) If `true`, the server will be backed up twice per day. By default, backups are disabled.
|
||||
- `disk` (Number) The amount of storage in GB assigned to the server.
|
||||
- `image` (String) The slug of the selected operating system.
|
||||
- `name` (String) The hostname of your server, such as vps01.yourcompany.com. If not provided, the server will be created with a random name.
|
||||
- `memory` (Number) The amount of memory in MB assigned to the server.
|
||||
- `name` (String) The hostname of your server, such as vps01.yourcompany.com.
|
||||
- `permalink` (String) A randomly generated two-word identifier assigned to servers in regions that support this feature
|
||||
- `port_blocking` (Boolean) Port blocking of outgoing connections for email, SSH and Remote Desktop (TCP ports 22, 25, and 3389) is enabled by default for all new servers. If this is false port blocking will be disabled. Disabling port blocking is only available to reviewed accounts.
|
||||
- `private_ipv4_addresses` (List of String) The private IPv4 addresses assigned to the server.
|
||||
- `public_ipv4_addresses` (List of String) The public IPv4 addresses assigned to the server.
|
||||
- `region` (String) The slug of the selected region.
|
||||
- `size` (String) The slug of the selected size.
|
||||
- `ssh_keys` (List of Number) This is a list of SSH key ids. If this is null or not provided, any SSH keys that have been marked as default will be deployed (assuming the operating system supports SSH Keys). Submit an empty list to disable deployment of default keys.
|
||||
- `user_data` (String) If provided this will be used to initialise the new server. This must be left null if the Image does not support UserData, see DistributionInfo.Features for more information.
|
||||
- `vpc_id` (Number) Leave null to use default (public) network for the selected region.
|
||||
- `ssh_keys` (List of Number) This is a list of SSH key ids that were added to the server during creation.
|
||||
- `user_data` (String) A script or cloud-config YAML file to configure the server.
|
||||
- `vpc_id` (Number) ID of the Virtual Private Cloud (VPC) the server is connected to.
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
page_title: "binarylane_server_firewall_rules Data Source - terraform-provider-binarylane"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
TODO
|
||||
Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
|
||||
---
|
||||
|
||||
# binarylane_server_firewall_rules (Data Source)
|
||||
|
||||
TODO
|
||||
Retrieve details about the External Firewall Rules assigned to a BinaryLane server.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "binarylane_server_firewall_rules" "example" {
|
||||
server_id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -21,16 +27,16 @@ TODO
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `firewall_rules` (List of Object) A list of rules for the server. NB: that any existing rules that are not included will be removed. Submit an empty list to clear all rules. (see [below for nested schema](#nestedatt--firewall_rules))
|
||||
- `firewall_rules` (Attributes List) A list of rules for the server. NB: that any existing rules that are not included will be removed. Submit an empty list to clear all rules. (see [below for nested schema](#nestedatt--firewall_rules))
|
||||
|
||||
<a id="nestedatt--firewall_rules"></a>
|
||||
### Nested Schema for `firewall_rules`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `action` (String)
|
||||
- `description` (String)
|
||||
- `destination_addresses` (List of String)
|
||||
- `destination_ports` (List of String)
|
||||
- `protocol` (String)
|
||||
- `source_addresses` (List of String)
|
||||
- `action` (String) The action to take when there is a match on this rule.
|
||||
- `description` (String) A description to assist in identifying this rule. Commonly used to record the reason for the rule or the intent behind it, e.g. "Block access to RDP" or "Allow access from HQ".
|
||||
- `destination_addresses` (List of String) The destination addresses to match for this rule. Each address may be an individual IPv4 address or a range in IPv4 CIDR notation.
|
||||
- `destination_ports` (List of String) The destination ports to match for this rule. Leave null or empty to match on all ports.
|
||||
- `protocol` (String) The protocol to match for this rule.
|
||||
- `source_addresses` (List of String) The source addresses to match for this rule. Each address may be an individual IPv4 address or a range in IPv4 CIDR notation.
|
||||
|
||||
@@ -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 generated by tfplugindocs -->
|
||||
## 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))
|
||||
|
||||
<a id="nestedatt--sizes"></a>
|
||||
### 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.
|
||||
|
||||
<a id="nestedatt--sizes--options"></a>
|
||||
### 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.
|
||||
|
||||
<a id="nestedatt--sizes--options--offsite_backup_frequency_cost"></a>
|
||||
### 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.
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--sizes--size_type"></a>
|
||||
### 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.
|
||||
@@ -10,7 +10,13 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "binarylane_ssh_key" "example" {
|
||||
id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -21,7 +27,7 @@ description: |-
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `default` (Boolean) Optional: If true this will be added to all new server installations (if we support SSH Key injection for the server's operating system).
|
||||
- `default` (Boolean) If `true`, this SSH key will be included on all new server installations (if the operating system supports SSH key injection).
|
||||
- `fingerprint` (String) The fingerprint of the SSH key.
|
||||
- `name` (String) A name to help you identify the key.
|
||||
- `public_key` (String) The public key in OpenSSH "authorized_keys" format.
|
||||
|
||||
@@ -10,7 +10,13 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "binarylane_vpc" "example" {
|
||||
id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
@@ -10,7 +10,13 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "binarylane_vpc_route_entries" "example" {
|
||||
vpc_id = 123456
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -21,13 +27,13 @@ description: |-
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `route_entries` (List of Object) Submit null to leave unaltered, submit an empty list to clear all route entries. It is not possible to PATCH individual route entries, to alter a route entry submit the entire list of route entries you wish to save. (see [below for nested schema](#nestedatt--route_entries))
|
||||
- `route_entries` (Attributes List) The route entries that control how network traffic is directed through the VPC environment. (see [below for nested schema](#nestedatt--route_entries))
|
||||
|
||||
<a id="nestedatt--route_entries"></a>
|
||||
### Nested Schema for `route_entries`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `description` (String)
|
||||
- `destination` (String)
|
||||
- `router` (String)
|
||||
- `description` (String) An optional description for the route.
|
||||
- `destination` (String) The destination address for this route entry. This may be in CIDR format.
|
||||
- `router` (String) The server that will receive traffic sent to the destination property in this VPC.
|
||||
|
||||
+18
-2
@@ -10,12 +10,28 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
terraform {
|
||||
required_providers {
|
||||
binarylane = {
|
||||
source = "oscarhermoso/binarylane"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "binarylane" {
|
||||
api_token = var.binarylane_api_token
|
||||
|
||||
# Or, set environment variable BINARYLANE_API_TOKEN
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -3,14 +3,30 @@
|
||||
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
|
||||
|
||||
```terraform
|
||||
resource "binarylane_server" "example" {
|
||||
count = 2
|
||||
# ...
|
||||
}
|
||||
|
||||
resource "binarylane_load_balancer" "example" {
|
||||
name = "tf-example-lb"
|
||||
forwarding_rules = [{ entry_protocol = "https" }]
|
||||
server_ids = [
|
||||
binarylane_server.example.0.id,
|
||||
binarylane_server.example.1.id
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -36,7 +52,7 @@ description: |-
|
||||
|
||||
Required:
|
||||
|
||||
- `entry_protocol` (String) The protocol that traffic must match for this load balancer to forward traffic according to this rule.
|
||||
- `entry_protocol` (String) The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
|
||||
|
||||
|
||||
<a id="nestedatt--health_check"></a>
|
||||
@@ -54,3 +70,11 @@ Optional:
|
||||
Optional:
|
||||
|
||||
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_load_balancer.example "<name or id>"
|
||||
```
|
||||
|
||||
@@ -3,35 +3,58 @@
|
||||
page_title: "binarylane_server Resource - terraform-provider-binarylane"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
Provides a Binary Lane Server resource. This can be used to create and delete servers.
|
||||
|
||||
---
|
||||
|
||||
# binarylane_server (Resource)
|
||||
|
||||
Provides a Binary Lane Server resource. This can be used to create and delete servers.
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "binarylane_server" "example" {
|
||||
name = "tf-example"
|
||||
region = "per" # or "syd", "mel", "bne", "sin"
|
||||
image = "ubuntu-24.04"
|
||||
size = "std-min" # 1 VPCU, 1 GB Memory, 20 GB NVME Storage, 1000 GB Data Transfer
|
||||
public_ipv4_count = 1
|
||||
|
||||
# Accepts a cloud-init script or cloud-config YAML file to configure the server
|
||||
# See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
|
||||
user_data = file("./init.sh")
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `image` (String) The slug of the selected operating system.
|
||||
- `public_ipv4_count` (Number) The number of public IPv4 addresses to assign to the server. If this is not provided, the server will be created with the default number of public IPv4 addresses.
|
||||
- `image` (String) The slug of the selected operating system, such as `debian-12`. You can fetch a full list of images from the BinaryLane API.
|
||||
- `public_ipv4_count` (Number) The number of public IPv4 addresses to assign to the server.
|
||||
- `region` (String) The slug of the selected region.
|
||||
- `size` (String) The slug of the selected size.
|
||||
|
||||
### Optional
|
||||
|
||||
- `backups` (Boolean) If true this will enable two daily backups for the server. `options.daily_backups` will override this value if provided. Setting this to false has no effect.
|
||||
- `backups` (Boolean) If `true` this will enable two daily backups for the server. By default, backups are disabled.
|
||||
- `disk` (Number) The total storage in GB for this server. Leave null to accept the default for the size Valid values:
|
||||
- must be a multiple of 5
|
||||
- \> 60 GB must be a multiple of 10
|
||||
- \> 200 GB must be a multiple of 100
|
||||
- `memory` (Number) The total memory in MB for this server. Leave null to accept the default size. Valid values:
|
||||
- must be a multiple of 128
|
||||
- \> 2048 MB must be a multiple of 1024
|
||||
- \> 16384 MB must be a multiple of 2048
|
||||
- \> 24576 MB must be a multiple of 4096
|
||||
- `name` (String) The hostname of your server, such as vps01.yourcompany.com. If not provided, the server will be created with a random name.
|
||||
- `password` (String, Sensitive) If this is provided the specified or default remote user's account password will be set to this value. Only valid if the server supports password change actions. If omitted and the server supports password change actions a random password will be generated and emailed to the account email address.
|
||||
- `port_blocking` (Boolean) Port blocking of outgoing connections for email, SSH and Remote Desktop (TCP ports 22, 25, and 3389) is enabled by default for all new servers. If this is false port blocking will be disabled. Disabling port blocking is only available to reviewed accounts.
|
||||
- `source_and_destination_check` (Boolean) This attribute can only be set if your server also has a `vpc_id` attribute set. When enabled (which is `true` by default), your server will only be able to send or receive packets that are directly addressed to one of the IP addresses associated with the Cloud Server. Generally, this is desirable behaviour because it prevents IP conflicts and other hard-to-diagnose networking faults due to incorrect network configuration. When `source_and_destination_check` is `false`, your Cloud Server will be able to send and receive packets addressed to any server. This is typically used when you want to use your Cloud Server as a VPN endpoint, a NAT server to provide internet access, or IP forwarding.
|
||||
- `ssh_keys` (List of Number) This is a list of SSH key ids. If this is null or not provided, any SSH keys that have been marked as default will be deployed (assuming the operating system supports SSH Keys). Submit an empty list to disable deployment of default keys.
|
||||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
|
||||
- `user_data` (String) If provided this will be used to initialise the new server. This must be left null if the Image does not support UserData, see DistributionInfo.Features for more information.
|
||||
- `user_data` (String) A script or cloud-config YAML file to configure the server. Can only be specified if the OS image supports UserData (i.e. not Windows). See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
|
||||
- `vpc_id` (Number) Leave null to use default (public) network for the selected region.
|
||||
|
||||
### Read-Only
|
||||
@@ -49,3 +72,11 @@ Optional:
|
||||
|
||||
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_server.example "<server name or id>"
|
||||
```
|
||||
|
||||
@@ -3,14 +3,34 @@
|
||||
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
|
||||
|
||||
```terraform
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
}
|
||||
|
||||
resource "binarylane_server_firewall_rules" "example" {
|
||||
server_id = binarylane_server.example.id
|
||||
firewall_rules = [
|
||||
{
|
||||
description = "Allow SSH"
|
||||
protocol = "tcp"
|
||||
source_addresses = ["0.0.0.0/0"]
|
||||
destination_addresses = [binarylane_server.example.private_ipv4_addresses.0]
|
||||
destination_ports = ["22"]
|
||||
action = "accept"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -34,3 +54,11 @@ Optional:
|
||||
|
||||
- `description` (String) A description to assist in identifying this rule. Commonly used to record the reason for the rule or the intent behind it, e.g. "Block access to RDP" or "Allow access from HQ".
|
||||
- `destination_ports` (List of String) The destination ports to match for this rule. Leave null or empty to match on all ports.
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_server_firewall_rules.example "<server name or id>"
|
||||
```
|
||||
|
||||
@@ -10,7 +10,21 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "binarylane_ssh_key" "example" {
|
||||
name = "tf-example"
|
||||
|
||||
# Generate with: ssh-keygen -t ed25519 -C "name@example.com"
|
||||
public_key = file("~/.ssh/id_ed25519.pub")
|
||||
}
|
||||
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
ssh_keys = [binarylane_ssh_key.example.id]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -22,9 +36,17 @@ description: |-
|
||||
|
||||
### Optional
|
||||
|
||||
- `default` (Boolean) Optional: If true this will be added to all new server installations (if we support SSH Key injection for the server's operating system).
|
||||
- `id` (Number) The ID or fingerprint of the SSH Key to fetch.
|
||||
- `default` (Boolean) If `true`, this SSH key will be included on all new server installations (if the operating system supports SSH key injection). Default is `false`.
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `fingerprint` (String) The fingerprint of the SSH key.
|
||||
- `id` (Number) The numeric ID of the SSH key.
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_ssh_key.example "<SSH Key ID or fingerprint>"
|
||||
```
|
||||
|
||||
@@ -10,7 +10,19 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "binarylane_vpc" "example" {
|
||||
name = "tf-example-vpc"
|
||||
ip_range = "10.240.0.0/16"
|
||||
}
|
||||
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -26,3 +38,11 @@ description: |-
|
||||
### Read-Only
|
||||
|
||||
- `id` (Number) The target vpc id.
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_vpc.example "<vpc_id>"
|
||||
```
|
||||
|
||||
@@ -10,7 +10,35 @@ description: |-
|
||||
|
||||
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "binarylane_vpc" "example" {
|
||||
name = "tf-example-vpc"
|
||||
ip_range = "10.240.0.0/16"
|
||||
}
|
||||
|
||||
resource "binarylane_server" "web" {
|
||||
# ...
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
}
|
||||
|
||||
resource "binarylane_vpc_route_entries" "example" {
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
route_entries = [
|
||||
{
|
||||
description = "NAT"
|
||||
destination = "0.0.0.0/0"
|
||||
router = binarylane_server.web.private_ipv4_addresses.0
|
||||
},
|
||||
{
|
||||
description = "VPN"
|
||||
destination = "192.168.1.0/24"
|
||||
router = binarylane_server.vpn.private_ipv4_addresses.0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
@@ -34,3 +62,11 @@ Required:
|
||||
Optional:
|
||||
|
||||
- `description` (String) An optional description for the route.
|
||||
|
||||
## Import
|
||||
|
||||
Import is supported using the following syntax:
|
||||
|
||||
```shell
|
||||
terraform import binarylane_vpc_route_entries.example "<vpc_id>"
|
||||
```
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
data "binarylane_images" "example" {
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_load_balancer" "example" {
|
||||
id = 123456
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
data "binarylane_regions" "example" {
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_server" "example" {
|
||||
id = 123456
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_server_firewall_rules" "example" {
|
||||
server_id = 123456
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
data "binarylane_sizes" "example" {
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_ssh_key" "example" {
|
||||
id = 123456
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_vpc" "example" {
|
||||
id = 123456
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
data "binarylane_vpc_route_entries" "example" {
|
||||
vpc_id = 123456
|
||||
}
|
||||
@@ -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
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
binarylane = {
|
||||
source = "oscarhermoso/binarylane"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "binarylane" {
|
||||
api_token = var.binarylane_api_token
|
||||
|
||||
# Or, set environment variable BINARYLANE_API_TOKEN
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_load_balancer.example "<name or id>"
|
||||
@@ -0,0 +1,13 @@
|
||||
resource "binarylane_server" "example" {
|
||||
count = 2
|
||||
# ...
|
||||
}
|
||||
|
||||
resource "binarylane_load_balancer" "example" {
|
||||
name = "tf-example-lb"
|
||||
forwarding_rules = [{ entry_protocol = "https" }]
|
||||
server_ids = [
|
||||
binarylane_server.example.0.id,
|
||||
binarylane_server.example.1.id
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_server.example "<server name or id>"
|
||||
@@ -0,0 +1,11 @@
|
||||
resource "binarylane_server" "example" {
|
||||
name = "tf-example"
|
||||
region = "per" # or "syd", "mel", "bne", "sin"
|
||||
image = "ubuntu-24.04"
|
||||
size = "std-min" # 1 VPCU, 1 GB Memory, 20 GB NVME Storage, 1000 GB Data Transfer
|
||||
public_ipv4_count = 1
|
||||
|
||||
# Accepts a cloud-init script or cloud-config YAML file to configure the server
|
||||
# See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script
|
||||
user_data = file("./init.sh")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_server_firewall_rules.example "<server name or id>"
|
||||
@@ -0,0 +1,17 @@
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
}
|
||||
|
||||
resource "binarylane_server_firewall_rules" "example" {
|
||||
server_id = binarylane_server.example.id
|
||||
firewall_rules = [
|
||||
{
|
||||
description = "Allow SSH"
|
||||
protocol = "tcp"
|
||||
source_addresses = ["0.0.0.0/0"]
|
||||
destination_addresses = [binarylane_server.example.private_ipv4_addresses.0]
|
||||
destination_ports = ["22"]
|
||||
action = "accept"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_ssh_key.example "<SSH Key ID or fingerprint>"
|
||||
@@ -0,0 +1,11 @@
|
||||
resource "binarylane_ssh_key" "example" {
|
||||
name = "tf-example"
|
||||
|
||||
# Generate with: ssh-keygen -t ed25519 -C "name@example.com"
|
||||
public_key = file("~/.ssh/id_ed25519.pub")
|
||||
}
|
||||
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
ssh_keys = [binarylane_ssh_key.example.id]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_vpc.example "<vpc_id>"
|
||||
@@ -0,0 +1,9 @@
|
||||
resource "binarylane_vpc" "example" {
|
||||
name = "tf-example-vpc"
|
||||
ip_range = "10.240.0.0/16"
|
||||
}
|
||||
|
||||
resource "binarylane_server" "example" {
|
||||
# ...
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
terraform import binarylane_vpc_route_entries.example "<vpc_id>"
|
||||
@@ -0,0 +1,25 @@
|
||||
resource "binarylane_vpc" "example" {
|
||||
name = "tf-example-vpc"
|
||||
ip_range = "10.240.0.0/16"
|
||||
}
|
||||
|
||||
resource "binarylane_server" "web" {
|
||||
# ...
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
}
|
||||
|
||||
resource "binarylane_vpc_route_entries" "example" {
|
||||
vpc_id = binarylane_vpc.example.id
|
||||
route_entries = [
|
||||
{
|
||||
description = "NAT"
|
||||
destination = "0.0.0.0/0"
|
||||
router = binarylane_server.web.private_ipv4_addresses.0
|
||||
},
|
||||
{
|
||||
description = "VPN"
|
||||
destination = "192.168.1.0/24"
|
||||
router = binarylane_server.vpn.private_ipv4_addresses.0
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -8,9 +8,9 @@ require (
|
||||
github.com/hashicorp/terraform-plugin-codegen-openapi v0.3.0
|
||||
github.com/hashicorp/terraform-plugin-docs v0.20.1
|
||||
github.com/hashicorp/terraform-plugin-framework v1.13.0
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0
|
||||
github.com/hashicorp/terraform-plugin-go v0.25.0
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.16.0
|
||||
github.com/hashicorp/terraform-plugin-go v0.26.0
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0
|
||||
github.com/hashicorp/terraform-plugin-testing v1.11.0
|
||||
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
|
||||
@@ -61,7 +61,7 @@ require (
|
||||
github.com/hashicorp/terraform-json v0.23.0 // indirect
|
||||
github.com/hashicorp/terraform-plugin-codegen-spec v0.2.0 // indirect
|
||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 // indirect
|
||||
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
|
||||
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
|
||||
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
|
||||
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||
github.com/huandu/xstrings v1.4.0 // indirect
|
||||
@@ -99,18 +99,18 @@ require (
|
||||
github.com/yuin/goldmark-meta v1.1.0 // indirect
|
||||
github.com/zclconf/go-cty v1.15.0 // indirect
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
|
||||
golang.org/x/crypto v0.29.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/sync v0.9.0 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/tools v0.22.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||
google.golang.org/grpc v1.67.1 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
google.golang.org/grpc v1.69.4 // indirect
|
||||
google.golang.org/protobuf v1.36.3 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -71,6 +71,10 @@ github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+
|
||||
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
|
||||
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||
@@ -149,20 +153,20 @@ github.com/hashicorp/terraform-plugin-docs v0.20.1 h1:Fq7E/HrU8kuZu3hNliZGwloFWS
|
||||
github.com/hashicorp/terraform-plugin-docs v0.20.1/go.mod h1:Yz6HoK7/EgzSrHPB9J/lWFzwl9/xep2OPnc5jaJDV90=
|
||||
github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw=
|
||||
github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU=
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E=
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY=
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0 h1:RXMmu7JgpFjnI1a5QjMCBb11usrW2OtAG+iOTIj5c9Y=
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0/go.mod h1:Bh89/hNmqsEWug4/XWKYBwtnw3tbz5BAy1L1OgvbIaY=
|
||||
github.com/hashicorp/terraform-plugin-go v0.25.0 h1:oi13cx7xXA6QciMcpcFi/rwA974rdTxjqEhXJjbAyks=
|
||||
github.com/hashicorp/terraform-plugin-go v0.25.0/go.mod h1:+SYagMYadJP86Kvn+TGeV+ofr/R3g4/If0O5sO96MVw=
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0 h1:I/N0g/eLZ1ZkLZXUQ0oRSXa8YG/EF0CEuQP1wXdrzKw=
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0/go.mod h1:t339KhmxnaF4SzdpxmqW8HnQBHVGYazwtfxU0qCs4eE=
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 h1:O9QqGoYDzQT7lwTXUsZEtgabeWW96zUBh47Smn2lkFA=
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.16.0/go.mod h1:Bh89/hNmqsEWug4/XWKYBwtnw3tbz5BAy1L1OgvbIaY=
|
||||
github.com/hashicorp/terraform-plugin-go v0.26.0 h1:cuIzCv4qwigug3OS7iKhpGAbZTiypAfFQmw8aE65O2M=
|
||||
github.com/hashicorp/terraform-plugin-go v0.26.0/go.mod h1:+CXjuLDiFgqR+GcrM5a2E2Kal5t5q2jb0E3D57tTdNY=
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
|
||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 h1:wyKCCtn6pBBL46c1uIIBNUOWlNfYXfXpVo16iDyLp8Y=
|
||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0/go.mod h1:B0Al8NyYVr8Mp/KLwssKXG1RqnTk7FySqSn4fRuLNgw=
|
||||
github.com/hashicorp/terraform-plugin-testing v1.11.0 h1:MeDT5W3YHbONJt2aPQyaBsgQeAIckwPX41EUHXEn29A=
|
||||
github.com/hashicorp/terraform-plugin-testing v1.11.0/go.mod h1:WNAHQ3DcgV/0J+B15WTE6hDvxcUdkPPpnB1FR3M910U=
|
||||
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
|
||||
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
|
||||
github.com/hashicorp/terraform-registry-address v0.2.4 h1:JXu/zHB2Ymg/TGVCRu10XqNa4Sh2bWcqCNyKWjnCPJA=
|
||||
github.com/hashicorp/terraform-registry-address v0.2.4/go.mod h1:tUNYTVyCtU4OIGXXMDp7WNcJ+0W1B4nmstVDgHMjfAU=
|
||||
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
|
||||
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
|
||||
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
|
||||
@@ -314,13 +318,23 @@ github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU=
|
||||
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
|
||||
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
|
||||
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
|
||||
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
|
||||
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
|
||||
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
|
||||
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
|
||||
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc=
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
@@ -337,14 +351,14 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -370,8 +384,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
@@ -382,8 +396,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
@@ -399,8 +413,8 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs
|
||||
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
||||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||
google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A=
|
||||
google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
@@ -409,8 +423,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
|
||||
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
+140
-1667
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -44,3 +51,85 @@ cat <<<$(jq '.components.schemas.CreateLoadBalancerRequest.properties.forwarding
|
||||
cat <<<$(jq '.components.schemas.ForwardingRule.properties.entry_protocol += {"x-oapi-codegen-extra-tags": {"tfsdk": "entry_protocol"}}' $OPENAPI_FILE) >$OPENAPI_FILE
|
||||
cat <<<$(jq '.components.schemas.LoadBalancer.properties.health_check += {"x-oapi-codegen-extra-tags": {"tfsdk": "health_check"}}' $OPENAPI_FILE) >$OPENAPI_FILE
|
||||
cat <<<$(jq '.components.schemas.HealthCheckProtocol |= del(.enum)' $OPENAPI_FILE) >$OPENAPI_FILE
|
||||
|
||||
## 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
|
||||
|
||||
+386
-2542
File diff suppressed because it is too large
Load Diff
+133
-388
@@ -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.
|
||||
@@ -421,6 +420,7 @@ const (
|
||||
PcI440fx4point2 VmMachineType = "pc_i440fx_4point2"
|
||||
PcI440fx5point0 VmMachineType = "pc_i440fx_5point0"
|
||||
PcI440fx5point1 VmMachineType = "pc_i440fx_5point1"
|
||||
PcI440fx7point2 VmMachineType = "pc_i440fx_7point2"
|
||||
)
|
||||
|
||||
// Account defines model for Account.
|
||||
@@ -492,7 +492,7 @@ type Action struct {
|
||||
// ResourceType The resource type (if any) associated with this action.
|
||||
ResourceType *ResourceType `json:"resource_type"`
|
||||
|
||||
// ResultData Returned information from a completed action. For example: a successful completed 'ping' action will have the ping value in ms in this field.
|
||||
// ResultData Returned information from a completed action. For example: a successful completed 'uptime' action will have the uptime value in this field.
|
||||
ResultData *string `json:"result_data"`
|
||||
|
||||
// StartedAt The timestamp in ISO8601 format of when processing of this action started.
|
||||
@@ -947,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.
|
||||
@@ -1303,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.
|
||||
//
|
||||
@@ -1317,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.
|
||||
@@ -1504,7 +1514,7 @@ type EnableIpv6Type string
|
||||
|
||||
// ForwardingRule defines model for ForwardingRule.
|
||||
type ForwardingRule struct {
|
||||
// EntryProtocol The protocol that traffic must match for this load balancer to forward traffic according to this rule.
|
||||
// EntryProtocol The protocol that traffic must match for the load balancer to forward it. Valid values are "http" and "https".
|
||||
EntryProtocol LoadBalancerRuleProtocol `json:"entry_protocol" tfsdk:"entry_protocol"`
|
||||
}
|
||||
|
||||
@@ -1533,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.
|
||||
@@ -1546,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.
|
||||
@@ -1642,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"`
|
||||
@@ -1966,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.
|
||||
@@ -2100,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.
|
||||
@@ -2152,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.
|
||||
@@ -2518,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.
|
||||
@@ -2678,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.
|
||||
@@ -2985,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 |
|
||||
// | ----- | ----------- |
|
||||
@@ -3014,6 +2996,7 @@ type VideoDevice string
|
||||
// | pc_i440fx_4point2 | PC I440 FX 4.2 |
|
||||
// | pc_i440fx_5point0 | PC I440 FX 5.0 |
|
||||
// | pc_i440fx_5point1 | PC I440 FX 5.1 |
|
||||
// | pc_i440fx_7point2 | PC I440 FX 7.2 |
|
||||
type VmMachineType string
|
||||
|
||||
// Vpc defines model for Vpc.
|
||||
@@ -3202,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"`
|
||||
@@ -3388,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"`
|
||||
@@ -3399,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
|
||||
@@ -3552,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
|
||||
|
||||
@@ -3648,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
|
||||
@@ -4427,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
|
||||
@@ -5307,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":
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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{},
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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)...)
|
||||
}
|
||||
@@ -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"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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"]
|
||||
@@ -237,6 +239,12 @@ func (r *loadBalancerResource) Read(ctx context.Context, req resource.ReadReques
|
||||
return
|
||||
}
|
||||
|
||||
if lbResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("Load balancer not found, removing from state: id=%s, name=%s", data.Id.String(), data.Name.ValueString()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
if lbResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
"Unexpected HTTP status code reading load balancer",
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)...)
|
||||
}
|
||||
@@ -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"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -30,6 +30,8 @@ type serverDataModel struct {
|
||||
PublicIpv4Addresses types.List `tfsdk:"public_ipv4_addresses"`
|
||||
PrivateIPv4Addresses types.List `tfsdk:"private_ipv4_addresses"`
|
||||
Permalink types.String `tfsdk:"permalink"`
|
||||
Memory types.Int32 `tfsdk:"memory"`
|
||||
Disk types.Int32 `tfsdk:"disk"`
|
||||
}
|
||||
|
||||
func (d *serverDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||
@@ -66,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"]
|
||||
@@ -76,10 +78,58 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
|
||||
Required: true, // ID is required to find the server
|
||||
}
|
||||
|
||||
nameDescription := "The hostname of your server, such as vps01.yourcompany.com."
|
||||
resp.Schema.Attributes["name"] = &schema.StringAttribute{
|
||||
Description: nameDescription,
|
||||
MarkdownDescription: nameDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
backupsDescription := "If `true`, the server will be backed up twice per day. By default, backups are disabled."
|
||||
resp.Schema.Attributes["backups"] = &schema.BoolAttribute{
|
||||
Description: backupsDescription,
|
||||
MarkdownDescription: backupsDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
sshKeysDescription := "This is a list of SSH key ids that were added to the server during creation."
|
||||
resp.Schema.Attributes["ssh_keys"] = &schema.ListAttribute{
|
||||
ElementType: types.Int64Type,
|
||||
Description: sshKeysDescription,
|
||||
MarkdownDescription: sshKeysDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
userDataDescription := "A script or cloud-config YAML file to configure the server."
|
||||
resp.Schema.Attributes["user_data"] = &schema.StringAttribute{
|
||||
Description: userDataDescription,
|
||||
MarkdownDescription: userDataDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
vpcIdDescription := "ID of the Virtual Private Cloud (VPC) the server is connected to."
|
||||
resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
|
||||
Description: vpcIdDescription,
|
||||
MarkdownDescription: vpcIdDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
// Additional attributes
|
||||
resp.Schema.Attributes["permalink"] = &schema.StringAttribute{
|
||||
Description: "A randomly generated two-word identifier assigned to servers in regions that support this feature",
|
||||
MarkdownDescription: "A randomly generated two-word identifier assigned to servers in regions that support this feature",
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
@@ -88,6 +138,8 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
|
||||
Description: publicIpv4AddressesDescription,
|
||||
MarkdownDescription: publicIpv4AddressesDescription,
|
||||
ElementType: types.StringType,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
@@ -96,6 +148,26 @@ func (d *serverDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
|
||||
Description: privateIpv4AddressesDescription,
|
||||
MarkdownDescription: privateIpv4AddressesDescription,
|
||||
ElementType: types.StringType,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
memoryDescription := "The amount of memory in MB assigned to the server."
|
||||
resp.Schema.Attributes["memory"] = &schema.Int32Attribute{
|
||||
Description: memoryDescription,
|
||||
MarkdownDescription: memoryDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
diskDescription := "The amount of storage in GB assigned to the server."
|
||||
resp.Schema.Attributes["disk"] = &schema.Int32Attribute{
|
||||
Description: diskDescription,
|
||||
MarkdownDescription: diskDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
}
|
||||
@@ -137,6 +209,8 @@ func (d *serverDataSource) Read(ctx context.Context, req datasource.ReadRequest,
|
||||
data.PortBlocking = types.BoolValue(serverResp.JSON200.Server.Networks.PortBlocking)
|
||||
data.VpcId = types.Int64PointerValue(serverResp.JSON200.Server.VpcId)
|
||||
data.Permalink = types.StringValue(*serverResp.JSON200.Server.Permalink)
|
||||
data.Memory = types.Int32Value(*serverResp.JSON200.Server.Memory)
|
||||
data.Disk = types.Int32Value(*serverResp.JSON200.Server.Disk)
|
||||
publicIpv4Addresses := []string{}
|
||||
privateIpv4Addresses := []string{}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -59,7 +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 = "TODO"
|
||||
resp.Schema.Description = "Retrieve details about the External Firewall Rules assigned to a BinaryLane server."
|
||||
|
||||
// Overrides
|
||||
serverId := resp.Schema.Attributes["server_id"]
|
||||
@@ -95,7 +95,7 @@ func (r *serverFirewallRulesResource) Create(ctx context.Context, req resource.C
|
||||
}
|
||||
|
||||
tflog.Debug(ctx, fmt.Sprintf("Creating server firewall rules: server_id=%s", data.ServerId.String()))
|
||||
serverResp, err := r.bc.client.PostServersServerIdActionsChangeAdvancedFirewallRulesWithResponse(
|
||||
fwResp, err := r.bc.client.PostServersServerIdActionsChangeAdvancedFirewallRulesWithResponse(
|
||||
ctx,
|
||||
data.ServerId.ValueInt64(),
|
||||
binarylane.PostServersServerIdActionsChangeAdvancedFirewallRulesJSONRequestBody{
|
||||
@@ -109,10 +109,15 @@ func (r *serverFirewallRulesResource) Create(ctx context.Context, req resource.C
|
||||
)
|
||||
return
|
||||
}
|
||||
if serverResp.StatusCode() != http.StatusOK {
|
||||
if fwResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("Server firewall rules not found, removing from state: server_id=%s", data.ServerId.String()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
if fwResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
"Unexpected HTTP status code creating server firewall rules",
|
||||
fmt.Sprintf("Received %s creating server firewall rules: server_id=%s. Details: %s", serverResp.Status(), data.ServerId.String(), serverResp.Body))
|
||||
fmt.Sprintf("Received %s creating server firewall rules: server_id=%s. Details: %s", fwResp.Status(), data.ServerId.String(), fwResp.Body))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -266,6 +271,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)),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -84,7 +84,6 @@ func (r *serverResource) Metadata(ctx context.Context, req resource.MetadataRequ
|
||||
|
||||
func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = resources.ServerResourceSchema(ctx)
|
||||
resp.Schema.Description = "Provides a Binary Lane Server resource. This can be used to create and delete servers."
|
||||
|
||||
// Overrides
|
||||
id := resp.Schema.Attributes["id"]
|
||||
@@ -100,10 +99,11 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
},
|
||||
}
|
||||
|
||||
imageDescription := "The slug of the selected operating system, such as `debian-12`. You can fetch a full list of images from the BinaryLane API."
|
||||
image := resp.Schema.Attributes["image"]
|
||||
resp.Schema.Attributes["image"] = &schema.StringAttribute{
|
||||
Description: image.GetDescription(),
|
||||
MarkdownDescription: image.GetMarkdownDescription(),
|
||||
Description: imageDescription,
|
||||
MarkdownDescription: imageDescription,
|
||||
Required: image.IsRequired(),
|
||||
Optional: image.IsOptional(),
|
||||
Computed: image.IsComputed(),
|
||||
@@ -112,14 +112,13 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
},
|
||||
}
|
||||
|
||||
backups := resp.Schema.Attributes["backups"]
|
||||
backupsDescription := "If `true` this will enable two daily backups for the server. By default, backups are disabled."
|
||||
resp.Schema.Attributes["backups"] = &schema.BoolAttribute{
|
||||
Description: backups.GetDescription(),
|
||||
MarkdownDescription: backups.GetMarkdownDescription(),
|
||||
Optional: backups.IsOptional(),
|
||||
Computed: backups.IsComputed(),
|
||||
Default: booldefault.StaticBool(false), // Add default to backups
|
||||
PlanModifiers: []planmodifier.Bool{boolplanmodifier.RequiresReplace()}, // TODO (#37)
|
||||
Description: backupsDescription,
|
||||
MarkdownDescription: backupsDescription,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false), // Add default to backups
|
||||
}
|
||||
|
||||
user_data := resp.Schema.Attributes["user_data"]
|
||||
@@ -135,7 +134,7 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
Description: vpcId.GetDescription(),
|
||||
MarkdownDescription: vpcId.GetMarkdownDescription(),
|
||||
Optional: vpcId.IsOptional(),
|
||||
Computed: false, // VPC ID is not computed, defined at creation
|
||||
Computed: false, // vpc_id is not computed, defined at creation
|
||||
}
|
||||
|
||||
portBlocking := resp.Schema.Attributes["port_blocking"]
|
||||
@@ -145,7 +144,19 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
Optional: portBlocking.IsOptional(),
|
||||
Computed: portBlocking.IsComputed(),
|
||||
Default: booldefault.StaticBool(true), // Add default to port_blocking
|
||||
PlanModifiers: []planmodifier.Bool{boolplanmodifier.RequiresReplace()},
|
||||
}
|
||||
|
||||
region := resp.Schema.Attributes["region"].(schema.StringAttribute)
|
||||
resp.Schema.Attributes["region"] = &schema.StringAttribute{
|
||||
Description: region.GetDescription(),
|
||||
MarkdownDescription: region.GetMarkdownDescription(),
|
||||
Optional: region.IsOptional(),
|
||||
Computed: region.IsComputed(),
|
||||
Required: region.IsRequired(),
|
||||
Validators: region.StringValidators(),
|
||||
PlanModifiers: []planmodifier.String{
|
||||
stringplanmodifier.RequiresReplace(),
|
||||
},
|
||||
}
|
||||
|
||||
sshKeys := resp.Schema.Attributes["ssh_keys"]
|
||||
@@ -160,6 +171,20 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
},
|
||||
}
|
||||
|
||||
userDataDescription := "A script or cloud-config YAML file to configure the server. Can only be specified if the OS image supports UserData (i.e. not Windows)." +
|
||||
" See more: https://cloudinit.readthedocs.io/en/latest/explanation/format.html#user-data-script"
|
||||
userData := resp.Schema.Attributes["user_data"]
|
||||
resp.Schema.Attributes["user_data"] = &schema.StringAttribute{
|
||||
Description: userDataDescription,
|
||||
MarkdownDescription: userDataDescription,
|
||||
Required: userData.IsRequired(),
|
||||
Optional: userData.IsOptional(),
|
||||
Computed: userData.IsComputed(),
|
||||
Validators: []validator.String{
|
||||
stringvalidator.LengthAtMost(65536),
|
||||
},
|
||||
}
|
||||
|
||||
// Additional attributes
|
||||
pwDescription :=
|
||||
"If this is provided the specified or default remote user's account password will be set to this value. " +
|
||||
@@ -171,20 +196,18 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
Optional: true, // Password optional, if not set will be emailed to user
|
||||
Computed: false, // Computed must be false to allow server to be created without password
|
||||
Sensitive: true, // Mark password as sensitive
|
||||
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
|
||||
}
|
||||
|
||||
publicIpv4CountDescription := "The number of public IPv4 addresses to assign to the server. If this is not provided, the " +
|
||||
"server will be created with the default number of public IPv4 addresses."
|
||||
publicIpv4CountDescription := "The number of public IPv4 addresses to assign to the server."
|
||||
resp.Schema.Attributes["public_ipv4_count"] = &schema.Int32Attribute{
|
||||
Description: publicIpv4CountDescription,
|
||||
MarkdownDescription: publicIpv4CountDescription,
|
||||
Required: true,
|
||||
Optional: false,
|
||||
Computed: false,
|
||||
// Default: int32default.StaticInt32(0), // TODO: Uncomment with 1.0 release (see issue #30)
|
||||
Validators: []validator.Int32{
|
||||
int32validator.AtLeast(0),
|
||||
int32validator.AtMost(8),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -260,6 +283,53 @@ func (r *serverResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
|
||||
},
|
||||
}
|
||||
|
||||
memoryDescription := `The total memory in MB for this server. Leave null to accept the default size.`
|
||||
memoryValidValues := "Valid values must be a multiple of 128. If the value is greater than 2048 MB, it must be a " +
|
||||
"multiple of 1024. If the value is greater than 16384 MB, it must be a multiple of 2048. If the value is greater " +
|
||||
"than 24576 MB, it must be a multiple of 4096."
|
||||
memoryValidValuesMarkdown := ` Valid values:
|
||||
- must be a multiple of 128
|
||||
- \> 2048 MB must be a multiple of 1024
|
||||
- \> 16384 MB must be a multiple of 2048
|
||||
- \> 24576 MB must be a multiple of 4096`
|
||||
|
||||
resp.Schema.Attributes["memory"] = &schema.Int32Attribute{
|
||||
Description: memoryDescription + memoryValidValues,
|
||||
MarkdownDescription: memoryDescription + memoryValidValuesMarkdown,
|
||||
Optional: true,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
Validators: []validator.Int32{
|
||||
int32validator.AtLeast(128),
|
||||
MultipleOfValidator{Multiple: 128},
|
||||
MultipleOfValidator{Multiple: 1024, RangeFrom: 2048, RangeTo: 16384},
|
||||
MultipleOfValidator{Multiple: 2048, RangeFrom: 16384, RangeTo: 24576},
|
||||
MultipleOfValidator{Multiple: 4096, RangeFrom: 24576},
|
||||
},
|
||||
}
|
||||
|
||||
diskDescription := `The total storage in GB for this server. Leave null to accept the default for the size`
|
||||
diskValidValues := "Valid values must be a multiple of 5. If the value is greater than 60 GB, it must be a multiple of 10. " +
|
||||
"if the value is greater than 200 GB, it must be a multiple of 100. "
|
||||
diskValidValuesMarkdown := ` Valid values:
|
||||
- must be a multiple of 5
|
||||
- \> 60 GB must be a multiple of 10
|
||||
- \> 200 GB must be a multiple of 100`
|
||||
|
||||
resp.Schema.Attributes["disk"] = &schema.Int32Attribute{
|
||||
Description: diskDescription + diskValidValues,
|
||||
MarkdownDescription: diskDescription + diskValidValuesMarkdown,
|
||||
Optional: true,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
Validators: []validator.Int32{
|
||||
int32validator.AtLeast(20),
|
||||
MultipleOfValidator{Multiple: 5},
|
||||
MultipleOfValidator{Multiple: 10, RangeFrom: 60, RangeTo: 200},
|
||||
MultipleOfValidator{Multiple: 100, RangeFrom: 200},
|
||||
},
|
||||
}
|
||||
|
||||
resp.Schema.Attributes["timeouts"] =
|
||||
timeouts.Attributes(ctx, timeouts.Opts{
|
||||
Create: true,
|
||||
@@ -274,6 +344,7 @@ func (r *serverResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan
|
||||
// Destruction plan, no modification needed
|
||||
return
|
||||
}
|
||||
|
||||
// Read Terraform plan data into the model
|
||||
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
@@ -293,6 +364,7 @@ func (r *serverResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan
|
||||
// Creation plan, no further modification needed
|
||||
return
|
||||
}
|
||||
|
||||
// Read Terraform state data into the model
|
||||
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
@@ -335,6 +407,14 @@ func (r *serverResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan
|
||||
)
|
||||
}
|
||||
|
||||
// Use state for unknown disk/memory values, as long as server size is the same
|
||||
if (plan.Memory.IsNull() || plan.Memory.IsUnknown()) && plan.Size.Equal(state.Size) {
|
||||
plan.Memory = state.Memory
|
||||
}
|
||||
if (plan.Disk.IsNull() || plan.Disk.IsUnknown()) && plan.Size.Equal(state.Size) {
|
||||
plan.Disk = state.Disk
|
||||
}
|
||||
|
||||
// Save data into Terraform state
|
||||
resp.Diagnostics.Append(resp.Plan.Set(ctx, &plan)...)
|
||||
}
|
||||
@@ -376,6 +456,14 @@ func (r *serverResource) Create(ctx context.Context, req resource.CreateRequest,
|
||||
Options: &binarylane.SizeOptionsRequest{
|
||||
Ipv4Addresses: data.PublicIpv4Count.ValueInt32Pointer(),
|
||||
},
|
||||
Backups: data.Backups.ValueBoolPointer(),
|
||||
}
|
||||
|
||||
if !data.Memory.IsNull() && !data.Memory.IsUnknown() {
|
||||
body.Options.Memory = data.Memory.ValueInt32Pointer()
|
||||
}
|
||||
if !data.Disk.IsNull() && !data.Disk.IsUnknown() {
|
||||
body.Options.Disk = data.Disk.ValueInt32Pointer()
|
||||
}
|
||||
|
||||
if data.Password.IsNull() {
|
||||
@@ -430,6 +518,8 @@ func (r *serverResource) Create(ctx context.Context, req resource.CreateRequest,
|
||||
data.VpcId = types.Int64PointerValue(serverResp.JSON200.Server.VpcId)
|
||||
data.Permalink = types.StringValue(*serverResp.JSON200.Server.Permalink)
|
||||
data.PasswordChangeSupported = types.BoolValue(*serverResp.JSON200.Server.PasswordChangeSupported)
|
||||
data.Memory = types.Int32Value(*serverResp.JSON200.Server.Memory)
|
||||
data.Disk = types.Int32Value(*serverResp.JSON200.Server.Disk)
|
||||
plannedSourceDestCheck := data.SourceAndDestinationCheck
|
||||
serverRespSourceDestCheck := types.BoolPointerValue(serverResp.JSON200.Server.Networks.SourceAndDestinationCheck)
|
||||
data.SourceAndDestinationCheck = serverRespSourceDestCheck
|
||||
@@ -486,6 +576,13 @@ func (r *serverResource) Read(ctx context.Context, req resource.ReadRequest, res
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if serverResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("Server not found, removing from state: id=%s, name=%s", data.Id.String(), data.Name.ValueString()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
if serverResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
fmt.Sprintf("Unexpected HTTP status code %s reading server: name=%s, id=%s", serverResp.Status(), data.Name.ValueString(), data.Id.String()),
|
||||
@@ -636,18 +733,42 @@ func (r *serverResource) Update(ctx context.Context, req resource.UpdateRequest,
|
||||
}
|
||||
|
||||
// Resize operation
|
||||
if !plan.Size.Equal(state.Size) || !plan.PublicIpv4Count.Equal(state.PublicIpv4Count) || !plan.Image.Equal(state.Image) {
|
||||
if !plan.Size.Equal(state.Size) ||
|
||||
!plan.Memory.IsNull() && !plan.Memory.IsUnknown() && !plan.Memory.Equal(state.Memory) ||
|
||||
!plan.Disk.IsNull() && !plan.Disk.IsUnknown() && !plan.Disk.Equal(state.Disk) ||
|
||||
!plan.Image.Equal(state.Image) ||
|
||||
!plan.PublicIpv4Count.Equal(state.PublicIpv4Count) {
|
||||
|
||||
resizeReq := &binarylane.PostServersServerIdActionsResizeJSONRequestBody{
|
||||
Type: "resize",
|
||||
Type: "resize",
|
||||
Options: &binarylane.ChangeSizeOptionsRequest{},
|
||||
}
|
||||
if !plan.Size.Equal(state.Size) {
|
||||
|
||||
if !plan.Size.Equal(state.Size) ||
|
||||
!plan.Memory.IsNull() && !plan.Memory.IsUnknown() && !plan.Memory.Equal(state.Memory) ||
|
||||
!plan.Disk.IsNull() && !plan.Disk.IsUnknown() && !plan.Disk.Equal(state.Disk) {
|
||||
|
||||
resizeReq.Size = plan.Size.ValueStringPointer()
|
||||
state.Size = plan.Size
|
||||
}
|
||||
if !plan.PublicIpv4Count.Equal(state.PublicIpv4Count) {
|
||||
resizeReq.Options = &binarylane.ChangeSizeOptionsRequest{
|
||||
Ipv4Addresses: plan.PublicIpv4Count.ValueInt32Pointer(),
|
||||
if !plan.Memory.IsUnknown() && !plan.Memory.IsNull() {
|
||||
resizeReq.Options.Memory = plan.Memory.ValueInt32Pointer()
|
||||
}
|
||||
if !plan.Disk.IsNull() && !plan.Disk.IsUnknown() {
|
||||
resizeReq.Options.Disk = plan.Disk.ValueInt32Pointer()
|
||||
}
|
||||
state.Size = plan.Size
|
||||
state.Memory = plan.Memory
|
||||
state.Disk = plan.Disk
|
||||
}
|
||||
|
||||
if !plan.Image.Equal(state.Image) {
|
||||
resizeReq.ChangeImage = &binarylane.ChangeImage{
|
||||
Image: plan.Image.ValueStringPointer(),
|
||||
}
|
||||
state.Image = plan.Image
|
||||
}
|
||||
|
||||
if !plan.PublicIpv4Count.Equal(state.PublicIpv4Count) {
|
||||
resizeReq.Options.Ipv4Addresses = plan.PublicIpv4Count.ValueInt32Pointer()
|
||||
if plan.PublicIpv4Count.ValueInt32() < state.PublicIpv4Count.ValueInt32() {
|
||||
currentIps := []string{}
|
||||
diags := state.PublicIpv4Addresses.ElementsAs(ctx, ¤tIps, false)
|
||||
@@ -665,12 +786,6 @@ func (r *serverResource) Update(ctx context.Context, req resource.UpdateRequest,
|
||||
state.PublicIpv4Count = plan.PublicIpv4Count
|
||||
state.PublicIpv4Addresses = plan.PublicIpv4Addresses
|
||||
}
|
||||
if !plan.Image.Equal(state.Image) {
|
||||
resizeReq.ChangeImage = &binarylane.ChangeImage{
|
||||
Image: plan.Image.ValueStringPointer(),
|
||||
}
|
||||
state.Image = plan.Image
|
||||
}
|
||||
|
||||
tflog.Info(ctx, fmt.Sprintf("Resizing server: server_id=%s", state.Id.String()))
|
||||
|
||||
@@ -699,10 +814,15 @@ func (r *serverResource) Update(ctx context.Context, req resource.UpdateRequest,
|
||||
return
|
||||
}
|
||||
|
||||
if state.PublicIpv4Addresses.IsUnknown() || listContainsUnknown(ctx, state.PublicIpv4Addresses) {
|
||||
// New IPs may have been allocated, so we need to check the server again
|
||||
if state.PublicIpv4Addresses.IsUnknown() || listContainsUnknown(ctx, state.PublicIpv4Addresses) || state.Memory.IsNull() || state.Memory.IsUnknown() {
|
||||
refreshNeeded = true
|
||||
}
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Rebuild operation
|
||||
@@ -754,6 +874,34 @@ func (r *serverResource) Update(ctx context.Context, req resource.UpdateRequest,
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
} else
|
||||
// Reset Password (only needed if server didn't rebuild)
|
||||
if !plan.Password.Equal(state.Password) {
|
||||
passwordResp, err := r.bc.client.PostServersServerIdActionsPasswordResetWithResponse(ctx, state.Id.ValueInt64(),
|
||||
binarylane.PasswordReset{
|
||||
Type: "password_reset",
|
||||
Password: plan.Password.ValueStringPointer(),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error resetting password", err.Error())
|
||||
return
|
||||
}
|
||||
err = r.waitForServerAction(ctx, state.Id.ValueInt64(), *passwordResp.JSON200.Action.Id)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error waiting for password reset", err.Error())
|
||||
return
|
||||
}
|
||||
state.Password = plan.Password
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Check source_and_destination_check
|
||||
@@ -768,6 +916,70 @@ func (r *serverResource) Update(ctx context.Context, req resource.UpdateRequest,
|
||||
|
||||
state.SourceAndDestinationCheck = plan.SourceAndDestinationCheck
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Enable or disable backups
|
||||
if !plan.Backups.Equal(state.Backups) {
|
||||
if plan.Backups.ValueBool() {
|
||||
backupResp, err := r.bc.client.PostServersServerIdActionsEnableBackupsWithResponse(ctx, state.Id.ValueInt64(), binarylane.EnableBackups{
|
||||
Type: "enable_backups",
|
||||
})
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error enabling backups", err.Error())
|
||||
return
|
||||
}
|
||||
err = r.waitForServerAction(ctx, state.Id.ValueInt64(), *backupResp.JSON200.Action.Id)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error waiting for backups to be enabled", err.Error())
|
||||
return
|
||||
}
|
||||
} else {
|
||||
backupResp, err := r.bc.client.PostServersServerIdActionsDisableBackupsWithResponse(ctx, state.Id.ValueInt64(), binarylane.DisableBackups{
|
||||
Type: "disable_backups",
|
||||
})
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error disabling backups", err.Error())
|
||||
return
|
||||
}
|
||||
err = r.waitForServerAction(ctx, state.Id.ValueInt64(), *backupResp.JSON200.Action.Id)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error waiting for backups to be disabled", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
state.Backups = plan.Backups
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Change port blocking
|
||||
if !plan.PortBlocking.Equal(state.PortBlocking) {
|
||||
portBlockingResp, err := r.bc.client.PostServersServerIdActionsChangePortBlockingWithResponse(ctx, state.Id.ValueInt64(),
|
||||
binarylane.ChangePortBlocking{
|
||||
Type: "change_port_blocking",
|
||||
Enabled: plan.PortBlocking.ValueBool(),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error changing \"port_blocking\" attribute", err.Error())
|
||||
return
|
||||
}
|
||||
err = r.waitForServerAction(ctx, state.Id.ValueInt64(), *portBlockingResp.JSON200.Action.Id)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error waiting for \"port_blocking\" attribute to change", err.Error())
|
||||
return
|
||||
}
|
||||
state.PortBlocking = plan.PortBlocking
|
||||
|
||||
// Save updated data into Terraform state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
}
|
||||
@@ -949,6 +1161,9 @@ func setServerResourceState(ctx context.Context, data *serverResourceModel, serv
|
||||
data.Permalink = types.StringValue(*serverResp.Server.Permalink)
|
||||
data.PasswordChangeSupported = types.BoolValue(*serverResp.Server.PasswordChangeSupported)
|
||||
data.SourceAndDestinationCheck = types.BoolPointerValue(serverResp.Server.Networks.SourceAndDestinationCheck)
|
||||
data.Memory = types.Int32Value(*serverResp.Server.Memory)
|
||||
data.Disk = types.Int32Value(*serverResp.Server.Disk)
|
||||
data.Backups = types.BoolValue(serverResp.Server.NextBackupWindow != nil)
|
||||
|
||||
publicIpv4Addresses := []string{}
|
||||
privateIpv4Addresses := []string{}
|
||||
|
||||
@@ -16,13 +16,13 @@ import (
|
||||
|
||||
func TestServerResource(t *testing.T) {
|
||||
// Must assign a password to the server or Binary Lane will send emails
|
||||
pw_bytes := make([]byte, 12)
|
||||
_, err := rand.Read(pw_bytes)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to generate password: %s", err)
|
||||
return
|
||||
}
|
||||
password := base64.URLEncoding.EncodeToString(pw_bytes)
|
||||
pwBytes := make([]byte, 12)
|
||||
rand.Read(pwBytes)
|
||||
password := base64.URLEncoding.EncodeToString(pwBytes)
|
||||
|
||||
pwBytes2 := make([]byte, 12)
|
||||
rand.Read(pwBytes2)
|
||||
password2 := base64.URLEncoding.EncodeToString(pwBytes2)
|
||||
|
||||
sshPublicKeyInitial := GeneratePublicKey(t)
|
||||
sshPublicKeyUpdated := GeneratePublicKey(t)
|
||||
@@ -56,11 +56,14 @@ resource "binarylane_server" "test" {
|
||||
region = "per"
|
||||
image = "debian-11"
|
||||
size = "std-min"
|
||||
memory = 1152
|
||||
password = "` + password + `"
|
||||
vpc_id = binarylane_vpc.test.id
|
||||
public_ipv4_count = 1
|
||||
ssh_keys = [binarylane_ssh_key.initial.id]
|
||||
source_and_destination_check = false
|
||||
backups = true
|
||||
port_blocking = false
|
||||
user_data = <<EOT
|
||||
#cloud-config
|
||||
echo "Hello World" > /var/tmp/output.txt
|
||||
@@ -80,6 +83,8 @@ data "binarylane_server" "test" {
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "region", "per"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "image", "debian-11"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "size", "std-min"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "memory", "1152"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "disk", "20"),
|
||||
resource.TestCheckResourceAttrSet("binarylane_server.test", "vpc_id"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "public_ipv4_count", "1"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "password", password),
|
||||
@@ -88,11 +93,12 @@ echo "Hello World" > /var/tmp/output.txt
|
||||
`),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "public_ipv4_addresses.#", "1"),
|
||||
resource.TestCheckResourceAttrSet("binarylane_server.test", "private_ipv4_addresses.0"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "port_blocking", "true"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "port_blocking", "false"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "ssh_keys.#", "1"),
|
||||
resource.TestCheckResourceAttrPair("binarylane_server.test", "ssh_keys.0", "binarylane_ssh_key.initial", "id"),
|
||||
resource.TestCheckResourceAttrSet("binarylane_server.test", "permalink"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "source_and_destination_check", "false"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "backups", "true"),
|
||||
|
||||
// Verify data source values
|
||||
resource.TestCheckResourceAttrPair("data.binarylane_server.test", "id", "binarylane_server.test", "id"),
|
||||
@@ -105,6 +111,10 @@ echo "Hello World" > /var/tmp/output.txt
|
||||
resource.TestCheckResourceAttr("data.binarylane_server.test", "user_data", `#cloud-config
|
||||
echo "Hello World" > /var/tmp/output.txt
|
||||
`),
|
||||
resource.TestCheckResourceAttr("data.binarylane_server.test", "memory", "1152"),
|
||||
resource.TestCheckResourceAttr("data.binarylane_server.test", "disk", "20"),
|
||||
resource.TestCheckResourceAttr("data.binarylane_server.test", "backups", "true"),
|
||||
resource.TestCheckResourceAttr("data.binarylane_server.test", "port_blocking", "false"),
|
||||
),
|
||||
},
|
||||
// Test import by ID
|
||||
@@ -147,11 +157,16 @@ resource "binarylane_server" "test" {
|
||||
region = "per"
|
||||
image = "debian-12"
|
||||
size = "std-1vcpu"
|
||||
disk = "45"
|
||||
password = "` + password + `"
|
||||
vpc_id = null
|
||||
public_ipv4_count = 0
|
||||
ssh_keys = [binarylane_ssh_key.updated.id]
|
||||
# source_and_destination_check = null # defaults to null when vpc_id is null
|
||||
|
||||
# source_and_destination_check = null # defaults to null
|
||||
# backups = false # defaults to false
|
||||
# port_blocking = true # defaults to true
|
||||
|
||||
user_data = <<EOT
|
||||
#cloud-config
|
||||
echo "Hello Whitespace" > /var/tmp/output.txt
|
||||
@@ -163,6 +178,8 @@ EOT
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "name", "tf-test-server-resource-2"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "size", "std-1vcpu"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "memory", "2048"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "disk", "45"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "public_ipv4_count", "0"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "public_ipv4_addresses.#", "0"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "image", "debian-12"),
|
||||
@@ -170,6 +187,8 @@ EOT
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "ssh_keys.#", "1"),
|
||||
resource.TestCheckResourceAttrPair("binarylane_server.test", "ssh_keys.0", "binarylane_ssh_key.updated", "id"),
|
||||
resource.TestCheckNoResourceAttr("binarylane_server.test", "source_and_destination_check"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "backups", "false"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "port_blocking", "true"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "user_data", // test extra whitespace
|
||||
`#cloud-config
|
||||
echo "Hello Whitespace" > /var/tmp/output.txt
|
||||
@@ -178,6 +197,54 @@ echo "Hello Whitespace" > /var/tmp/output.txt
|
||||
`),
|
||||
),
|
||||
},
|
||||
// Change password testing (Cannot run at same time as Rebuild operation, so it has it's own test)
|
||||
{
|
||||
Config: providerConfig + `
|
||||
resource "binarylane_vpc" "test" {
|
||||
name = "tf-test-server-resource"
|
||||
ip_range = "10.240.0.0/16"
|
||||
}
|
||||
|
||||
resource "binarylane_ssh_key" "initial" {
|
||||
name = "tf-test-server-resource-initial"
|
||||
public_key = "` + sshPublicKeyInitial + `"
|
||||
default = true
|
||||
}
|
||||
|
||||
resource "binarylane_ssh_key" "updated" {
|
||||
name = "tf-test-server-resource-updated"
|
||||
public_key = "` + sshPublicKeyUpdated + `"
|
||||
default = true
|
||||
}
|
||||
|
||||
resource "binarylane_server" "test" {
|
||||
name = "tf-test-server-resource-2"
|
||||
region = "per"
|
||||
image = "debian-12"
|
||||
size = "std-1vcpu"
|
||||
disk = "45"
|
||||
password = "` + password2 + `"
|
||||
vpc_id = null
|
||||
public_ipv4_count = 0
|
||||
ssh_keys = [binarylane_ssh_key.updated.id]
|
||||
|
||||
# source_and_destination_check = null # defaults to null
|
||||
# backups = false # defaults to false
|
||||
# port_blocking = true # defaults to true
|
||||
|
||||
user_data = <<EOT
|
||||
#cloud-config
|
||||
echo "Hello Whitespace" > /var/tmp/output.txt
|
||||
|
||||
|
||||
EOT
|
||||
}
|
||||
`,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "name", "tf-test-server-resource-2"),
|
||||
resource.TestCheckResourceAttr("binarylane_server.test", "password", password2),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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)...)
|
||||
}
|
||||
@@ -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"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -59,7 +59,17 @@ func (d *sshKeyDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
|
||||
return
|
||||
}
|
||||
resp.Schema = *ds
|
||||
// resp.Schema.Description = "TODO"
|
||||
|
||||
// Overrides
|
||||
defaultDescription := "If `true`, this SSH key will be included on all new server installations (if the operating " +
|
||||
"system supports SSH key injection)."
|
||||
resp.Schema.Attributes["default"] = schema.BoolAttribute{
|
||||
Description: defaultDescription,
|
||||
MarkdownDescription: defaultDescription,
|
||||
Optional: false,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
|
||||
// Additional attributes
|
||||
fingerprintDescription := "The fingerprint of the SSH key."
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
)
|
||||
|
||||
// Ensure the implementation satisfies the expected interfaces.
|
||||
@@ -61,15 +62,24 @@ func (r *sshKeyResource) Metadata(ctx context.Context, req resource.MetadataRequ
|
||||
|
||||
func (r *sshKeyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = resources.SshKeyResourceSchema(ctx)
|
||||
// resp.Schema.Description = "TODO"
|
||||
|
||||
// Overrides
|
||||
default_ := resp.Schema.Attributes["default"]
|
||||
idDescription := "The numeric ID of the SSH key."
|
||||
resp.Schema.Attributes["id"] = schema.Int64Attribute{
|
||||
Required: false,
|
||||
Optional: false,
|
||||
Computed: true,
|
||||
Description: idDescription,
|
||||
MarkdownDescription: idDescription,
|
||||
}
|
||||
|
||||
defaultDescription := "If `true`, this SSH key will be included on all new server installations (if the operating " +
|
||||
"system supports SSH key injection). Default is `false`."
|
||||
resp.Schema.Attributes["default"] = schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: default_.GetDescription(),
|
||||
MarkdownDescription: default_.GetMarkdownDescription(),
|
||||
Description: defaultDescription,
|
||||
MarkdownDescription: defaultDescription,
|
||||
Default: booldefault.StaticBool(false), // Add default to backups
|
||||
}
|
||||
|
||||
@@ -114,6 +124,11 @@ func (r *sshKeyResource) Create(ctx context.Context, req resource.CreateRequest,
|
||||
)
|
||||
return
|
||||
}
|
||||
if sshResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("SSH Key not found, removing from state: name=%s", data.Name.String()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
if sshResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
"Unexpected HTTP status code creating SSH key",
|
||||
@@ -265,7 +280,7 @@ func (r *sshKeyResource) ImportState(
|
||||
|
||||
sshResp, err := r.bc.client.GetAccountKeysWithResponse(ctx, ¶ms)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError(fmt.Sprintf("Error getting SSH key for import: fingerprint=%s", req.ID), err.Error())
|
||||
resp.Diagnostics.AddError(fmt.Sprintf("Error getting SSH keys for import: fingerprint=%s", req.ID), err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+149
-116
@@ -32,129 +32,162 @@ func convertResourceSchemaToDataSourceSchema(rs r_schema.Schema, cfg AttributeCo
|
||||
|
||||
required := cfg.RequiredAttributes != nil && slices.Contains(*cfg.RequiredAttributes, name)
|
||||
optional := cfg.OptionalAttributes != nil && slices.Contains(*cfg.OptionalAttributes, name)
|
||||
switch attribute.GetType() {
|
||||
case types.BoolType:
|
||||
ds.Attributes[name] = d_schema.BoolAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.DynamicType:
|
||||
ds.Attributes[name] = d_schema.DynamicAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.Float32Type:
|
||||
ds.Attributes[name] = d_schema.Float32Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.Float64Type:
|
||||
ds.Attributes[name] = d_schema.Float64Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.Int32Type:
|
||||
ds.Attributes[name] = d_schema.Int32Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.Int64Type:
|
||||
ds.Attributes[name] = d_schema.Int64Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.NumberType:
|
||||
ds.Attributes[name] = d_schema.NumberAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
case types.StringType:
|
||||
ds.Attributes[name] = d_schema.StringAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
default:
|
||||
if listType, isList := attribute.GetType().(types.ListType); isList {
|
||||
ds.Attributes[name] = d_schema.ListAttribute{
|
||||
ElementType: listType.ElemType,
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if objType, isObject := attribute.(r_schema.SingleNestedAttribute); isObject {
|
||||
attributeTypes := make(map[string]attr.Type, len(objType.GetAttributes()))
|
||||
for name, attribute := range objType.GetAttributes() {
|
||||
attributeTypes[name] = attribute.GetType()
|
||||
}
|
||||
|
||||
ds.Attributes[name] = d_schema.ObjectAttribute{
|
||||
CustomType: objType.CustomType,
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
AttributeTypes: attributeTypes,
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("failed to convert resource schema attribute to data source schema attribute: name=%s, type=%s", name, attribute.GetType())
|
||||
attr, err := convertResourceAttrToDataSourceAttr(name, attribute, required, optional)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert resource schema attribute to data source schema attribute: %w", err)
|
||||
}
|
||||
ds.Attributes[name] = attr
|
||||
}
|
||||
|
||||
return &ds, nil
|
||||
}
|
||||
|
||||
func convertResourceAttrToDataSourceAttr(name string, attribute r_schema.Attribute, required, optional bool) (d_schema.Attribute, error) {
|
||||
switch attribute.GetType() {
|
||||
case types.BoolType:
|
||||
return d_schema.BoolAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.DynamicType:
|
||||
return d_schema.DynamicAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.Float32Type:
|
||||
return d_schema.Float32Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.Float64Type:
|
||||
return d_schema.Float64Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.Int32Type:
|
||||
return d_schema.Int32Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.Int64Type:
|
||||
return d_schema.Int64Attribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.NumberType:
|
||||
return d_schema.NumberAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
case types.StringType:
|
||||
return d_schema.StringAttribute{
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
default:
|
||||
if t, isList := attribute.(r_schema.ListNestedAttribute); isList {
|
||||
nestedObjectAttrs := make(map[string]d_schema.Attribute)
|
||||
for name, attribute := range t.NestedObject.Attributes {
|
||||
nestedAttribute, err := convertResourceAttrToDataSourceAttr(name, attribute, required, optional)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nestedObjectAttrs[name] = nestedAttribute
|
||||
}
|
||||
|
||||
return d_schema.ListNestedAttribute{
|
||||
NestedObject: d_schema.NestedAttributeObject{
|
||||
Attributes: nestedObjectAttrs,
|
||||
CustomType: t.NestedObject.CustomType,
|
||||
Validators: t.NestedObject.Validators,
|
||||
},
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if t, isList := attribute.GetType().(types.ListType); isList {
|
||||
return d_schema.ListAttribute{
|
||||
ElementType: t.ElemType,
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if t, isObject := attribute.(r_schema.SingleNestedAttribute); isObject {
|
||||
attributeTypes := make(map[string]attr.Type, len(t.GetAttributes()))
|
||||
for name, attribute := range t.GetAttributes() {
|
||||
attributeTypes[name] = attribute.GetType()
|
||||
}
|
||||
|
||||
return d_schema.ObjectAttribute{
|
||||
CustomType: t.CustomType,
|
||||
Description: attribute.GetDescription(),
|
||||
Required: required,
|
||||
Optional: optional,
|
||||
Computed: !required,
|
||||
Sensitive: attribute.IsSensitive(),
|
||||
MarkdownDescription: attribute.GetMarkdownDescription(),
|
||||
DeprecationMessage: attribute.GetDeprecationMessage(),
|
||||
AttributeTypes: attributeTypes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("conversion of attribute type is not implemented: name=%s, type=%s", name, attribute.GetType())
|
||||
}
|
||||
}
|
||||
|
||||
func listContainsUnknown(ctx context.Context, list types.List) bool {
|
||||
// If the whole list is unknown, return true
|
||||
if list.IsUnknown() {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package provider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
)
|
||||
|
||||
var (
|
||||
_ validator.Int32 = &MultipleOfValidator{}
|
||||
)
|
||||
|
||||
type MultipleOfValidator struct {
|
||||
Multiple, RangeFrom, RangeTo int32
|
||||
}
|
||||
|
||||
func (v MultipleOfValidator) Description(ctx context.Context) string {
|
||||
if v.RangeFrom == 0 {
|
||||
return fmt.Sprintf(`must be a multiple of %d`, v.Multiple)
|
||||
}
|
||||
return fmt.Sprintf("when greater than %d, must be a multiple of %d", v.RangeFrom, v.Multiple)
|
||||
}
|
||||
|
||||
func (v MultipleOfValidator) MarkdownDescription(ctx context.Context) string {
|
||||
if v.RangeFrom == 0 {
|
||||
return fmt.Sprintf(`must be a multiple of %d`, v.Multiple)
|
||||
}
|
||||
return fmt.Sprintf("when greater than %d, must be a multiple of %d", v.RangeFrom, v.Multiple)
|
||||
}
|
||||
|
||||
func (v MultipleOfValidator) ValidateInt32(ctx context.Context, req validator.Int32Request, resp *validator.Int32Response) {
|
||||
if req.ConfigValue.IsUnknown() || req.ConfigValue.IsNull() {
|
||||
return
|
||||
}
|
||||
memory := req.ConfigValue.ValueInt32()
|
||||
|
||||
if memory%v.Multiple == 0 || v.RangeFrom != 0 && memory < v.RangeFrom || v.RangeTo != 0 && memory >= v.RangeTo {
|
||||
return
|
||||
}
|
||||
|
||||
if v.RangeFrom != 0 {
|
||||
resp.Diagnostics.AddAttributeError(
|
||||
req.Path,
|
||||
"Not a Multiple",
|
||||
fmt.Sprintf("if greater than %d, value must be a multiple of %d", v.RangeFrom, v.Multiple),
|
||||
)
|
||||
} else {
|
||||
resp.Diagnostics.AddAttributeError(
|
||||
req.Path,
|
||||
"Not a Multiple",
|
||||
fmt.Sprintf("value must be a multiple of %d", v.Multiple),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,11 @@ func (r *vpcResource) Read(ctx context.Context, req resource.ReadRequest, resp *
|
||||
)
|
||||
return
|
||||
}
|
||||
if vpcResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("VPC not found, removing from state: id=%d", data.Id.ValueInt64()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
if vpcResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
"Unexpected HTTP status code reading VPC",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"terraform-provider-binarylane/internal/resources"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -50,7 +50,20 @@ func (d *vpcRouteEntriesDataSource) Schema(ctx context.Context, req datasource.S
|
||||
resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
|
||||
Description: vpcId.GetDescription(),
|
||||
MarkdownDescription: vpcId.GetMarkdownDescription(),
|
||||
Required: true, // VPC ID is required to define the route entries
|
||||
Required: true, // vpc_id is required to define the route entries
|
||||
}
|
||||
|
||||
vpcRouteEntries := resp.Schema.Attributes["route_entries"].(schema.ListNestedAttribute)
|
||||
vpcRouteEntriesDescription := "The route entries that control how network traffic is directed through the VPC environment."
|
||||
resp.Schema.Attributes["route_entries"] = &schema.ListNestedAttribute{
|
||||
Description: vpcRouteEntriesDescription,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
CustomType: vpcRouteEntries.NestedObject.CustomType,
|
||||
Attributes: vpcRouteEntries.NestedObject.Attributes,
|
||||
},
|
||||
CustomType: vpcRouteEntries.CustomType,
|
||||
Required: false,
|
||||
Computed: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -50,7 +51,7 @@ func (r *vpcRouteEntriesResource) Schema(ctx context.Context, req resource.Schem
|
||||
resp.Schema.Attributes["vpc_id"] = &schema.Int64Attribute{
|
||||
Description: vpcId.GetDescription(),
|
||||
MarkdownDescription: vpcId.GetMarkdownDescription(),
|
||||
Required: true, // VPC ID is required to define the route entries
|
||||
Required: true, // vpc_id is required to define the route entries
|
||||
Validators: []validator.Int64{
|
||||
int64validator.AtLeast(1),
|
||||
},
|
||||
@@ -123,6 +124,11 @@ func (r *vpcRouteEntriesResource) Read(ctx context.Context, req resource.ReadReq
|
||||
)
|
||||
return
|
||||
}
|
||||
if vpcResp.StatusCode() == http.StatusNotFound {
|
||||
tflog.Warn(ctx, fmt.Sprintf("VPC route entries not found, removing from state: vpc_id=%d", data.VpcId.ValueInt64()))
|
||||
resp.State.RemoveResource(ctx)
|
||||
return
|
||||
}
|
||||
if vpcResp.StatusCode() != http.StatusOK {
|
||||
resp.Diagnostics.AddError(
|
||||
"Unexpected HTTP status code reading VPC route entries",
|
||||
@@ -244,6 +250,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),
|
||||
|
||||
@@ -26,8 +26,8 @@ func LoadBalancerResourceSchema(ctx context.Context) schema.Schema {
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"entry_protocol": schema.StringAttribute{
|
||||
Required: true,
|
||||
Description: "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
|
||||
MarkdownDescription: "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
|
||||
Description: "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
|
||||
MarkdownDescription: "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOf(
|
||||
"http",
|
||||
|
||||
@@ -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
|
||||
+696
-1
@@ -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"
|
||||
},
|
||||
@@ -17,7 +712,7 @@
|
||||
"name": "entry_protocol",
|
||||
"string": {
|
||||
"computed_optional_required": "required",
|
||||
"description": "The protocol that traffic must match for this load balancer to forward traffic according to this rule.",
|
||||
"description": "The protocol that traffic must match for the load balancer to forward it. Valid values are \"http\" and \"https\".",
|
||||
"validators": [
|
||||
{
|
||||
"custom": {
|
||||
|
||||
+32
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user