adminapi

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type AccessKey

type AccessKey struct {
	AccessKey string  `json:"access_key"`
	Grants    []Grant `json:"grants"`
	Source    Source  `json:"source"`
	// Creation time, for runtime-managed credentials.
	CreatedAt OptDateTime `json:"created_at"`
}

Ref: #/components/schemas/AccessKey

func (*AccessKey) Decode

func (s *AccessKey) Decode(d *jx.Decoder) error

Decode decodes AccessKey from json.

func (*AccessKey) Encode

func (s *AccessKey) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AccessKey) GetAccessKey

func (s *AccessKey) GetAccessKey() string

GetAccessKey returns the value of AccessKey.

func (*AccessKey) GetCreatedAt

func (s *AccessKey) GetCreatedAt() OptDateTime

GetCreatedAt returns the value of CreatedAt.

func (*AccessKey) GetGrants

func (s *AccessKey) GetGrants() []Grant

GetGrants returns the value of Grants.

func (*AccessKey) GetSource

func (s *AccessKey) GetSource() Source

GetSource returns the value of Source.

func (*AccessKey) MarshalJSON

func (s *AccessKey) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AccessKey) SetAccessKey

func (s *AccessKey) SetAccessKey(val string)

SetAccessKey sets the value of AccessKey.

func (*AccessKey) SetCreatedAt

func (s *AccessKey) SetCreatedAt(val OptDateTime)

SetCreatedAt sets the value of CreatedAt.

func (*AccessKey) SetGrants

func (s *AccessKey) SetGrants(val []Grant)

SetGrants sets the value of Grants.

func (*AccessKey) SetSource

func (s *AccessKey) SetSource(val Source)

SetSource sets the value of Source.

func (*AccessKey) UnmarshalJSON

func (s *AccessKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AccessKey) Validate

func (s *AccessKey) Validate() error

type AccessKeyList

type AccessKeyList struct {
	Keys []AccessKey `json:"keys"`
}

Ref: #/components/schemas/AccessKeyList

func (*AccessKeyList) Decode

func (s *AccessKeyList) Decode(d *jx.Decoder) error

Decode decodes AccessKeyList from json.

func (*AccessKeyList) Encode

func (s *AccessKeyList) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AccessKeyList) GetKeys

func (s *AccessKeyList) GetKeys() []AccessKey

GetKeys returns the value of Keys.

func (*AccessKeyList) MarshalJSON

func (s *AccessKeyList) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AccessKeyList) SetKeys

func (s *AccessKeyList) SetKeys(val []AccessKey)

SetKeys sets the value of Keys.

func (*AccessKeyList) UnmarshalJSON

func (s *AccessKeyList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AccessKeyList) Validate

func (s *AccessKeyList) Validate() error

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) ControlRebalance

func (c *Client) ControlRebalance(ctx context.Context, request *RebalanceControlRequest) (*RebalanceStatus, error)

ControlRebalance invokes controlRebalance operation.

Start, pause or resume the cluster-wide rebalance from this node. At most one rebalance runs cluster-wide (etcd election); starting on several nodes leaves the extras waiting as standby runners. Pausing stops this node's runner and keeps the resume cursor, so a later start/resume — on any node — continues where it left off.

POST /api/v1/cluster/rebalance

func (*Client) CreateAccessKey

func (c *Client) CreateAccessKey(ctx context.Context, request *CreateAccessKeyRequest) (*CreatedAccessKey, error)

CreateAccessKey invokes createAccessKey operation.

Create a runtime credential. The access key and secret are generated when not supplied. The secret is returned only in this response and cannot be retrieved later.

POST /api/v1/access-keys

func (*Client) DeleteAccessKey

func (c *Client) DeleteAccessKey(ctx context.Context, params DeleteAccessKeyParams) error

DeleteAccessKey invokes deleteAccessKey operation.

Remove a runtime credential. Config-defined credentials cannot be deleted.

DELETE /api/v1/access-keys/{accessKey}

func (*Client) GetInfo

func (c *Client) GetInfo(ctx context.Context) (*InstanceInfo, error)

