services

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: BSD-3-Clause Imports: 11 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,omitempty"`
	Domains  []CreateRequestDomain  `json:"domains,omitempty"`
	Services []CreateRequestService `json:"services,omitempty"`
}

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

type CreateRequestDomain added in v0.5.7

type CreateRequestDomain struct {
	Name        string                          `json:"name"`
	Certificate *CreateRequestDomainCertificate `json:"certificate,omitempty"`
}

type CreateRequestDomainCertificate added in v0.5.7

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

type CreateRequestService added in v0.5.0

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

type CreateResponseItem added in v0.5.0

type CreateResponseItem struct {
	Status  string                    `json:"status"`
	UUID    string                    `json:"uuid"`
	Name    string                    `json:"name"`
	Domains []GetCreateResponseDomain `json:"domains"`

	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 GetCreateResponseDomain added in v0.5.7

type GetCreateResponseDomain struct {
	FQDN        string                              `json:"fqdn"`
	Certificate *GetCreateResponseDomainCertificate `json:"certificate"`
}

type GetCreateResponseDomainCertificate added in v0.5.7

type GetCreateResponseDomainCertificate struct {
	UUID  string `json:"uuid"`
	Name  string `json:"name"`
	State string `json:"state"`
}

type GetResponseInstance added in v0.5.5

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

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"`
	Persistent bool                      `json:"persistent"`
	Autoscale  bool                      `json:"autoscale"`
	Services   []GetResponseService      `json:"services"`
	Domains    []GetCreateResponseDomain `json:"domains"`
	Instances  []GetResponseInstance     `json:"instances"`

	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) (*kcclient.ServiceResponse[CreateResponseItem], error)

	// Get returns the current state and the configuration of service groups.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#getting-the-state-of-a-service-group
	Get(ctx context.Context, ids ...string) (*kcclient.ServiceResponse[GetResponseItem], error)

	// Delete deletes the specified service group(s).
	// Fails if there are still instances attached to any of the specified
	// groups. After this call the UUIDs of the groups are no longer valid.
	//
	// This operation cannot be undone.
	//
	// See: https://docs.kraft.cloud/api/v1/services/#deleting-a-service-group
	Delete(ctx context.Context, ids ...string) (*kcclient.ServiceResponse[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) (*kcclient.ServiceResponse[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