baseplate

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseplateServiceIsHealthyResult_Success_DEFAULT bool
View Source
var BaseplateServiceV2IsHealthyResult_Success_DEFAULT bool
View Source
var Error_Code_DEFAULT int32
View Source
var Error_Details_DEFAULT map[string]string
View Source
var Error_Message_DEFAULT string
View Source
var Error_Retryable_DEFAULT bool
View Source
var GoUnusedProtection__ int

Functions

This section is empty.

Types

type BaseplateService

type BaseplateService interface {

	// Return whether or not the service is healthy.
	//
	// The healthchecker (baseplate.server.healthcheck) expects this endpoint to
	// exist so it can determine your service's health.
	//
	// This should return True if the service is healthy. If the service is
	// unhealthy, it can return False or raise an exception.
	//
	IsHealthy(ctx context.Context) (_r bool, _err error)
}

type BaseplateServiceClient

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

The base for any baseplate-based service.

Your service should inherit from this one so that common tools can interact with any expected interfaces.

DEPRECATED: Please migrate to BaseplateServiceV2.

func NewBaseplateServiceClient

func NewBaseplateServiceClient(c thrift.TClient) *BaseplateServiceClient

func NewBaseplateServiceClientProtocol

func NewBaseplateServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BaseplateServiceClient

func (*BaseplateServiceClient) Client_

func (p *BaseplateServiceClient) Client_() thrift.TClient

func (*BaseplateServiceClient) IsHealthy

func (p *BaseplateServiceClient) IsHealthy(ctx context.Context) (_r bool, _err error)

Return whether or not the service is healthy.

The healthchecker (baseplate.server.healthcheck) expects this endpoint to exist so it can determine your service's health.

This should return True if the service is healthy. If the service is unhealthy, it can return False or raise an exception.

func (*BaseplateServiceClient) LastResponseMeta_ added in v0.8.0

func (p *BaseplateServiceClient) LastResponseMeta_() thrift.ResponseMeta

func (*BaseplateServiceClient) SetLastResponseMeta_ added in v0.8.0

func (p *BaseplateServiceClient) SetLastResponseMeta_(meta thrift.ResponseMeta)

type BaseplateServiceIsHealthyArgs

type BaseplateServiceIsHealthyArgs struct {
}

func NewBaseplateServiceIsHealthyArgs

func NewBaseplateServiceIsHealthyArgs() *BaseplateServiceIsHealthyArgs

func (*BaseplateServiceIsHealthyArgs) LogValue added in v0.9.17

func (*BaseplateServiceIsHealthyArgs) Read

func (*BaseplateServiceIsHealthyArgs) String

func (*BaseplateServiceIsHealthyArgs) Write

type BaseplateServiceIsHealthyResult

type BaseplateServiceIsHealthyResult struct {
	Success *bool `thrift:"success,0" db:"success" json:"success,omitempty"`
}

Attributes:

  • Success

func NewBaseplateServiceIsHealthyResult

func NewBaseplateServiceIsHealthyResult() *BaseplateServiceIsHealthyResult

func (*BaseplateServiceIsHealthyResult) GetSuccess

func (p *BaseplateServiceIsHealthyResult) GetSuccess() bool

func (*BaseplateServiceIsHealthyResult) IsSetSuccess

func (p *BaseplateServiceIsHealthyResult) IsSetSuccess() bool

func (*BaseplateServiceIsHealthyResult) LogValue added in v0.9.17

func (*BaseplateServiceIsHealthyResult) Read

func (*BaseplateServiceIsHealthyResult) ReadField0

func (*BaseplateServiceIsHealthyResult) String

func (*BaseplateServiceIsHealthyResult) Write

type BaseplateServiceProcessor

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

func NewBaseplateServiceProcessor

func NewBaseplateServiceProcessor(handler BaseplateService) *BaseplateServiceProcessor

func (*BaseplateServiceProcessor) AddToProcessorMap