GetInfo invokes getInfo operation.

Build information, uptime and whether authentication is enabled.

GET /api/v1/info

func (*Client) GetRebalanceStatus

func (c *Client) GetRebalanceStatus(ctx context.Context) (*RebalanceStatus, error)

GetRebalanceStatus invokes getRebalanceStatus operation.

State and progress of the cluster rebalance runner on this node, the persisted resume cursor and the depth of the async repair queue. State is "disabled" when the server is not in cluster mode.

GET /api/v1/cluster/rebalance

func (*Client) ListAccessKeys

func (c *Client) ListAccessKeys(ctx context.Context) (*AccessKeyList, error)

ListAccessKeys invokes listAccessKeys operation.

Every credential the server accepts, secrets omitted.

GET /api/v1/access-keys

type ClientOption

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

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type CreateAccessKeyRequest

type CreateAccessKeyRequest struct {
	// Access key ID; generated when omitted.
	AccessKey OptString `json:"access_key"`
	// Secret access key; generated when omitted.
	SecretKey OptString `json:"secret_key"`
	Grants    []Grant   `json:"grants"`
}

Ref: #/components/schemas/CreateAccessKeyRequest

func (*CreateAccessKeyRequest) Decode

func (s *CreateAccessKeyRequest) Decode(d *jx.Decoder) error

Decode decodes CreateAccessKeyRequest from json.

func (*CreateAccessKeyRequest) Encode

func (s *CreateAccessKeyRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateAccessKeyRequest) GetAccessKey

func (s *CreateAccessKeyRequest) GetAccessKey() OptString

GetAccessKey returns the value of AccessKey.

func (*CreateAccessKeyRequest) GetGrants

func (s *CreateAccessKeyRequest) GetGrants() []Grant

GetGrants returns the value of Grants.

func (*CreateAccessKeyRequest) GetSecretKey

func (s *CreateAccessKeyRequest) GetSecretKey() OptString

GetSecretKey returns the value of SecretKey.

func (*CreateAccessKeyRequest) MarshalJSON

func (s *CreateAccessKeyRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateAccessKeyRequest) SetAccessKey

func (s *CreateAccessKeyRequest) SetAccessKey(val OptString)

SetAccessKey sets the value of AccessKey.

func (*CreateAccessKeyRequest) SetGrants

func (s *CreateAccessKeyRequest) SetGrants(val []Grant)

SetGrants sets the value of Grants.

func (*CreateAccessKeyRequest) SetSecretKey

func (s *CreateAccessKeyRequest) SetSecretKey(val OptString)

SetSecretKey sets the value of SecretKey.

func (*CreateAccessKeyRequest) UnmarshalJSON

func (s *CreateAccessKeyRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateAccessKeyRequest) Validate

func (s *CreateAccessKeyRequest) Validate() error

type CreatedAccessKey

type CreatedAccessKey struct {
	AccessKey string `json:"access_key"`
	// Secret access key — shown once, not retrievable later.
	SecretKey string    `json:"secret_key"`
	Grants    []Grant   `json:"grants"`
	CreatedAt time.Time `json:"created_at"`
}

Ref: #/components/schemas/CreatedAccessKey

func (*CreatedAccessKey) Decode

func (s *CreatedAccessKey) Decode(d *jx.Decoder) error

Decode decodes CreatedAccessKey from json.

func (*CreatedAccessKey) Encode

func (s *CreatedAccessKey) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreatedAccessKey) GetAccessKey

func (s *CreatedAccessKey) GetAccessKey() string

GetAccessKey returns the value of AccessKey.

func (*CreatedAccessKey) GetCreatedAt

func (s *CreatedAccessKey) GetCreatedAt() time.Time

GetCreatedAt returns the value of CreatedAt.

func (*CreatedAccessKey) GetGrants

func (s *CreatedAccessKey) GetGrants() []Grant

GetGrants returns the value of Grants.

func (*CreatedAccessKey) GetSecretKey

func (s *CreatedAccessKey) GetSecretKey() string

