restapi

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: AGPL-3.0 Imports: 97 Imported by: 0

Documentation

Overview

Package restapi MinIO Console Server

Schemes:
  http
  ws
Host: localhost
BasePath: /api/v1
Version: 0.1.0

Consumes:
  - application/json
  - multipart/form-data

Produces:
  - application/zip
  - application/octet-stream
  - application/json

swagger:meta

Index

Constants

View Source
const (
	Unknown = 0
	Allow   = 1
	Deny    = -1
)

Policy evaluated constants

View Source
const (
	// Constants for common configuration
	ConsoleMinIOServer = "CONSOLE_MINIO_SERVER"
	ConsoleSubnetProxy = "CONSOLE_SUBNET_PROXY"
	ConsoleMinIORegion = "CONSOLE_MINIO_REGION"
	ConsoleHostname    = "CONSOLE_HOSTNAME"
	ConsolePort        = "CONSOLE_PORT"
	ConsoleTLSPort     = "CONSOLE_TLS_PORT"

	// Constants for Secure middleware
	ConsoleSecureAllowedHosts                    = "CONSOLE_SECURE_ALLOWED_HOSTS"
	ConsoleSecureAllowedHostsAreRegex            = "CONSOLE_SECURE_ALLOWED_HOSTS_ARE_REGEX"
	ConsoleSecureFrameDeny                       = "CONSOLE_SECURE_FRAME_DENY"
	ConsoleSecureContentTypeNoSniff              = "CONSOLE_SECURE_CONTENT_TYPE_NO_SNIFF"
	ConsoleSecureBrowserXSSFilter                = "CONSOLE_SECURE_BROWSER_XSS_FILTER"
	ConsoleSecureContentSecurityPolicy           = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY"
	ConsoleSecureContentSecurityPolicyReportOnly = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY_REPORT_ONLY"
	ConsoleSecureHostsProxyHeaders               = "CONSOLE_SECURE_HOSTS_PROXY_HEADERS"
	ConsoleSecureSTSSeconds                      = "CONSOLE_SECURE_STS_SECONDS"
	ConsoleSecureSTSIncludeSubdomains            = "CONSOLE_SECURE_STS_INCLUDE_SUB_DOMAINS"
	ConsoleSecureSTSPreload                      = "CONSOLE_SECURE_STS_PRELOAD"
	ConsoleSecureTLSRedirect                     = "CONSOLE_SECURE_TLS_REDIRECT"
	ConsoleSecureTLSHost                         = "CONSOLE_SECURE_TLS_HOST"
	ConsoleSecureTLSTemporaryRedirect            = "CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT"
	ConsoleSecureForceSTSHeader                  = "CONSOLE_SECURE_FORCE_STS_HEADER"
	ConsoleSecurePublicKey                       = "CONSOLE_SECURE_PUBLIC_KEY"
	ConsoleSecureReferrerPolicy                  = "CONSOLE_SECURE_REFERRER_POLICY"
	ConsoleSecureFeaturePolicy                   = "CONSOLE_SECURE_FEATURE_POLICY"
	ConsoleSecureExpectCTHeader                  = "CONSOLE_SECURE_EXPECT_CT_HEADER"
	PrometheusURL                                = "CONSOLE_PROMETHEUS_URL"
	PrometheusAuthToken                          = "CONSOLE_PROMETHEUS_AUTH_TOKEN"
	PrometheusJobID                              = "CONSOLE_PROMETHEUS_JOB_ID"
	PrometheusExtraLabels                        = "CONSOLE_PROMETHEUS_EXTRA_LABELS"
	ConsoleLogQueryURL                           = "CONSOLE_LOG_QUERY_URL"
	ConsoleLogQueryAuthToken                     = "CONSOLE_LOG_QUERY_AUTH_TOKEN"
	ConsoleMaxConcurrentUploads                  = "CONSOLE_MAX_CONCURRENT_UPLOADS"
	ConsoleMaxConcurrentDownloads                = "CONSOLE_MAX_CONCURRENT_DOWNLOADS"
	ConsoleDevMode                               = "CONSOLE_DEV_MODE"
	ConsoleAnimatedLogin                         = "CONSOLE_ANIMATED_LOGIN"
	LogSearchQueryAuthToken                      = "LOGSEARCH_QUERY_AUTH_TOKEN"
	SlashSeparator                               = "/"
	LocalAddress                                 = "127.0.0.1"
)

list of all console environment constants

View Source
const EnvSubnetLicense = "CONSOLE_SUBNET_LICENSE"
View Source
const (
	SubPath = "CONSOLE_SUBPATH"
)

Variables

