api

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxPerPage is the maximum amount of results returned for paginated queries to the API
	DefaultMaxPerPage int = 1000

	UserContextKey contextKey = "user"
)
View Source
const (
	DefaultLoginExpiration = time.Hour * 24 * 7
	JWTCookieName          = "access_token"
)
View Source
const (
	RequestIDHeaderName = "X-Request-ID"
	LoggerServiceName   = "rest_api"
	BaseURL             = "/api/v1"
)

Variables

View Source
var (
	ErrUnexpectedSigningMethod = errors.New("unexpected signing method")
	ErrAuthenticationFailed    = errors.New("error authenticating request")
)
View Source
var ErrInvalidAPIEndpoint = errors.New("invalid API endpoint")

Functions

func AuthMiddleware added in v0.40.0

func AuthMiddleware(logger logging.Logger, swagger *openapi3.Swagger, authService auth.Service) func(next http.Handler) http.Handler

func GenerateJWT

func GenerateJWT(secret []byte, accessKeyID string, issuedAt, expiresAt time.Time) (string, error)

func Int64Ptr added in v0.40.0

func Int64Ptr(n int64) *int64

func Int64Value added in v0.40.0

func Int64Value(p *int64) int64

func InvalidAPIEndpointHandler added in v0.48.0

func InvalidAPIEndpointHandler(w http.ResponseWriter, _ *http.Request)

InvalidAPIEndpointHandler returns ErrInvalidAPIEndpoint, and is currently being used to ensure that routes under the pattern it is used with in chi.Router.Mount (i.e. /api/v1) are not accessible.

func IsStatusCodeOK added in v0.40.0

func IsStatusCodeOK(statusCode int) bool

func MetricsMiddleware added in v0.40.0

func MetricsMiddleware(swagger *openapi3.Swagger) func(http.Handler) http.Handler

func NewHandlerWithDefault

func NewHandlerWithDefault(root http.FileSystem, handler http.Handler, defaultPath string, gatewayDomains []string) http.Handler

func NewUIHandler

func NewUIHandler(authService auth.Service, gatewayDomains []string) http.Handler

func NoCacheHandler added in v0.43.0

func NoCacheHandler(handler http.Handler) http.Handler

NoCacheHandler based on github.com/zenazn/goji's NoCache

func OapiRequestValidatorWithOptions added in v0.40.0

func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *openapi3filter.Options) func(http.Handler) http.Handler

OapiRequestValidatorWithOptions Creates middleware to validate request by swagger spec. This middleware is good for net/http either since go-chi is 100% compatible with net/http. The original implementation can be found at https://github.com/deepmap/oapi-codegen/blob/master/pkg/chi-middleware/oapi_validate.go Used our own implementation in order to:

  1. Use the latest version kin-openapi (can switch back when oapi-codegen will be updated)
  2. For file upload wanted to skip body validation for two reasons: a. didn't find a way for the validator to accept any file content type b. didn't want the validator to read the complete request body for the specific request

func Serve

func Serve(
	cfg *config.Config,
	catalog catalog.Interface,
	authService auth.Service,
	blockAdapter block.Adapter,
	metadataManager auth.MetadataManager,
	migrator db.Migrator,
	collector stats.Collector,
	cloudMetadataProvider cloud.MetadataProvider,
	actions actionsHandler,
	logger logging.Logger,
	gatewayDomains []string,
) http.Handler

func StringPtr added in v0.40.0

func StringPtr(s string) *string

func StringValue added in v0.40.0

func StringValue(s *string) string

Types

type Controller

type Controller struct {
	Config                *config.Config
	Catalog               catalog.Interface
	Auth                  auth.Service
	BlockAdapter          block.Adapter
	MetadataManager       auth.MetadataManager
	Migrator              db.Migrator
	Collector             stats.Collector
	CloudMetadataProvider cloud.MetadataProvider
	Actions               actionsHandler
	Logger                logging.Logger
}

func NewController

func NewController(
	cfg *config.Config,
	catalog catalog.Interface,
	authService auth.Service,
	blockAdapter block.Adapter,
	metadataManager auth.MetadataManager,
	migrator db.Migrator,
	collector stats.Collector,
	cloudMetadataProvider cloud.MetadataProvider,
	actions actionsHandler,
	logger logging.Logger,
) *Controller

func (*Controller) AddGroupMembership added in v0.40.0

func (c *Controller) AddGroupMembership(w http.ResponseWriter, r *http.Request, groupID string, userID string)

func (*Controller) AttachPolicyToGroup added in v0.40.0