GetSecretKey returns the value of SecretKey.

func (*CreatedAccessKey) MarshalJSON

func (s *CreatedAccessKey) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreatedAccessKey) SetAccessKey

func (s *CreatedAccessKey) SetAccessKey(val string)

SetAccessKey sets the value of AccessKey.

func (*CreatedAccessKey) SetCreatedAt

func (s *CreatedAccessKey) SetCreatedAt(val time.Time)

SetCreatedAt sets the value of CreatedAt.

func (*CreatedAccessKey) SetGrants

func (s *CreatedAccessKey) SetGrants(val []Grant)

SetGrants sets the value of Grants.

func (*CreatedAccessKey) SetSecretKey

func (s *CreatedAccessKey) SetSecretKey(val string)

SetSecretKey sets the value of SecretKey.

func (*CreatedAccessKey) UnmarshalJSON

func (s *CreatedAccessKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreatedAccessKey) Validate

func (s *CreatedAccessKey) Validate() error

type DeleteAccessKeyNoContent

type DeleteAccessKeyNoContent struct{}

DeleteAccessKeyNoContent is response for DeleteAccessKey operation.

type DeleteAccessKeyParams

type DeleteAccessKeyParams struct {
	// The access key ID to delete.
	AccessKey string
}

DeleteAccessKeyParams is parameters of deleteAccessKey operation.

type Error

type Error struct {
	ErrorMessage string `json:"error_message"`
}

Error occurred while processing request. Ref: #/components/schemas/Error

func (*Error) Decode

func (s *Error) Decode(d *jx.Decoder) error

Decode decodes Error from json.

func (*Error) Encode

func (s *Error) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Error) GetErrorMessage

func (s *Error) GetErrorMessage() string

GetErrorMessage returns the value of ErrorMessage.

func (*Error) MarshalJSON

func (s *Error) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetErrorMessage

func (s *Error) SetErrorMessage(val string)

SetErrorMessage sets the value of ErrorMessage.

func (*Error) UnmarshalJSON

func (s *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type Grant

type Grant struct {
	// Bucket glob pattern; "*" matches all buckets.
	Bucket     string     `json:"bucket"`
	Permission Permission `json:"permission"`
}

Ref: #/components/schemas/Grant

func (*Grant) Decode

func (s *Grant) Decode(d *jx.Decoder) error

Decode decodes Grant from json.

func (*Grant) Encode

func (s *Grant) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Grant) GetBucket

func (s *Grant) GetBucket() string

GetBucket returns the value of Bucket.

func (*Grant) GetPermission

func (s *Grant) GetPermission() Permission

GetPermission returns the value of Permission.

func (*Grant) MarshalJSON

func (s *Grant) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Grant) SetBucket

func (s *Grant) SetBucket(val string)

SetBucket sets the value of Bucket.

func (*Grant) SetPermission

func (s *Grant) SetPermission(val Permission)

SetPermission sets the value of Permission.

func (*Grant) UnmarshalJSON

func (s *Grant) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Grant) Validate

func (s *Grant) Validate() error

type Handler

