Assign role to group
Assign role to group
client.Zones.Groups.Roles.Add(ctx, groupID, params) (*RoleAssignment, error)
POST/zones/{zoneId}/groups/{groupId}/roles
Assigns a role to the group; members inherit it. Provide role_id, or role_identifier with owner_type. Returns the shared role-assignment shape with principal_type set to group.
Parameters
groupID string
Returns
Assign role to group
package main
import (
"context"
"fmt"
"github.com/keycardai/keycard-go"
"github.com/keycardai/keycard-go/option"
)
func main() {
client := keycard.NewClient(
option.WithAPIKey("My API Key"),
)
roleAssignment, err := client.Zones.Groups.Roles.Add(
context.TODO(),
"groupId",
keycard.ZoneGroupRoleAddParams{
ZoneID: "zoneId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", roleAssignment.ID)
}
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}Returns Examples
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}