templates

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 19 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) 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.

Jump to

Keyboard shortcuts

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