Skip to content

Commit

Permalink
Deprecate Group Field of Instance Options; Retype Group in `Insta…
Browse files Browse the repository at this point in the history
…nceUpdateOptions` to be String Pointer (#457)
  • Loading branch information
zliang-akamai committed Feb 20, 2024
1 parent 278a6e9 commit 852aace
Show file tree
Hide file tree
Showing 25 changed files with 4,918 additions and 64,072 deletions.
14 changes: 10 additions & 4 deletions instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ type InstanceCreateOptions struct {
Region string `json:"region"`
Type string `json:"type"`
Label string `json:"label,omitempty"`
Group string `json:"group,omitempty"`
RootPass string `json:"root_pass,omitempty"`
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
AuthorizedUsers []string `json:"authorized_users,omitempty"`
Expand All @@ -135,16 +134,21 @@ type InstanceCreateOptions struct {
// Creation fields that need to be set explicitly false, "", or 0 use pointers
SwapSize *int `json:"swap_size,omitempty"`
Booted *bool `json:"booted,omitempty"`

// Deprecated: group is a deprecated property denoting a group label for the Linode.
Group string `json:"group,omitempty"`
}

// InstanceUpdateOptions is an options struct used when Updating an Instance
type InstanceUpdateOptions struct {
Label string `json:"label,omitempty"`
Group string `json:"group,omitempty"`
Backups *InstanceBackup `json:"backups,omitempty"`
Alerts *InstanceAlert `json:"alerts,omitempty"`
WatchdogEnabled *bool `json:"watchdog_enabled,omitempty"`
Tags *[]string `json:"tags,omitempty"`

// Deprecated: group is a deprecated property denoting a group label for the Linode.
Group *string `json:"group,omitempty"`
}

// UnmarshalJSON implements the json.Unmarshaler interface
Expand Down Expand Up @@ -173,7 +177,7 @@ func (i *Instance) UnmarshalJSON(b []byte) error {
func (i *Instance) GetUpdateOptions() InstanceUpdateOptions {
return InstanceUpdateOptions{
Label: i.Label,
Group: i.Group,
Group: &i.Group,
Backups: i.Backups,
Alerts: i.Alerts,
WatchdogEnabled: &i.WatchdogEnabled,
Expand All @@ -189,12 +193,14 @@ type InstanceCloneOptions struct {
// LinodeID is an optional existing instance to use as the target of the clone
LinodeID int `json:"linode_id,omitempty"`
Label string `json:"label,omitempty"`
Group string `json:"group,omitempty"`
BackupsEnabled bool `json:"backups_enabled"`
Disks []int `json:"disks,omitempty"`
Configs []int `json:"configs,omitempty"`
PrivateIP bool `json:"private_ip,omitempty"`
Metadata *InstanceMetadataOptions `json:"metadata,omitempty"`

// Deprecated: group is a deprecated property denoting a group label for the Linode.
Group string `json:"group,omitempty"`
}

// InstanceResizeOptions is an options struct used when resizing an instance
Expand Down
1,766 changes: 1,414 additions & 352 deletions test/integration/fixtures/TestInstanceBackups_List.yaml

Large diffs are not rendered by default.

162 changes: 94 additions & 68 deletions test/integration/fixtures/TestInstanceFirewalls_List.yaml

Large diffs are not rendered by default.

55,758 changes: 334 additions & 55,424 deletions test/integration/fixtures/TestInstance_Clone.yaml

Large diffs are not rendered by default.

104 changes: 54 additions & 50 deletions test/integration/fixtures/TestInstance_ConfigInterface_Update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ interactions:
{"id": "us-iad", "label": "Washington, DC", "country": "us", "capabilities":
["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "Kubernetes",
"Cloud Firewall", "Vlans", "VPCs", "Managed Databases", "Metadata", "Premium
Plans"], "status": "ok", "resolvers": {"ipv4": "139.144.192.62, 139.144.192.60, 139.144.192.61, 139.144.192.53, 139.144.192.54, 139.144.192.67, 139.144.192.69, 139.144.192.66, 139.144.192.52, 139.144.192.68",
"ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678"}},
Plans"], "status": "ok", "resolvers": {"ipv4": "139.144.192.62, 139.144.192.60,
139.144.192.61, 139.144.192.53, 139.144.192.54, 139.144.192.67, 139.144.192.69,
139.144.192.66, 139.144.192.52, 139.144.192.68", "ipv6": "1234::5678,
1234::5678, 1234::5678, 1234::5678,
1234::5678, 1234::5678, 1234::5678,
1234::5678, 1234::5678, 1234::5678"}},
{"id": "us-ord", "label": "Chicago, IL", "country": "us", "capabilities": ["Linodes",
"NodeBalancers", "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall",
"Vlans", "VPCs", "Managed Databases", "Metadata", "Premium Plans"], "status":
Expand Down Expand Up @@ -156,21 +160,21 @@ interactions:
1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678,
1234::5678"}}, {"id": "us-west", "label": "Fremont, CA", "country": "us",
"capabilities": ["Linodes", "NodeBalancers", "Block Storage", "Kubernetes",
"Cloud Firewall", "Block Storage Migrations", "Managed Databases"], "status":
"ok", "resolvers": {"ipv4": "173.230.145.5, 173.230.147.5, 173.230.155.5, 173.255.212.5,
173.255.219.5, 173.255.241.5, 173.255.243.5, 173.255.244.5, 74.207.241.5, 74.207.242.5",
"ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678,
1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678"}}, {"id":
"us-southeast", "label": "Atlanta, GA", "country": "us", "capabilities": ["Linodes",
"NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes",
"Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed Databases"],
"status": "ok", "resolvers": {"ipv4": "74.207.231.5, 173.230.128.5, 173.230.129.5,
173.230.136.5, 173.230.140.5, 66.228.59.5, 66.228.62.5, 50.116.35.5, 50.116.41.5,
23.239.18.5", "ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678,
"status": "ok", "resolvers": {"ipv4": "173.230.145.5, 173.230.147.5, 173.230.155.5,
173.255.212.5, 173.255.219.5, 173.255.241.5, 173.255.243.5, 173.255.244.5, 74.207.241.5,
74.207.242.5", "ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678,
1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678"}},
{"id": "us-east", "label": "Newark, NJ", "country": "us", "capabilities": ["Linodes",
"NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes",
"Cloud Firewall", "Bare Metal", "Vlans", "Block Storage Migrations", "Managed
{"id": "us-southeast", "label": "Atlanta, GA", "country": "us", "capabilities":
["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes",
"Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed
Databases"], "status": "ok", "resolvers": {"ipv4": "74.207.231.5, 173.230.128.5,
173.230.129.5, 173.230.136.5, 173.230.140.5, 66.228.59.5, 66.228.62.5, 50.116.35.5,
50.116.41.5, 23.239.18.5", "ipv6": "1234::5678, 1234::5678, 1234::5678,
1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678,
1234::5678"}}, {"id": "us-east", "label": "Newark, NJ", "country": "us", "capabilities":
["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes",
"Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed
Databases"], "status": "ok", "resolvers": {"ipv4": "66.228.42.5, 96.126.106.5,
50.116.53.5, 50.116.58.5, 50.116.61.5, 50.116.62.5, 66.175.211.5, 97.107.133.4,
207.192.69.4, 207.192.69.5", "ipv6": "1234::5678, 1234::5678, 1234::5678,
Expand Down Expand Up @@ -224,7 +228,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:07 GMT
- Wed, 14 Feb 2024 18:09:14 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -250,7 +254,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"region":"us-iad","type":"g6-nanode-1","label":"go-test-ins-wo-disk-2yu6l4o73ht7","booted":false}'
body: '{"region":"us-iad","type":"g6-nanode-1","label":"go-test-ins-wo-disk-73be3u8uqn82","booted":false}'
form: {}
headers:
Accept:
Expand All @@ -262,15 +266,15 @@ interactions:
url: https://api.linode.com/v4beta/linode/instances
method: POST
response:
body: '{"id": 54253757, "label": "go-test-ins-wo-disk-2yu6l4o73ht7", "group":
body: '{"id": 54933555, "label": "go-test-ins-wo-disk-73be3u8uqn82", "group":
"", "status": "provisioning", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05",
"type": "g6-nanode-1", "ipv4": ["139.144.202.159"], "ipv6": "1234::5678/128",
"type": "g6-nanode-1", "ipv4": ["139.144.202.63"], "ipv6": "1234::5678/128",
"image": null, "region": "us-iad", "specs": {"disk": 25600, "memory": 1024,
"vcpus": 1, "gpus": 0, "transfer": 1000}, "alerts": {"cpu": 90, "network_in":
10, "network_out": 10, "transfer_quota": 80, "io": 10000}, "backups": {"enabled":
false, "available": false, "schedule": {"day": null, "window": null}, "last_successful":
null}, "hypervisor": "kvm", "watchdog_enabled": true, "tags": [], "host_uuid":
"82627d6efdfe4053b931690ee476e7b64f186697", "has_user_data": false}'
"069a01c443a4c034edaff10aeecdf8fb95ec66ba", "has_user_data": false}'
headers:
Access-Control-Allow-Credentials:
- "true"
Expand All @@ -287,13 +291,13 @@ interactions:
Connection:
- keep-alive
Content-Length:
- "738"
- "737"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:08 GMT
- Wed, 14 Feb 2024 18:09:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -317,7 +321,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"label":"go-test-conf-8r49bm12fs2k","devices":{},"interfaces":null}'
body: '{"label":"go-test-conf-9iut07dbo832","devices":{},"interfaces":null}'
form: {}
headers:
Accept:
Expand All @@ -326,10 +330,10 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/linode/instances/54253757/configs
url: https://api.linode.com/v4beta/linode/instances/54933555/configs
method: POST
response:
body: '{"id": 57334211, "label": "go-test-conf-8r49bm12fs2k", "helpers": {"updatedb_disabled":
body: '{"id": 58037972, "label": "go-test-conf-9iut07dbo832", "helpers": {"updatedb_disabled":
true, "distro": true, "modules_dep": true, "network": true, "devtmpfs_automount":
true}, "kernel": "linode/latest-64bit", "comments": "", "memory_limit": 0, "created":
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "root_device": "/dev/sda",
Expand Down Expand Up @@ -358,7 +362,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:08 GMT
- Wed, 14 Feb 2024 18:09:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -382,7 +386,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"label":"go-test-vpc-1705956548479670000","region":"us-iad","subnets":[{"label":"linodego-vpc-test-1705956548479742000","ipv4":"192.168.0.0/25"}]}'
body: '{"label":"go-test-vpc-1707934155274221000","region":"us-iad","subnets":[{"label":"linodego-vpc-test-1707934155274261000","ipv4":"192.168.0.0/25"}]}'
form: {}
headers:
Accept:
Expand All @@ -394,8 +398,8 @@ interactions:
url: https://api.linode.com/v4beta/vpcs
method: POST
response:
body: '{"id": 19446, "label": "go-test-vpc-1705956548479670000", "description":
"", "region": "us-iad", "subnets": [{"id": 20513, "label": "linodego-vpc-test-1705956548479742000",
body: '{"id": 22685, "label": "go-test-vpc-1707934155274221000", "description":
"", "region": "us-iad", "subnets": [{"id": 23564, "label": "linodego-vpc-test-1707934155274261000",
"ipv4": "192.168.0.0/25", "ipv6": null, "linodes": [], "created": "2018-01-02T03:04:05",
"updated": "2018-01-02T03:04:05"}], "created": "2018-01-02T03:04:05", "updated":
"2018-01-02T03:04:05"}'
Expand All @@ -421,7 +425,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:08 GMT
- Wed, 14 Feb 2024 18:09:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -445,7 +449,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"purpose":"vpc","subnet_id":20513}'
body: '{"purpose":"vpc","subnet_id":23564}'
form: {}
headers:
Accept:
Expand All @@ -454,11 +458,11 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/linode/instances/54253757/configs/57334211/interfaces
url: https://api.linode.com/v4beta/linode/instances/54933555/configs/58037972/interfaces
method: POST
response:
body: '{"id": 976040, "purpose": "vpc", "primary": false, "active": false, "ipam_address":
null, "label": null, "vpc_id": 19446, "subnet_id": 20513, "ipv4": {"vpc": "192.168.0.2",
body: '{"id": 1041200, "purpose": "vpc", "primary": false, "active": false, "ipam_address":
null, "label": null, "vpc_id": 22685, "subnet_id": 23564, "ipv4": {"vpc": "192.168.0.2",
"nat_1_1": null}, "ipv6": null, "ip_ranges": []}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -476,13 +480,13 @@ interactions:
Connection:
- keep-alive
Content-Length:
- "221"
- "222"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:09 GMT
- Wed, 14 Feb 2024 18:09:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -515,11 +519,11 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/linode/instances/54253757/configs/57334211/interfaces/976040
url: https://api.linode.com/v4beta/linode/instances/54933555/configs/58037972/interfaces/1041200
method: PUT
response:
body: '{"id": 976040, "purpose": "vpc", "primary": true, "active": false, "ipam_address":
null, "label": null, "vpc_id": 19446, "subnet_id": 20513, "ipv4": {"vpc": "192.168.0.2",
body: '{"id": 1041200, "purpose": "vpc", "primary": true, "active": false, "ipam_address":
null, "label": null, "vpc_id": 22685, "subnet_id": 23564, "ipv4": {"vpc": "192.168.0.2",
"nat_1_1": null}, "ipv6": null, "ip_ranges": []}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -537,13 +541,13 @@ interactions:
Connection:
- keep-alive
Content-Length:
- "220"
- "221"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:09 GMT
- Wed, 14 Feb 2024 18:09:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -576,12 +580,12 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/linode/instances/54253757/configs/57334211/interfaces/976040
url: https://api.linode.com/v4beta/linode/instances/54933555/configs/58037972/interfaces/1041200
method: PUT
response:
body: '{"id": 976040, "purpose": "vpc", "primary": true, "active": false, "ipam_address":
null, "label": null, "vpc_id": 19446, "subnet_id": 20513, "ipv4": {"vpc": "192.168.0.10",
"nat_1_1": "139.144.202.159"}, "ipv6": null, "ip_ranges": []}'
body: '{"id": 1041200, "purpose": "vpc", "primary": true, "active": false, "ipam_address":
null, "label": null, "vpc_id": 22685, "subnet_id": 23564, "ipv4": {"vpc": "192.168.0.10",
"nat_1_1": "139.144.202.63"}, "ipv6": null, "ip_ranges": []}'
headers:
Access-Control-Allow-Credentials:
- "true"
Expand All @@ -604,7 +608,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:10 GMT
- Wed, 14 Feb 2024 18:09:16 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -637,7 +641,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/linode/instances/54253757
url: https://api.linode.com/v4beta/linode/instances/54933555
method: DELETE
response:
body: '{}'
Expand All @@ -663,7 +667,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:10 GMT
- Wed, 14 Feb 2024 18:09:16 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -696,7 +700,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/vpcs/19446
url: https://api.linode.com/v4beta/vpcs/22685
method: DELETE
response:
body: '{}'
Expand All @@ -722,7 +726,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 22 Jan 2024 20:49:10 GMT
- Wed, 14 Feb 2024 18:09:17 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
Loading

0 comments on commit 852aace

Please sign in to comment.