View Source
var (
	// Port console default port
	Port = "9090"

	// Hostname console hostname
	// avoid listening on 0.0.0.0 by default
	// instead listen on all IPv4 and IPv6
	// - Hostname should be empty.
	Hostname = ""

	// TLSPort console tls port
	TLSPort = "9443"

	// TLSRedirect console tls redirect rule
	TLSRedirect = "on"

	ConsoleResourceName = "console-ui"
)
View Source
var (
	// GlobalRootCAs is CA root certificates, a nil value means system certs pool will be used
	GlobalRootCAs *x509.CertPool
	// GlobalPublicCerts has certificates Console will use to serve clients
	GlobalPublicCerts []*x509.Certificate
	// GlobalTLSCertsManager custom TLS Manager for SNI support
	GlobalTLSCertsManager *xcerts.Manager
)
View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)
View Source
var (
	ErrDefault                          = errors.New("an error occurred, please try again")
	ErrInvalidLogin                     = errors.New("invalid Login")
	ErrForbidden                        = errors.New("403 Forbidden")
	ErrBadRequest                       = errors.New("400 Bad Request")
	ErrFileTooLarge                     = errors.New("413 File too Large")
	ErrInvalidSession                   = errors.New("invalid session")
	ErrNotFound                         = errors.New("not found")
	ErrGroupAlreadyExists               = errors.New("error group name already in use")
	ErrInvalidErasureCodingValue        = errors.New("invalid Erasure Coding Value")
	ErrBucketBodyNotInRequest           = errors.New("error bucket body not in request")
	ErrBucketNameNotInRequest           = errors.New("error bucket name not in request")
	ErrGroupBodyNotInRequest            = errors.New("error group body not in request")
	ErrGroupNameNotInRequest            = errors.New("error group name not in request")
	ErrPolicyNameNotInRequest           = errors.New("error policy name not in request")
	ErrPolicyBodyNotInRequest           = errors.New("error policy body not in request")
	ErrPolicyNameContainsSpace          = errors.New("error policy name cannot contain spaces")
	ErrInvalidEncryptionAlgorithm       = errors.New("error invalid encryption algorithm")
	ErrSSENotConfigured                 = errors.New("error server side encryption configuration not found")
	ErrBucketLifeCycleNotConfigured     = errors.New("error bucket life cycle configuration not found")
	ErrChangePassword                   = errors.New("error please check your current password")
	ErrInvalidLicense                   = errors.New("invalid license key")
	ErrLicenseNotFound                  = errors.New("license not found")
	ErrAvoidSelfAccountDelete           = errors.New("logged in user cannot be deleted by itself")
	ErrAccessDenied                     = errors.New("access denied")
	ErrOauth2Provider                   = errors.New("unable to contact configured identity provider")
	ErrNonUniqueAccessKey               = errors.New("access key already in use")
	ErrRemoteTierExists                 = errors.New("specified remote tier already exists")
	ErrRemoteTierNotFound               = errors.New("specified remote tier was not found")
	ErrRemoteTierUppercase              = errors.New("tier name must be in uppercase")
	ErrRemoteTierBucketNotFound         = errors.New("remote tier bucket not found")
	ErrRemoteInvalidCredentials         = errors.New("invalid remote tier credentials")
	ErrUnableToGetTenantUsage           = errors.New("unable to get tenant usage")
	ErrTooManyNodes                     = errors.New("cannot request more nodes than what is available in the cluster")
	ErrTooFewNodes                      = errors.New("there are not enough nodes in the cluster to support this tenant")
	ErrTooFewAvailableNodes             = errors.New("there is not enough available nodes to satisfy this requirement")
	ErrFewerThanFourNodes               = errors.New("at least 4 nodes are required for a tenant")
	ErrUnableToGetTenantLogs            = errors.New("unable to get tenant logs")
	ErrUnableToUpdateTenantCertificates = errors.New("unable to update tenant certificates")
	ErrUpdatingEncryptionConfig         = errors.New("unable to update encryption configuration")
	ErrDeletingEncryptionConfig         = errors.New("error disabling tenant encryption")
	ErrEncryptionConfigNotFound         = errors.New("encryption configuration not found")
	ErrPolicyNotFound                   = errors.New("policy does not exist")
	ErrLoginNotAllowed                  = errors.New("login not allowed")
	ErrSubnetUploadFail                 = errors.New("SUBNET upload failed")
	ErrHealthReportFail                 = errors.New("failure to generate Health report")
)
View Source
var (
	LogInfo  = logInfo
	LogError = logError
	LogIf    = logIf
)

globally changeable logger styles

View Source
var ErrSubnetLicenseNotFound = errors.New("license not found")
View Source
var InstanceLicensePlan = PlanAGPL
View Source
var (
	MinioServerInfoMock func(ctx context.Context) (madmin.InfoMessage, error)
)

Functions

