api

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum amount of results returned for paginated queries to the API
	MaxResultsPerPage     = 1000
	DefaultResultsPerPage = 100

	UserContextKey contextKey = "user"
)
View Source
const (
	RequestIDHeaderName        = "X-Request-ID"
	LoggerServiceName          = "rest_api"
	JWTAuthorizationHeaderName = "X-JWT-Authorization"
)
View Source
const (
	JWTCookieName          = "access_token"
	DefaultLoginExpiration = time.Hour * 24 * 7
)
View Source
const SetupLakeFSRoute = "/setup_lakefs"

Variables

View Source
var (
	ErrAuthenticationFailed = errors.New(http.StatusUnauthorized, "error authenticating request")
)

Functions

func HandlerWithDefault

func HandlerWithDefault(root http.FileSystem, handler http.Handler, defaultPath string) http.Handler

func NewHandler

func NewHandler(
	cataloger catalog.Cataloger,
	blockStore block.Adapter,
	authService auth.Service,
	meta auth.MetadataManager,
	stats stats.Collector,
	retention retention.Service,
	migrator db.Migrator,
	dedupCleaner *dedup.Cleaner,
	logger logging.Logger,
) http.Handler

func NoCache

func NoCache(h http.Handler) http.Handler

func UIHandler

func UIHandler(authService auth.Service) http.Handler

Types

type AuthClient

type AuthClient interface {
	GetCurrentUser(ctx context.Context) (*models.User, error)
	GetUser(ctx context.Context, userId string) (*models.User, error)
	ListUsers(ctx context.Context, after string, amount int) ([]*models.User, *models.Pagination, error)
	DeleteUser(ctx context.Context, userId string) error
	CreateUser(ctx context.Context, userId string) (*models.User, error)
	GetGroup(ctx context.Context, groupId string) (*models.Group, error)
	ListGroups(ctx context.Context, after string, amount int) ([]*models.Group, *models.Pagination, error)
	CreateGroup(ctx context.Context, groupId string) (*models.Group, error)
	DeleteGroup(ctx context.Context, groupId string) error
	ListPolicies(ctx context.Context, after string, amount int) ([]*models.Policy, *models.Pagination, error)
	CreatePolicy(ctx context.Context, policy *models.Policy) (*models.Policy, error)
	GetPolicy(ctx context.Context, policyId string) (*models.Policy, error)
	DeletePolicy(ctx context.Context, policyId string) error
	ListGroupMembers(ctx context.Context, groupId string, after string, amount int) ([]*models.User, *models.Pagination, error)
	AddGroupMembership(ctx context.Context, groupId, userId string) error
	DeleteGroupMembership(ctx context.Context, groupId, userId string) error
	ListUserCredentials(ctx context.Context, userId string, after string, amount int) ([]*models.Credentials, *models.Pagination, error)
	CreateCredentials(ctx context.Context, userId string) (*models.CredentialsWithSecret, error)
	DeleteCredentials(ctx context.Context, userId, accessKeyId string) error
	GetCredentials(ctx context.Context, userId, accessKeyId string) (*models.Credentials, error)
	ListUserGroups(ctx context.Context, userId string, after string, amount int) ([]*models.Group, *models.Pagination, error)
	ListUserPolicies(ctx context.Context, userId string, effective bool, after string, amount int) ([]*models.Policy, *models.Pagination, error)
	AttachPolicyToUser(ctx context.Context, userId, policyId string) error
	DetachPolicyFromUser(ctx context.Context, userId, policyId string) error
	ListGroupPolicies(ctx context.Context, groupId string, after string, amount int) ([]*models.Policy, *models.Pagination, error)
	AttachPolicyToGroup(ctx context.Context, groupId, policyId string) error
	DetachPolicyFromGroup(ctx context.Context, groupId, policyId string) error
}

type Client

type Client interface {
	AuthClient
	RepositoryClient
}

func NewClient

func NewClient(endpointURL, accessKeyId, secretAccessKey string) (Client, error)

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(cataloger catalog.Cataloger, auth auth.Service, blockAdapter block.Adapter, stats stats.Collector, retention retention.Service, dedupCleaner *dedup.Cleaner, logger logging.Logger) *Controller

func (*Controller) AddGroupMembershipHandler

func (c *Controller) AddGroupMembershipHandler() authop.AddGroupMembershipHandler

func (*Controller) AttachPolicyToGroupHandler

func (c *Controller) AttachPolicyToGroupHandler() authop.AttachPolicyToGroupHandler

func (*Controller) AttachPolicyToUserHandler

func (c *Controller) AttachPolicyToUserHandler() authop.AttachPolicyToUserHandler

func (*Controller) BranchesDiffBranchHandler

func (c *Controller) BranchesDiffBranchHandler() branches.DiffBranchHandler

func (*Controller) CommitHandler

func (c *Controller) CommitHandler() commits.CommitHandler

func (*Controller) CommitsGetBranchCommitLogHandler

func (c *Controller) CommitsGetBranchCommitLogHandler() commits.GetBranchCommitLogHandler

