Skip to content

Commit 3c9b19d

Browse files
committed
make changes from review
1 parent 8557d88 commit 3c9b19d

File tree

6 files changed

+31
-33
lines changed

6 files changed

+31
-33
lines changed

docs/stackit_beta_volume_create.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ stackit beta volume create [flags]
1313
### Examples
1414

1515
```
16-
Create a volume with availability zone "eu01-1"
17-
$ stackit beta volume create --availability-zone eu01-1
16+
Create a volume with availability zone "eu01-1" and size 64 GB
17+
$ stackit beta volume create --availability-zone eu01-1 --size 64
1818
19-
Create a volume with name "volume-1"
20-
$ stackit beta volume create --availability-zone eu01-1 --name volume-1
19+
Create a volume with name "volume-1", source id "xxx" and type "image"
20+
$ stackit beta volume create --availability-zone eu01-1 --name volume-1 --source-id xxx --source-type image
2121
22-
Create a volume with availability zone "eu01-1", performance class "storage_premium_perf1"
23-
$ stackit beta volume create --availability-zone eu01-1 --performance-class storage_premium_perf1
22+
Create a volume with availability zone "eu01-1", performance class "storage_premium_perf1" and size 64 GB
23+
$ stackit beta volume create --availability-zone eu01-1 --performance-class storage_premium_perf1 --size 64
2424
```
2525

2626
### Options
@@ -32,9 +32,9 @@ stackit beta volume create [flags]
3232
--label stringToString Labels are key-value string pairs which can be attached to a volume. A label can be provided with the format key=value and the flag can be used multiple times to provide a list of labels (default [])
3333
-n, --name string Volume name
3434
--performance-class string Performance class
35-
--size int Volume size (GB). Either size or source ID and type flags must be given.
36-
--source-id string ID of the source object of volume. Either size or source id and type flags must be given. Source ID and type must be provided together.
37-
--source-type string Type of the source object of volume. Either size or source id and type flags must be given. Source ID and type must be provided together.
35+
--size int Volume size (GB). Either 'size' or the 'source-id' and 'source-type' flags must be given
36+
--source-id string ID of the source object of volume. Either 'size' or the 'source-id' and 'source-type' flags must be given
37+
--source-type string Type of the source object of volume. Either 'size' or the 'source-id' and 'source-type' flags must be given
3838
```
3939

4040
### Options inherited from parent commands

docs/stackit_beta_volume_resize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ stackit beta volume resize [flags]
2121

2222
```
2323
-h, --help Help for "stackit beta volume resize"
24-
--size int Volume size
24+
--size int Volume size (GB)
2525
```
2626

2727
### Options inherited from parent commands

internal/cmd/beta/volume/create/create.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ func NewCmd(p *print.Printer) *cobra.Command {
5353
Args: args.NoArgs,
5454
Example: examples.Build(
5555
examples.NewExample(
56-
`Create a volume with availability zone "eu01-1"`,
57-
`$ stackit beta volume create --availability-zone eu01-1`,
56+
`Create a volume with availability zone "eu01-1" and size 64 GB`,
57+
`$ stackit beta volume create --availability-zone eu01-1 --size 64`,
5858
),
5959
examples.NewExample(
60-
`Create a volume with name "volume-1"`,
61-
`$ stackit beta volume create --availability-zone eu01-1 --name volume-1`,
60+
`Create a volume with name "volume-1", source id "xxx" and type "image"`,
61+
`$ stackit beta volume create --availability-zone eu01-1 --name volume-1 --source-id xxx --source-type image`,
6262
),
6363
examples.NewExample(
64-
`Create a volume with availability zone "eu01-1", performance class "storage_premium_perf1"`,
65-
`$ stackit beta volume create --availability-zone eu01-1 --performance-class storage_premium_perf1`,
64+
`Create a volume with availability zone "eu01-1", performance class "storage_premium_perf1" and size 64 GB`,
65+
`$ stackit beta volume create --availability-zone eu01-1 --performance-class storage_premium_perf1 --size 64`,
6666
),
6767
),
6868
RunE: func(cmd *cobra.Command, args []string) error {

internal/cmd/beta/volume/describe/describe.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ func outputResult(p *print.Printer, outputFormat string, volume *iaas.Volume) er
119119

120120
return nil
121121
default:
122-
serverId := ""
123-
if volume.ServerId != nil {
124-
serverId = *volume.ServerId
125-
}
126-
127-
sourceId := ""
128-
if volume.Source != nil {
129-
sourceId = *volume.Source.Id
130-
}
131-
132122
table := tables.NewTable()
133123
table.AddRow("ID", *volume.Id)
134124
table.AddSeparator()
@@ -142,10 +132,18 @@ func outputResult(p *print.Printer, outputFormat string, volume *iaas.Volume) er
142132
table.AddSeparator()
143133
table.AddRow("AVAILABILITY ZONE", *volume.AvailabilityZone)
144134
table.AddSeparator()
145-
table.AddRow("SOURCE", sourceId)
146-
table.AddSeparator()
147-
table.AddRow("SERVER", serverId)
148-
table.AddSeparator()
135+
136+
if volume.Source != nil {
137+
sourceId := *volume.Source.Id
138+
table.AddRow("SOURCE", sourceId)
139+
table.AddSeparator()
140+
}
141+
142+
if volume.ServerId != nil {
143+
serverId := *volume.ServerId
144+
table.AddRow("SERVER", serverId)
145+
table.AddSeparator()
146+
}
149147

150148
err := table.Display(p)
151149
if err != nil {

internal/cmd/beta/volume/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func outputResult(p *print.Printer, outputFormat string, volumes []iaas.Volume)
164164
return nil
165165
default:
166166
table := tables.NewTable()
167-
table.SetHeader("ID", "Name", "Status", "Server", "Public IP")
167+
table.SetHeader("ID", "Name", "Status", "Server", "Availability Zone", "Size (GB)")
168168

169169
for _, volume := range volumes {
170170
serverId := ""

internal/cmd/beta/volume/update/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
148148
return req.UpdateVolumePayload(payload)
149149
}
150150

151-
func outputResult(p *print.Printer, model *inputModel, projectLabel string, volume *iaas.Volume) error {
151+
func outputResult(p *print.Printer, model *inputModel, volumeLabel string, volume *iaas.Volume) error {
152152
switch model.OutputFormat {
153153
case print.JSONOutputFormat:
154154
details, err := json.MarshalIndent(volume, "", " ")
@@ -167,7 +167,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, volu
167167

168168
return nil
169169
default:
170-
p.Outputf("Updated volume for project %q.\n", projectLabel)
170+
p.Outputf("Updated volume %q.\n", volumeLabel)
171171
return nil
172172
}
173173
}

0 commit comments

Comments
 (0)