define endpoints as constants
This commit is contained in:
@@ -35,7 +35,7 @@ type ResourceRole struct {
|
||||
|
||||
// CreateRole creates a role on the given resource id with the provided actions.
|
||||
func (c *client) CreateRole(ctx context.Context, resourceID gidx.PrefixedID, actions []string) (gidx.PrefixedID, error) {
|
||||
path := fmt.Sprintf("/api/v1/resources/%s/roles", resourceID.String())
|
||||
path := fmt.Sprintf(permsPathResourceRolesFormat, resourceID.String())
|
||||
|
||||
body, err := encodeJSON(ResourceRoleCreate{
|
||||
Actions: actions,
|
||||
@@ -77,7 +77,7 @@ func (c *client) DeleteRole(ctx context.Context, roleID gidx.PrefixedID) error {
|
||||
|
||||
// ListResourceRoles fetches all roles assigned to the provided resource.
|
||||
func (c *client) ListResourceRoles(ctx context.Context, resourceID gidx.PrefixedID) (ResourceRoles, error) {
|
||||
path := fmt.Sprintf("/api/v1/resources/%s/roles", resourceID.String())
|
||||
path := fmt.Sprintf(permsPathResourceRolesFormat, resourceID.String())
|
||||
|
||||
var response struct {
|
||||
Data ResourceRoles `json:"data"`
|
||||
|
||||
Reference in New Issue
Block a user