func AuditLogMiddleware added in v0.16.1

func AuditLogMiddleware(next http.Handler) http.Handler

func AuthenticationMiddleware added in v0.4.6

func AuthenticationMiddleware(next http.Handler) http.Handler

func ContextMiddleware added in v0.16.1

func ContextMiddleware(next http.Handler) http.Handler

func DifferenceArrays

func DifferenceArrays(a, b []string) []string

DifferenceArrays returns the elements in `a` that aren't in `b`.

func ExpireSessionCookie added in v0.4.6

func ExpireSessionCookie() http.Cookie

func FileServerMiddleware

func FileServerMiddleware(next http.Handler) http.Handler

FileServerMiddleware serves files from the static folder

func GetConsoleHTTPClient added in v0.9.1

func GetConsoleHTTPClient(address string, clientIP string) *http.Client

GetConsoleHTTPClient caches different http clients depending on the target endpoint while taking in consideration CA certs stored in ${HOME}/.console/certs/CAs and ${HOME}/.minio/certs/CAs If the target endpoint points to a loopback device, skip the TLS verification.

func GetHostname

func GetHostname() string

GetHostname gets console hostname set on env variable, default one or defined on run command

func GetMinIORegion added in v0.8.0

func GetMinIORegion() string

func GetPort

func GetPort() int

GetPort gets console por set on env variable or default one

func GetSecureAllowedHosts added in v0.8.0

func GetSecureAllowedHosts() []string

Get secure middleware env variable configurations

func GetSecureAllowedHostsAreRegex added in v0.8.0

func GetSecureAllowedHostsAreRegex() bool

AllowedHostsAreRegex determines, if the provided AllowedHosts slice contains valid regular expressions. Default is false.

func GetSecureBrowserXSSFilter added in v0.8.0

func GetSecureBrowserXSSFilter() bool

If BrowserXssFilter is true, adds the X-XSS-Protection header with the value `1; mode=block`. Default is true.

func GetSecureContentSecurityPolicy added in v0.8.0

func GetSecureContentSecurityPolicy() string

ContentSecurityPolicy allows the Content-Security-Policy header value to be set with a custom value. Default is "". Passing a template string will replace `$NONCE` with a dynamic nonce value of 16 bytes for each request which can be later retrieved using the Nonce function.

func GetSecureContentSecurityPolicyReportOnly added in v0.8.0

func GetSecureContentSecurityPolicyReportOnly() string

ContentSecurityPolicyReportOnly allows the Content-Security-Policy-Report-Only header value to be set with a custom value. Default is "".

func GetSecureContentTypeNonSniff added in v0.8.0

func GetSecureContentTypeNonSniff() bool

If ContentTypeNosniff is true, adds the X-Content-Type-Options header with the value `nosniff`. Default is true.

func GetSecureExpectCTHeader added in v0.8.0

func GetSecureExpectCTHeader() string

func GetSecureFeaturePolicy added in v0.8.0

func GetSecureFeaturePolicy() string

FeaturePolicy allows the Feature-Policy header with the value to be set with a custom value. Default is "".

func GetSecureForceSTSHeader added in v0.8.0

func GetSecureForceSTSHeader() bool

STS header is only included when the connection is HTTPS.

func GetSecureFrameDeny added in v0.8.0

func GetSecureFrameDeny() bool

If FrameDeny is set to true, adds the X-Frame-Options header with the value of `DENY`. Default is true.

func GetSecureHostsProxyHeaders added in v0.8.0

func GetSecureHostsProxyHeaders() []string

HostsProxyHeaders is a set of header keys that may hold a proxied hostname value for the request.

func GetSecurePublicKey added in v0.8.0

func GetSecurePublicKey() string

PublicKey implements HPKP to prevent MITM attacks with forged certificates. Default is "".

func GetSecureReferrerPolicy added in v0.8.0

func GetSecureReferrerPolicy() string

ReferrerPolicy allows the Referrer-Policy header with the value to be set with a custom value. Default is "".

func GetSecureSTSIncludeSubdomains added in v0.8.0

func GetSecureSTSIncludeSubdomains() bool

If STSIncludeSubdomains is set to true, the `includeSubdomains` will be appended to the Strict-Transport-Security header. Default is false.

func GetSecureSTSPreload added in v0.8.0

func GetSecureSTSPreload() bool

If STSPreload is set to true, the `preload` flag will be appended to the Strict-Transport-Security header. Default is false.

func GetSecureSTSSeconds added in v0.8.0

func GetSecureSTSSeconds() int64

STSSeconds is the max-age of the Strict-Transport-Security header. Default is 0, which would NOT include the header.

func GetSecureTLSHost added in v0.8.0

func GetSecureTLSHost() string

TLSHost is the host name that is used to redirect HTTP requests to HTTPS. Default is "", which indicates to use the same host.