func (c *Controller) AttachPolicyToGroup(w http.ResponseWriter, r *http.Request, groupID string, policyID string)

func (*Controller) AttachPolicyToUser added in v0.40.0

func (c *Controller) AttachPolicyToUser(w http.ResponseWriter, r *http.Request, userID string, policyID string)

func (*Controller) Commit added in v0.40.0

func (c *Controller) Commit(w http.ResponseWriter, r *http.Request, body CommitJSONRequestBody, repository string, branch string)

func (*Controller) CreateBranch added in v0.40.0

func (c *Controller) CreateBranch(w http.ResponseWriter, r *http.Request, body CreateBranchJSONRequestBody, repository string)

func (*Controller) CreateCredentials added in v0.40.0

func (c *Controller) CreateCredentials(w http.ResponseWriter, r *http.Request, userID string)

func (*Controller) CreateGroup added in v0.40.0

func (c *Controller) CreateGroup(w http.ResponseWriter, r *http.Request, body CreateGroupJSONRequestBody)

func (*Controller) CreatePolicy added in v0.40.0

func (c *Controller) CreatePolicy(w http.ResponseWriter, r *http.Request, body CreatePolicyJSONRequestBody)

func (*Controller) CreateRepository added in v0.40.0

func (c *Controller) CreateRepository(w http.ResponseWriter, r *http.Request, body CreateRepositoryJSONRequestBody, params CreateRepositoryParams)

func (*Controller) CreateSymlinkFile added in v0.40.0

func (c *Controller) CreateSymlinkFile(w http.ResponseWriter, r *http.Request, repository string, branch string, params CreateSymlinkFileParams)

func (*Controller) CreateTag added in v0.40.0

func (c *Controller) CreateTag(w http.ResponseWriter, r *http.Request, body CreateTagJSONRequestBody, repository string)

func (*Controller) CreateUser added in v0.40.0

func (c *Controller) CreateUser(w http.ResponseWriter, r *http.Request, body CreateUserJSONRequestBody)

func (*Controller) DeleteBranch added in v0.40.0

func (c *Controller) DeleteBranch(w http.ResponseWriter, r *http.Request, repository string, branch string)

func (*Controller) DeleteCredentials added in v0.40.0

func (c *Controller) DeleteCredentials(w http.ResponseWriter, r *http.Request, userID string, accessKeyID string)

func (*Controller) DeleteGroup added in v0.40.0

func (c *Controller) DeleteGroup(w http.ResponseWriter, r *http.Request, groupID string)

func (*Controller) DeleteGroupMembership added in v0.40.0

func (c *Controller) DeleteGroupMembership(w http.ResponseWriter, r *http.Request, groupID string, userID string)

func (*Controller) DeleteObject added in v0.40.0

func (c *Controller) DeleteObject(w http.ResponseWriter, r *http.Request, repository string, branch string, params DeleteObjectParams)

func (*Controller) DeletePolicy added in v0.40.0

func (c *Controller) DeletePolicy(w http.ResponseWriter, r *http.Request, policyID string)

func (*Controller) DeleteRepository added in v0.40.0

func (c *Controller) DeleteRepository(w http.ResponseWriter, r *http.Request, repository string)

func (*Controller) DeleteTag added in v0.40.0

func (c *Controller) DeleteTag(w http.ResponseWriter, r *http.Request, repository string, tag string)

func (*Controller) DeleteUser added in v0.40.0

func (c *Controller) DeleteUser(w http.ResponseWriter, r *http.Request, userID string)

func (*Controller) DetachPolicyFromGroup added in v0.40.0

func (c *Controller) DetachPolicyFromGroup(w http.ResponseWriter, r *http.Request, groupID string, policyID string)

func (*Controller) DetachPolicyFromUser added in v0.40.0

func (c *Controller) DetachPolicyFromUser(w http.ResponseWriter, r *http.Request, userID string, policyID string)

func (*Controller) DiffBranch added in v0.40.0

func (c *Controller) DiffBranch(w http.ResponseWriter, r *http.Request, repository string, branch string, params DiffBranchParams)

func (*Controller) DiffRefs added in v0.40.0

func (c *Controller) DiffRefs(w http.ResponseWriter, r *http.Request, repository string, leftRef string, rightRef string, params DiffRefsParams)

func (*Controller) DumpRefs added in v0.40.0

func (c *Controller) DumpRefs(w http.ResponseWriter, r *http.Request, repository string)

func (*Controller) GetBranch added in v0.40.0

func (c *Controller) GetBranch(w http.ResponseWriter, r *http.Request, repository string, branch string)

func (*Controller) GetCommit added in v0.40.0

