Skip to content

Commit

Permalink
feat(webhosting): add control panel support in webhosting (#3484)
Browse files Browse the repository at this point in the history
Co-authored-by: Yacine Fodil <105779815+yfodil@users.noreply.github.com>
  • Loading branch information
scaleway-bot and yfodil authored Nov 10, 2023
1 parent dc6469d commit 5ddaad4
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Control panels represent the kind of administration panel to manage your Web Hosting plan, cPanel or plesk.

USAGE:
scw webhosting control-panels

FLAGS:
-h, --help help for control-panels

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARGS:
[tags.{index}] List of tags for the Web Hosting plan
[domain] Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand
[option-ids.{index}] IDs of any selected additional options for the Web Hosting plan
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EXAMPLES:

ARGS:
hosting-id Hosting ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EXAMPLES:

ARGS:
domain Domain associated with the DNS records
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for get-dns-records
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EXAMPLES:

ARGS:
hosting-id Hosting ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ EXAMPLES:
scw webhosting hosting list project-id=a3244331-5d32-4e36-9bf9-b60233e201c7 organization-id=a3244331-5d32-4e36-9bf9-b60233e201c7

ARGS:
[order-by] Sort order for Web Hosting plans in the response (created_at_asc | created_at_desc)
[tags.{index}] Tags to filter for, only Web Hosting plans with matching tags will be returned
[statuses.{index}] Statuses to filter for, only Web Hosting plans with matching statuses will be returned (unknown_status | delivering | ready | deleting | error | locked | migrating)
[domain] Domain to filter for, only Web Hosting plans associated with this domain will be returned
[project-id] Project ID to filter for, only Web Hosting plans from this Project will be returned
[organization-id] Organization ID to filter for, only Web Hosting plans from this Organization will be returned
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | all)
[order-by] Sort order for Web Hosting plans in the response (created_at_asc | created_at_desc)
[tags.{index}] Tags to filter for, only Web Hosting plans with matching tags will be returned
[statuses.{index}] Statuses to filter for, only Web Hosting plans with matching statuses will be returned (unknown_status | delivering | ready | deleting | error | locked | migrating)
[domain] Domain to filter for, only Web Hosting plans associated with this domain will be returned
[project-id] Project ID to filter for, only Web Hosting plans from this Project will be returned
[control-panels.{index}] Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned
[organization-id] Organization ID to filter for, only Web Hosting plans from this Organization will be returned
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | all)

FLAGS:
-h, --help help for list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EXAMPLES:

ARGS:
hosting-id Hosting ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ARGS:
[tags.{index}] New tags for the Web Hosting plan
[option-ids.{index}] IDs of the new options for the Web Hosting plan
[offer-id] ID of the new offer for the Web Hosting plan
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARGS:
[without-options] Defines whether the response should consist of offers only, without options
[only-options] Defines whether the response should consist of options only, without offers
[hosting-id] ID of a Web Hosting plan, to check compatibility with returned offers (in case of wanting to update the plan)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for list
Expand Down
5 changes: 3 additions & 2 deletions cmd/scw/testdata/test-all-usage-webhosting-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ USAGE:
scw webhosting <command>

AVAILABLE COMMANDS:
hosting Hosting management commands
offer Offer management commands
control-panels Control Panels
hosting Hosting management commands
offer Offer management commands

FLAGS:
-h, --help help for webhosting
Expand Down
32 changes: 24 additions & 8 deletions docs/commands/webhosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Documentation for `scw webhosting`
Web Hosting API.