func (p *BaseplateServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*BaseplateServiceProcessor) GetProcessorFunction

func (p *BaseplateServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*BaseplateServiceProcessor) Process

func (p *BaseplateServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*BaseplateServiceProcessor) ProcessorMap

type BaseplateServiceV2 added in v0.5.2

type BaseplateServiceV2 interface {

	// Return whether or not the service is healthy.
	//
	// The healthchecker (baseplate.server.healthcheck) expects this endpoint to
	// exist so it can determine your service's health.
	//
	// This should return True if the service is healthy. If the service is
	// unhealthy, it can return False or raise an exception.
	//
	//
	// Parameters:
	//  - Request
	IsHealthy(ctx context.Context, request *IsHealthyRequest) (_r bool, _err error)
}

type BaseplateServiceV2Client added in v0.5.2

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

The base for any baseplate-based service.

Your service should inherit from this one so that common tools can interact with any expected interfaces.

func NewBaseplateServiceV2Client added in v0.5.2

func NewBaseplateServiceV2Client(c thrift.TClient) *BaseplateServiceV2Client

func NewBaseplateServiceV2ClientFactory added in v0.5.2

func NewBaseplateServiceV2ClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BaseplateServiceV2Client

func NewBaseplateServiceV2ClientProtocol added in v0.5.2

func NewBaseplateServiceV2ClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BaseplateServiceV2Client

func (*BaseplateServiceV2Client) Client_ added in v0.5.2

func (*BaseplateServiceV2Client) IsHealthy added in v0.5.2

func (p *BaseplateServiceV2Client) IsHealthy(ctx context.Context, request *IsHealthyRequest) (_r bool, _err error)

Return whether or not the service is healthy.

The healthchecker (baseplate.server.healthcheck) expects this endpoint to exist so it can determine your service's health.

This should return True if the service is healthy. If the service is unhealthy, it can return False or raise an exception.

Parameters:

  • Request

func (*BaseplateServiceV2Client) LastResponseMeta_ added in v0.8.0

func (p *BaseplateServiceV2Client) LastResponseMeta_() thrift.ResponseMeta

func (*BaseplateServiceV2Client) SetLastResponseMeta_ added in v0.8.0

func (p *BaseplateServiceV2Client) SetLastResponseMeta_(meta thrift.ResponseMeta)

type BaseplateServiceV2IsHealthyArgs added in v0.5.2

type BaseplateServiceV2IsHealthyArgs struct {
	Request *IsHealthyRequest `thrift:"request,1" db:"request" json:"request"`
}

Attributes:

  • Request

func NewBaseplateServiceV2IsHealthyArgs added in v0.5.2

func NewBaseplateServiceV2IsHealthyArgs() *BaseplateServiceV2IsHealthyArgs

func (*BaseplateServiceV2IsHealthyArgs) GetRequest added in v0.5.2

func (*BaseplateServiceV2IsHealthyArgs) IsSetRequest added in v0.5.2

func (p *BaseplateServiceV2IsHealthyArgs) IsSetRequest() bool

func (*BaseplateServiceV2IsHealthyArgs) LogValue added in v0.9.17

func (*BaseplateServiceV2IsHealthyArgs) Read added in v0.5.2

func (*BaseplateServiceV2IsHealthyArgs) ReadField1 added in v0.5.2

func (*BaseplateServiceV2IsHealthyArgs) String added in v0.5.2

func (*BaseplateServiceV2IsHealthyArgs) Write added in v0.5.2

type BaseplateServiceV2IsHealthyResult added in v0.5.2

type BaseplateServiceV2IsHealthyResult struct {
	Success *bool `thrift:"success,0" db:"success" json:"success,omitempty"`
}

Attributes:

  • Success

func NewBaseplateServiceV2IsHealthyResult added in v0.5.2

func NewBaseplateServiceV2IsHealthyResult() *BaseplateServiceV2IsHealthyResult

