ListSecrets
client.Secrets.List(ctx, params) (*SecretsPage[Secret], error)
POST/gitpod.v1.SecretService/ListSecrets
Lists secrets
Use this method to:
- View all project secrets
- View all user secrets
Examples
-
List project secrets:
Shows all secrets for a project.
filter: scope: projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" pagination: pageSize: 20 -
List user secrets:
Shows all secrets for a user.
filter: scope: userId: "123e4567-e89b-12d3-a456-426614174000" pagination: pageSize: 20
ListSecrets
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
page, err := client.Secrets.List(context.TODO(), gitpod.SecretListParams{
Filter: gitpod.F(gitpod.SecretListParamsFilter{
Scope: gitpod.F(gitpod.SecretScopeParam{
ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
}),
}),
Pagination: gitpod.F(gitpod.SecretListParamsPagination{
PageSize: gitpod.F(int64(20)),
}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"pagination": {
"nextToken": "nextToken"
},
"secrets": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"apiOnly": true,
"containerRegistryBasicAuthHost": "https://example.com",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"environmentVariable": true,
"filePath": "filePath",
"name": "name",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"scope": {
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"serviceAccountId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"updatedAt": "2019-12-27T18:11:19.117Z"
}
]
}Returns Examples
{
"pagination": {
"nextToken": "nextToken"
},
"secrets": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"apiOnly": true,
"containerRegistryBasicAuthHost": "https://example.com",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"environmentVariable": true,
"filePath": "filePath",
"name": "name",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"scope": {
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"serviceAccountId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"updatedAt": "2019-12-27T18:11:19.117Z"
}
]
}