Skip to content

Commit f2ddf2c

Browse files
feat(api): manual updates
1 parent e2c8f14 commit f2ddf2c

6 files changed

Lines changed: 24 additions & 112 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2eeb61205775c5997abf8154cd6f6fe81a1e83870eff10050b17ed415aa7860b.yml
3-
openapi_spec_hash: 63405add4a3f53718f8183cbb8c1a22f
1+
configured_endpoints: 16
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-ff8ccba8b5409eaa1128df9027582cb63f66e8accd75e511f70b7c27ef26c9ae.yml
3+
openapi_spec_hash: 1dbacc339695a7c78718f90f791d3f01
44
config_hash: 00ec9df250b9dc077f8d3b93a442d252

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ Response Types:
1414
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentStateEvent">DeploymentStateEvent</a>
1515
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentNewResponse">DeploymentNewResponse</a>
1616
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentGetResponse">DeploymentGetResponse</a>
17-
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentListResponse">DeploymentListResponse</a>
1817
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentFollowResponseUnion">DeploymentFollowResponseUnion</a>
1918

2019
Methods:
2120

2221
- <code title="post /deployments">client.Deployments.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentNewParams">DeploymentNewParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentNewResponse">DeploymentNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2322
- <code title="get /deployments/{id}">client.Deployments.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentGetResponse">DeploymentGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
24-
- <code title="get /deployments">client.Deployments.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentListParams">DeploymentListParams</a>) ([]<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentListResponse">DeploymentListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2523
- <code title="get /deployments/{id}/events">client.Deployments.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentService.Follow">Follow</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentFollowParams">DeploymentFollowParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#DeploymentFollowResponseUnion">DeploymentFollowResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2624

2725
# Apps

app.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/onkernel/kernel-go-sdk/option"
1414
"github.com/onkernel/kernel-go-sdk/packages/param"
1515
"github.com/onkernel/kernel-go-sdk/packages/respjson"
16-
"github.com/onkernel/kernel-go-sdk/shared"
1716
"github.com/onkernel/kernel-go-sdk/shared/constant"
1817
)
1918