func (c *Controller) GetCommit(w http.ResponseWriter, r *http.Request, repository string, commitID string)

func (*Controller) GetCredentials added in v0.40.0

func (c *Controller) GetCredentials(w http.ResponseWriter, r *http.Request, userID string, accessKeyID string)

func (*Controller) GetCurrentUser added in v0.40.0

func (c *Controller) GetCurrentUser(w http.ResponseWriter, r *http.Request)

func (*Controller) GetGarbageCollectionRules added in v0.43.0

func (c *Controller) GetGarbageCollectionRules(w http.ResponseWriter, r *http.Request, repository string)

func (*Controller) GetGroup added in v0.40.0

func (c *Controller) GetGroup(w http.ResponseWriter, r *http.Request, groupID string)

func (*Controller) GetLakeFSVersion added in v0.43.0

func (c *Controller) GetLakeFSVersion(w http.ResponseWriter, r *http.Request)

func (*Controller) GetMetaRange added in v0.40.0

func (c *Controller) GetMetaRange(w http.ResponseWriter, r *http.Request, repository string, metaRange string)

func (*Controller) GetObject added in v0.40.0

func (c *Controller) GetObject(w http.ResponseWriter, r *http.Request, repository string, ref string, params GetObjectParams)

func (*Controller) GetPhysicalAddress added in v0.40.0

func (c *Controller) GetPhysicalAddress(w http.ResponseWriter, r *http.Request, repository string, branch string, params GetPhysicalAddressParams)

func (*Controller) GetPolicy added in v0.40.0

func (c *Controller) GetPolicy(w http.ResponseWriter, r *http.Request, policyID string)

func (*Controller) GetRange added in v0.40.0

func (c *Controller) GetRange(w http.ResponseWriter, r *http.Request, repository string, pRange string)

func (*Controller) GetRepository added in v0.40.0

func (c *Controller) GetRepository(w http.ResponseWriter, r *http.Request, repository string)

func (*Controller) GetRun added in v0.40.0

func (c *Controller) GetRun(w http.ResponseWriter, r *http.Request, repository string, runID string)

func (*Controller) GetRunHookOutput added in v0.40.0

func (c *Controller) GetRunHookOutput(w http.ResponseWriter, r *http.Request, repository string, runID string, hookRunID string)

func (*Controller) GetStorageConfig added in v0.42.0

func (c *Controller) GetStorageConfig(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTag added in v0.40.0

func (c *Controller) GetTag(w http.ResponseWriter, r *http.Request, repository string, tag string)

func (*Controller) GetUnderlyingProperties added in v0.40.0

func (c *Controller) GetUnderlyingProperties(w http.ResponseWriter, r *http.Request, repository string, ref string, params GetUnderlyingPropertiesParams)

func (*Controller) GetUser added in v0.40.0

func (c *Controller) GetUser(w http.ResponseWriter, r *http.Request, userID string)

func (*Controller) HealthCheck added in v0.40.0

func (c *Controller) HealthCheck(w http.ResponseWriter, _ *http.Request)

func (*Controller) LinkPhysicalAddress added in v0.40.0

func (c *Controller) LinkPhysicalAddress(w http.ResponseWriter, r *http.Request, body LinkPhysicalAddressJSONRequestBody, repository string, branch string, params LinkPhysicalAddressParams)

func (*Controller) ListBranches added in v0.40.0

func (c *Controller) ListBranches(w http.ResponseWriter, r *http.Request, repository string, params ListBranchesParams)

func (*Controller) ListGroupMembers added in v0.40.0

func (c *Controller) ListGroupMembers(w http.ResponseWriter, r *http.Request, groupID string, params ListGroupMembersParams)

func (*Controller) ListGroupPolicies added in v0.40.0

func (c *Controller) ListGroupPolicies(w http.ResponseWriter, r *http.Request, groupID string, params ListGroupPoliciesParams)

func (*Controller) ListGroups added in v0.40.0

func (c *Controller) ListGroups(w http.ResponseWriter, r *http.Request, params ListGroupsParams)

func (*Controller) ListObjects added in v0.40.0

func (c *Controller) ListObjects(w http.ResponseWriter, r *http.Request, repository string, ref string, params ListObjectsParams)

func (*Controller) ListPolicies added in v0.40.0

func (c *Controller) ListPolicies(w http.ResponseWriter, r *http.Request, params ListPoliciesParams)

func (*Controller) ListRepositories added in v0.40.0

func (c *Controller) ListRepositories(w http.ResponseWriter, r *http.Request, params ListRepositoriesParams)

func (*Controller) ListRepositoryRuns added in v0.40.0

func (c *Controller) ListRepositoryRuns(w http.ResponseWriter, r *http.Request, repository string, params ListRepositoryRunsParams)

func (*Controller) ListRunHooks added in v0.40.0

func (c *Controller) ListRunHooks(w http.ResponseWriter, r *http.Request, repository string, runID string, params ListRunHooksParams)

func (*Controller) ListTags added in v0.40.0

func (c *Controller) ListTags(w http.ResponseWriter, r *http.Request, repository string, params ListTagsParams)

func (*Controller) ListUserCredentials added in v0.40.0

func (c *Controller) ListUserCredentials(w http.ResponseWriter, r *http.Request, userID string, params ListUserCredentialsParams)

func (*Controller) ListUserGroups added in v0.40.0

func (c *Controller) ListUserGroups(w http.ResponseWriter, r *http.Request, userID string, params ListUserGroupsParams)

func (*Controller) ListUserPolicies added in v0.40.0

func (c *Controller) ListUserPolicies(w http.ResponseWriter, r *http.Request, userID string, params ListUserPoliciesParams)

func (*Controller) ListUsers added in v0.40.0

func (c *Controller) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)

