Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: ./go.mod

Expand All @@ -35,10 +35,10 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/gitpod-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: ./go.mod

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.0"
".": "0.8.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 159
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d62ef4b9187c1f3d36f428abc4b31d8a09ffd36e93d39b8136c60c8f463c838e.yml
openapi_spec_hash: d7f01b6f24e88eb46d744ecd28061f26
config_hash: 26e4a10dfc6ec809322e60d889d15414
configured_endpoints: 160
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-a19818e87979929d5484f97ec50318899c659c73733b4a700a41f28687ee2632.yml
openapi_spec_hash: f2d83905d1ed19d50c2f4641ecf29204
config_hash: e84bdcd3fab4b185dd3dd79f70ea527d
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.8.0 (2025-12-19)

Full Changelog: [v0.7.0...v0.8.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.7.0...v0.8.0)

### Features

* **agent:** add group-based SCM tools access control ([02a3ac4](https://github.com/gitpod-io/gitpod-sdk-go/commit/02a3ac402e5b07ea0efffaf6a35ea3740b800211))


### Bug Fixes

* skip usage tests that don't work with Prism ([2e9de50](https://github.com/gitpod-io/gitpod-sdk-go/commit/2e9de50431b0d2ab64db8b7bbba3c83aedc7d74b))


### Chores

* pin GitHub Actions to SHA ([af1d69c](https://github.com/gitpod-io/gitpod-sdk-go/commit/af1d69c695071e89c7ede111953b510914b6dff0))

## 0.7.0 (2025-12-15)

Full Changelog: [v0.6.1...v0.7.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.6.1...v0.7.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.7.0'
go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.8.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,13 @@ Response Types:

- <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#GroupMembership">GroupMembership</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#GroupMembershipNewResponse">GroupMembershipNewResponse</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#GroupMembershipGetResponse">GroupMembershipGetResponse</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#GroupMembershipDeleteResponse">GroupMembershipDeleteResponse</a>

Methods:

- <code title="post /gitpod.v1.GroupService/CreateMembership">client.Groups.Memberships.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#GroupMembershipService.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#GroupMembershipNewParams">GroupMembershipNewParams</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#GroupMembershipNewResponse">GroupMembershipNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /gitpod.v1.GroupService/GetMembership">client.Groups.Memberships.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#GroupMembershipService.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#GroupMembershipGetParams">GroupMembershipGetParams</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#GroupMembershipGetResponse">GroupMembershipGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /gitpod.v1.GroupService/ListMemberships">client.Groups.Memberships.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#GroupMembershipService.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#GroupMembershipListParams">GroupMembershipListParams</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#MembersPage">MembersPage</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#GroupMembership">GroupMembership</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /gitpod.v1.GroupService/DeleteMembership">client.Groups.Memberships.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#GroupMembershipService.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#GroupMembershipDeleteParams">GroupMembershipDeleteParams</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#GroupMembershipDeleteResponse">GroupMembershipDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

Expand Down
62 changes: 62 additions & 0 deletions groupmembership.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,36 @@ func (r *GroupMembershipService) New(ctx context.Context, body GroupMembershipNe
return
}

// Gets a specific membership by group ID and subject.
//
// Use this method to:
//
// - Check if a user or service account is a member of a group
// - Verify group membership for access control
//
// ### Examples
//
// - Check user membership:
//
// Checks if a user is a member of a specific group.
//
// ```yaml
// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// subject:
// id: "f53d2330-3795-4c5d-a1f3-453121af9c60"
// principal: PRINCIPAL_USER
// ```
//
// ### Authorization
//
// All organization members can check group membership (transparency model).
func (r *GroupMembershipService) Get(ctx context.Context, body GroupMembershipGetParams, opts ...option.RequestOption) (res *GroupMembershipGetResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.GroupService/GetMembership"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Lists all memberships of a group.
//
// Use this method to:
Expand Down Expand Up @@ -216,6 +246,28 @@ func (r groupMembershipNewResponseJSON) RawJSON() string {
return r.raw
}

type GroupMembershipGetResponse struct {
// The membership if found, nil if subject is not a member
Member GroupMembership `json:"member"`
JSON groupMembershipGetResponseJSON `json:"-"`
}

// groupMembershipGetResponseJSON contains the JSON metadata for the struct
// [GroupMembershipGetResponse]
type groupMembershipGetResponseJSON struct {
Member apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *GroupMembershipGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r groupMembershipGetResponseJSON) RawJSON() string {
return r.raw
}

type GroupMembershipDeleteResponse = interface{}

type GroupMembershipNewParams struct {
Expand All @@ -228,6 +280,16 @@ func (r GroupMembershipNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type GroupMembershipGetParams struct {
// Subject to check membership for
Subject param.Field[shared.SubjectParam] `json:"subject,required"`
GroupID param.Field[string] `json:"groupId" format:"uuid"`
}

func (r GroupMembershipGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type GroupMembershipListParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
Expand Down
29 changes: 29 additions & 0 deletions groupmembership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,35 @@ func TestGroupMembershipNewWithOptionalParams(t *testing.T) {
}
}

func TestGroupMembershipGetWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := gitpod.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Groups.Memberships.Get(context.TODO(), gitpod.GroupMembershipGetParams{
Subject: gitpod.F(shared.SubjectParam{
ID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
Principal: gitpod.F(shared.PrincipalUser),
}),
GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
})
if err != nil {
var apierr *gitpod.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestGroupMembershipListWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.7.0" // x-release-please-version
const PackageVersion = "0.8.0" // x-release-please-version
21 changes: 14 additions & 7 deletions organizationpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,21 @@ type AgentPolicy struct {
McpDisabled bool `json:"mcpDisabled,required"`
// scm_tools_disabled controls whether SCM (Source Control Management) tools are
// disabled for agents
ScmToolsDisabled bool `json:"scmToolsDisabled,required"`
JSON agentPolicyJSON `json:"-"`
ScmToolsDisabled bool `json:"scmToolsDisabled,required"`
// scm_tools_allowed_group_id restricts SCM tools access to members of this group.
// Empty means no restriction (all users can use SCM tools if not disabled).
ScmToolsAllowedGroupID string `json:"scmToolsAllowedGroupId"`
JSON agentPolicyJSON `json:"-"`
}

// agentPolicyJSON contains the JSON metadata for the struct [AgentPolicy]
type agentPolicyJSON struct {
CommandDenyList apijson.Field
McpDisabled apijson.Field
ScmToolsDisabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
CommandDenyList apijson.Field
McpDisabled apijson.Field
ScmToolsDisabled apijson.Field
ScmToolsAllowedGroupID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AgentPolicy) UnmarshalJSON(data []byte) (err error) {
Expand Down Expand Up @@ -401,6 +405,9 @@ type OrganizationPolicyUpdateParamsAgentPolicy struct {
// mcp_disabled controls whether MCP (Model Context Protocol) is disabled for
// agents
McpDisabled param.Field[bool] `json:"mcpDisabled"`
// scm_tools_allowed_group_id restricts SCM tools access to members of this group.
// Empty means no restriction (all users can use SCM tools if not disabled).
ScmToolsAllowedGroupID param.Field[string] `json:"scmToolsAllowedGroupId"`
// scm_tools_disabled controls whether SCM (Source Control Management) tools are
// disabled for agents
ScmToolsDisabled param.Field[bool] `json:"scmToolsDisabled"`
Expand Down
7 changes: 4 additions & 3 deletions organizationpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ func TestOrganizationPolicyUpdateWithOptionalParams(t *testing.T) {
_, err := client.Organizations.Policies.Update(context.TODO(), gitpod.OrganizationPolicyUpdateParams{
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
AgentPolicy: gitpod.F(gitpod.OrganizationPolicyUpdateParamsAgentPolicy{
CommandDenyList: gitpod.F([]string{"string"}),
McpDisabled: gitpod.F(true),
ScmToolsDisabled: gitpod.F(true),
CommandDenyList: gitpod.F([]string{"string"}),
McpDisabled: gitpod.F(true),
ScmToolsAllowedGroupID: gitpod.F("scmToolsAllowedGroupId"),
ScmToolsDisabled: gitpod.F(true),
}),
AllowedEditorIDs: gitpod.F([]string{"string"}),
AllowLocalRunners: gitpod.F(true),
Expand Down
3 changes: 3 additions & 0 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,9 @@ type ProjectListParamsFilter struct {
// runner_ids filters the response to only projects that use environment classes
// from these runners
RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
// runner_kinds filters the response to only projects that use environment classes
// from runners of these kinds
RunnerKinds param.Field[[]RunnerKind] `json:"runnerKinds"`
// search performs case-insensitive search across project name, project ID, and
// repository name
Search param.Field[string] `json:"search"`
Expand Down
7 changes: 4 additions & 3 deletions project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ func TestProjectListWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.ProjectListParamsFilter{
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
Search: gitpod.F("search"),
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindUnspecified}),
Search: gitpod.F("search"),
}),
Pagination: gitpod.F(gitpod.ProjectListParamsPagination{
Token: gitpod.F("token"),
Expand Down
1 change: 1 addition & 0 deletions usage1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestUsage(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
t.Skip("Prism tests are disabled")
response, err := client.Identity.GetAuthenticatedIdentity(context.TODO(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err != nil {
t.Error(err)
Expand Down