func (*BaseplateServiceV2IsHealthyResult) GetSuccess added in v0.5.2

func (p *BaseplateServiceV2IsHealthyResult) GetSuccess() bool

func (*BaseplateServiceV2IsHealthyResult) IsSetSuccess added in v0.5.2

func (p *BaseplateServiceV2IsHealthyResult) IsSetSuccess() bool

func (*BaseplateServiceV2IsHealthyResult) LogValue added in v0.9.17

func (*BaseplateServiceV2IsHealthyResult) Read added in v0.5.2

func (*BaseplateServiceV2IsHealthyResult) ReadField0 added in v0.5.2

func (*BaseplateServiceV2IsHealthyResult) String added in v0.5.2

func (*BaseplateServiceV2IsHealthyResult) Write added in v0.5.2

type BaseplateServiceV2Processor added in v0.5.2

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

func NewBaseplateServiceV2Processor added in v0.5.2

func NewBaseplateServiceV2Processor(handler BaseplateServiceV2) *BaseplateServiceV2Processor

func (*BaseplateServiceV2Processor) AddToProcessorMap added in v0.5.2

func (p *BaseplateServiceV2Processor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*BaseplateServiceV2Processor) GetProcessorFunction added in v0.5.2

func (p *BaseplateServiceV2Processor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*BaseplateServiceV2Processor) Process added in v0.5.2

func (p *BaseplateServiceV2Processor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*BaseplateServiceV2Processor) ProcessorMap added in v0.5.2

type Error added in v0.4.0

type Error struct {
	Code      *int32            `thrift:"code,1" db:"code" json:"code,omitempty"`
	Message   *string           `thrift:"message,2" db:"message" json:"message,omitempty"`
	Details   map[string]string `thrift:"details,3" db:"details" json:"details,omitempty"`
	Retryable *bool             `thrift:"retryable,4" db:"retryable" json:"retryable,omitempty"`
}

Attributes:

  • Code: A code describing the general nature of the error.

This should be specified for all errors. This field uses the i32 type instead of the ErrorCode type in order to give developers an escape hatch to define their own error codes. Developers should do their best to avoid defining a custom error code. Developers should use a value higher than 1000 when defining custom codes.

  • Message: A human-readable error message. It should both explain the error

and offer an actionable resolution to it, if applicable. It should be safe to desplay this message in a user-facing client.

  • Details: A map of additional error information. This is most useful

when there is a validation error. The server may use this map to return multiple errors. This should be safe for clients to display. Example:

   {
       "post.title": "This field is too long.",
       "post.kind": "This field is required."
   }
- Retryable: Server could choose to set this field to true to explicitly indicate

that client shall retry this request, and false to explicitly indicate that client shall not retry this request. Unset means that it's up to the client to decide (using other information, for example the code) whether to retry this request.

func NewError added in v0.4.0

func NewError() *Error

func (*Error) Equals added in v0.8.0

func (p *Error) Equals(other *Error) bool

func (*Error) Error added in v0.4.0

func (p *Error) Error() string

func (*Error) GetCode added in v0.4.0

func (p *Error) GetCode() int32

func (*Error) GetDetails added in v0.4.0

func (p *Error) GetDetails() map[string]string

func (*Error) GetMessage added in v0.4.0

func (p *Error) GetMessage() string

func (*Error) GetRetryable added in v0.8.0

func (p *Error) GetRetryable() bool

func (*Error) IsSetCode added in v0.4.0

func (p *Error) IsSetCode() bool

func (*Error) IsSetDetails added in v0.4.0

func (p *Error) IsSetDetails() bool

func (*Error) IsSetMessage added in v0.4.0

func (p *Error) IsSetMessage() bool

func (*Error) IsSetRetryable added in v0.8.0

func (p *Error) IsSetRetryable() bool

func (*Error) LogValue added in v0.9.17

func (p *Error) LogValue() slog.Value

func (*Error) Read added in v0.4.0