type Handler interface {
	// ControlRebalance implements controlRebalance operation.
	//
	// Start, pause or resume the cluster-wide rebalance from this node. At most one rebalance runs
	// cluster-wide (etcd election); starting on several nodes leaves the extras waiting as standby
	// runners. Pausing stops this node's runner and keeps the resume cursor, so a later start/resume —
	// on any node — continues where it left off.
	//
	// POST /api/v1/cluster/rebalance
	ControlRebalance(ctx context.Context, req *RebalanceControlRequest) (*RebalanceStatus, error)
	// CreateAccessKey implements createAccessKey operation.
	//
	// Create a runtime credential. The access key and secret are generated when not supplied. The secret
	// is returned only in this response and cannot be retrieved later.
	//
	// POST /api/v1/access-keys
	CreateAccessKey(ctx context.Context, req *CreateAccessKeyRequest) (*CreatedAccessKey, error)
	// DeleteAccessKey implements deleteAccessKey operation.
	//
	// Remove a runtime credential. Config-defined credentials cannot be deleted.
	//
	// DELETE /api/v1/access-keys/{accessKey}
	DeleteAccessKey(ctx context.Context, params DeleteAccessKeyParams) error
	// GetInfo implements getInfo operation.
	//
	// Build information, uptime and whether authentication is enabled.
	//
	// GET /api/v1/info
	GetInfo(ctx context.Context) (*InstanceInfo, error)
	// GetRebalanceStatus implements getRebalanceStatus operation.
	//
	// State and progress of the cluster rebalance runner on this node, the persisted resume cursor and the
	// depth of the async repair queue. State is "disabled" when the server is not in cluster mode.
	//
	// GET /api/v1/cluster/rebalance
	GetRebalanceStatus(ctx context.Context) (*RebalanceStatus, error)
	// ListAccessKeys implements listAccessKeys operation.
	//
	// Every credential the server accepts, secrets omitted.
	//
	// GET /api/v1/access-keys
	ListAccessKeys(ctx context.Context) (*AccessKeyList, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type InstanceInfo

type InstanceInfo struct {
	Version       string    `json:"version"`
	Commit        string    `json:"commit"`
	GoVersion     string    `json:"go_version"`
	Os            string    `json:"os"`
	Arch          string    `json:"arch"`
	StartTime     time.Time `json:"start_time"`
	UptimeSeconds float64   `json:"uptime_seconds"`
	// Whether SigV4 authentication is enabled.
	AuthEnabled bool `json:"auth_enabled"`
}

Ref: #/components/schemas/InstanceInfo

func (*InstanceInfo) Decode

func (s *InstanceInfo) Decode(d *jx.Decoder) error

Decode decodes InstanceInfo from json.

func (*InstanceInfo) Encode

func (s *InstanceInfo) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*InstanceInfo) GetArch

func (s *InstanceInfo) GetArch() string

GetArch returns the value of Arch.

func (*InstanceInfo) GetAuthEnabled

func (s *InstanceInfo) GetAuthEnabled() bool

GetAuthEnabled returns the value of AuthEnabled.

func (*InstanceInfo) GetCommit

func (s *InstanceInfo) GetCommit() string

GetCommit returns the value of Commit.

func (*InstanceInfo) GetGoVersion

func (s *InstanceInfo) GetGoVersion() string

GetGoVersion returns the value of GoVersion.

func (*InstanceInfo) GetOs

func (s *InstanceInfo) GetOs() string

GetOs returns the value of Os.

func (*InstanceInfo) GetStartTime

func (s *InstanceInfo) GetStartTime() time.Time

GetStartTime returns the value of StartTime.

func (*InstanceInfo) GetUptimeSeconds

func (s *InstanceInfo) GetUptimeSeconds() float64

GetUptimeSeconds returns the value of UptimeSeconds.

func (*InstanceInfo) GetVersion

func (s *InstanceInfo) GetVersion() string

GetVersion returns the value of Version.

func (*InstanceInfo) MarshalJSON

func (s *InstanceInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*InstanceInfo) SetArch

func (s *InstanceInfo) SetArch(val string)

SetArch sets the value of Arch.

func (*InstanceInfo) SetAuthEnabled

func (s *InstanceInfo) SetAuthEnabled(val bool)

SetAuthEnabled sets the value of AuthEnabled.

func (*InstanceInfo) SetCommit

func (s *InstanceInfo) SetCommit(val string)

SetCommit sets the value of Commit.

func (*InstanceInfo) SetGoVersion

func (s *InstanceInfo) SetGoVersion(val string)

SetGoVersion sets the value of GoVersion.

func (*InstanceInfo) SetOs

func (s *InstanceInfo) SetOs(val string)

SetOs sets the value of Os.

func (*InstanceInfo) SetStartTime

func (s *InstanceInfo) SetStartTime(val time.Time)

SetStartTime sets the value of StartTime.

func (*InstanceInfo) SetUptimeSeconds

func (s *InstanceInfo) SetUptimeSeconds(val float64)

SetUptimeSeconds sets the value of UptimeSeconds.

func (*InstanceInfo) SetVersion

func (s *InstanceInfo) SetVersion(val string)

SetVersion sets the value of Version.

func (*InstanceInfo) UnmarshalJSON

func (s *InstanceInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*InstanceInfo) Validate

func (s *InstanceInfo) Validate() error

type Invoker

type Invoker interface {
	// ControlRebalance invokes controlRebalance operation.
	//
	// Start, pause or resume the cluster-wide rebalance from this node. At most one rebalance runs
	// cluster-wide (etcd election); starting on several nodes leaves the extras waiting as standby
	// runners. Pausing stops this node's runner and keeps the resume cursor, so a later start/resume —
	// on any node — continues where it left off.
	//
	// POST /api/v1/cluster/rebalance
	ControlRebalance(ctx context.Context, request *RebalanceControlRequest) (*RebalanceStatus, error)
	// CreateAccessKey invokes createAccessKey operation.
	//
	// Create a runtime credential. The access key and secret are generated when not supplied. The secret
	// is returned only in this response and cannot be retrieved later.
	//
	// POST /api/v1/access-keys
	CreateAccessKey(ctx context.Context, request *CreateAccessKeyRequest) (*CreatedAccessKey, error)
	// DeleteAccessKey invokes deleteAccessKey operation.
	//
	// Remove a runtime credential. Config-defined credentials cannot be deleted.
	//
	// DELETE /api/v1/access-keys/{accessKey}
	DeleteAccessKey(ctx context.Context, params DeleteAccessKeyParams) error
	// GetInfo invokes getInfo operation.
	//
	// Build information, uptime and whether authentication is enabled.
	//
	// GET /api/v1/info
	GetInfo(ctx context.Context) (*InstanceInfo, error)
	// GetRebalanceStatus invokes getRebalanceStatus operation.
	//
	// State and progress of the cluster rebalance runner on this node, the persisted resume cursor and the
	// depth of the async repair queue. State is "disabled" when the server is not in cluster mode.
	//
	// GET /api/v1/cluster/rebalance
	GetRebalanceStatus(ctx context.Context) (*RebalanceStatus, error)
	// ListAccessKeys invokes listAccessKeys operation.
	//
	// Every credential the server accepts, secrets omitted.
	//
	// GET /api/v1/access-keys
	ListAccessKeys(ctx context.Context) (*AccessKeyList, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Labeler

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

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	ControlRebalanceOperation   OperationName = "ControlRebalance"
	CreateAccessKeyOperation    OperationName = "CreateAccessKey"
	DeleteAccessKeyOperation    OperationName = "DeleteAccessKey"
	GetInfoOperation            OperationName = "GetInfo"
	GetRebalanceStatusOperation OperationName = "GetRebalanceStatus"
	ListAccessKeysOperation     OperationName = "ListAccessKeys"
)

type OptDateTime

type OptDateTime struct {
	Value time.Time
	Set   bool
}

OptDateTime is optional time.Time.

func NewOptDateTime

func NewOptDateTime(v time.Time) OptDateTime

NewOptDateTime returns new OptDateTime with value set to v.

func (*OptDateTime) Decode

func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error

Decode decodes time.Time from json.

func (OptDateTime) Encode

func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))