func GetSecureTLSTemporaryRedirect added in v0.8.0

func GetSecureTLSTemporaryRedirect() bool

If TLSTemporaryRedirect is true, the a 302 will be used while redirecting. Default is false (301).

func GetSubnetHTTPClient added in v0.14.0

func GetSubnetHTTPClient(ctx context.Context, minioClient MinioAdmin) (*xhttp.Client, error)

GetSubnetHTTPClient will return a client with proxy if configured, otherwise will return the default console http client

func GetSubnetKeyFromMinIOConfig added in v0.14.0

func GetSubnetKeyFromMinIOConfig(ctx context.Context, minioClient MinioAdmin) (*subnet.LicenseTokenConfig, error)

func GetSubnetRegToken added in v0.14.0

func GetSubnetRegToken(ctx context.Context, minioClient MinioAdmin) (string, error)

func GetSubnetRegister added in v0.14.0

func GetSubnetRegister(ctx context.Context, minioClient MinioAdmin, httpClient xhttp.ClientI, params subnetApi.SubnetRegisterParams) error

func GetTLSPort added in v0.3.11

func GetTLSPort() int

GetTLSPort gets console tls port set on env variable or default one

func GetTLSRedirect added in v0.6.0

func GetTLSRedirect() string

If GetTLSRedirect is set to true, then only allow HTTPS requests. Default is true.

func IsElementInArray

func IsElementInArray(a []string, b string) bool

IsElementInArray returns true if the string belongs to the slice

func NewConsoleCredentials added in v0.8.0

func NewConsoleCredentials(accessKey, secretKey, location, clientIP string) (*credentials.Credentials, error)

func NewMinioAdminClient added in v0.8.0

func NewMinioAdminClient(ctx context.Context, sessionClaims *models.Principal) (*madmin.AdminClient, error)

func NewSessionCookieForConsole added in v0.4.6

func NewSessionCookieForConsole(token string) http.Cookie

func PrepareConsoleHTTPClient added in v0.9.1

func PrepareConsoleHTTPClient(insecure bool, clientIP string) *http.Client

PrepareConsoleHTTPClient returns an http.Client with custom configurations need it by *credentials.STSAssumeRole custom configurations include the use of CA certificates

func RandomCharString

func RandomCharString(n int) string

func RandomCharStringWithAlphabet

func RandomCharStringWithAlphabet(n int, alphabet string) string

func RejectS3Middleware added in v0.11.0

func RejectS3Middleware(next http.Handler) http.Handler

RejectS3Middleware will reject requests that have AWS S3 specific headers.

func SanitizeEncodedPrefix added in v0.11.0

func SanitizeEncodedPrefix(rawPrefix string) string

SanitizeEncodedPrefix replaces spaces for + since those are lost when you do GET parameters

func SetPolicy added in v0.19.2

func SetPolicy(ctx context.Context, client MinioAdmin, name, entityName string, entityType models.PolicyEntity) error

SetPolicy calls MinIO server to assign policy to a group or user.

func SubnetLogin added in v0.14.0

func SubnetLogin(client xhttp.ClientI, username, password string) (string, string, error)

func SubnetLoginWithMFA added in v0.14.0

func SubnetLoginWithMFA(client xhttp.ClientI, username, mfaToken, otp string) (*models.SubnetLoginResponse, error)

func SubnetRegisterWithAPIKey added in v0.14.0

func SubnetRegisterWithAPIKey(ctx context.Context, minioClient MinioAdmin, apiKey string) (bool, error)

func UniqueKeys

func UniqueKeys(a []string) []string

UniqueKeys returns an array without duplicated keys

func ValidateEncodedStyles added in v0.20.0

func ValidateEncodedStyles(encodedStyles string) error

Types

type AdminClient added in v0.8.0

type AdminClient struct {
	Client *madmin.AdminClient
}

Interface implementation

Define the structure of a minIO Client and define the functions that are actually used from minIO api.

func (AdminClient) AccountInfo added in v0.8.0

func (ac AdminClient) AccountInfo(ctx context.Context) (madmin.AccountInfo, error)

AccountInfo implements madmin.AccountInfo()

type AdminClientMock added in v0.23.0

type AdminClientMock struct{}

func (AdminClientMock) AccountInfo added in v0.23.0

func (ac AdminClientMock) AccountInfo(ctx context.Context) (madmin.AccountInfo, error)

type CodedAPIError added in v0.38.0

type CodedAPIError struct {
	Code     int
	APIError *models.APIError
}

func Error added in v0.16.1

func Error(err ...interface{}) *CodedAPIError

Error receives an errors object and parse it against k8sErrors, returns the right errors code paired with a generic errors message

func ErrorWithContext added in v0.16.1

