Skip to content

Commit 7c48ec7

Browse files
feat(api): expose Veto Exec security policies
1 parent 852cade commit 7c48ec7

6 files changed

Lines changed: 1220 additions & 7 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: 208
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-fd66f2e81aa69c4f641455d0c0a0445dd1d19044d4df4e9836f8a4c46fc9dc6f.yml
1+
configured_endpoints: 213
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-b1e68173fb6d6d5724b044c11054fe52886b4df5a28fa9cfb3012bb98029b8a0.yml
33
openapi_spec_hash: 28370b91b0a88436db1be3e889572d06
4-
config_hash: 54a2464546fb2664da69602e71358c39
4+
config_hash: ebf0825535f3d05be92a8814930ca9df

‎api.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,24 @@ Methods:
964964
- <code title="post /gitpod.v1.SecretService/GetSecretValue">client.Secrets.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretService.GetValue">GetValue</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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretGetValueParams">SecretGetValueParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretGetValueResponse">SecretGetValueResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
965965
- <code title="post /gitpod.v1.SecretService/UpdateSecretValue">client.Secrets.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretService.UpdateValue">UpdateValue</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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretUpdateValueParams">SecretUpdateValueParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecretUpdateValueResponse">SecretUpdateValueResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
966966

967+
# SecurityPolicies
968+
969+
Response Types:
970+
971+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicy">SecurityPolicy</a>
972+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyNewResponse">SecurityPolicyNewResponse</a>
973+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyGetResponse">SecurityPolicyGetResponse</a>
974+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyUpdateResponse">SecurityPolicyUpdateResponse</a>
975+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyDeleteResponse">SecurityPolicyDeleteResponse</a>
976+
977+
Methods:
978+
979+
- <code title="post /gitpod.v1.SecurityService/CreateSecurityPolicy">client.SecurityPolicies.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyService.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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyNewParams">SecurityPolicyNewParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyNewResponse">SecurityPolicyNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
980+
- <code title="post /gitpod.v1.SecurityService/GetSecurityPolicy">client.SecurityPolicies.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyService.Get">Get</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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyGetParams">SecurityPolicyGetParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyGetResponse">SecurityPolicyGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
981+
- <code title="post /gitpod.v1.SecurityService/UpdateSecurityPolicy">client.SecurityPolicies.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyService.Update">Update</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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyUpdateParams">SecurityPolicyUpdateParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyUpdateResponse">SecurityPolicyUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
982+
- <code title="post /gitpod.v1.SecurityService/ListSecurityPolicies">client.SecurityPolicies.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyListParams">SecurityPolicyListParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/packages/pagination#SecurityPoliciesPage">SecurityPoliciesPage</a>[<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicy">SecurityPolicy</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
983+
- <code title="post /gitpod.v1.SecurityService/DeleteSecurityPolicy">client.SecurityPolicies.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyService.Delete">Delete</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/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyDeleteParams">SecurityPolicyDeleteParams</a>) (\*<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityPolicyDeleteResponse">SecurityPolicyDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
984+
967985
# Usage
968986

969987
Params Types:

‎client.go‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ type Client struct {
3636
// PrebuildService manages prebuilds for projects to enable faster environment
3737
// startup times. Prebuilds create snapshots of environments that can be used to
3838
// provision new environments quickly.
39-
Prebuilds *PrebuildService
40-
Projects *ProjectService
41-
Runners *RunnerService
42-
Secrets *SecretService
39+
Prebuilds *PrebuildService
40+
Projects *ProjectService
41+
Runners *RunnerService
42+
Secrets *SecretService
43+
SecurityPolicies *SecurityPolicyService
4344
// UsageService provides usage information about environments, users, and projects.
4445
Usage *UsageService
4546
Users *UserService
@@ -91,6 +92,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
9192
r.Projects = NewProjectService(opts...)
9293
r.Runners = NewRunnerService(opts...)
9394
r.Secrets = NewSecretService(opts...)
95+
r.SecurityPolicies = NewSecurityPolicyService(opts...)
9496
r.Usage = NewUsageService(opts...)
9597
r.Users = NewUserService(opts...)
9698

‎packages/pagination/pagination.go‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,6 +3371,131 @@ func (r *SecretsPageAutoPager[T]) Index() int {
33713371
return r.run
33723372
}
33733373

3374+
type SecurityPoliciesPagePagination struct {
3375+
NextToken string `json:"nextToken"`
3376+
JSON securityPoliciesPagePaginationJSON `json:"-"`
3377+
}
3378+
3379+
// securityPoliciesPagePaginationJSON contains the JSON metadata for the struct
3380+
// [SecurityPoliciesPagePagination]
3381+
type securityPoliciesPagePaginationJSON struct {
3382+
NextToken apijson.Field
3383+
raw string
3384+
ExtraFields map[string]apijson.Field
3385+
}
3386+
3387+
func (r *SecurityPoliciesPagePagination) UnmarshalJSON(data []byte) (err error) {
3388+
return apijson.UnmarshalRoot(data, r)
3389+
}
3390+
3391+
func (r securityPoliciesPagePaginationJSON) RawJSON() string {
3392+
return r.raw
3393+
}
3394+
3395+
type SecurityPoliciesPage[T any] struct {
3396+
Pagination SecurityPoliciesPagePagination `json:"pagination"`
3397+
SecurityPolicies []T `json:"securityPolicies"`
3398+
JSON securityPoliciesPageJSON `json:"-"`
3399+
cfg *requestconfig.RequestConfig
3400+
res *http.Response
3401+
}
3402+
3403+
// securityPoliciesPageJSON contains the JSON metadata for the struct
3404+
// [SecurityPoliciesPage[T]]
3405+
type securityPoliciesPageJSON struct {
3406+
Pagination apijson.Field
3407+
SecurityPolicies apijson.Field
3408+
raw string
3409+
ExtraFields map[string]apijson.Field
3410+
}
3411+
3412+
func (r *SecurityPoliciesPage[T]) UnmarshalJSON(data []byte) (err error) {
3413+
return apijson.UnmarshalRoot(data, r)
3414+
}
3415+
3416+
func (r securityPoliciesPageJSON) RawJSON() string {
3417+
return r.raw
3418+
}
3419+
3420+
// GetNextPage returns the next page as defined by this pagination style. When
3421+
// there is no next page, this function will return a 'nil' for the page value, but
3422+
// will not return an error
3423+
func (r *SecurityPoliciesPage[T]) GetNextPage() (res *SecurityPoliciesPage[T], err error) {
3424+
if len(r.SecurityPolicies) == 0 {
3425+
return nil, nil
3426+
}
3427+
next := r.Pagination.NextToken
3428+
if len(next) == 0 {
3429+
return nil, nil
3430+
}
3431+
cfg := r.cfg.Clone(r.cfg.Context)
3432+
err = cfg.Apply(option.WithQuery("token", next))
3433+
if err != nil {
3434+
return nil, err
3435+
}
3436+
var raw *http.Response
3437+
cfg.ResponseInto = &raw
3438+
cfg.ResponseBodyInto = &res
3439+
err = cfg.Execute()
3440+
if err != nil {
3441+
return nil, err
3442+
}
3443+
res.SetPageConfig(cfg, raw)
3444+
return res, nil
3445+
}
3446+
3447+
func (r *SecurityPoliciesPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
3448+
if r == nil {
3449+
r = &SecurityPoliciesPage[T]{}
3450+
}
3451+
r.cfg = cfg
3452+
r.res = res
3453+
}
3454+
3455+
type SecurityPoliciesPageAutoPager[T any] struct {
3456+
page *SecurityPoliciesPage[T]
3457+
cur T
3458+
idx int
3459+
run int
3460+
err error
3461+
}
3462+
3463+
func NewSecurityPoliciesPageAutoPager[T any](page *SecurityPoliciesPage[T], err error) *SecurityPoliciesPageAutoPager[T] {
3464+
return &SecurityPoliciesPageAutoPager[T]{
3465+
page: page,
3466+
err: err,
3467+
}
3468+
}
3469+
3470+
func (r *SecurityPoliciesPageAutoPager[T]) Next() bool {
3471+
if r.page == nil || len(r.page.SecurityPolicies) == 0 {
3472+
return false
3473+
}
3474+
if r.idx >= len(r.page.SecurityPolicies) {
3475+
r.idx = 0
3476+
r.page, r.err = r.page.GetNextPage()
3477+
if r.err != nil || r.page == nil || len(r.page.SecurityPolicies) == 0 {
3478+
return false
3479+
}
3480+
}
3481+
r.cur = r.page.SecurityPolicies[r.idx]
3482+
r.run += 1
3483+
r.idx += 1
3484+
return true
3485+
}
3486+
3487+
func (r *SecurityPoliciesPageAutoPager[T]) Current() T {
3488+
return r.cur
3489+
}
3490+
3491+
func (r *SecurityPoliciesPageAutoPager[T]) Err() error {
3492+
return r.err
3493+
}
3494+
3495+
func (r *SecurityPoliciesPageAutoPager[T]) Index() int {
3496+
return r.run
3497+
}
3498+
33743499
type ServicesPagePagination struct {
33753500
NextToken string `json:"nextToken"`
33763501
JSON servicesPagePaginationJSON `json:"-"`

0 commit comments

Comments
 (0)