quota

package
v0.0.0-...-ec03ccd Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyArtifactMiddleware

func CopyArtifactMiddleware() func(http.Handler) http.Handler

CopyArtifactMiddleware middleware to request count and storage resources for copy artifact API

func PostInitiateBlobUploadMiddleware

func PostInitiateBlobUploadMiddleware() func(http.Handler) http.Handler

PostInitiateBlobUploadMiddleware middleware to add blob to project after mount blob success

func PutBlobUploadMiddleware

func PutBlobUploadMiddleware() func(http.Handler) http.Handler

PutBlobUploadMiddleware middleware to request storage resource for the project

func PutManifestMiddleware

func PutManifestMiddleware() func(http.Handler) http.Handler

PutManifestMiddleware middleware to request count and storage resources for the project

func RefreshForProjectMiddleware

func RefreshForProjectMiddleware(skippers ...middleware.Skipper) func(http.Handler) http.Handler

RefreshForProjectMiddleware middleware which refresh the quota usage of project after the response success

func RefreshMiddleware

func RefreshMiddleware(config RefreshConfig, skipers ...middleware.Skipper) func(http.Handler) http.Handler

RefreshMiddleware middleware which refresh the quota usage after the response success

func RequestMiddleware

func RequestMiddleware(config RequestConfig, skippers ...middleware.Skipper) func(http.Handler) http.Handler

RequestMiddleware middleware which request resources

Types

type RefreshConfig

type RefreshConfig struct {
	// IgnoreLimitation allow quota usage exceed the limitation when it's true
	IgnoreLimitation bool

	// ReferenceObject returns reference object its quota usage will refresh by reference and reference id
	ReferenceObject func(*http.Request) (reference string, referenceID string, err error)
}

RefreshConfig refresh quota usage middleware config

type RequestConfig

type RequestConfig struct {
	// ReferenceObject returns reference object which resources will be requested
	ReferenceObject func(r *http.Request) (reference string, referenceID string, err error)

	// Resources returns request resources for the reference object
	Resources func(r *http.Request, reference, referenceID string) (types.ResourceList, error)

	// ResourcesWarningPercent value from 0 to 100
	ResourcesWarningPercent int

	// ResourcesWarning returns event which will be notified when resources usage exceeded the wanring percent
	ResourcesWarning func(r *http.Request, reference, referenceID string, message string) event.Metadata

	// ResourcesExceeded returns event which will be notified when resources exceeded the limitation
	ResourcesExceeded func(r *http.Request, reference, referenceID string, message string) event.Metadata
}

RequestConfig request resources middleware config

Jump to

Keyboard shortcuts

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