func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError

ErrorWithContext :

func GetKMSAPIsResponse added in v0.21.0

func GetKMSAPIsResponse(session *models.Principal, params kmsAPI.KMSAPIsParams) (*models.KmsAPIsResponse, *CodedAPIError)

func GetKMSAssignPolicyResponse added in v0.20.3

func GetKMSAssignPolicyResponse(session *models.Principal, params kmsAPI.KMSAssignPolicyParams) *CodedAPIError

func GetKMSCreateKeyResponse added in v0.20.3

func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *CodedAPIError

func GetKMSDeleteIdentityResponse added in v0.20.3

func GetKMSDeleteIdentityResponse(session *models.Principal, params kmsAPI.KMSDeleteIdentityParams) *CodedAPIError

func GetKMSDeleteKeyResponse added in v0.20.3

func GetKMSDeleteKeyResponse(session *models.Principal, params kmsAPI.KMSDeleteKeyParams) *CodedAPIError

func GetKMSDeletePolicyResponse added in v0.20.3

func GetKMSDeletePolicyResponse(session *models.Principal, params kmsAPI.KMSDeletePolicyParams) *CodedAPIError

func GetKMSDescribeIdentityResponse added in v0.20.3

func GetKMSDescribeIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeIdentityParams) (*models.KmsDescribeIdentityResponse, *CodedAPIError)

func GetKMSDescribePolicyResponse added in v0.20.3

func GetKMSDescribePolicyResponse(session *models.Principal, params kmsAPI.KMSDescribePolicyParams) (*models.KmsDescribePolicyResponse, *CodedAPIError)

func GetKMSDescribeSelfIdentityResponse added in v0.20.3

func GetKMSDescribeSelfIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeSelfIdentityParams) (*models.KmsDescribeSelfIdentityResponse, *CodedAPIError)

func GetKMSGetPolicyResponse added in v0.20.3

func GetKMSGetPolicyResponse(session *models.Principal, params kmsAPI.KMSGetPolicyParams) (*models.KmsGetPolicyResponse, *CodedAPIError)

func GetKMSImportKeyResponse added in v0.20.3

func GetKMSImportKeyResponse(session *models.Principal, params kmsAPI.KMSImportKeyParams) *CodedAPIError

func GetKMSKeyStatusResponse added in v0.20.3

func GetKMSKeyStatusResponse(session *models.Principal, params kmsAPI.KMSKeyStatusParams) (*models.KmsKeyStatusResponse, *CodedAPIError)

func GetKMSListIdentitiesResponse added in v0.20.3

func GetKMSListIdentitiesResponse(session *models.Principal, params kmsAPI.KMSListIdentitiesParams) (*models.KmsListIdentitiesResponse, *CodedAPIError)

func GetKMSListKeysResponse added in v0.20.3

func GetKMSListKeysResponse(session *models.Principal, params kmsAPI.KMSListKeysParams) (*models.KmsListKeysResponse, *CodedAPIError)

func GetKMSListPoliciesResponse added in v0.20.3

func GetKMSListPoliciesResponse(session *models.Principal, params kmsAPI.KMSListPoliciesParams) (*models.KmsListPoliciesResponse, *CodedAPIError)

func GetKMSMetricsResponse added in v0.21.0

func GetKMSMetricsResponse(session *models.Principal, params kmsAPI.KMSMetricsParams) (*models.KmsMetricsResponse, *CodedAPIError)

func GetKMSSetPolicyResponse added in v0.20.3

func GetKMSSetPolicyResponse(session *models.Principal, params kmsAPI.KMSSetPolicyParams) *CodedAPIError

func GetKMSStatusResponse added in v0.20.3

func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *CodedAPIError)

func GetKMSVersionResponse added in v0.21.0

func GetKMSVersionResponse(session *models.Principal, params kmsAPI.KMSVersionParams) (*models.KmsVersionResponse, *CodedAPIError)

func GetReleaseListResponse added in v0.24.0

func GetReleaseListResponse(_ *models.Principal, params release.ListReleasesParams) (*models.ReleaseListResponse, *CodedAPIError)

func GetSubnetAPIKeyResponse added in v0.19.2

func GetSubnetAPIKeyResponse(session *models.Principal, params subnetApi.SubnetAPIKeyParams) (*models.APIKey, *CodedAPIError)

func GetSubnetInfoResponse added in v0.14.0

func GetSubnetInfoResponse(session *models.Principal, params subnetApi.SubnetInfoParams) (*models.License, *CodedAPIError)

func GetSubnetLoginResponse added in v0.14.0

func GetSubnetLoginResponse(session *models.Principal, params subnetApi.SubnetLoginParams) (*models.SubnetLoginResponse, *CodedAPIError)