func (p *Error) Read(ctx context.Context, iprot thrift.TProtocol) error

func (*Error) ReadField1 added in v0.4.0

func (p *Error) ReadField1(ctx context.Context, iprot thrift.TProtocol) error

func (*Error) ReadField2 added in v0.4.0

func (p *Error) ReadField2(ctx context.Context, iprot thrift.TProtocol) error

func (*Error) ReadField3 added in v0.4.0

func (p *Error) ReadField3(ctx context.Context, iprot thrift.TProtocol) error

func (*Error) ReadField4 added in v0.8.0

func (p *Error) ReadField4(ctx context.Context, iprot thrift.TProtocol) error

func (*Error) String added in v0.4.0

func (p *Error) String() string

func (Error) TExceptionType added in v0.8.0

func (Error) TExceptionType() thrift.TExceptionType

func (*Error) Validate added in v0.9.15

func (p *Error) Validate() error

func (*Error) Write added in v0.4.0

func (p *Error) Write(ctx context.Context, oprot thrift.TProtocol) error

type ErrorCode added in v0.4.0

type ErrorCode int64

The integer values within this enum correspond to HTTP status codes.

HTTP layers can easily map errors to an appropriate status code.

const (
	ErrorCode_BAD_REQUEST                     ErrorCode = 400
	ErrorCode_UNAUTHORIZED                    ErrorCode = 401
	ErrorCode_PAYMENT_REQUIRED                ErrorCode = 402
	ErrorCode_FORBIDDEN                       ErrorCode = 403
	ErrorCode_NOT_FOUND                       ErrorCode = 404
	ErrorCode_CONFLICT                        ErrorCode = 409
	ErrorCode_GONE                            ErrorCode = 410
	ErrorCode_PRECONDITION_FAILED             ErrorCode = 412
	ErrorCode_PAYLOAD_TOO_LARGE               ErrorCode = 413
	ErrorCode_IM_A_TEAPOT                     ErrorCode = 418
	ErrorCode_MISDIRECTED_REQUEST             ErrorCode = 421
	ErrorCode_UNPROCESSABLE_ENTITY            ErrorCode = 422
	ErrorCode_LOCKED                          ErrorCode = 423
	ErrorCode_FAILED_DEPENDENCY               ErrorCode = 424
	ErrorCode_TOO_EARLY                       ErrorCode = 425
	ErrorCode_PRECONDITION_REQUIRED           ErrorCode = 428
	ErrorCode_TOO_MANY_REQUESTS               ErrorCode = 429
	ErrorCode_REQUEST_HEADER_FIELDS_TOO_LARGE ErrorCode = 431
	ErrorCode_UNAVAILABLE_FOR_LEGAL_REASONS   ErrorCode = 451
	ErrorCode_INTERNAL_SERVER_ERROR           ErrorCode = 500
	ErrorCode_NOT_IMPLEMENTED                 ErrorCode = 501
	ErrorCode_BAD_GATEWAY                     ErrorCode = 502
	ErrorCode_SERVICE_UNAVAILABLE             ErrorCode = 503
	ErrorCode_TIMEOUT                         ErrorCode = 504
	ErrorCode_INSUFFICIENT_STORAGE            ErrorCode = 507
	ErrorCode_LOOP_DETECTED                   ErrorCode = 508
	ErrorCode_USER_DEFINED                    ErrorCode = 1000
)

func ErrorCodeFromString added in v0.4.0

func ErrorCodeFromString(s string) (ErrorCode, error)

func ErrorCodePtr added in v0.4.0

func ErrorCodePtr(v ErrorCode) *ErrorCode

func (ErrorCode) MarshalText added in v0.4.0

func (p ErrorCode) MarshalText() ([]byte, error)

func (*ErrorCode) Scan added in v0.4.0

func (p *ErrorCode) Scan(value interface{}) error

func (ErrorCode) String added in v0.4.0

func (p ErrorCode) String() string

func (*ErrorCode) UnmarshalText added in v0.4.0