- [Control Panels](#control-panels)
- [Hosting management commands](#hosting-management-commands)
- [Order a Web Hosting plan](#order-a-web-hosting-plan)
- [Delete a Web Hosting plan](#delete-a-web-hosting-plan)
Expand All @@ -14,6 +15,20 @@ Web Hosting API.
- [List all offers](#list-all-offers)


## Control Panels

Control panels represent the kind of administration panel to manage your Web Hosting plan, cPanel or plesk.

Control panels represent the kind of administration panel to manage your Web Hosting plan, cPanel or plesk.

**Usage:**

```
scw webhosting control-panels
```



## Hosting management commands

With a Scaleway Web Hosting plan, you can manage your domain, configure your web hosting services, manage your emails and more. Create, list, update and delete your Web Hosting plans with these calls.
Expand All @@ -40,7 +55,7 @@ scw webhosting hosting create [arg=value ...]
| tags.{index} | | List of tags for the Web Hosting plan |
| domain | | Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand |
| option-ids.{index} | | IDs of any selected additional options for the Web Hosting plan |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |



Expand All @@ -60,7 +75,7 @@ scw webhosting hosting delete [arg=value ...]
| Name | | Description |
|------|---|-------------|
| hosting-id | Required | Hosting ID |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -90,7 +105,7 @@ scw webhosting hosting get [arg=value ...]
| Name | | Description |
|------|---|-------------|
| hosting-id | Required | Hosting ID |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -120,7 +135,7 @@ scw webhosting hosting get-dns-records [arg=value ...]
| Name | | Description |
|------|---|-------------|
| domain | Required | Domain associated with the DNS records |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -154,8 +169,9 @@ scw webhosting hosting list [arg=value ...]
| statuses.{index} | One of: `unknown_status`, `delivering`, `ready`, `deleting`, `error`, `locked`, `migrating` | Statuses to filter for, only Web Hosting plans with matching statuses will be returned |
| domain | | Domain to filter for, only Web Hosting plans associated with this domain will be returned |
| project-id | | Project ID to filter for, only Web Hosting plans from this Project will be returned |
| control-panels.{index} | | Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned |
| organization-id | | Organization ID to filter for, only Web Hosting plans from this Organization will be returned |
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `all` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -185,7 +201,7 @@ scw webhosting hosting restore [arg=value ...]
| Name | | Description |
|------|---|-------------|
| hosting-id | Required | Hosting ID |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -219,7 +235,7 @@ scw webhosting hosting update [arg=value ...]
| tags.{index} | | New tags for the Web Hosting plan |
| option-ids.{index} | | IDs of the new options for the Web Hosting plan |
| offer-id | | ID of the new offer for the Web Hosting plan |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down Expand Up @@ -267,7 +283,7 @@ scw webhosting offer list [arg=value ...]
| without-options | | Defines whether the response should consist of offers only, without options |
| only-options | | Defines whether the response should consist of options only, without offers |
| hosting-id | | ID of a Web Hosting plan, to check compatibility with returned offers (in case of wanting to update the plan) |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config |


**Examples:**
Expand Down
33 changes: 25 additions & 8 deletions internal/namespaces/webhosting/v1alpha1/webhosting_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func GetGeneratedCommands() *core.Commands {
webhostingRoot(),
webhostingHosting(),
webhostingOffer(),
webhostingControlPanels(),
webhostingHostingCreate(),
webhostingHostingList(),
webhostingHostingGet(),
Expand Down Expand Up @@ -58,6 +59,15 @@ func webhostingOffer() *core.Command {
}
}

func webhostingControlPanels() *core.Command {
return &core.Command{
Short: `Control Panels`,
Long: `Control panels represent the kind of administration panel to manage your Web Hosting plan, cPanel or plesk.`,
Namespace: "webhosting",
Resource: "control-panels",
}
}

func webhostingHostingCreate() *core.Command {
return &core.Command{
Short: `Order a Web Hosting plan`,
Expand Down Expand Up @@ -104,7 +114,7 @@ func webhostingHostingCreate() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.CreateHostingRequest)
Expand Down Expand Up @@ -164,14 +174,21 @@ func webhostingHostingList() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "control-panels.{index}",
Short: `Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "organization-id",
Short: `Organization ID to filter for, only Web Hosting plans from this Organization will be returned`,
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.Region(core.AllLocalities)),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.Region(core.AllLocalities)),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.ListHostingsRequest)
Expand Down Expand Up @@ -216,7 +233,7 @@ func webhostingHostingGet() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.GetHostingRequest)
Expand Down Expand Up @@ -280,7 +297,7 @@ func webhostingHostingUpdate() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.UpdateHostingRequest)
Expand Down Expand Up @@ -324,7 +341,7 @@ func webhostingHostingDelete() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.DeleteHostingRequest)
Expand Down Expand Up @@ -360,7 +377,7 @@ func webhostingHostingRestore() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.RestoreHostingRequest)
Expand Down Expand Up @@ -396,7 +413,7 @@ func webhostingHostingGetDNSRecords() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.GetDomainDNSRecordsRequest)
Expand Down Expand Up @@ -454,7 +471,7 @@ func webhostingOfferList() *core.Command {
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*webhosting.ListOffersRequest)
Expand Down

0 comments on commit 5ddaad4

Please sign in to comment.