func GetSubnetLoginWithMFAResponse added in v0.14.0

func GetSubnetLoginWithMFAResponse(session *models.Principal, params subnetApi.SubnetLoginMFAParams) (*models.SubnetLoginResponse, *CodedAPIError)

func GetSubnetRegTokenResponse added in v0.14.0

func GetSubnetRegTokenResponse(session *models.Principal, params subnetApi.SubnetRegTokenParams) (*models.SubnetRegTokenResponse, *CodedAPIError)

func GetSubnetRegisterResponse added in v0.14.0

func GetSubnetRegisterResponse(session *models.Principal, params subnetApi.SubnetRegisterParams) *CodedAPIError

type Conditions added in v0.17.0

type Conditions struct {
	S3Prefix []string `json:"s3:prefix"`
}

type ConfigurationSetItem added in v0.24.0

type ConfigurationSetItem struct {
	Value  string
	Enable bool
}

type ConsoleCredentials

type ConsoleCredentials struct {
	ConsoleCredentials *credentials.Credentials
	AccountAccessKey   string
}

Interface implementation

func (ConsoleCredentials) Expire

func (c ConsoleCredentials) Expire()

Expire implements *Login.Expire()

func (ConsoleCredentials) Get

Get implements *Login.Get()

func (ConsoleCredentials) GetAccountAccessKey added in v0.8.0

func (c ConsoleCredentials) GetAccountAccessKey() string

type ConsoleCredentialsI added in v0.5.0

type ConsoleCredentialsI interface {
	Get() (credentials.Value, error)
	Expire()
	GetAccountAccessKey() string
}

ConsoleCredentialsI interface with all functions to be implemented by mock when testing, it should include all needed consoleCredentials.Login api calls that are used within this project.

type ConsoleTransport added in v0.30.0

type ConsoleTransport struct {
	Transport *http.Transport
	ClientIP  string
}

func PrepareSTSClientTransport added in v0.16.1

func PrepareSTSClientTransport(insecure bool, remoteAddress string) *ConsoleTransport

PrepareSTSClientTransport :

func (*ConsoleTransport) RoundTrip added in v0.30.0

func (t *ConsoleTransport) RoundTrip(req *http.Request) (*http.Response, error)

type ConsoleWebsocket

type ConsoleWebsocket interface {
	// contains filtered or unexported methods
}

ConsoleWebsocket interface of a Websocket Client

type ConsoleWebsocketAdmin

type ConsoleWebsocketAdmin interface {
	// contains filtered or unexported methods
}

ConsoleWebsocketAdmin interface of a Websocket Client

type ConsoleWebsocketMClient added in v0.22.1

type ConsoleWebsocketMClient interface {
	// contains filtered or unexported methods
}

ConsoleWebSocketMClient interface of a Websocket Client

type Context added in v0.7.5

type Context struct {
	Host                string
	HTTPPort, HTTPSPort int
	TLSRedirect         string
	// Legacy options, TODO: remove in future
	TLSCertificate, TLSKey, TLSca string
}

Context captures all command line flags values

func (*Context) Load added in v0.7.5

func (c *Context) Load(ctx *cli.Context) error

Load loads restapi Context from command line context.

type CustomButtonStyle added in v0.20.0

type CustomButtonStyle struct {
	BackgroundColor *string `json:"backgroundColor"`
	TextColor       *string `json:"textColor"`
	HoverColor      *string `json:"hoverColor"`
	HoverText       *string `json:"hoverText"`
	ActiveColor     *string `json:"activeColor"`
	ActiveText      *string `json:"activeText"`
	DisabledColor   *string `json:"disabledColor"`
	DisabledText    *string `json:"disdabledText"`
}

type CustomInputStyle added in v0.26.4

type CustomInputStyle struct {
	Border          *string `json:"border"`
	HoverBorder     *string `json:"hoverBorder"`
	TextColor       *string `json:"textColor"`
	BackgroundColor *string `json:"backgroundColor"`
}

type CustomStyles added in v0.20.0

type CustomStyles struct {
	BackgroundColor       *string            `json:"backgroundColor"`
	FontColor             *string            `json:"fontColor"`
	SecondaryFontColor    *string            `json:"secondaryFontColor"`
	BorderColor           *string            `json:"borderColor"`
	LoaderColor           *string            `json:"loaderColor"`
	BoxBackground         *string            `json:"boxBackground"`
	OkColor               *string            `json:"okColor"`
	ErrorColor            *string            `json:"errorColor"`
	WarnColor             *string            `json:"warnColor"`
	LinkColor             *string            `json:"linkColor"`
	DisabledLinkColor     *string            `json:"disabledLinkColor"`
	HoverLinkColor        *string            `json:"hoverLinkColor"`
	ButtonStyles          *CustomButtonStyle `json:"buttonStyles"`
	SecondaryButtonStyles *CustomButtonStyle `json:"secondaryButtonStyles"`
	RegularButtonStyles   *CustomButtonStyle `json:"regularButtonStyles"`
	TableColors           *CustomTableStyle  `json:"tableColors"`
	InputBox              *CustomInputStyle  `json:"inputBox"`
	Switch                *CustomSwitchStyle `json:"switch"`
}

