Skip to content

Commit

Permalink
feat(serverless): remove serverless metrics and logs endpoints (#3715)
Browse files Browse the repository at this point in the history
Co-authored-by: Jules Castéran <jcasteran@scaleway.com>
  • Loading branch information
scaleway-bot and Codelax authored Mar 18, 2024
1 parent d24f686 commit 50c4ff4
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ AVAILABLE COMMANDS:
delete Delete a container
deploy Deploy a container
get Get a container
get-logs Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List your container logs
list List all your containers
update Update an existing container

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ AVAILABLE COMMANDS:
deploy Deploy a function
get Get a function
get-download-url Get a download URL of a function
get-logs Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List application logs
get-upload-url Get an upload URL of a function
list List all your functions
update Update an existing function
Expand Down
22 changes: 0 additions & 22 deletions docs/commands/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Container as a Service API.
- [Delete a container](#delete-a-container)
- [Deploy a container](#deploy-a-container)
- [Get a container](#get-a-container)
- [Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List your container logs](#deprecated-(replaced-by-[cockpit](https:www.scaleway.comendevelopersapicockpit)).-list-your-container-logs)
- [List all your containers](#list-all-your-containers)
- [Update an existing container](#update-an-existing-container)
- [Cron management commands](#cron-management-commands)
Expand Down Expand Up @@ -143,27 +142,6 @@ scw container container get <container-id ...> [arg=value ...]



### Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List your container logs

Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List the logs of the container with the specified ID.

**Usage:**

```
scw container container get-logs <container-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| container-id | Required | UUID of the container |
| order-by | One of: `timestamp_desc`, `timestamp_asc` | Order of the logs |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |



### List all your containers

List all containers for a specified region.
Expand Down
22 changes: 0 additions & 22 deletions docs/commands/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Function as a Service API.
- [Deploy a function](#deploy-a-function)
- [Get a function](#get-a-function)
- [Get a download URL of a function](#get-a-download-url-of-a-function)
- [Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List application logs](#deprecated-(replaced-by-[cockpit](https:www.scaleway.comendevelopersapicockpit)).-list-application-logs)
- [Get an upload URL of a function](#get-an-upload-url-of-a-function)
- [List all your functions](#list-all-your-functions)
- [Update an existing function](#update-an-existing-function)
Expand Down Expand Up @@ -388,27 +387,6 @@ scw function function get-download-url <function-id ...> [arg=value ...]



### Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List application logs

Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List the application logs of the function with the specified ID.

**Usage:**

```
scw function function get-logs <function-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| function-id | Required | UUID of the function to get the logs for |
| order-by | One of: `timestamp_desc`, `timestamp_asc` | Order of the logs |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |



### Get an upload URL of a function

Get an upload URL of a function associated with the specified ID.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/moby/buildkit v0.11.6
github.com/opencontainers/go-digest v1.0.0
github.com/pkg/errors v0.9.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240306151930-770cc3aba07c
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240314074042-0b790ad4f7ce
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240306151930-770cc3aba07c h1:LR4IxwRZoPKU9jyxT3Z9qGtWJzMHS0LFj0jyVrrIiqc=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240306151930-770cc3aba07c/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240314074042-0b790ad4f7ce h1:bGISpoEAHMfjP82D80zJ/+ljNznUSvUx/8X5ijaB3fo=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25.0.20240314074042-0b790ad4f7ce/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
48 changes: 0 additions & 48 deletions internal/namespaces/container/v1beta1/container_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func GetGeneratedCommands() *core.Commands {
containerCronCreate(),
containerCronUpdate(),
containerCronDelete(),
containerContainerGetLogs(),
containerDomainList(),
containerDomainGet(),
containerDomainCreate(),
Expand Down Expand Up @@ -1015,53 +1014,6 @@ func containerCronDelete() *core.Command {
}
}

func containerContainerGetLogs() *core.Command {
return &core.Command{
Short: `Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List your container logs`,
Long: `Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List the logs of the container with the specified ID.`,
Namespace: "container",
Resource: "container",
Verb: "get-logs",
// Deprecated: true,
ArgsType: reflect.TypeOf(container.ListLogsRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "container-id",
Short: `UUID of the container`,
Required: true,
Deprecated: false,
Positional: true,
},
{
Name: "order-by",
Short: `Order of the logs`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"timestamp_desc", "timestamp_asc"},
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*container.ListLogsRequest)

client := core.ExtractClient(ctx)
api := container.NewAPI(client)
opts := []scw.RequestOption{scw.WithAllPages()}
if request.Region == scw.Region(core.AllLocalities) {
opts = append(opts, scw.WithRegions(api.Regions()...))
request.Region = ""
}
resp, err := api.ListLogs(request, opts...)
if err != nil {
return nil, err
}
return resp.Logs, nil

},
}
}

func containerDomainList() *core.Command {
return &core.Command{
Short: `List all domain name bindings`,
Expand Down
48 changes: 0 additions & 48 deletions internal/namespaces/function/v1beta1/function_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func GetGeneratedCommands() *core.Commands {
functionCronCreate(),
functionCronUpdate(),
functionCronDelete(),
functionFunctionGetLogs(),
functionDomainList(),
functionDomainGet(),
functionDomainCreate(),
Expand Down Expand Up @@ -1113,53 +1112,6 @@ func functionCronDelete() *core.Command {
}
}

func functionFunctionGetLogs() *core.Command {
return &core.Command{
Short: `Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List application logs`,
Long: `Deprecated (replaced by [Cockpit](https://www.scaleway.com/en/developers/api/cockpit/)). List the application logs of the function with the specified ID.`,
Namespace: "function",
Resource: "function",
Verb: "get-logs",
// Deprecated: true,
ArgsType: reflect.TypeOf(function.ListLogsRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "function-id",
Short: `UUID of the function to get the logs for`,
Required: true,
Deprecated: false,
Positional: true,
},
{
Name: "order-by",
Short: `Order of the logs`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"timestamp_desc", "timestamp_asc"},
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*function.ListLogsRequest)

client := core.ExtractClient(ctx)
api := function.NewAPI(client)
opts := []scw.RequestOption{scw.WithAllPages()}
if request.Region == scw.Region(core.AllLocalities) {
opts = append(opts, scw.WithRegions(api.Regions()...))
request.Region = ""
}
resp, err := api.ListLogs(request, opts...)
if err != nil {
return nil, err
}
return resp.Logs, nil

},
}
}

func functionDomainList() *core.Command {
return &core.Command{
Short: `List all domain name bindings`,
Expand Down

0 comments on commit 50c4ff4

Please sign in to comment.