Skip to content

Commit 05b8667

Browse files
Laure-didependabot[bot]scaleway-botjremy42
committed
feat(file): activate support and generate doc (scaleway#4693)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Scaleway Bot <[email protected]> Co-authored-by: Jonathan R. <[email protected]>
1 parent 2ec359e commit 05b8667

File tree

4 files changed

+182
-1
lines changed

4 files changed

+182
-1
lines changed

commands/commands.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
domain "github.com/scaleway/scaleway-cli/v2/internal/namespaces/domain/v2beta1"
2121
edgeservices "github.com/scaleway/scaleway-cli/v2/internal/namespaces/edge_services/v1beta1"
2222
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/feedback"
23+
file "github.com/scaleway/scaleway-cli/v2/internal/namespaces/file/v1alpha1"
2324
flexibleip "github.com/scaleway/scaleway-cli/v2/internal/namespaces/flexibleip/v1alpha1"
2425
function "github.com/scaleway/scaleway-cli/v2/internal/namespaces/function/v1beta1"
2526
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/help"
@@ -115,7 +116,10 @@ func GetCommands() *core.Commands {
115116
)
116117

117118
if beta {
118-
commands.Merge(dedibox.GetCommands())
119+
commands.MergeAll(
120+
dedibox.GetCommands(),
121+
file.GetCommands(),
122+
)
119123
}
120124

121125
return commands

core/command.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ func (c *Commands) Merge(cmds *Commands) {
291291
}
292292
}
293293

294+
func (c *Commands) MergeAll(cmds ...*Commands) {
295+
for _, command := range cmds {
296+
c.Merge(command)
297+
}
298+
}
299+
294300
func (c *Commands) GetAll() []*Command {
295301
return c.commands
296302
}

docs/commands/file.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen -->
2+
# Documentation for `scw file`
3+
This API allows you to manage your File Storage resources.
4+
5+
- [Attachment management](#attachment-management)
6+
- [List filesystems attachments](#list-filesystems-attachments)
7+
- [Filesystem management](#filesystem-management)
8+
- [Create a new filesystem](#create-a-new-filesystem)
9+
- [Delete a detached filesystem](#delete-a-detached-filesystem)
10+
- [Get filesystem details](#get-filesystem-details)
11+
- [List all filesystems](#list-all-filesystems)
12+
- [Update filesystem properties](#update-filesystem-properties)
13+
14+
15+
## Attachment management
16+
17+
Attachment management.
18+
19+
20+
### List filesystems attachments
21+
22+
List all existing attachments in a specified region.
23+
By default, the attachments listed are ordered by creation date in ascending order.
24+
This can be modified using the `order_by` field.
25+
26+
**Usage:**
27+
28+
```
29+
scw file attachment list [arg=value ...]
30+
```
31+
32+
33+
**Args:**
34+
35+
| Name | | Description |
36+
|------|---|-------------|
37+
| filesystem-id | | UUID of the File Storage volume |
38+
| resource-id | | Filter by resource ID |
39+
| resource-type | One of: `unknown_resource_type`, `instance_server` | Filter by resource type |
40+
| zone | | Filter by resource zone |
41+
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |
42+
43+
44+
45+
## Filesystem management
46+
47+
Filesystem management.
48+
49+
50+
### Create a new filesystem
51+
52+
To create a new filesystem, you need to provide a name, a size, and a project ID.
53+
54+
**Usage:**
55+
56+
```
57+
scw file filesystem create [arg=value ...]
58+
```
59+
60+
61+
**Args:**
62+
63+
| Name | | Description |
64+
|------|---|-------------|
65+
| name | Required | Name of the filesystem |
66+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
67+
| size | Required | Filesystem size in bytes, with a granularity of 100 GB (10^11 bytes). |
68+
| tags.{index} | | List of tags assigned to the filesystem |
69+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
70+
71+
72+
73+
### Delete a detached filesystem
74+
75+
You must specify the `filesystem_id` of the filesystem you want to delete.
76+
77+
**Usage:**
78+
79+
```
80+
scw file filesystem delete <filesystem-id ...> [arg=value ...]
81+
```
82+
83+
84+
**Args:**
85+
86+
| Name | | Description |
87+
|------|---|-------------|
88+
| filesystem-id | Required | UUID of the filesystem |
89+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
90+
91+
92+
93+
### Get filesystem details
94+
95+
Retrieve all properties and current status of a specific filesystem identified by its ID.
96+
97+
**Usage:**
98+
99+
```
100+
scw file filesystem get <filesystem-id ...> [arg=value ...]
101+
```
102+
103+
104+
**Args:**
105+
106+
| Name | | Description |
107+
|------|---|-------------|
108+
| filesystem-id | Required | UUID of the filesystem |
109+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
110+
111+
112+
113+
### List all filesystems
114+
115+
Retrieve all filesystems in the specified region. Results are ordered by creation date in ascending order by default.
116+
Use the order_by parameter to modify the sorting behavior.
117+
118+
**Usage:**
119+
120+
```
121+
scw file filesystem list [arg=value ...]
122+
```
123+
124+
125+
**Args:**
126+
127+
| Name | | Description |
128+
|------|---|-------------|
129+
| order-by | One of: `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc` | Criteria to use when ordering the list |
130+
| project-id | | Filter by project ID |
131+
| name | | Filter the return filesystems by their names |
132+
| tags.{index} | | Filter by tags. Only filesystems with one or more matching tags will be returned |
133+
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |
134+
135+
136+
137+
### Update filesystem properties
138+
139+
Update the technical details of a filesystem, such as its name, tags or its new size.
140+
You can only resize a filesystem to a larger size.
141+
142+
**Usage:**
143+
144+
```
145+
scw file filesystem update [arg=value ...]
146+
```
147+
148+
149+
**Args:**
150+
151+
| Name | | Description |
152+
|------|---|-------------|
153+
| filesystem-id | Required | UUID of the filesystem |
154+
| name | | When defined, is the new name of the filesystem |
155+
| size | | Optional field for increasing the size of the filesystem (must be larger than the current size) |
156+
| tags.{index} | | List of tags assigned to the filesystem |
157+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
158+
159+
160+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package file
2+
3+
import "github.com/scaleway/scaleway-cli/v2/core"
4+
5+
func GetCommands() *core.Commands {
6+
cmds := GetGeneratedCommands()
7+
8+
cmds.MustFind("file").Groups = []string{"storage"}
9+
10+
return cmds
11+
}

0 commit comments

Comments
 (0)