func (*Controller) Configure

func (c *Controller) Configure(api *operations.LakefsAPI)

Configure attaches our API operations to a generated swagger API stub Adding new handlers requires also adding them here so that the generated server will use them

func (*Controller) Context

func (c *Controller) Context() context.Context

func (*Controller) CreateBranchHandler

func (c *Controller) CreateBranchHandler() branches.CreateBranchHandler

func (*Controller) CreateCredentialsHandler

func (c *Controller) CreateCredentialsHandler() authop.CreateCredentialsHandler

func (*Controller) CreateGroupHandler

func (c *Controller) CreateGroupHandler() authop.CreateGroupHandler

func (*Controller) CreatePolicyHandler

func (c *Controller) CreatePolicyHandler() authop.CreatePolicyHandler

func (*Controller) CreateRepositoryHandler

func (c *Controller) CreateRepositoryHandler() repositories.CreateRepositoryHandler

func (*Controller) CreateUserHandler

func (c *Controller) CreateUserHandler() authop.CreateUserHandler

func (*Controller) DeleteBranchHandler

func (c *Controller) DeleteBranchHandler() branches.DeleteBranchHandler

func (*Controller) DeleteCredentialsHandler

func (c *Controller) DeleteCredentialsHandler() authop.DeleteCredentialsHandler

func (*Controller) DeleteGroupHandler

func (c *Controller) DeleteGroupHandler() authop.DeleteGroupHandler

func (*Controller) DeleteGroupMembershipHandler

func (c *Controller) DeleteGroupMembershipHandler() authop.DeleteGroupMembershipHandler

func (*Controller) DeletePolicyHandler

func (c *Controller) DeletePolicyHandler() authop.DeletePolicyHandler

func (*Controller) DeleteRepositoryHandler

func (c *Controller) DeleteRepositoryHandler() repositories.DeleteRepositoryHandler

func (*Controller) DeleteUserHandler

func (c *Controller) DeleteUserHandler() authop.DeleteUserHandler

func (*Controller) DetachPolicyFromGroupHandler

func (c *Controller) DetachPolicyFromGroupHandler() authop.DetachPolicyFromGroupHandler

func (*Controller) DetachPolicyFromUserHandler

func (c *Controller) DetachPolicyFromUserHandler() authop.DetachPolicyFromUserHandler

func (*Controller) GetBranchHandler

func (c *Controller) GetBranchHandler() branches.GetBranchHandler

func (*Controller) GetCommitHandler

func (c *Controller) GetCommitHandler() commits.GetCommitHandler

func (*Controller) GetCredentialsHandler

func (c *Controller) GetCredentialsHandler() authop.GetCredentialsHandler

func (*Controller) GetCurrentUserHandler

func (c *Controller) GetCurrentUserHandler() authop.GetCurrentUserHandler

func (*Controller) GetGroupHandler

func (c *Controller) GetGroupHandler() authop.GetGroupHandler

func (*Controller) GetPolicyHandler

func (c *Controller) GetPolicyHandler() authop.GetPolicyHandler

func (*Controller) GetRepoHandler

func (c *Controller) GetRepoHandler() repositories.GetRepositoryHandler

func (*Controller) GetUserHandler

func (c *Controller) GetUserHandler() authop.GetUserHandler

func (*Controller) ImportFromS3InventoryHandler

func (c *Controller) ImportFromS3InventoryHandler() repositories.ImportFromS3InventoryHandler

func (*Controller) ListBranchesHandler

func (c *Controller) ListBranchesHandler() branches.ListBranchesHandler

func (*Controller) ListGroupMembersHandler

func (c *Controller) ListGroupMembersHandler() authop.ListGroupMembersHandler

func (*Controller) ListGroupPoliciesHandler

func (c *Controller) ListGroupPoliciesHandler() authop.ListGroupPoliciesHandler

func (*Controller) ListGroupsHandler

func (c *Controller) ListGroupsHandler() authop.ListGroupsHandler

func (*Controller) ListPoliciesHandler

func (c *Controller) ListPoliciesHandler() authop.ListPoliciesHandler

func (*Controller) ListRepositoriesHandler

func (c *Controller) ListRepositoriesHandler() repositories.ListRepositoriesHandler

func (*Controller) ListUserCredentialsHandler

func (c *Controller) ListUserCredentialsHandler() authop.ListUserCredentialsHandler

func (*Controller) ListUserGroupsHandler

func (c *Controller) ListUserGroupsHandler() authop.ListUserGroupsHandler

func (*Controller) ListUserPoliciesHandler

func (c *Controller) ListUserPoliciesHandler() authop.ListUserPoliciesHandler

func (*Controller) ListUsersHandler

func (c *Controller) ListUsersHandler() authop.ListUsersHandler

func (*Controller) MergeMergeIntoBranchHandler

func (c *Controller) MergeMergeIntoBranchHandler() refs.MergeIntoBranchHandler

func (*Controller) MetadataCreateSymlinkHandler

func (c *Controller) MetadataCreateSymlinkHandler() metadataop.CreateSymlinkHandler

