service

package
v0.0.0-...-794f3e4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthAdminService

type AuthAdminService interface {
	// OrganizationService base interface
	OrganizationService

	// PrincipalService base interface
	PrincipalService

	// ResourceService base interface
	ResourceService

	// PermissionService base interface
	PermissionService

	// 	RoleService base interface
	RoleService

	// 	GroupService base interface
	GroupService

	// 	RelationshipService base interface
	RelationshipService
}

AuthAdminService - admin APIs for auth data

type GroupService

type GroupService interface {
	// CreateGroup - creates a new group
	CreateGroup(
		ctx context.Context,
		organizationID string,
		group *types.Group) (*types.Group, error)

	// UpdateGroup - updates an exising group
	UpdateGroup(
		ctx context.Context,
		organizationID string,
		group *types.Group) error

	// DeleteGroup removes group
	DeleteGroup(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string) error

	// GetGroup - finds group
	GetGroup(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (*types.Group, error)

	// GetGroups - queries groups
	GetGroups(
		ctx context.Context,
		organizationID string,
		namespace string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Group, nextOffset string, err error)

	// AddRolesToGroup helper
	AddRolesToGroup(
		ctx context.Context,
		organizationID string,
		namespace string,
		groupID string,
		roleIDs ...string,
	) error

	// DeleteRolesToGroup helper
	DeleteRolesToGroup(
		ctx context.Context,
		organizationID string,
		namespace string,
		groupID string,
		roleIDs ...string,
	) error
}

GroupService - admin APIs for groups

type OrganizationService

type OrganizationService interface {
	// GetOrganization finds organization
	GetOrganization(
		ctx context.Context,
		id string) (*types.Organization, error)

	// GetOrganizations - queries organizations
	GetOrganizations(
		ctx context.Context,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Organization, nextOffset string, err error)

	// CreateOrganization - adds an organization
	CreateOrganization(
		ctx context.Context,
		org *types.Organization) (*types.Organization, error)

	// UpdateOrganization - updates organization
	UpdateOrganization(
		ctx context.Context,
		org *types.Organization) error

	// DeleteOrganization deletes organization
	DeleteOrganization(
		ctx context.Context,
		id string) error
}

OrganizationService - admin APIs for organization data

type PermissionService

type PermissionService interface {
	// CreatePermission - creates a new permission
	CreatePermission(
		ctx context.Context,
		organizationID string,
		permission *types.Permission) (*types.Permission, error)

	// UpdatePermission - updates an existing permission
	UpdatePermission(
		ctx context.Context,
		organizationID string,
		permission *types.Permission) error

	// DeletePermission removes permission
	DeletePermission(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string) error

	// GetPermission - finds permission
	GetPermission(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (*types.Permission, error)

	// GetPermissions - queries permissions
	GetPermissions(
		ctx context.Context,
		organizationID string,
		namespace string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Permission, nextOffset string, err error)
}

PermissionService - admin APIs for permissions data

type PrincipalService

type PrincipalService interface {
	// CreatePrincipal - creates new principal object
	CreatePrincipal(
		ctx context.Context,
		principal *types.Principal) (*types.Principal, error)

	// UpdatePrincipal - updates principal
	UpdatePrincipal(
		ctx context.Context,
		principal *types.Principal) error

	// DeletePrincipal removes principal
	DeletePrincipal(
		ctx context.Context,
		organizationID string,
		id string) error

	// GetPrincipalExt - retrieves full principal
	GetPrincipalExt(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (ext *domain.PrincipalExt, err error)

	// GetPrincipal - retrieves principal
	GetPrincipal(
		ctx context.Context,
		organizationID string,
		id string,
	) (*types.Principal, error)

	// GetPrincipals - queries principals
	GetPrincipals(
		ctx context.Context,
		organizationID string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Principal, nextOffset string, err error)
	// AddGroupsToPrincipal helper
	AddGroupsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		groupIDs ...string,
	) error

	// DeleteGroupsToPrincipal helper
	DeleteGroupsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		groupIDs ...string,
	) error

	// AddRolesToPrincipal helper
	AddRolesToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		roleIDs ...string,
	) error

	// DeleteRolesToPrincipal helper
	DeleteRolesToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		roleIDs ...string,
	) error

	// AddPermissionsToPrincipal helper
	AddPermissionsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		permissionIds ...string,
	) error

	// DeletePermissionsToPrincipal helper
	DeletePermissionsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		permissionIds ...string,
	) error

	// AddRelationshipsToPrincipal helper
	AddRelationshipsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		relationshipIds ...string,
	) error

	// DeleteRelationshipsToPrincipal helper
	DeleteRelationshipsToPrincipal(
		ctx context.Context,
		organizationID string,
		namespace string,
		principalID string,
		relationshipIds ...string,
	) error
}

