You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/openapi/models.go
+99-13Lines changed: 99 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,6 @@ import (
21
21
"github.com/theopenlane/utils/passwd"
22
22
)
23
23
24
-
const (
25
-
exampleFindingsCount=5
26
-
)
27
-
28
24
// ExampleProvider interface allows response models to provide their own examples
29
25
// This eliminates the need for separate Example* variables and static switch statements
30
26
typeExampleProviderinterface {
@@ -2534,24 +2530,31 @@ var ExampleScopesReply = ScopesReply{
2534
2530
// Roles
2535
2531
// =========
2536
2532
2533
+
// OrganizationRole contains certain metadata for a role that can be assigned to users.
2534
+
typeOrganizationRolestruct {
2535
+
IDstring`json:"id" description:"The role relation ID" example:"policy_manager"`
2536
+
Namestring`json:"name" description:"The display name for the role" example:"Policy Manager"`
2537
+
Descriptionstring`json:"description" description:"The role description" example:"Manage all policies and procedures"`
2538
+
}
2539
+
2537
2540
// RolesRequest contains roles that can be assigned to users on top of org roles
2538
2541
typeRolesRequeststruct{}
2539
2542
2540
2543
// RolesReply holds the fields that are sent on a response to the `/roles` endpoint
2541
2544
typeRolesReplystruct {
2542
2545
// Reply is the reply value.
2543
2546
rout.Reply
2544
-
// Scopes is a list of roles that can be assigned
2545
-
Roles []string`json:"roles,omitempty" description:"A map of object types to operations that can be set for an API Token"`
2547
+
// Roles is a list of organization responsibility roles that can be assigned.
2548
+
Roles []OrganizationRole`json:"roles,omitempty" description:"Organization roles and responsibilities that can be assigned"`
2546
2549
}
2547
2550
2548
-
// ExampleResponse returns an example ScopesReply for OpenAPI documentation
2551
+
// ExampleResponse returns an example RolesReply for OpenAPI documentation
2549
2552
func (r*RolesReply) ExampleResponse() any {
2550
-
returnExampleScopesReply
2553
+
returnExampleRolesReply
2551
2554
}
2552
2555
2553
2556
// Validate ensures the required fields are set on the RolesRequest
2554
-
func (r*ScopesReply) Validate() error {
2557
+
func (r*RolesRequest) Validate() error {
2555
2558
returnnil
2556
2559
}
2557
2560
@@ -2561,9 +2564,92 @@ var ExampleRolesRequest = RolesRequest{}
2561
2564
// ExampleRolesReply is an example of a successful `/roles` response for OpenAPI documentation
2562
2565
varExampleRolesReply=RolesReply{
2563
2566
Reply: rout.Reply{Success: true},
2564
-
Roles: []string{
2565
-
"compliance_manager",
2566
-
"risk_manager",
2567
-
"policy_manager",
2567
+
Roles: []OrganizationRole{
2568
+
{
2569
+
ID: "policy_manager",
2570
+
Name: "Policy Manager",
2571
+
Description: "Can manage all policies and procedures",
2572
+
},
2573
+
{
2574
+
ID: "risk_manager",
2575
+
Name: "Risk Manager",
2576
+
Description: "Can manage risks, vulnerabilities, and findings",
2577
+
},
2568
2578
},
2569
2579
}
2580
+
2581
+
// OrganizationRolesRequest contains roles that can be assigned to users or groups.
2582
+
typeOrganizationRolesRequeststruct {
2583
+
OrganizationIDstring`json:"organization_id,omitempty" description:"The ID of the organization to assign roles in. Defaults to the authenticated organization." example:"01J4HMNDSZCCQBTY93BF9CBF5D"`
2584
+
Rolestring`json:"role" description:"The organization responsibility role to assign" example:"policy_manager"`
2585
+
UserIDs []string`json:"user_ids,omitempty" description:"User IDs to assign the role to"`
2586
+
GroupIDs []string`json:"group_ids,omitempty" description:"Group IDs to assign the role to"`
2587
+
}
2588
+
2589
+
// OrganizationRolesReply contains the newly assigned/removed role.
2590
+
typeOrganizationRolesReplystruct {
2591
+
rout.Reply
2592
+
OrganizationIDstring`json:"organization_id" description:"The ID of the organization the role was applied to" example:"01J4HMNDSZCCQBTY93BF9CBF5D"`
0 commit comments