services

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const Endpoint = "/services"

Endpoint is the public path for the services service.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest added in v0.5.0

type CreateRequest struct {
	Name     *string                `json:"name"`
	DNSName  *string                `json:"dns_name"`
	Services []CreateRequestService `json:"services"`
}

CreateRequest is the payload for a POST /services request. https://docs.kraft.cloud/api/v1/services/#creating-a-new-service-group

type CreateRequestService added in v0.5.0

type CreateRequestService struct {
	Port            int       `json:"port"`
	DestinationPort *int      `json:"destination_port"`
	Handlers        []Handler `json:"handlers"`
}

type CreateResponseItem added in v0.5.0

type CreateResponseItem struct {
	Status string `json:"status"`
	UUID   string `json:"uuid"`
	Name   string `json:"name"`
	FQDN   string `json:"fqdn"`

	kcclient.APIResponseCommon
}

CreateResponseItem is a data item from a response to a POST /services request. https://docs.kraft.cloud/api/v1/services/#creating-a-new-service-group

type DeleteResponseItem added in v0.5.0

type DeleteResponseItem struct {
	Status string `json:"status"`
	UUID   string `json:"uuid"`
	Name   string `json:"name"`

	kcclient.APIResponseCommon
}

DeleteResponseItem is a data item from a response to a DELETE /services request. https://docs.kraft.cloud/api/v1/services/#deleting-a-service-group

type GetResponseItem added in v0.5.0

type GetResponseItem struct {
	Status     string               `json:"status"`
	UUID       string               `json:"uuid"`
	Name       string               `json:"name"`
	CreatedAt  string               `json:"created_at"`
	FQDN       string               `json:"fqdn"`
	Instances  []string             `json:"instances"`
	Services   []GetResponseService `json:"services"`
	Persistent bool                 `json:"persistent"`
	Autoscale  bool                 `json:"autoscale"`

	kcclient.APIResponseCommon
}

GetResponseItem is a data item from a response to a GET /services request. https://docs.kraft.cloud/api/v1/services/#getting-the-status-of-a-service-group

type GetResponseService added in v0.5.0

type GetResponseService struct {
	Port            int       `json:"port"`
	DestinationPort int       `json:"destination_port"`
	Handlers        []Handler `json:"handlers"`
}

type Handler added in v0.3.0

type Handler string

Connection Handlers. KraftCloud uses connection handlers to decide how to forward connections from the Internet to your application. You configure the handlers for every published service port individually.

Currently, there is a set of constraints when publishing ports:

  • Port 80: Must have http and must not have tls set;
  • Port 443: Must have http and tls set;
  • The `redirect` handler can only be set on port 80 (HTTP) to redirect to port 443 (HTTPS);
  • All other ports must have tls and must not have http set.
const (
	// Terminate the TLS connection at the KraftCloud gateway using our wildcard
	// certificate issued for the kraft.cloud domain. The gateway forwards the
	// unencrypted traffic to your application.
	HandlerTLS Handler = "tls"

	// Enable HTTP mode on the load balancer to load balance on the level of
	// individual HTTP requests. In this mode, only HTTP connections are accepted.
	// If this option is not set the load balancer works in TCP mode and
	// distributes TCP connections.
	HandlerHTTP Handler = "http"

	// Redirect traffic from the source port to the destination port.
	HandlerRedirect Handler = "redirect"
)

func Handlers added in v0.3.0

func Handlers() []Handler

Handlers returns all possible service handlers.

type ListResponseItem added in v0.5.0

type ListResponseItem struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`

	kcclient.APIResponseCommon
}

ListResponseItem is a data item from a response to a GET /services/list request. https://docs.kraft.cloud/api/v1/services/#list-existing-service-groups

type ServicesService added in v0.3.0

type ServicesService interface {
	kcclient.ServiceClient[ServicesService]

	// Creates one or more service groups with the given configuration. Note that,
	// the service group properties like published ports can only be defined
	// during creation. They cannot be changed later.
	//
	// Each port in a service group can specify a list of handlers that determine
	// how traffic arriving at the port is handled. See Connection Handlers for a
	// complete overview.
	//
	// You can specify an array of service group descriptions to create multiple
	// groups with different properties with the same call.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#creating-new-service-groups
	Create(ctx context.Context, req CreateRequest) (*CreateResponseItem, error)

	// GetByUUID returns the current state and the configuration of a service group.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#getting-the-state-of-a-service-group
	GetByUUID(ctx context.Context, uuid string) (*GetResponseItem, error)

	// GetByName returns the current state and the configuration of a service group.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#getting-the-state-of-a-service-group
	GetByName(ctx context.Context, name string) (*GetResponseItem, error)

	// DeleteByUUID the specified service group based on its UUID.  Fails if there
	// are still instances attached to group. After this call the UUID of the
	// group is no longer valid.
	//
	// This operation cannot be undone.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#deleting-a-service-group
	DeleteByUUID(ctx context.Context, uuid string) (*DeleteResponseItem, error)

	// DeleteByName the specified service group based on its name.  Fails if there
	// are still instances attached to group. After this call the UUID of the
	// group is no longer valid.
	//
	// This operation cannot be undone.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#deleting-a-service-group
	DeleteByName(ctx context.Context, name string) (*DeleteResponseItem, error)

	// Lists all existing service groups. You can filter by persistence and DNS
	// name. The latter can be used to lookup the UUID of the service group that
	// owns a certain DNS name. The returned groups fulfill all provided filter
	// criteria. No particular value is assumed if a filter is not part of the
	// request.
	//
	// The array of groups in the response can be directly fed into the other
	// endpoints, for example, to delete (empty) groups.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#list-existing-service-groups
	List(ctx context.Context) ([]ListResponseItem, error)
}

func NewServicesClientFromOptions

func NewServicesClientFromOptions(opts *options.Options) ServicesService

NewServicesClientFromOptions instantiates a new image services client based on the provided pre-existing options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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