Encode encodes time.Time as json.

func (OptDateTime) Get

func (o OptDateTime) Get() (v time.Time, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptDateTime) IsSet

func (o OptDateTime) IsSet() bool

IsSet returns true if OptDateTime was set.

func (OptDateTime) MarshalJSON

func (s OptDateTime) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptDateTime) Or

func (o OptDateTime) Or(d time.Time) time.Time

Or returns value if set, or given parameter if does not.

func (*OptDateTime) Reset

func (o *OptDateTime) Reset()

Reset unsets value.

func (*OptDateTime) SetTo

func (o *OptDateTime) SetTo(v time.Time)

SetTo sets value to v.

func (*OptDateTime) UnmarshalJSON

func (s *OptDateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) Option

WithAttributes specifies default otel attributes.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type Permission

type Permission string

Access level; Admin includes Write includes Read. Ref: #/components/schemas/Permission

const (
	PermissionRead  Permission = "read"
	PermissionWrite Permission = "write"
	PermissionAdmin Permission = "admin"
)

func (Permission) AllValues

func (Permission) AllValues() []Permission

AllValues returns all Permission values.

func (*Permission) Decode

func (s *Permission) Decode(d *jx.Decoder) error

Decode decodes Permission from json.

func (Permission) Encode

func (s Permission) Encode(e *jx.Encoder)

