MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Get

Method Get

app/controlplane/internal/service/group.go:82–114  ·  view source on GitHub ↗

Get retrieves a group by its ID within the current organization.

(ctx context.Context, req *pb.GroupServiceGetRequest)

Source from the content-addressed store, hash-verified

80
81// Get retrieves a group by its ID within the current organization.
82func (g *GroupService) Get(ctx context.Context, req *pb.GroupServiceGetRequest) (*pb.GroupServiceGetResponse, error) {
83 currentOrg, err := requireCurrentOrg(ctx)
84 if err != nil {
85 return nil, err
86 }
87
88 // Parse orgID
89 orgUUID, err := uuid.Parse(currentOrg.ID)
90 if err != nil {
91 return nil, errors.BadRequest("invalid", "invalid organization ID")
92 }
93
94 // Parse groupID and groupName from the request
95 id, name, err := req.GetGroupReference().Parse()
96 if err != nil {
97 return nil, errors.BadRequest("invalid", fmt.Sprintf("invalid group reference: %s", err.Error()))
98 }
99
100 // Initialize the options for getting the group
101 opts := &biz.IdentityReference{
102 ID: id,
103 Name: name,
104 }
105
106 gr, err := g.groupUseCase.Get(ctx, orgUUID, opts)
107 if err != nil {
108 return nil, handleUseCaseErr(err, g.log)
109 }
110
111 return &pb.GroupServiceGetResponse{
112 Group: bizGroupToPb(gr),
113 }, nil
114}
115
116// List retrieves a list of groups within the current organization, with optional filters and pagination.
117func (g *GroupService) List(ctx context.Context, req *pb.GroupServiceListRequest) (*pb.GroupServiceListResponse, error) {

Callers

nothing calls this directly

Calls 7

requireCurrentOrgFunction · 0.85
handleUseCaseErrFunction · 0.85
bizGroupToPbFunction · 0.85
ParseMethod · 0.80
ErrorMethod · 0.65
GetMethod · 0.65
GetGroupReferenceMethod · 0.45

Tested by

no test coverage detected