From 5ddaad46abfd24d298ab789bf10ec63d794593cb Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Fri, 10 Nov 2023 16:03:43 +0100 Subject: [PATCH] feat(webhosting): add control panel support in webhosting (#3484) Co-authored-by: Yacine Fodil <105779815+yfodil@users.noreply.github.com> --- ...age-webhosting-control-panels-usage.golden | 15 +++++++++ ...age-webhosting-hosting-create-usage.golden | 2 +- ...age-webhosting-hosting-delete-usage.golden | 2 +- ...sting-hosting-get-dns-records-usage.golden | 2 +- ...-usage-webhosting-hosting-get-usage.golden | 2 +- ...usage-webhosting-hosting-list-usage.golden | 15 +++++---- ...ge-webhosting-hosting-restore-usage.golden | 2 +- ...age-webhosting-hosting-update-usage.golden | 2 +- ...l-usage-webhosting-offer-list-usage.golden | 2 +- .../test-all-usage-webhosting-usage.golden | 5 +-- docs/commands/webhosting.md | 32 +++++++++++++----- .../webhosting/v1alpha1/webhosting_cli.go | 33 ++++++++++++++----- 12 files changed, 82 insertions(+), 32 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-webhosting-control-panels-usage.golden diff --git a/cmd/scw/testdata/test-all-usage-webhosting-control-panels-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-control-panels-usage.golden new file mode 100644 index 0000000000..8c6ea5b341 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-webhosting-control-panels-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-create-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-create-usage.golden index dd011c2f0b..abeed92857 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-create-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-delete-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-delete-usage.golden index 0ed9cf2380..0b37c8194e 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-delete-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-delete-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-dns-records-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-dns-records-usage.golden index 7024dda7a4..74d45eea4e 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-dns-records-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-dns-records-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-usage.golden index 95771ee64f..95648d1df5 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-get-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-list-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-list-usage.golden index 1f05967999..973165e95a 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-list-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-restore-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-restore-usage.golden index ba2d86d5fa..34d02bb165 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-restore-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-restore-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-hosting-update-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-hosting-update-usage.golden index 393691ae28..cefdb388a6 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-hosting-update-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-hosting-update-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-offer-list-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-offer-list-usage.golden index 77944e4771..9ea7bb31fc 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-offer-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-offer-list-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-webhosting-usage.golden b/cmd/scw/testdata/test-all-usage-webhosting-usage.golden index 065f8076f5..cf9c94ad50 100644 --- a/cmd/scw/testdata/test-all-usage-webhosting-usage.golden +++ b/cmd/scw/testdata/test-all-usage-webhosting-usage.golden @@ -6,8 +6,9 @@ USAGE: scw webhosting 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 diff --git a/docs/commands/webhosting.md b/docs/commands/webhosting.md index 2f8fd0f517..09b54aedd8 100644 --- a/docs/commands/webhosting.md +++ b/docs/commands/webhosting.md @@ -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) @@ -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. @@ -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`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | @@ -60,7 +75,7 @@ scw webhosting hosting delete [arg=value ...] | Name | | Description | |------|---|-------------| | hosting-id | Required | Hosting ID | -| region | Default: `fr-par`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -90,7 +105,7 @@ scw webhosting hosting get [arg=value ...] | Name | | Description | |------|---|-------------| | hosting-id | Required | Hosting ID | -| region | Default: `fr-par`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -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`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -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`
One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `all` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -185,7 +201,7 @@ scw webhosting hosting restore [arg=value ...] | Name | | Description | |------|---|-------------| | hosting-id | Required | Hosting ID | -| region | Default: `fr-par`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -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`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** @@ -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`
One of: `fr-par` | Region to target. If none is passed will use default region from the config | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | **Examples:** diff --git a/internal/namespaces/webhosting/v1alpha1/webhosting_cli.go b/internal/namespaces/webhosting/v1alpha1/webhosting_cli.go index d1cb794eae..5176c984b3 100644 --- a/internal/namespaces/webhosting/v1alpha1/webhosting_cli.go +++ b/internal/namespaces/webhosting/v1alpha1/webhosting_cli.go @@ -22,6 +22,7 @@ func GetGeneratedCommands() *core.Commands { webhostingRoot(), webhostingHosting(), webhostingOffer(), + webhostingControlPanels(), webhostingHostingCreate(), webhostingHostingList(), webhostingHostingGet(), @@ -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`, @@ -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) @@ -164,6 +174,13 @@ 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`, @@ -171,7 +188,7 @@ func webhostingHostingList() *core.Command { 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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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)