func (*Controller) LogAction

func (c *Controller) LogAction(ctx context.Context, action string)

func (*Controller) LogBranchCommits added in v0.40.0

func (c *Controller) LogBranchCommits(w http.ResponseWriter, r *http.Request, repository string, branch string, params LogBranchCommitsParams)

LogBranchCommits deprecated replaced by LogCommits

func (*Controller) LogCommits added in v0.40.0

func (c *Controller) LogCommits(w http.ResponseWriter, r *http.Request, repository string, ref string, params LogCommitsParams)

func (*Controller) Login added in v0.40.0

func (c *Controller) Login(w http.ResponseWriter, r *http.Request, body LoginJSONRequestBody)

func (*Controller) Logout added in v0.40.0

func (c *Controller) Logout(w http.ResponseWriter, r *http.Request)

func (*Controller) MergeIntoBranch added in v0.40.0

func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, body MergeIntoBranchJSONRequestBody, repository string, sourceRef string, destinationBranch string)

func (*Controller) PrepareGarbageCollectionCommits added in v0.43.0

func (c *Controller) PrepareGarbageCollectionCommits(w http.ResponseWriter, r *http.Request, body PrepareGarbageCollectionCommitsJSONRequestBody, repository string)

func (*Controller) ResetBranch added in v0.40.0

func (c *Controller) ResetBranch(w http.ResponseWriter, r *http.Request, body ResetBranchJSONRequestBody, repository string, branch string)

func (*Controller) RestoreRefs added in v0.40.0

func (c *Controller) RestoreRefs(w http.ResponseWriter, r *http.Request, body RestoreRefsJSONRequestBody, repository string)

func (*Controller) RevertBranch added in v0.40.0

func (c *Controller) RevertBranch(w http.ResponseWriter, r *http.Request, body RevertBranchJSONRequestBody, repository string, branch string)

func (*Controller) SetGarbageCollectionRules added in v0.43.0

func (c *Controller) SetGarbageCollectionRules(w http.ResponseWriter, r *http.Request, body SetGarbageCollectionRulesJSONRequestBody, repository string)

func (*Controller) Setup added in v0.40.0

func (c *Controller) Setup(w http.ResponseWriter, r *http.Request, body SetupJSONRequestBody)

func (*Controller) StageObject added in v0.40.0

func (c *Controller) StageObject(w http.ResponseWriter, r *http.Request, body StageObjectJSONRequestBody, repository string, branch string, params StageObjectParams)

func (*Controller) StatObject added in v0.40.0

func (c *Controller) StatObject(w http.ResponseWriter, r *http.Request, repository string, ref string, params StatObjectParams)

func (*Controller) UpdatePolicy added in v0.40.0

func (c *Controller) UpdatePolicy(w http.ResponseWriter, r *http.Request, body UpdatePolicyJSONRequestBody, policyID string)

func (*Controller) UploadObject added in v0.40.0

func (c *Controller) UploadObject(w http.ResponseWriter, r *http.Request, repository string, branch string, params UploadObjectParams)

type LoginRequestData

type LoginRequestData struct {
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
}

type LoginResponseData

type LoginResponseData struct {
	Token string `json:"token"`
}

Directories

Path Synopsis
Package helpers provides useful wrappers for clients using the lakeFS OpenAPI.
Package helpers provides useful wrappers for clients using the lakeFS OpenAPI.

Jump to

Keyboard shortcuts

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