Skip to content

Commit 93b5f84

Browse files
TPT-4113: Add support for Expand Create Linodes Options and Password-less Linodes (#956)
* TPT-4256: Implemented changes for SLADE and CLEO projects (#910) * Implemented changes for SLADE and CLEO projects * Fixes * Add comments to mention AuthorizedUsers * TPT-4260 Implement integration tests for expand create linodes options and password less (#944) * Fixes * Creates test cases for linode password-less option * Apply code review suggestions * Replace sting to constant variables --------- Co-authored-by: ezilber-akamai <ezilber@akamai.com> * Fix lint * Address CoPilot feedback * Address suggestions * Switch new fields to use omitzero --------- Co-authored-by: Pawel <100145168+psnoch-akamai@users.noreply.github.com>
1 parent 80a7340 commit 93b5f84

7 files changed

Lines changed: 1461 additions & 23 deletions

instance_disks.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ type InstanceDiskCreateOptions struct {
4747
Label string `json:"label"`
4848
Size int `json:"size"`
4949

50-
// Image is optional, but requires RootPass if provided
51-
Image string `json:"image,omitempty"`
52-
RootPass string `json:"root_pass,omitempty"`
50+
// Image is optional, but requires at least one of RootPass, AuthorizedUsers, or AuthorizedKeys if provided
51+
Image string `json:"image,omitempty"`
52+
53+
RootPass string `json:"root_pass,omitempty"`
54+
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
55+
AuthorizedUsers []string `json:"authorized_users,omitempty"`
5356

5457
Filesystem string `json:"filesystem,omitempty"`
55-
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
56-
AuthorizedUsers []string `json:"authorized_users,omitempty"`
5758
StackscriptID int `json:"stackscript_id,omitempty"`
5859
StackscriptData map[string]string `json:"stackscript_data,omitempty"`
5960
}

instances.go

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,21 @@ type InstancePasswordResetOptions struct {
178178

179179
// InstanceCreateOptions require only Region and Type
180180
type InstanceCreateOptions struct {
181-
Region string `json:"region"`
182-
Type string `json:"type"`
183-
Label string `json:"label,omitempty"`
184-
RootPass string `json:"root_pass,omitempty"`
185-
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
186-
AuthorizedUsers []string `json:"authorized_users,omitempty"`
187-
StackScriptID int `json:"stackscript_id,omitempty"`
188-
StackScriptData map[string]string `json:"stackscript_data,omitempty"`
189-
BackupID int `json:"backup_id,omitempty"`
190-
Image string `json:"image,omitempty"`
181+
Region string `json:"region"`
182+
Type string `json:"type"`
183+
Label string `json:"label,omitempty"`
184+
185+
StackScriptID int `json:"stackscript_id,omitempty"`
186+
StackScriptData map[string]string `json:"stackscript_data,omitempty"`
187+
BackupID int `json:"backup_id,omitempty"`
188+
189+
// Image is optional, but requires at least one of RootPass, AuthorizedUsers, or AuthorizedKeys if provided
190+
Image string `json:"image,omitempty"`
191+
192+
RootPass string `json:"root_pass,omitempty"`
193+
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
194+
AuthorizedUsers []string `json:"authorized_users,omitempty"`
195+
191196
BackupsEnabled bool `json:"backups_enabled,omitempty"`
192197
PrivateIP bool `json:"private_ip,omitempty"`
193198
NetworkHelper *bool `json:"network_helper,omitempty"`
@@ -216,6 +221,8 @@ type InstanceCreateOptions struct {
216221
IPv4 []string `json:"ipv4,omitempty"`
217222

218223
MaintenancePolicy *string `json:"maintenance_policy,omitempty"`
224+
Kernel *string `json:"kernel,omitzero"`
225+
BootSize *int `json:"boot_size,omitzero"`
219226
}
220227

221228
// InstanceCreatePlacementGroupOptions represents the placement group
@@ -503,10 +510,13 @@ func (c *Client) RebootInstance(ctx context.Context, linodeID int, configID int)
503510

504511
// InstanceRebuildOptions is a struct representing the options to send to the rebuild linode endpoint
505512
type InstanceRebuildOptions struct {
506-
Image string `json:"image,omitempty"`
507-
RootPass string `json:"root_pass,omitempty"`
508-
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
509-
AuthorizedUsers []string `json:"authorized_users,omitempty"`
513+
// Image is the image to deploy when rebuilding the Linode
514+
Image string `json:"image,omitempty"`
515+
516+
RootPass string `json:"root_pass,omitempty"`
517+
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
518+
AuthorizedUsers []string `json:"authorized_users,omitempty"`
519+
510520
StackScriptID int `json:"stackscript_id,omitempty"`
511521
StackScriptData map[string]string `json:"stackscript_data,omitempty"`
512522
Booted *bool `json:"booted,omitempty"`

0 commit comments

Comments
 (0)