func (p *ErrorCode) UnmarshalText(text []byte) error

func (*ErrorCode) Value added in v0.4.0

func (p *ErrorCode) Value() (driver.Value, error)

type IsHealthyProbe added in v0.4.2

type IsHealthyProbe int64

The different types of probes supported by is_healthy endpoint.

Please refer to Kubernetes' documentation for the differences between them: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

Your service should use Readiness probe as the fallback for unsupported probes.

Note that the HTTP health check could use the string names of the probes, so changing the names, even without changing the numeric values, is considered as breaking change and should be avoided.

const (
	IsHealthyProbe_READINESS IsHealthyProbe = 1
	IsHealthyProbe_LIVENESS  IsHealthyProbe = 2
	IsHealthyProbe_STARTUP   IsHealthyProbe = 3
)
var IsHealthyRequest_Probe_DEFAULT IsHealthyProbe

func IsHealthyProbeFromString added in v0.4.2

func IsHealthyProbeFromString(s string) (IsHealthyProbe, error)

func IsHealthyProbePtr added in v0.4.2

func IsHealthyProbePtr(v IsHealthyProbe) *IsHealthyProbe

func (IsHealthyProbe) MarshalText added in v0.4.2

func (p IsHealthyProbe) MarshalText() ([]byte, error)

func (*IsHealthyProbe) Scan added in v0.4.2

func (p *IsHealthyProbe) Scan(value interface{}) error

func (IsHealthyProbe) String added in v0.4.2

func (p IsHealthyProbe) String() string

func (*IsHealthyProbe) UnmarshalText added in v0.4.2

func (p *IsHealthyProbe) UnmarshalText(text []byte) error

func (*IsHealthyProbe) Value added in v0.4.2

func (p *IsHealthyProbe) Value() (driver.Value, error)

type IsHealthyRequest added in v0.4.2

type IsHealthyRequest struct {
	Probe *IsHealthyProbe `thrift:"probe,1" db:"probe" json:"probe,omitempty"`
}

The arg struct for is_healthy endpoint.

Attributes:

  • Probe
var BaseplateServiceV2IsHealthyArgs_Request_DEFAULT *IsHealthyRequest

func NewIsHealthyRequest added in v0.4.2

func NewIsHealthyRequest() *IsHealthyRequest

func (*IsHealthyRequest) Equals added in v0.8.0

func (p *IsHealthyRequest) Equals(other *IsHealthyRequest) bool

func (*IsHealthyRequest) GetProbe added in v0.4.2

func (p *IsHealthyRequest) GetProbe() IsHealthyProbe

func (*IsHealthyRequest) IsSetProbe added in v0.4.2

func (p *IsHealthyRequest) IsSetProbe() bool

func (*IsHealthyRequest) LogValue added in v0.9.17

func (p *IsHealthyRequest) LogValue() slog.Value

func (*IsHealthyRequest) Read added in v0.4.2

func (p *IsHealthyRequest) Read(ctx context.Context, iprot thrift.TProtocol) error

func (*IsHealthyRequest) ReadField1 added in v0.4.2

func (p *IsHealthyRequest) ReadField1(ctx context.Context, iprot thrift.TProtocol) error

func (*IsHealthyRequest) String added in v0.4.2

func (p *IsHealthyRequest) String() string

func (*IsHealthyRequest) Validate added in v0.9.15

func (p *IsHealthyRequest) Validate() error

func (*IsHealthyRequest) Write added in v0.4.2

func (p *IsHealthyRequest) Write(ctx context.Context, oprot thrift.TProtocol) error

type TimestampMilliseconds added in v0.4.2

type TimestampMilliseconds int64

An integer measuring the number of milliseconds of UTC time since epoch.

func TimestampMillisecondsPtr added in v0.4.2

func TimestampMillisecondsPtr(v TimestampMilliseconds) *TimestampMilliseconds

Jump to

Keyboard shortcuts

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