Encode encodes Permission as json.

func (Permission) MarshalJSON

func (s Permission) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Permission) MarshalText

func (s Permission) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Permission) UnmarshalJSON

func (s *Permission) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Permission) UnmarshalText

func (s *Permission) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Permission) Validate

func (s Permission) Validate() error

type RebalanceAction

type RebalanceAction string

Ref: #/components/schemas/RebalanceAction

const (
	RebalanceActionStart  RebalanceAction = "start"
	RebalanceActionPause  RebalanceAction = "pause"
	RebalanceActionResume RebalanceAction = "resume"
)

func (RebalanceAction) AllValues

func (RebalanceAction) AllValues() []RebalanceAction

AllValues returns all RebalanceAction values.

func (*RebalanceAction) Decode

func (s *RebalanceAction) Decode(d *jx.Decoder) error

Decode decodes RebalanceAction from json.

func (RebalanceAction) Encode

func (s RebalanceAction) Encode(e *jx.Encoder)

Encode encodes RebalanceAction as json.

func (RebalanceAction) MarshalJSON

func (s RebalanceAction) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (RebalanceAction) MarshalText

func (s RebalanceAction) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*RebalanceAction) UnmarshalJSON

func (s *RebalanceAction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RebalanceAction) UnmarshalText

func (s *RebalanceAction) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (RebalanceAction) Validate

func (s RebalanceAction) Validate() error

type RebalanceControlRequest

type RebalanceControlRequest struct {
	Action RebalanceAction `json:"action"`
}

Ref: #/components/schemas/RebalanceControlRequest

func (*RebalanceControlRequest) Decode

func (s *RebalanceControlRequest) Decode(d *jx.Decoder) error

Decode decodes RebalanceControlRequest from json.

func (*RebalanceControlRequest) Encode

func (s *RebalanceControlRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RebalanceControlRequest) GetAction

GetAction returns the value of Action.

func (*RebalanceControlRequest) MarshalJSON

func (s *RebalanceControlRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RebalanceControlRequest) SetAction

func (s *RebalanceControlRequest) SetAction(val RebalanceAction)

SetAction sets the value of Action.

func (*RebalanceControlRequest) UnmarshalJSON

func (s *RebalanceControlRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RebalanceControlRequest) Validate

func (s *RebalanceControlRequest) Validate() error

type RebalanceState

type RebalanceState string

Runner state on this node: "disabled" (not cluster mode), "idle" (never started since boot), "waiting" (campaigning for the cluster-wide slot behind another runner), "running", "paused" (stopped by an operator, resume cursor kept), "done" (last run completed) or "failed" (last run aborted with an error). Ref: #/components/schemas/RebalanceState

const (
	RebalanceStateDisabled RebalanceState = "disabled"
	RebalanceStateIdle     RebalanceState = "idle"
	RebalanceStateWaiting  RebalanceState = "waiting"
	RebalanceStateRunning  RebalanceState = "running"
	RebalanceStatePaused   RebalanceState = "paused"
	RebalanceStateDone     RebalanceState = "done"
	RebalanceStateFailed   RebalanceState = "failed"
)

func (RebalanceState) AllValues

func (RebalanceState) AllValues() []RebalanceState

AllValues returns all RebalanceState values.

func (*RebalanceState) Decode

func (s *RebalanceState) Decode(d *jx.Decoder) error

Decode decodes RebalanceState from json.

func (RebalanceState) Encode