type CustomSwitchStyle added in v0.26.4

type CustomSwitchStyle struct {
	SwitchBackground          *string `json:"switchBackground"`
	BulletBorderColor         *string `json:"bulletBorderColor"`
	BulletBGColor             *string `json:"bulletBGColor"`
	DisabledBackground        *string `json:"disabledBackground"`
	DisabledBulletBorderColor *string `json:"disabledBulletBorderColor"`
	DisabledBulletBGColor     *string `json:"disabledBulletBGColor"`
}

type CustomTableStyle added in v0.26.4

type CustomTableStyle struct {
	Border          *string `json:"border"`
	DisabledBorder  *string `json:"disabledBorder"`
	DisabledBG      *string `json:"disabledBG"`
	Selected        *string `json:"selected"`
	DeletedDisabled *string `json:"deletedDisabled"`
	HoverColor      *string `json:"hoverColor"`
}

type DataResult added in v0.5.0

type DataResult struct {
	Metric map[string]string `json:"metric"`
	Values []interface{}     `json:"values"`
}

type GridPos added in v0.7.2

type GridPos struct {
	H int32
	W int32
	X int32
	Y int32
}

type LabelResponse added in v0.5.0

type LabelResponse struct {
	Status string   `json:"status"`
	Data   []string `json:"data"`
}

type LabelResults added in v0.5.0

type LabelResults struct {
	Label    string
	Response LabelResponse
}

type ListObjectsOpts added in v0.23.1

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

type LogRequest added in v0.15.9

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

Type for log requests. This allows for filtering by node and kind

type MCClient added in v0.3.1

type MCClient interface {
	// contains filtered or unexported methods
}

MCClient interface with all functions to be implemented by mock when testing, it should include all mc/S3Client respective api calls that are used within this project.

type Metric added in v0.5.0

type Metric struct {
	ID            int32
	Title         string
	Type          string
	Options       MetricOptions
	Targets       []Target
	GridPos       GridPos
	MaxDataPoints int32
}

type MetricOptions added in v0.5.0

type MetricOptions struct {
	ReduceOptions ReduceOptions
}

type MinIOConfig added in v0.19.4

type MinIOConfig struct {
	OpenIDProviders oauth2.OpenIDPCfg
}

MinIOConfig represents application configuration passed in from the MinIO server to the console.

var GlobalMinIOConfig MinIOConfig

GlobalMinIOConfig is the global application configuration passed in from the MinIO server.

type MinioAdmin

type MinioAdmin interface {
	AccountInfo(ctx context.Context) (madmin.AccountInfo, error)
	// contains filtered or unexported methods
}

MinioAdmin interface with all functions to be implemented by mock when testing, it should include all MinioAdmin respective api calls that are used within this project.

type MinioClient

type MinioClient interface {
	GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error)
	SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error
	RemoveBucketTagging(ctx context.Context, bucketName string) error
	// contains filtered or unexported methods
}

MinioClient interface with all functions to be implemented by mock when testing, it should include all MinioClient respective api calls that are used within this project.

type MultiLifecycleResult added in v0.14.6

type MultiLifecycleResult struct {
	BucketName string
	Error      string
}

type ObjectResponse added in v0.22.1

type ObjectResponse struct {
	Name         string `json:"name,omitempty"`
	LastModified string `json:"last_modified,omitempty"`
	Size         int64  `json:"size,omitempty"`
	VersionID    string `json:"version_id,omitempty"`
	DeleteMarker bool   `json:"delete_flag,omitempty"`
	IsLatest     bool   `json:"is_latest,omitempty"`
}

type ObjectsRequest added in v0.22.1

type ObjectsRequest struct {
	Mode       string `json:"mode,omitempty"`
	BucketName string `json:"bucket_name"`
	Prefix     string `json:"prefix"`
	Date       string `json:"date"`
	RequestID  int64  `json:"request_id"`
}

type PromResp added in v0.5.0

type PromResp struct {
	Status string       `json:"status"`
	Data   PromRespData `json:"data"`
}

type PromRespData added in v0.5.0

type PromRespData struct {
	ResultType string       `json:"resultType"`
	Result     []DataResult `json:"result"`
}

type ReduceOptions added in v0.5.0

type ReduceOptions struct {
	Calcs []string
}

type RemoteBucketResult added in v0.6.7