@@ -50,27 +49,24 @@ func (r *AppService) List(ctx context.Context, query AppListParams, opts ...opti
5049
type AppListResponse struct {
5150
// Unique identifier for the app version
5251
ID string `json:"id,required"`
53-
// List of actions available on the app
54-
Actions []shared.AppAction `json:"actions,required"`
5552
// Name of the application
5653
AppName string `json:"app_name,required"`
5754
// Deployment ID
5855
Deployment string `json:"deployment,required"`
59-
// Environment variables configured for this app version
60-
EnvVars map[string]string `json:"env_vars,required"`
6156
// Deployment region code
6257
Region constant.AwsUsEast1a `json:"region,required"`
6358
// Version label for the application
6459
Version string `json:"version,required"`
60+
// Environment variables configured for this app version
61+
EnvVars map[string]string `json:"env_vars"`
6562
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
6663
JSON struct {
6764
ID respjson.Field
68-
Actions respjson.Field
6965
AppName respjson.Field
7066
Deployment respjson.Field
71-
EnvVars respjson.Field
7267
Region respjson.Field
7368
Version respjson.Field
69+
EnvVars respjson.Field
7470
ExtraFields map[string]respjson.Field
7571
raw string
7672
} `json:"-"`

appdeployment.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type AppDeploymentNewResponseApp struct {
9999
// ID for the app version deployed
100100
ID string `json:"id,required"`
101101
// List of actions available on the app
102-
Actions []shared.AppAction `json:"actions,required"`
102+
Actions []AppDeploymentNewResponseAppAction `json:"actions,required"`
103103
// Name of the app
104104
Name string `json:"name,required"`
105105
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -118,6 +118,23 @@ func (r *AppDeploymentNewResponseApp) UnmarshalJSON(data []byte) error {
118118
return apijson.UnmarshalRoot(data, r)
119119
}
120120

121+
type AppDeploymentNewResponseAppAction struct {
122+
// Name of the action
123+
Name string `json:"name,required"`
124+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
125+
JSON struct {
126+
Name respjson.Field
127+
ExtraFields map[string]respjson.Field
128+
raw string
129+
} `json:"-"`
130+
}
131+
132+
// Returns the unmodified JSON received from the API
133+
func (r AppDeploymentNewResponseAppAction) RawJSON() string { return r.JSON.raw }
134+
func (r *AppDeploymentNewResponseAppAction) UnmarshalJSON(data []byte) error {
135+
return apijson.UnmarshalRoot(data, r)
136+
}
137+
121138
// Current status of the deployment
122139
type AppDeploymentNewResponseStatus string
123140

deployment.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ func (r *DeploymentService) Get(ctx context.Context, id string, opts ...option.R
6565
return
6666
}
6767

68-
// List deployments. Optionally filter by application name.
69-
func (r *DeploymentService) List(ctx context.Context, query DeploymentListParams, opts ...option.RequestOption) (res *[]DeploymentListResponse, err error) {
70-
opts = append(r.Options[:], opts...)
71-
path := "deployments"
72-
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
73-
return
74-
}
75-
7668
// Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
7769
// status updates for a deployment. The stream terminates automatically once the
7870
// deployment reaches a terminal state.
@@ -261,58 +253,6 @@ const (
261253
DeploymentGetResponseStatusStopped DeploymentGetResponseStatus = "stopped"
262254
)
263255

264-
// Deployment record information.
265-
type DeploymentListResponse struct {
266-
// Unique identifier for the deployment
267-
ID string `json:"id,required"`
268-
// Timestamp when the deployment was created
269-
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
270-
// Deployment region code
271-
Region constant.AwsUsEast1a `json:"region,required"`
272-
// Current status of the deployment
273-
//
274-
// Any of "queued", "in_progress", "running", "failed", "stopped".
275-
Status DeploymentListResponseStatus `json:"status,required"`
276-
// Relative path to the application entrypoint
277-
EntrypointRelPath string `json:"entrypoint_rel_path"`
278-
// Environment variables configured for this deployment
279-
EnvVars map[string]string `json:"env_vars"`
280-
// Status reason
281-
StatusReason string `json:"status_reason"`
282-
// Timestamp when the deployment was last updated
283-
UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
284-
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
285-
JSON struct {
286-
ID respjson.Field
287-
CreatedAt respjson.Field
288-
Region respjson.Field
289-
Status respjson.Field
290-
EntrypointRelPath respjson.Field
291-
EnvVars respjson.Field
292-
StatusReason respjson.Field
293-
UpdatedAt respjson.Field
294-
ExtraFields map[string]respjson.Field
295-
raw string
296-
} `json:"-"`
297-
}
298-
299-
// Returns the unmodified JSON received from the API
300-
func (r DeploymentListResponse) RawJSON() string { return r.JSON.raw }
301-
func (r *DeploymentListResponse) UnmarshalJSON(data []byte) error {
302-
return apijson.UnmarshalRoot(data, r)
303-
}
304-
305-
// Current status of the deployment
306-
type DeploymentListResponseStatus string
307-
308-
const (
309-
DeploymentListResponseStatusQueued DeploymentListResponseStatus = "queued"
310-
DeploymentListResponseStatusInProgress DeploymentListResponseStatus = "in_progress"
311-
DeploymentListResponseStatusRunning DeploymentListResponseStatus = "running"
312-
DeploymentListResponseStatusFailed DeploymentListResponseStatus = "failed"
313-
DeploymentListResponseStatusStopped DeploymentListResponseStatus = "stopped"
314-
)
315-
316256
// DeploymentFollowResponseUnion contains all possible properties and values from
317257
// [shared.LogEvent], [DeploymentStateEvent],
318258
// [DeploymentFollowResponseAppVersionSummaryEvent], [shared.ErrorEvent],
@@ -474,20 +414,6 @@ const (
474414
DeploymentNewParamsRegionAwsUsEast1a DeploymentNewParamsRegion = "aws.us-east-1a"
475415
)
476416

477-
type DeploymentListParams struct {
478-
// Filter results by application name.
479-
AppName param.Opt[string] `query:"app_name,omitzero" json:"-"`
480-
paramObj
481-
}
482-
483-
// URLQuery serializes [DeploymentListParams]'s query parameters as `url.Values`.
484-
func (r DeploymentListParams) URLQuery() (v url.Values, err error) {
485-
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
486-
ArrayFormat: apiquery.ArrayQueryFormatComma,
487-
NestedFormat: apiquery.NestedQueryFormatBrackets,
488-
})
489-
}
490-
491417
type DeploymentFollowParams struct {
492418
// Show logs since the given time (RFC timestamps or durations like 5m).
493419
Since param.Opt[string] `query:"since,omitzero" json:"-"`

deployment_test.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,3 @@ func TestDeploymentGet(t *testing.T) {
6969
t.Fatalf("err should be nil: %s", err.Error())
7070
}
7171
}
72-
73-
func TestDeploymentListWithOptionalParams(t *testing.T) {
74-
t.Skip("skipped: tests are disabled for the time being")
75-
baseURL := "http://localhost:4010"
76-
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
77-
baseURL = envURL
78-
}
79-
if !testutil.CheckTestServer(t, baseURL) {
80-
return
81-
}
82-
client := kernel.NewClient(
83-
option.WithBaseURL(baseURL),
84-
option.WithAPIKey("My API Key"),
85-
)
86-
_, err := client.Deployments.List(context.TODO(), kernel.DeploymentListParams{
87-
AppName: kernel.String("app_name"),
88-
})
89-
if err != nil {
90-
var apierr *kernel.Error
91-
if errors.As(err, &apierr) {
92-
t.Log(string(apierr.DumpRequest(true)))
93-
}
94-
t.Fatalf("err should be nil: %s", err.Error())
95-
}
96-
}

0 commit comments

Comments
 (0)