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
4 changes: 2 additions & 2 deletions docs/runware_serverless_apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runware serverless apps [flags]
* [runware serverless](runware_serverless.md) - Manage Runware serverless applications
* [runware serverless apps builds](runware_serverless_apps_builds.md) - Inspect application builds
* [runware serverless apps delete](runware_serverless_apps_delete.md) - Delete a serverless application
* [runware serverless apps endpoints](runware_serverless_apps_endpoints.md) - List endpoints for a serverless application
* [runware serverless apps endpoints](runware_serverless_apps_endpoints.md) - List and inspect endpoints for a serverless application
* [runware serverless apps env](runware_serverless_apps_env.md) - Manage plain-text environment variables for an application
* [runware serverless apps invoke](runware_serverless_apps_invoke.md) - Invoke an application endpoint
* [runware serverless apps list](runware_serverless_apps_list.md) - List serverless applications
Expand All @@ -42,5 +42,5 @@ runware serverless apps [flags]
* [runware serverless apps tasks](runware_serverless_apps_tasks.md) - List and inspect application tasks
* [runware serverless apps usage](runware_serverless_apps_usage.md) - Show usage and cost for a serverless application
* [runware serverless apps versions](runware_serverless_apps_versions.md) - Manage application versions
* [runware serverless apps workers](runware_serverless_apps_workers.md) - List workers for a serverless application
* [runware serverless apps workers](runware_serverless_apps_workers.md) - List and inspect workers for a serverless application

10 changes: 9 additions & 1 deletion docs/runware_serverless_apps_endpoints.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
## runware serverless apps endpoints

List endpoints for a serverless application
List and inspect endpoints for a serverless application

### Synopsis

List the endpoints of the application's active version.

The set is written by the source itself and is replaced atomically whenever a
version activates. Empty while the app is initializing.

```
runware serverless apps endpoints <appId> [flags]
Expand Down Expand Up @@ -36,4 +43,5 @@ runware serverless apps endpoints <appId> [flags]
### SEE ALSO

* [runware serverless apps](runware_serverless_apps.md) - Manage deployed serverless applications
* [runware serverless apps endpoints show](runware_serverless_apps_endpoints_show.md) - Show a single application endpoint

38 changes: 38 additions & 0 deletions docs/runware_serverless_apps_endpoints_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## runware serverless apps endpoints show

Show a single application endpoint

### Synopsis

Show one endpoint of the application's active version by ID.

```
runware serverless apps endpoints show <appId> <endpointId> [flags]
```

### Examples

```
# show an endpoint
runware serverless apps endpoints show my-app 11111111-1111-1111-1111-111111111111
```

### Options

```
-h, --help help for show
```

### Options inherited from parent commands

```
--debug Show full debug output
-F, --format string CLI output format: table, json, yaml (default "table")
--transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws")
-v, --verbose Show request/response details
```

### SEE ALSO

* [runware serverless apps endpoints](runware_serverless_apps_endpoints.md) - List and inspect endpoints for a serverless application

8 changes: 7 additions & 1 deletion docs/runware_serverless_apps_workers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## runware serverless apps workers

List workers for a serverless application
List and inspect workers for a serverless application

### Synopsis

List workers observed for an application, including terminal stopped rows
until they are purged.

```
runware serverless apps workers <appId> [flags]
Expand Down Expand Up @@ -40,4 +45,5 @@ runware serverless apps workers <appId> [flags]
### SEE ALSO

* [runware serverless apps](runware_serverless_apps.md) - Manage deployed serverless applications
* [runware serverless apps workers show](runware_serverless_apps_workers_show.md) - Show a single application worker

40 changes: 40 additions & 0 deletions docs/runware_serverless_apps_workers_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## runware serverless apps workers show

Show a single application worker

### Synopsis

Show one worker by ID within the application.

The ID is the Kubernetes pod UID recorded by the reconciler.

