Skip to content

Commit

Permalink
NOISSUE - Use role id instead of name (#2612)
Browse files Browse the repository at this point in the history
Signed-off-by: Arvindh <[email protected]>
  • Loading branch information
arvindh123 authored Dec 25, 2024
1 parent 58ba597 commit 6b16535
Show file tree
Hide file tree
Showing 38 changed files with 1,784 additions and 1,840 deletions.
1 change: 1 addition & 0 deletions api/http/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func EncodeError(_ context.Context, err error, w http.ResponseWriter) {
errors.Contains(err, apiutil.ErrMissingParentGroupID),
errors.Contains(err, apiutil.ErrMissingConnectionType),
errors.Contains(err, apiutil.ErrMissingRoleName),
errors.Contains(err, apiutil.ErrMissingRoleID),
errors.Contains(err, apiutil.ErrMissingPolicyEntityType),
errors.Contains(err, apiutil.ErrMissingRoleMembers):
err = unwrap(err)
Expand Down
5 changes: 4 additions & 1 deletion api/http/util/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ var (
// ErrEmptyList indicates that entity data is empty.
ErrEmptyList = errors.New("empty list provided")

// ErrMissingRoleName indicates that role name are empty.
// ErrMissingRoleName indicates that role name is empty.
ErrMissingRoleName = errors.New("empty role name")

// ErrMissingRoleID indicates that role id is empty.
ErrMissingRoleID = errors.New("empty role id")

// ErrMissingRoleOperations indicates that role operations are empty.
ErrMissingRoleOperations = errors.New("empty role operations")

Expand Down
66 changes: 33 additions & 33 deletions apidocs/openapi/clients.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

/{domainID}/clients/{clientID}/roles:
post:
operationId: createClientRole
Expand Down Expand Up @@ -485,7 +485,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

get:
operationId: listClientRoles
tags:
Expand Down Expand Up @@ -520,7 +520,7 @@ paths:
"500":
$ref: "#/components/responses/ServiceError"

/{domainID}/clients/{clientID}/roles/{roleName}:
/{domainID}/clients/{clientID}/roles/{roleID}:
get:
operationId: getClientRole
tags:
Expand All @@ -531,7 +531,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -550,7 +550,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

put:
operationId: updateClientRole
summary: Updates client role.
Expand All @@ -561,7 +561,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
requestBody:
$ref: "./schemas/roles.yml#/components/requestBodies/UpdateRoleReq"
security:
Expand All @@ -582,7 +582,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

delete:
operationId: deleteClientRole
summary: Deletes client role.
Expand All @@ -593,7 +593,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -612,8 +612,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/actions:

/{domainID}/clients/{clientID}/roles/{roleID}/actions:
post:
operationId: addClientRoleAction
summary: Adds a role action for a client role.
Expand All @@ -624,7 +624,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
requestBody:
$ref: "./schemas/roles.yml#/components/requestBodies/AddRoleActionsReq"
security:
Expand All @@ -645,18 +645,18 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

get:
operationId: listClientRoleActions
tags:
- Roles
summary: Lists client role actions.
description: |
Retrieves a list of client role actions.
Retrieves a list of client role actions.
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -675,8 +675,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/actions/delete:

/{domainID}/clients/{clientID}/roles/{roleID}/actions/delete:
post:
operationId: deleteClientRoleAction
summary: Deletes role actions for a client role.
Expand All @@ -687,7 +687,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
requestBody:
$ref: "./schemas/roles.yml#/components/requestBodies/AddRoleActionsReq"
security:
Expand All @@ -708,8 +708,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/actions/delete-all:

/{domainID}/clients/{clientID}/roles/{roleID}/actions/delete-all:
post:
operationId: deleteAllClientRoleActions
summary: Deletes all role actions for a client role.
Expand All @@ -720,7 +720,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -739,8 +739,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/members:

/{domainID}/clients/{clientID}/roles/{roleID}/members:
post:
operationId: addClientRoleMember
summary: Adds a member to a client role.
Expand All @@ -751,7 +751,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
requestBody:
$ref: "./schemas/roles.yml#/components/requestBodies/AddRoleMembersReq"
security:
Expand All @@ -772,18 +772,18 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

get:
operationId: listClientRoleMembers
tags:
- Roles
summary: Lists client role members.
description: |
Retrieves a list of client role members.
Retrieves a list of client role members.
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -802,8 +802,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/members/delete:

/{domainID}/clients/{clientID}/roles/{roleID}/members/delete:
post:
operationId: deleteClientRoleMembers
summary: Deletes members from a client role.
Expand All @@ -814,7 +814,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
requestBody:
$ref: "./schemas/roles.yml#/components/requestBodies/AddRoleMembersReq"
security:
Expand All @@ -835,8 +835,8 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/{domainID}/clients/{clientID}/roles/{roleName}/members/delete-all:

/{domainID}/clients/{clientID}/roles/{roleID}/members/delete-all:
post:
operationId: deleteAllClientRoleMembers
summary: Deletes all members from a client role.
Expand All @@ -847,7 +847,7 @@ paths:
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/clientID"
- $ref: "./schemas/roles.yml#/components/parameters/RoleName"
- $ref: "./schemas/roles.yml#/components/parameters/RoleID"
security:
- bearerAuth: []
responses:
Expand All @@ -874,7 +874,7 @@ paths:
- Roles
summary: Retrieves available actions.
description: |
Retrieves a list of available actions.
Retrieves a list of available actions.
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
security:
Expand Down
Loading

0 comments on commit 6b16535

Please sign in to comment.