Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/scw/testdata/test-all-usage-tem-offers-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve the list of the available and free-of-charge offers you can subscribe to.

USAGE:
scw tem offers list [arg=value ...]

ARGS:
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for list

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
20 changes: 20 additions & 0 deletions cmd/scw/testdata/test-all-usage-tem-offers-update-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update a subscribed offer.

USAGE:
scw tem offers update [arg=value ...]

ARGS:
[project-id] Project ID to use. If none is passed the default project ID will be used
[name] Name of the offer-subscription (unknown_name | essential | scale)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for update

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
8 changes: 7 additions & 1 deletion cmd/scw/testdata/test-all-usage-tem-offers-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
This section allows you to manage and get get subscribed information about your project email offer.

USAGE:
scw tem offers
scw tem offers <command>

AVAILABLE COMMANDS:
list List the available offers.
update Update a subscribed offer

FLAGS:
-h, --help help for offers
Expand All @@ -13,3 +17,5 @@ GLOBAL FLAGS:
-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

Use "scw tem offers [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get project resource consumption.

USAGE:
scw tem project-consumption get [arg=value ...]

ARGS:
[project-id] Project ID to use. If none is passed the default project ID will be used
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for get

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 @@ -3,7 +3,10 @@
Project consumption allow you to see your project consumption.

USAGE:
scw tem project-consumption
scw tem project-consumption <command>

AVAILABLE COMMANDS:
get Get project resource consumption.

FLAGS:
-h, --help help for project-consumption
Expand All @@ -13,3 +16,5 @@ GLOBAL FLAGS:
-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

Use "scw tem project-consumption [command] --help" for more information about a command.
53 changes: 49 additions & 4 deletions docs/commands/tem.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ This API allows you to manage your Transactional Email services.
- [Email statuses](#email-statuses)
- [List emails](#list-emails)
- [Project offers management commands](#project-offers-management-commands)
- [List the available offers.](#list-the-available-offers.)
- [Update a subscribed offer](#update-a-subscribed-offer)
- [Project consumption management commands](#project-consumption-management-commands)
- [Get project resource consumption.](#get-project-resource-consumption.)
- [Project settings management commands](#project-settings-management-commands)
- [Webhook management commands](#webhook-management-commands)
- [Create a Webhook](#create-a-webhook)
Expand Down Expand Up @@ -398,29 +401,71 @@ scw tem email list [arg=value ...]

This section allows you to manage and get get subscribed information about your project email offer.

This section allows you to manage and get get subscribed information about your project email offer.

### List the available offers.

Retrieve the list of the available and free-of-charge offers you can subscribe to.

**Usage:**

```
scw tem offers list [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



### Update a subscribed offer

Update a subscribed offer.

**Usage:**

```
scw tem offers
scw tem offers update [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| name | One of: `unknown_name`, `essential`, `scale` | Name of the offer-subscription |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



## Project consumption management commands

Project consumption allow you to see your project consumption.

Project consumption allow you to see your project consumption.

### Get project resource consumption.

Get project resource consumption.

**Usage:**

```
scw tem project-consumption
scw tem project-consumption get [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



## Project settings management commands

Expand Down
82 changes: 82 additions & 0 deletions internal/namespaces/tem/v1alpha1/tem_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func GetGeneratedCommands() *core.Commands {
temBlocklistsList(),
temBlocklistsCreate(),
temBlocklistsDelete(),
temOffersUpdate(),
temOffersList(),
temProjectConsumptionGet(),
)
}
func temRoot() *core.Command {
Expand Down Expand Up @@ -1250,3 +1253,82 @@ func temBlocklistsDelete() *core.Command {
},
}
}

func temOffersUpdate() *core.Command {
return &core.Command{
Short: `Update a subscribed offer`,
Long: `Update a subscribed offer.`,
Namespace: "tem",
Resource: "offers",
Verb: "update",
// Deprecated: false,
ArgsType: reflect.TypeOf(tem.UpdateOfferSubscriptionRequest{}),
ArgSpecs: core.ArgSpecs{
core.ProjectIDArgSpec(),
{
Name: "name",
Short: `Name of the offer-subscription`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown_name", "essential", "scale"},
},
core.RegionArgSpec(scw.RegionFrPar),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*tem.UpdateOfferSubscriptionRequest)

client := core.ExtractClient(ctx)
api := tem.NewAPI(client)
return api.UpdateOfferSubscription(request)

},
}
}

func temOffersList() *core.Command {
return &core.Command{
Short: `List the available offers.`,
Long: `Retrieve the list of the available and free-of-charge offers you can subscribe to.`,
Namespace: "tem",
Resource: "offers",
Verb: "list",
// Deprecated: false,
ArgsType: reflect.TypeOf(tem.ListOffersRequest{}),
ArgSpecs: core.ArgSpecs{
core.RegionArgSpec(scw.RegionFrPar),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*tem.ListOffersRequest)

client := core.ExtractClient(ctx)
api := tem.NewAPI(client)
return api.ListOffers(request)

},
}
}

func temProjectConsumptionGet() *core.Command {
return &core.Command{
Short: `Get project resource consumption.`,
Long: `Get project resource consumption.`,
Namespace: "tem",
Resource: "project-consumption",
Verb: "get",
// Deprecated: false,
ArgsType: reflect.TypeOf(tem.GetProjectConsumptionRequest{}),
ArgSpecs: core.ArgSpecs{
core.ProjectIDArgSpec(),
core.RegionArgSpec(scw.RegionFrPar),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*tem.GetProjectConsumptionRequest)

client := core.ExtractClient(ctx)
api := tem.NewAPI(client)
return api.GetProjectConsumption(request)

},
}
}
Loading