```
runware serverless apps workers show <appId> <workerId> [flags]
```

### Examples

```
# show a worker
runware serverless apps workers show my-app 44444444-4444-4444-4444-444444444444
```

### Options

```
-h, --help help for show
```

### Options inherited from parent commands

```
--debug Show full debug output
-F, --format string CLI output format: table, json, yaml (default "table")
--transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws")
-v, --verbose Show request/response details
```

### SEE ALSO

* [runware serverless apps workers](runware_serverless_apps_workers.md) - List and inspect workers for a serverless application

64 changes: 64 additions & 0 deletions internal/api/serverless/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,38 @@ func (c *Client) ListEndpoints(ctx context.Context, appID string, params *ListEn
}
}

// GetEndpoint returns a single endpoint by ID.
func (c *Client) GetEndpoint(ctx context.Context, appID string, endpointID uuid.UUID) (*Endpoint, error) {
if c.apiKey == "" {
return nil, transport.ErrNoAPIKey
}

resp, err := c.inner.GetEndpointWithResponse(ctx, appID, endpointID)
if err != nil {
return nil, fmt.Errorf("get endpoint: %w", err)
}

c.logResponse(ctx, resp.HTTPResponse, resp.Body)

switch resp.StatusCode() {
case http.StatusOK:
if resp.JSON200 == nil {
return nil, fmt.Errorf("get endpoint: empty 200 response")
}
return resp.JSON200, nil
case http.StatusUnauthorized:
return nil, problemToError(resp.ApplicationproblemJSON401, http.StatusUnauthorized)
case http.StatusForbidden:
return nil, problemToError(resp.ApplicationproblemJSON403, http.StatusForbidden)
case http.StatusNotFound:
return nil, problemToError(resp.ApplicationproblemJSON404, http.StatusNotFound)
case http.StatusUnprocessableEntity:
return nil, problemToError(resp.ApplicationproblemJSON422, http.StatusUnprocessableEntity)
default:
return nil, problemFromBody(resp.Body, resp.StatusCode())
}
}

// ListVersions returns a page of versions for an app.
func (c *Client) ListVersions(ctx context.Context, appID string, params *ListVersionsParams) (Page[Version], error) {
if c.apiKey == "" {
Expand Down Expand Up @@ -762,6 +794,38 @@ func (c *Client) ListWorkers(ctx context.Context, appID string, params *ListWork
}
}

// GetWorker returns a single worker by ID (the Kubernetes pod UID).
func (c *Client) GetWorker(ctx context.Context, appID string, workerID uuid.UUID) (*Worker, error) {
if c.apiKey == "" {
return nil, transport.ErrNoAPIKey
}

resp, err := c.inner.GetWorkerWithResponse(ctx, appID, workerID)
if err != nil {
return nil, fmt.Errorf("get worker: %w", err)
}

c.logResponse(ctx, resp.HTTPResponse, resp.Body)

switch resp.StatusCode() {
case http.StatusOK:
if resp.JSON200 == nil {
return nil, fmt.Errorf("get worker: empty 200 response")
}
return resp.JSON200, nil
case http.StatusUnauthorized:
return nil, problemToError(resp.ApplicationproblemJSON401, http.StatusUnauthorized)
case http.StatusForbidden:
return nil, problemToError(resp.ApplicationproblemJSON403, http.StatusForbidden)
case http.StatusNotFound:
return nil, problemToError(resp.ApplicationproblemJSON404, http.StatusNotFound)
case http.StatusUnprocessableEntity:
return nil, problemToError(resp.ApplicationproblemJSON422, http.StatusUnprocessableEntity)
default:
return nil, problemFromBody(resp.Body, resp.StatusCode())
}
}

// NewCodeAppSource builds an appSource for a code-based create.
func NewCodeAppSource(src CodeSourceUpsert) (AppSourceUpsert, error) {
var source gen.AppSourceUpsert_Source
Expand Down
Loading