PrincipalService - admin APIs for principals data

type RelationshipService

type RelationshipService interface {
	// CreateRelationship - creates a new relationship
	CreateRelationship(
		ctx context.Context,
		organizationID string,
		relationship *types.Relationship) (*types.Relationship, error)

	// UpdateRelationship - creates a new relationship
	UpdateRelationship(
		ctx context.Context,
		organizationID string,
		relationship *types.Relationship) error

	// DeleteRelationship removes relationship
	DeleteRelationship(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string) error

	// GetRelationship - finds relationship
	GetRelationship(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (*types.Relationship, error)

	// GetRelationships - queries relationships
	GetRelationships(
		ctx context.Context,
		organizationID string,
		namespace string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Relationship, nextOffset string, err error)
}

RelationshipService - admin APIs for relationships data

type ResourceService

type ResourceService interface {
	// CreateResource - create resource
	CreateResource(
		ctx context.Context,
		organizationID string,
		resource *types.Resource) (*types.Resource, error)

	// UpdateResource - updates resource
	UpdateResource(
		ctx context.Context,
		organizationID string,
		resource *types.Resource) error

	// DeleteResource removes resource
	DeleteResource(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string) error

	// GetResource - finds resource
	GetResource(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (*types.Resource, error)

	// QueryResources - queries resources
	QueryResources(
		ctx context.Context,
		organizationID string,
		namespace string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Resource, nextOffset string, err error)

	// AllocateResourceInstance - allocates resource-instance
	AllocateResourceInstance(
		ctx context.Context,
		organizationID string,
		namespace string,
		resourceID string,
		principalID string,
		constraints string,
		expiry time.Duration,
		context map[string]string,
	) error

	// DeallocateResourceInstance - deallocates resource-instance
	DeallocateResourceInstance(
		ctx context.Context,
		organizationID string,
		namespace string,
		resourceID string,
		principalID string,
	) error

	// CountResourceInstances - size of total and allocated resource-instances
	CountResourceInstances(
		ctx context.Context,
		organizationID string,
		namespace string,
		resourceID string,
	) (capacity int32, allocated int32, err error)

	// QueryResourceInstances - queries resource-instances
	QueryResourceInstances(
		ctx context.Context,
		organizationID string,
		namespace string,
		resourceID string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.ResourceInstance, nextOffset string, err error)
}

ResourceService - admin APIs for resources data

type RoleService

type RoleService interface {
	// CreateRole - creates a new role
	CreateRole(
		ctx context.Context,
		organizationID string,
		role *types.Role) (*types.Role, error)

	// UpdateRole - updates an existing role
	UpdateRole(
		ctx context.Context,
		organizationID string,
		role *types.Role) error

	// DeleteRole removes role
	DeleteRole(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string) error

	// GetRole - finds role
	GetRole(
		ctx context.Context,
		organizationID string,
		namespace string,
		id string,
	) (*types.Role, error)

	// GetRoles - queries roles
	GetRoles(
		ctx context.Context,
		organizationID string,
		namespace string,
		predicate map[string]string,
		offset string,
		limit int64) (res []*types.Role, nextOffset string, err error)

	// AddPermissionsToRole helper
	AddPermissionsToRole(
		ctx context.Context,
		organizationID string,
		namespace string,
		roleID string,
		permissionIds ...string,
	) error

	// DeletePermissionsToRole helper
	DeletePermissionsToRole(
		ctx context.Context,
		organizationID string,
		namespace string,
		roleID string,
		permissionIds ...string,
	) error
}

RoleService - admin APIs for roles data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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