func (*Controller) ObjectsDeleteObjectHandler

func (c *Controller) ObjectsDeleteObjectHandler() objects.DeleteObjectHandler

func (*Controller) ObjectsGetObjectHandler

func (c *Controller) ObjectsGetObjectHandler() objects.GetObjectHandler

func (*Controller) ObjectsGetUnderlyingPropertiesHandler

func (c *Controller) ObjectsGetUnderlyingPropertiesHandler() objects.GetUnderlyingPropertiesHandler

func (*Controller) ObjectsListObjectsHandler

func (c *Controller) ObjectsListObjectsHandler() objects.ListObjectsHandler

func (*Controller) ObjectsStatObjectHandler

func (c *Controller) ObjectsStatObjectHandler() objects.StatObjectHandler

func (*Controller) ObjectsUploadObjectHandler

func (c *Controller) ObjectsUploadObjectHandler() objects.UploadObjectHandler

func (*Controller) RefsDiffRefsHandler

func (c *Controller) RefsDiffRefsHandler() refs.DiffRefsHandler

func (*Controller) RetentionGetRetentionPolicyHandler

func (c *Controller) RetentionGetRetentionPolicyHandler() retentionop.GetRetentionPolicyHandler

func (*Controller) RetentionUpdateRetentionPolicyHandler

func (c *Controller) RetentionUpdateRetentionPolicyHandler() retentionop.UpdateRetentionPolicyHandler

func (*Controller) RevertBranchHandler

func (c *Controller) RevertBranchHandler() branches.RevertBranchHandler

func (*Controller) UpdatePolicyHandler

func (c *Controller) UpdatePolicyHandler() authop.UpdatePolicyHandler

type Dependencies

type Dependencies struct {
	Cataloger    catalog.Cataloger
	Auth         auth.Service
	BlockAdapter block.Adapter
	Stats        stats.Collector
	Retention    retention.Service
	Dedup        *dedup.Cleaner
	// contains filtered or unexported fields
}

func (*Dependencies) LogAction

func (d *Dependencies) LogAction(action string)

func (*Dependencies) WithContext

func (d *Dependencies) WithContext(ctx context.Context) *Dependencies

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) BasicAuth

func (s *Handler) BasicAuth() func(accessKey, secretKey string) (user *models.User, err error)

BasicAuth returns a function that hooks into Swagger's basic Auth provider it uses the Auth.Service provided to ensure credentials are valid

func (*Handler) JwtTokenAuth

func (s *Handler) JwtTokenAuth() func(string) (*models.User, error)

JwtTokenAuth decodes, validates and authenticates a user that exists in the X-JWT-Authorization header. This header either exists natively, or is set using a token

type RepositoryClient

type RepositoryClient interface {
	ListRepositories(ctx context.Context, after string, amount int) ([]*models.Repository, *models.Pagination, error)
	GetRepository(ctx context.Context, repository string) (*models.Repository, error)
	CreateRepository(ctx context.Context, repository *models.RepositoryCreation) error
	DeleteRepository(ctx context.Context, repository string) error

	ListBranches(ctx context.Context, repository string, from string, amount int) ([]string, *models.Pagination, error)
	GetBranch(ctx context.Context, repository, branchId string) (string, error)
	CreateBranch(ctx context.Context, repository string, branch *models.BranchCreation) (string, error)
	DeleteBranch(ctx context.Context, repository, branchId string) error
	RevertBranch(ctx context.Context, repository, branchId string, revertProps *models.RevertCreation) error

	Commit(ctx context.Context, repository, branchId, message string, metadata map[string]string) (*models.Commit, error)
	GetCommit(ctx context.Context, repository, commitId string) (*models.Commit, error)
	GetCommitLog(ctx context.Context, repository, branchId, after string, amount int) ([]*models.Commit, *models.Pagination, error)

	StatObject(ctx context.Context, repository, ref, path string) (*models.ObjectStats, error)
	ListObjects(ctx context.Context, repository, ref, prefix, from string, amount int) ([]*models.ObjectStats, *models.Pagination, error)
	GetObject(ctx context.Context, repository, ref, path string, w io.Writer) (*objects.GetObjectOK, error)
	UploadObject(ctx context.Context, repository, branchId, path string, r io.Reader) (*models.ObjectStats, error)
	DeleteObject(ctx context.Context, repository, branchId, path string) error

	DiffRefs(ctx context.Context, repository, leftRef, rightRef string) ([]*models.Diff, error)
	Merge(ctx context.Context, repository, leftRef, rightRef string) ([]*models.MergeResult, error)

	DiffBranch(ctx context.Context, repository, branch string) ([]*models.Diff, error)

	GetRetentionPolicy(ctx context.Context, repository string) (*models.RetentionPolicyWithCreationDate, error)
	UpdateRetentionPolicy(ctx context.Context, repository string, policy *models.RetentionPolicy) error
	Symlink(ctx context.Context, repoId, ref, path string) (string, error)
}

Jump to

Keyboard shortcuts

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