func (s RebalanceState) Encode(e *jx.Encoder)

Encode encodes RebalanceState as json.

func (RebalanceState) MarshalJSON

func (s RebalanceState) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (RebalanceState) MarshalText

func (s RebalanceState) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*RebalanceState) UnmarshalJSON

func (s *RebalanceState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RebalanceState) UnmarshalText

func (s *RebalanceState) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (RebalanceState) Validate

func (s RebalanceState) Validate() error

type RebalanceStatus

type RebalanceStatus struct {
	State RebalanceState `json:"state"`
	// Objects processed by the current or last run on this node.
	Objects int `json:"objects"`
	// Objects the run changed (fragments moved, sidecars rewritten, old copies retired).
	Relocated int `json:"relocated"`
	// Objects whose repair errored; the run continues past them.
	Failed int `json:"failed"`
	// Persisted resume cursor: everything up to and including (bucket, key) is done.
	CursorBucket OptString `json:"cursor_bucket"`
	CursorKey    OptString `json:"cursor_key"`
	// When the current or last run started on this node.
	StartedAt OptDateTime `json:"started_at"`
	// When the last run ended on this node.
	FinishedAt OptDateTime `json:"finished_at"`
	// Why the last run failed, for state "failed".
	ErrorMessage OptString `json:"error_message"`
	// Pending async replication-remainder tasks on this node (repair backlog indicator).
	RepairQueueDepth int `json:"repair_queue_depth"`
}

Ref: #/components/schemas/RebalanceStatus

func (*RebalanceStatus) Decode

func (s *RebalanceStatus) Decode(d *jx.Decoder) error

Decode decodes RebalanceStatus from json.

func (*RebalanceStatus) Encode

func (s *RebalanceStatus) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RebalanceStatus) GetCursorBucket

func (s *RebalanceStatus) GetCursorBucket() OptString

GetCursorBucket returns the value of CursorBucket.

func (*RebalanceStatus) GetCursorKey

func (s *RebalanceStatus) GetCursorKey() OptString

GetCursorKey returns the value of CursorKey.

func (*RebalanceStatus) GetErrorMessage

func (s *RebalanceStatus) GetErrorMessage() OptString

GetErrorMessage returns the value of ErrorMessage.

func (*RebalanceStatus) GetFailed

func (s *RebalanceStatus) GetFailed() int

GetFailed returns the value of Failed.

func (*RebalanceStatus) GetFinishedAt

func (s *RebalanceStatus) GetFinishedAt() OptDateTime

GetFinishedAt returns the value of FinishedAt.

func (*RebalanceStatus) GetObjects

func (s *RebalanceStatus) GetObjects() int

GetObjects returns the value of Objects.

func (*RebalanceStatus) GetRelocated

func (s *RebalanceStatus) GetRelocated() int

GetRelocated returns the value of Relocated.

func (*RebalanceStatus) GetRepairQueueDepth

func (s *RebalanceStatus) GetRepairQueueDepth() int

GetRepairQueueDepth returns the value of RepairQueueDepth.

func (*RebalanceStatus) GetStartedAt

func (s *RebalanceStatus) GetStartedAt() OptDateTime

GetStartedAt returns the value of StartedAt.

func (*RebalanceStatus) GetState

func (s *RebalanceStatus) GetState() RebalanceState

GetState returns the value of State.

func (*RebalanceStatus) MarshalJSON

func (s *RebalanceStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RebalanceStatus) SetCursorBucket

func (s *RebalanceStatus) SetCursorBucket(val OptString)

SetCursorBucket sets the value of CursorBucket.

func (*RebalanceStatus) SetCursorKey

func (s *RebalanceStatus) SetCursorKey(val OptString)

SetCursorKey sets the value of CursorKey.

func (*RebalanceStatus) SetErrorMessage

func (s *RebalanceStatus) SetErrorMessage(val OptString)

SetErrorMessage sets the value of ErrorMessage.

func (*RebalanceStatus) SetFailed

func (s *RebalanceStatus) SetFailed(val int)

SetFailed sets the value of Failed.