type RemoteBucketResult struct {
	OriginBucket string
	TargetBucket string
	Error        string
}

type Server

type Server struct {
	EnabledListeners []string         `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"`
	CleanupTimeout   time.Duration    `long:"cleanup-timeout" description:"grace period for which to wait before killing idle connections" default:"10s"`
	GracefulTimeout  time.Duration    `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
	MaxHeaderSize    flagext.ByteSize `` /* 231-byte string literal not displayed */

	SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/console.sock"`

	Host         string        `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
	Port         int           `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
	ListenLimit  int           `long:"listen-limit" description:"limit the number of outstanding requests"`
	KeepAlive    time.Duration `` /* 169-byte string literal not displayed */
	ReadTimeout  time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
	WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`

	TLSHost           string         `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
	TLSPort           int            `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
	TLSCertificate    flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
	TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
	TLSCACertificate  flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
	TLSListenLimit    int            `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
	TLSKeepAlive      time.Duration  `` /* 160-byte string literal not displayed */
	TLSReadTimeout    time.Duration  `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
	TLSWriteTimeout   time.Duration  `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
	// contains filtered or unexported fields
}

Server for the console API

func NewServer

func NewServer(api *operations.ConsoleAPI) *Server

NewServer creates a new api console server but does not configure it

func (*Server) ConfigureAPI

func (s *Server) ConfigureAPI()

ConfigureAPI configures the API and handlers.

func (*Server) ConfigureFlags

func (s *Server) ConfigureFlags()

ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse

func (*Server) Fatalf

func (s *Server) Fatalf(f string, args ...interface{})

Fatalf logs message either via defined user logger or via system one if no user logger is defined. Exits with non-zero status after printing

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler returns a handler useful for testing

func (*Server) HTTPListener

func (s *Server) HTTPListener() ([]net.Listener, error)

HTTPListener returns the http listener

func (*Server) Listen

func (s *Server) Listen() error

Listen creates the listeners for the server

func (*Server) Logf

func (s *Server) Logf(f string, args ...interface{})

Logf logs message either via defined user logger or via system one if no user logger is defined.

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve the api

func (*Server) SetAPI

func (s *Server) SetAPI(api *operations.ConsoleAPI)

SetAPI configures the server with the specified API. Needs to be called before Serve

func (*Server) SetHandler

func (s *Server) SetHandler(handler http.Handler)

SetHandler allows for setting a http handler on this server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown server and clean up resources

func (*Server) TLSListener

func (s *Server) TLSListener() ([]net.Listener, error)

TLSListener returns the https listener

func (*Server) UnixListener

func (s *Server) UnixListener() (net.Listener, error)

UnixListener returns the domain socket listener

type SubnetPlan added in v0.23.1

type SubnetPlan int
const (
	PlanAGPL SubnetPlan = iota
	PlanStandard
	PlanEnterprise
)

func (SubnetPlan) String added in v0.23.1

func (sp SubnetPlan) String() string

type SubnetRegistration added in v0.14.0

type SubnetRegistration struct {
	AccessToken   string
	MFAToken      string
	Organizations []models.SubnetOrganization
}

type Target added in v0.5.0

type Target struct {
	Expr         string
	Interval     string
	LegendFormat string
	Step         int32
	InitialTime  int64
}

type TraceRequest added in v0.7.5

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

Types for trace request. this adds support for calls, threshold, status and extra filters

type UsageInfo added in v0.8.0

type UsageInfo struct {
	Buckets          int64
	Objects          int64
	Usage            int64
	DrivesUsage      int64
	Servers          []*models.ServerProperties
	EndpointNotReady bool
	Backend          *models.BackendProperties
}

func GetAdminInfo added in v0.8.0

func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error)

GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure

type VersionState added in v0.6.4

type VersionState string
const (
	VersionEnable  VersionState = "enable"
	VersionSuspend VersionState = "suspend"
)

type WSConn

type WSConn interface {
	// contains filtered or unexported methods
}

WSConn interface with all functions to be implemented by mock when testing, it should include all websocket.Conn respective api calls that are used within this project.

type WSResponse added in v0.22.1

type WSResponse struct {
	RequestID  int64            `json:"request_id,omitempty"`
	Error      *CodedAPIError   `json:"error,omitempty"`
	RequestEnd bool             `json:"request_end,omitempty"`
	Prefix     string           `json:"prefix,omitempty"`
	BucketName string           `json:"bucketName,omitempty"`
	Data       []ObjectResponse `json:"data,omitempty"`
}

type Widget added in v0.5.0

type Widget struct {
	Title string
	Type  string
}

type WidgetLabel added in v0.5.0

type WidgetLabel struct {
	Name string
}

Jump to

Keyboard shortcuts

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