templates

package
v0.750.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AuthZProvider is the authz registry for Notebooks, Shells, and Commands.

Functions

func DeleteWorkspaceTemplates

func DeleteWorkspaceTemplates(ctx context.Context, workspaceID int) error

DeleteWorkspaceTemplates deletes all the templates in a workspace.

func TemplateByName

func TemplateByName(ctx context.Context, name string) (model.Template, error)

TemplateByName looks up a config template by name in a database.

func UnmarshalTemplateConfig

func UnmarshalTemplateConfig(
	ctx context.Context,
	name string,
	user *model.User,
	out interface{},
	disallowUnknownFields bool,
) error

UnmarshalTemplateConfig unmarshals the template config into `o` and returns api-ready errors.

Types

type TemplateAPIServer

type TemplateAPIServer struct{}

TemplateAPIServer implements the template APIs for Determined's API server.

func (*TemplateAPIServer) DeleteTemplate

DeleteTemplate a template by name. Returns an error if the template does not exist.

func (*TemplateAPIServer) GetTemplate

GetTemplate by name. Returns an error if the requested template does not exist.

func (*TemplateAPIServer) GetTemplates

GetTemplates viewable by the user. If there are no matches, returns an empty list.

func (*TemplateAPIServer) PatchTemplateConfig

PatchTemplateConfig does a full update of the requested template's config.

func (*TemplateAPIServer) PatchTemplateName

PatchTemplateName rename a template.

func (*TemplateAPIServer) PostTemplate

PostTemplate creates a template. If a template with the same name exists, an error is returned.

func (*TemplateAPIServer) PutTemplate

PutTemplate creates or updates a template.

type TemplateAuthZ

type TemplateAuthZ interface {
	// ViewableScopes returns the set of scopes that the user can view templates in.
	ViewableScopes(
		ctx context.Context, curUser *model.User, requestedScope model.AccessScopeID,
	) (model.AccessScopeSet, error)

	// CanCreateTemplate checks if the user can create a template.
	CanCreateTemplate(
		ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
	) (permErr error, err error)

	// CanViewTemplate checks if the user can view a template.
	CanViewTemplate(
		ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
	) (permErr error, err error)

	// CanUpdateTemplate checks if the user can update a template.
	CanUpdateTemplate(
		ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
	) (permErr error, err error)

	// CanDeleteTemplate checks if the user can delete a template.
	CanDeleteTemplate(
		ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
	) (permErr error, err error)
}

TemplateAuthZ describes authz methods for template actions.

type TemplateAuthZBasic

type TemplateAuthZBasic struct{}

TemplateAuthZBasic is basic OSS controls.

func (*TemplateAuthZBasic) CanCreateTemplate

func (a *TemplateAuthZBasic) CanCreateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanCreateTemplate implements the TemplateAuthZ interface.

func (*TemplateAuthZBasic) CanDeleteTemplate

func (a *TemplateAuthZBasic) CanDeleteTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanDeleteTemplate implements the TemplateAuthZ interface.

func (*TemplateAuthZBasic) CanUpdateTemplate

func (a *TemplateAuthZBasic) CanUpdateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanUpdateTemplate implements the TemplateAuthZ interface.

func (*TemplateAuthZBasic) CanViewTemplate

func (a *TemplateAuthZBasic) CanViewTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanViewTemplate implements the TemplateAuthZ interface.

func (*TemplateAuthZBasic) ViewableScopes

func (a *TemplateAuthZBasic) ViewableScopes(
	ctx context.Context, curUser *model.User, requestedScope model.AccessScopeID,
) (model.AccessScopeSet, error)

ViewableScopes implements the TemplateAuthZ interface.

type TemplateAuthZPermissive

type TemplateAuthZPermissive struct{}

TemplateAuthZPermissive is permissive implementation of the TemplateAuthZ interface.

func (*TemplateAuthZPermissive) CanCreateTemplate

func (a *TemplateAuthZPermissive) CanCreateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanCreateTemplate logs the request.

func (*TemplateAuthZPermissive) CanDeleteTemplate

func (a *TemplateAuthZPermissive) CanDeleteTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanDeleteTemplate logs the request.

func (*TemplateAuthZPermissive) CanUpdateTemplate

func (a *TemplateAuthZPermissive) CanUpdateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanUpdateTemplate logs the request.

func (*TemplateAuthZPermissive) CanViewTemplate

func (a *TemplateAuthZPermissive) CanViewTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanViewTemplate logs the request.

func (*TemplateAuthZPermissive) ViewableScopes

func (a *TemplateAuthZPermissive) ViewableScopes(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (model.AccessScopeSet, error)

ViewableScopes logs the request.

type TemplateAuthZRBAC

type TemplateAuthZRBAC struct{}

TemplateAuthZRBAC is the RBAC implementation of the TemplateAuthZ interface.

func (*TemplateAuthZRBAC) CanCreateTemplate

func (a *TemplateAuthZRBAC) CanCreateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanCreateTemplate checks if the user can create the template.

func (*TemplateAuthZRBAC) CanDeleteTemplate

func (a *TemplateAuthZRBAC) CanDeleteTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanDeleteTemplate checks if the user can delete the template.

func (*TemplateAuthZRBAC) CanUpdateTemplate

func (a *TemplateAuthZRBAC) CanUpdateTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanUpdateTemplate checks if the user can update templates.

func (*TemplateAuthZRBAC) CanViewTemplate

func (a *TemplateAuthZRBAC) CanViewTemplate(
	ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)

CanViewTemplate checks if the user can view the template.

func (*TemplateAuthZRBAC) ViewableScopes

func (a *TemplateAuthZRBAC) ViewableScopes(
	ctx context.Context, curUser *model.User, requestedScope model.AccessScopeID,
) (model.AccessScopeSet, error)

ViewableScopes implements the TemplateAuthZ interface.

Jump to

Keyboard shortcuts

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