roles

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package roles is used for creating and managing custom roles (and permissions assigned to them)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Role

type Role struct {
	Name        string                   `json:"name,omitempty"`
	Description string                   `json:"description,omitempty"`
	Permissions []permissions.Permission `json:"permissions,omitempty"`
}

Role is a STACKIT role (or a custom user role)

type Roles

type Roles struct {
	ResourceID   string `json:"resourceId,omitempty"`
	ResourceType string `json:"resourceType,omitempty"`
	Roles        []Role `json:"roles,omitempty"`
}

Roles describes the resource and roles assigned to it

type RolesService

type RolesService common.Service

RolesService is the service that handles CRUD functionality for membership roles

func New

func New(c common.Client) *RolesService

New returns a new handler for the service

func (*RolesService) AddCustom

func (svc *RolesService) AddCustom(ctx context.Context, resourceID, resourceType string, roles ...Role) (res Roles, err error)

AddCustom adds new user specified roles to a resource https://api.stackit.schwarz/membership-service/openapi.v2.html#operation/patch-roles

func (*RolesService) GetByResource

func (svc *RolesService) GetByResource(ctx context.Context, resourceID, resourceType string) (r Roles, err error)

GetByResource returns a list of roles and permissions by resources type & ID Reference: https://api.stackit.schwarz/membership-service/openapi.v2.html#operation/get-roles

func (*RolesService) RemoveCustom

func (svc *RolesService) RemoveCustom(ctx context.Context, resourceID, resourceType string, roles ...Role) (r Roles, err error)

RemoveCustom removes custom user specified roles from a resource Reference: https://api.stackit.schwarz/membership-service/openapi.v2.html#operation/post-roles-remove

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL