Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(instance): use a slice for addition snapshots in create volume #1575

Merged
merged 3 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ EXAMPLES:
scw instance image create name=foobar root-volume=11111111-1111-1111-1111-111111111111 arch=x86_64

ARGS:
[name=<generated>] Name of the image
snapshot-id UUID of the snapshot that will be used as root volume in the image
arch Architecture of the image (x86_64 | arm)
[default-bootscript] Default bootscript of the image
[additional-snapshots.{key}.id] UUID of the snapshot to add
[additional-snapshots.{key}.name] Name of the additional snapshot
[additional-snapshots.{key}.size] Size of the additional snapshot
[additional-snapshots.{key}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd)
[additional-snapshots.{key}.project-id] Project ID that own the additional snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[public] True to create a public image
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | pl-waw-1)
[name=<generated>] Name of the image
snapshot-id UUID of the snapshot that will be used as root volume in the image
arch Architecture of the image (x86_64 | arm)
[default-bootscript] Default bootscript of the image
[additional-snapshots.{index}.id] UUID of the snapshot to add
[additional-snapshots.{index}.name] Name of the additional snapshot
[additional-snapshots.{index}.size] Size of the additional snapshot
[additional-snapshots.{index}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd)
[additional-snapshots.{index}.project-id] Project ID that own the additional snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[public] True to create a public image
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | pl-waw-1)

DEPRECATED ARGS:
[additional-snapshots.{key}.organization-id] Organization ID that own the additional snapshot
[additional-snapshots.{index}.organization-id] Organization ID that own the additional snapshot

FLAGS:
-h, --help help for create
Expand Down
14 changes: 7 additions & 7 deletions internal/namespaces/instance/v1/custom_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,29 @@ func imagesMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) {
func imageCreateBuilder(c *core.Command) *core.Command {
type customCreateImageRequest struct {
*instance.CreateImageRequest
AdditionalVolumes map[string]*instance.VolumeTemplate
AdditionalVolumes []*instance.VolumeTemplate
SnapshotID string
OrganizationID *string
ProjectID *string
}

c.ArgSpecs.GetByName("extra-volumes.{key}.id").Short = "UUID of the snapshot to add"
c.ArgSpecs.GetByName("extra-volumes.{key}.id").Name = "additional-snapshots.{key}.id"
c.ArgSpecs.GetByName("extra-volumes.{key}.id").Name = "additional-snapshots.{index}.id"

c.ArgSpecs.GetByName("extra-volumes.{key}.name").Short = "Name of the additional snapshot"
c.ArgSpecs.GetByName("extra-volumes.{key}.name").Name = "additional-snapshots.{key}.name"
c.ArgSpecs.GetByName("extra-volumes.{key}.name").Name = "additional-snapshots.{index}.name"

c.ArgSpecs.GetByName("extra-volumes.{key}.size").Short = "Size of the additional snapshot"
c.ArgSpecs.GetByName("extra-volumes.{key}.size").Name = "additional-snapshots.{key}.size"
c.ArgSpecs.GetByName("extra-volumes.{key}.size").Name = "additional-snapshots.{index}.size"

c.ArgSpecs.GetByName("extra-volumes.{key}.volume-type").Short = "Underlying volume type of the additional snapshot"
c.ArgSpecs.GetByName("extra-volumes.{key}.volume-type").Name = "additional-snapshots.{key}.volume-type"
c.ArgSpecs.GetByName("extra-volumes.{key}.volume-type").Name = "additional-snapshots.{index}.volume-type"

c.ArgSpecs.GetByName("extra-volumes.{key}.organization").Short = "Organization ID that own the additional snapshot"
c.ArgSpecs.GetByName("extra-volumes.{key}.organization").Name = "additional-snapshots.{key}.organization-id"
c.ArgSpecs.GetByName("extra-volumes.{key}.organization").Name = "additional-snapshots.{index}.organization-id"

c.ArgSpecs.GetByName("extra-volumes.{key}.project").Short = "Project ID that own the additional snapshot"
c.ArgSpecs.GetByName("extra-volumes.{key}.project").Name = "additional-snapshots.{key}.project-id"
c.ArgSpecs.GetByName("extra-volumes.{key}.project").Name = "additional-snapshots.{index}.project-id"

c.ArgSpecs.GetByName("root-volume").Short = "UUID of the snapshot that will be used as root volume in the image"
c.ArgSpecs.GetByName("root-volume").Name = "snapshot-id"
Expand Down