CreateGroup
client.Groups.New(ctx, body) (*GroupNewResponse, error)
POST/gitpod.v1.GroupService/CreateGroup
Creates a new group within an organization.
Use this method to:
- Create teams for access control
- Organize users by department or function
- Set up role-based access groups
Examples
-
Create a basic group:
Creates a group with name and description.
organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" name: "Backend Team" description: "Backend engineering team"
Authorization
Requires org:admin role on the organization.
CreateGroup
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"),
)
group, err := client.Groups.New(context.TODO(), gitpod.GroupNewParams{
Description: gitpod.F("Backend engineering team"),
Name: gitpod.F("Backend Team"),
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.Group)
}
{
"group": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"description": "description",
"directShare": true,
"memberCount": 0,
"name": "xxx",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"systemManaged": true,
"updatedAt": "2019-12-27T18:11:19.117Z"
}
}Returns Examples
{
"group": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"description": "description",
"directShare": true,
"memberCount": 0,
"name": "xxx",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"systemManaged": true,
"updatedAt": "2019-12-27T18:11:19.117Z"
}
}