func (*RebalanceStatus) SetFinishedAt

func (s *RebalanceStatus) SetFinishedAt(val OptDateTime)

SetFinishedAt sets the value of FinishedAt.

func (*RebalanceStatus) SetObjects

func (s *RebalanceStatus) SetObjects(val int)

SetObjects sets the value of Objects.

func (*RebalanceStatus) SetRelocated

func (s *RebalanceStatus) SetRelocated(val int)

SetRelocated sets the value of Relocated.

func (*RebalanceStatus) SetRepairQueueDepth

func (s *RebalanceStatus) SetRepairQueueDepth(val int)

SetRepairQueueDepth sets the value of RepairQueueDepth.

func (*RebalanceStatus) SetStartedAt

func (s *RebalanceStatus) SetStartedAt(val OptDateTime)

SetStartedAt sets the value of StartedAt.

func (*RebalanceStatus) SetState

func (s *RebalanceStatus) SetState(val RebalanceState)

SetState sets the value of State.

func (*RebalanceStatus) UnmarshalJSON

func (s *RebalanceStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RebalanceStatus) Validate

func (s *RebalanceStatus) Validate() error

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationGroup

func (r Route) OperationGroup() string

OperationGroup returns the x-ogen-operation-group value.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

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

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

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

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type Source

type Source string

Where the credential is defined. Ref: #/components/schemas/Source

const (
	SourceConfig  Source = "config"
	SourceManaged Source = "managed"
)

func (Source) AllValues

func (Source) AllValues() []Source

AllValues returns all Source values.

func (*Source) Decode

func (s *Source) Decode(d *jx.Decoder) error

Decode decodes Source from json.

func (Source) Encode

func (s Source) Encode(e *jx.Encoder)

Encode encodes Source as json.

func (Source) MarshalJSON

func (s Source) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Source) MarshalText

func (s Source) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Source) UnmarshalJSON

func (s *Source) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Source) UnmarshalText

func (s *Source) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Source) Validate

func (s Source) Validate() error

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) ControlRebalance

ControlRebalance implements controlRebalance operation.

Start, pause or resume the cluster-wide rebalance from this node. At most one rebalance runs cluster-wide (etcd election); starting on several nodes leaves the extras waiting as standby runners. Pausing stops this node's runner and keeps the resume cursor, so a later start/resume — on any node — continues where it left off.

POST /api/v1/cluster/rebalance

func (UnimplementedHandler) CreateAccessKey

CreateAccessKey implements createAccessKey operation.

Create a runtime credential. The access key and secret are generated when not supplied. The secret is returned only in this response and cannot be retrieved later.

POST /api/v1/access-keys

func (UnimplementedHandler) DeleteAccessKey

func (UnimplementedHandler) DeleteAccessKey(ctx context.Context, params DeleteAccessKeyParams) error

DeleteAccessKey implements deleteAccessKey operation.

Remove a runtime credential. Config-defined credentials cannot be deleted.

DELETE /api/v1/access-keys/{accessKey}

func (UnimplementedHandler) GetInfo

func (UnimplementedHandler) GetInfo(ctx context.Context) (r *InstanceInfo, _ error)

GetInfo implements getInfo operation.

Build information, uptime and whether authentication is enabled.

GET /api/v1/info

func (UnimplementedHandler) GetRebalanceStatus

func (UnimplementedHandler) GetRebalanceStatus(ctx context.Context) (r *RebalanceStatus, _ error)

GetRebalanceStatus implements getRebalanceStatus operation.

State and progress of the cluster rebalance runner on this node, the persisted resume cursor and the depth of the async repair queue. State is "disabled" when the server is not in cluster mode.

GET /api/v1/cluster/rebalance

func (UnimplementedHandler) ListAccessKeys

func (UnimplementedHandler) ListAccessKeys(ctx context.Context) (r *AccessKeyList, _ error)

ListAccessKeys implements listAccessKeys operation.

Every credential the server accepts, secrets omitted.

GET /api/v1/access-keys

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

Jump to

Keyboard shortcuts

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