File tree Expand file tree Collapse file tree 7 files changed +198
-0
lines changed
Expand file tree Collapse file tree 7 files changed +198
-0
lines changed Original file line number Diff line number Diff line change 1+ package delete
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/params"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
8+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
9+ )
10+
11+ const distributionIDFlag = "distribution-id"
12+
13+ type inputModel struct {
14+ * globalflags.GlobalFlagModel
15+ DistributionID string
16+ }
17+
18+ func NewCmd (params * params.CmdParams ) * cobra.Command {
19+ cmd := & cobra.Command {
20+ Use : "delete" ,
21+ Short : "Delete a CDN distribution" ,
22+ Long : "Delete a CDN distribution by its ID." ,
23+ Args : args .NoArgs ,
24+ Example : examples .Build (
25+ examples .NewExample (
26+ `Delete a CDN distribution with ID "xxx"` ,
27+ `$ stackit beta cdn distribution delete --distribution-id xxx` ,
28+ ),
29+ ),
30+ RunE : func (cmd * cobra.Command , args []string ) error {
31+
32+ // TODO
33+ return nil
34+ },
35+ }
36+ configureFlags (cmd )
37+ return cmd
38+ }
39+
40+ func configureFlags (cmd * cobra.Command ) {
41+ //TODO
42+ }
Original file line number Diff line number Diff line change 1+ package describe
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/params"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
8+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
9+ )
10+
11+ const distributionIDFlag = "distribution-id"
12+
13+ type inputModel struct {
14+ * globalflags.GlobalFlagModel
15+ DistributionID string
16+ }
17+
18+ func NewCmd (params * params.CmdParams ) * cobra.Command {
19+ cmd := & cobra.Command {
20+ Use : "describe" ,
21+ Short : "Describe a CDN distribution" ,
22+ Long : "Describe a CDN distribution by its ID." ,
23+ Args : args .NoArgs ,
24+ Example : examples .Build (
25+ examples .NewExample (
26+ `Get details of a CDN distribution with ID "xxx"` ,
27+ `$ stackit beta cdn distribution describe --distribution-id xxx` ,
28+ ),
29+ ),
30+ RunE : func (cmd * cobra.Command , args []string ) error {
31+ // TODO
32+ return nil
33+ },
34+ }
35+ configureFlags (cmd )
36+ return cmd
37+ }
38+
39+ func configureFlags (cmd * cobra.Command ) {
40+ cmd .Flags ().String (distributionIDFlag , "" , "The ID of the CDN distribution to describe" )
41+ err := cmd .MarkFlagRequired (distributionIDFlag )
42+ cobra .CheckErr (err )
43+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package distribution
22
33import (
44 "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/beta/alb/delete"
6+ "github.com/stackitcloud/stackit-cli/internal/cmd/beta/alb/describe"
7+ "github.com/stackitcloud/stackit-cli/internal/cmd/beta/alb/update"
58 "github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create"
69 "github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list"
710 "github.com/stackitcloud/stackit-cli/internal/cmd/params"
@@ -22,5 +25,8 @@ func NewCommand(params *params.CmdParams) *cobra.Command {
2225
2326func addSubcommands (cmd * cobra.Command , params * params.CmdParams ) {
2427 cmd .AddCommand (list .NewCmd (params ))
28+ cmd .AddCommand (describe .NewCmd (params ))
2529 cmd .AddCommand (create .NewCmd (params ))
30+ cmd .AddCommand (update .NewCmd (params ))
31+ cmd .AddCommand (delete .NewCmd (params ))
2632}
Original file line number Diff line number Diff line change 1+ package update
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/params"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
8+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
9+ "github.com/stackitcloud/stackit-sdk-go/services/cdn"
10+ )
11+
12+ const (
13+ distributionIDFlag = "distribution-id"
14+ regionsFlag = "regions"
15+ )
16+
17+ type inputModel struct {
18+ * globalflags.GlobalFlagModel
19+ DistributionID string
20+ Regions []cdn.Region
21+ }
22+
23+ func NewCmd (params * params.CmdParams ) * cobra.Command {
24+ cmd := & cobra.Command {
25+ Use : "update" ,
26+ Short : "Update a CDN distribution" ,
27+ Long : "Update a CDN distribution by its ID, allowing replacement of its regions." ,
28+ Args : args .NoArgs ,
29+ Example : examples .Build (
30+ examples .NewExample (
31+ `Update a CDN distribution with ID "xxx" to be cached in reions "EU" and "AF"` ,
32+ `$ stackit beta cdn distribution update --distribution-id xxx --regions EU,AF` ,
33+ ),
34+ ),
35+ RunE : func (cmd * cobra.Command , args []string ) error {
36+ // TODO
37+ return nil
38+ },
39+ }
40+ configureFlags (cmd )
41+ return cmd
42+ }
43+
44+ func configureFlags (cmd * cobra.Command ) {
45+ //TODO
46+ }
Original file line number Diff line number Diff line change 1+ package create
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/params"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ )
8+
9+ const (
10+ flagDistributionID = "distribution-id"
11+ flagName = "name"
12+ )
13+
14+ func NewCmd (params * params.CmdParams ) * cobra.Command {
15+ cmd := & cobra.Command {
16+ Use : "create" ,
17+ Short : "Create a CDN domain" ,
18+ Long : "Create a new CDN domain associated with a CDN distribution." ,
19+ Args : cobra .NoArgs ,
20+ Example : examples .Build (
21+ examples .NewExample (
22+ `Create a CDN domain named "example.com" for distribution with ID "xxx"` ,
23+ `$ stackit beta cdn domain create --name example.com --distribution-id xxx` ,
24+ ),
25+ ),
26+ RunE : func (cmd * cobra.Command , args []string ) error {
27+ // TODO
28+ return nil
29+ },
30+ }
31+ configureFlags (cmd )
32+ return cmd
33+ }
34+
35+ func configureFlags (cmd * cobra.Command ) {
36+ // TODO
37+ }
Original file line number Diff line number Diff line change 1+ package describe
Original file line number Diff line number Diff line change 1+ package domain
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/params"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
7+ )
8+
9+ func NewCommand (params * params.CmdParams ) * cobra.Command {
10+ cmd := & cobra.Command {
11+ Use : "domain" ,
12+ Short : "Manage CDN domains" ,
13+ Long : "Manage the lifecycle of CDN domains." ,
14+ Args : cobra .NoArgs ,
15+ Run : utils .CmdHelp ,
16+ }
17+ addSubcommands (cmd , params )
18+ return cmd
19+ }
20+
21+ func addSubcommands (cmd * cobra.Command , params * params.CmdParams ) {
22+
23+ }
You can’t perform that action at this time.
0 commit comments