aptible

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const MaximumPagesOfEnvironments = 30
View Source
const MaximumPagesOfStacks = 10

Variables

This section is empty.

Functions

func GetAuthURL added in v0.4.0

func GetAuthURL() string

func GetEndpointType

func GetEndpointType(t string) (string, error)

func GetHost

func GetHost() (string, error)

Gets host from env var or sets default.

func GetHumanReadableEndpointType

func GetHumanReadableEndpointType(t string) (string, error)

func GetIDFromHref

func GetIDFromHref(href string) (int64, error)

Gets ID from an href

func GetToken

func GetToken() (string, error)

GetToken - gets a token (or error) for use from username password, an environment variable or filesystem

func MakeInt64Slice added in v0.5.0

func MakeInt64Slice(interfaceSlice []interface{}) ([]int64, error)

makes a int64 slice out of a slice of type interface

func MakeStringSlice

func MakeStringSlice(interfaceSlice []interface{}) ([]string, error)

makes a string slice out of a slice of type interface

Types

type AcmeChallenge added in v0.1.4

type AcmeChallenge struct {
	Method string
	From   string
	To     string
}

type App

type App struct {
	ID            int64
	GitRepo       string
	Deleted       bool
	EnvironmentID int64
	Handle        string
	Env           interface{}
	Services      []Service
}

type AppUpdates added in v0.1.13

type AppUpdates struct {
	// Handle - field to update app handle
	Handle string
}

type Client

type Client struct {
	Client   *deploy.DeployAPIV1
	Token    runtime.ClientAuthInfoWriter
	RawToken string
}

func SetUpClient

func SetUpClient() (*Client, error)

sets up client and gets auth token used for API requests

func (*Client) CreateApp

func (c *Client) CreateApp(handle string, accountID int64) (App, error)

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(accountID int64, attrs DBCreateAttrs) (Database, error)

func (*Client) CreateEndpoint

func (c *Client) CreateEndpoint(service Service, attrs EndpointCreateAttrs) (Endpoint, error)

CreateEndpoint() creates Vhost API object + provision operation on the app.

func (*Client) CreateEnvironment added in v0.3.0

func (c *Client) CreateEnvironment(organizationID string, stackID int64, attrs EnvironmentCreateAttrs) (Environment, error)

func (*Client) CreateLogDrain added in v0.1.5

func (c *Client) CreateLogDrain(handle string, accountID int64, attrs *LogDrainCreateAttrs) (*LogDrain, error)

func (*Client) CreateMetricDrain added in v0.2.0

func (c *Client) CreateMetricDrain(handle string, accountID int64, attrs *MetricDrainCreateAttrs) (*MetricDrain, error)

func (*Client) CreateReplica

func (c *Client) CreateReplica(attrs ReplicateAttrs) (Database, error)

func (*Client) DeleteApp

func (c *Client) DeleteApp(appID int64) (bool, error)

func (*Client) DeleteDatabase

func (c *Client) DeleteDatabase(databaseID int64) error

func (*Client) DeleteEndpoint

func (c *Client) DeleteEndpoint(endpointID int64) error

DeleteEndpoint() deletes the endpoint.

func (*Client) DeleteEnvironment added in v0.3.0

func (c *Client) DeleteEnvironment(environmentID int64) error

func (*Client) DeleteLogDrain added in v0.1.5

func (c *Client) DeleteLogDrain(logDrainID int64) (bool, error)

func (*Client) DeleteMetricDrain added in v0.2.0

func (c *Client) DeleteMetricDrain(metricDrainID int64) (bool, error)

func (*Client) DeleteReplica

func (c *Client) DeleteReplica(replicaID int64) error

func (*Client) DeployApp

func (c *Client) DeployApp(config map[string]interface{}, appID int64) error

func (*Client) GetApp

func (c *Client) GetApp(appID int64) (App, error)

func (*Client) GetConfiguration

func (c *Client) GetConfiguration(configID int64) (Configuration, error)

func (*Client) GetConfigurationFromHref

func (c *Client) GetConfigurationFromHref(href string) (Configuration, error)

func (*Client) GetDatabase

func (c *Client) GetDatabase(databaseID int64) (Database, error)

func (*Client) GetDatabaseIDFromHandle

func (c *Client) GetDatabaseIDFromHandle(accountID int64, handle string) (int64, bool, error)

Gets database id associated with a given handle.

func (*Client) GetDatabaseImage

func (c *Client) GetDatabaseImage(imageID int64) (DatabaseImage, error)

func (*Client) GetDatabaseImageByTypeAndVersion

func (c *Client) GetDatabaseImageByTypeAndVersion(imageType string, version string) (DatabaseImage, error)

func (*Client) GetDatabaseOperations

func (c *Client) GetDatabaseOperations(databaseID int64, page int64) (*models.InlineResponse20031, error)

func (*Client) GetDisk

func (c *Client) GetDisk(diskID int64) (Disk, error)

func (*Client) GetDiskFromHref

func (c *Client) GetDiskFromHref(href string) (Disk, error)

func (*Client) GetEndpoint

func (c *Client) GetEndpoint(endpointID int64) (Endpoint, error)

GetEndpoint() returns the response's payload, a bool saying whether or not the endpoint has been deprovisioned, and an error.

func (*Client) GetEnvironment added in v0.3.0

func (c *Client) GetEnvironment(environmentID int64) (Environment, error)

func (*Client) GetEnvironmentFromHandle added in v0.3.2

func (c *Client) GetEnvironmentFromHandle(handle string) (Environment, error)

func (*Client) GetEnvironmentIDFromHandle

func (c *Client) GetEnvironmentIDFromHandle(handle string) (int64, error)

Gets environment id associated with a given handle.

func (*Client) GetImageFromHref

func (c *Client) GetImageFromHref(href string) (DatabaseImage, error)

func (*Client) GetLogDrain added in v0.1.5

func (c *Client) GetLogDrain(logDrainID int64) (*LogDrain, error)

func (*Client) GetMetricDrain added in v0.2.0

func (c *Client) GetMetricDrain(metricDrainID int64) (*MetricDrain, error)

func (*Client) GetOrganization added in v0.4.0

func (c *Client) GetOrganization() (Organization, error)

GetOrganization get organizations by user's token. Attempts to get organizations from auth api, then attempts to get the FIRST one. if more than one is found or none are found, error is raised

func (*Client) GetReplica

func (c *Client) GetReplica(replicaID int64) (Database, error)

func (*Client) GetReplicaFromHandle

func (c *Client) GetReplicaFromHandle(databaseID int64, handle string) (*models.InlineResponse20016EmbeddedDatabases, error)

func (*Client) GetService

func (c *Client) GetService(serviceID int64) (Service, error)

func (*Client) GetServiceForAppByName

func (c *Client) GetServiceForAppByName(appID int64, serviceName string) (Service, error)

func (*Client) GetServiceFromHref

func (c *Client) GetServiceFromHref(href string) (Service, error)

func (*Client) GetStack added in v0.3.0

func (c *Client) GetStack(id int64) (Stack, error)

func (*Client) GetStackByName added in v0.3.2

func (c *Client) GetStackByName(name string) (Stack, error)

func (*Client) GetStacks added in v0.3.2

func (c *Client) GetStacks() ([]Stack, error)

func (*Client) ScaleService

func (c *Client) ScaleService(serviceID int64, containerCount int64, memoryLimit int64, containerProfile string) error

func (*Client) UpdateApp added in v0.1.13

func (c *Client) UpdateApp(appID int64, appUpdates AppUpdates) error

func (*Client) UpdateDatabase

func (c *Client) UpdateDatabase(databaseID int64, updates DBUpdates) error

func (*Client) UpdateEndpoint

func (c *Client) UpdateEndpoint(endpointID int64, up EndpointUpdates) error

UpdateEndpoint() takes in an endpointID and updates needed, and updates the endpoint.

func (*Client) UpdateEnvironment added in v0.3.0

func (c *Client) UpdateEnvironment(environmentID int64, environmentUpdates EnvironmentUpdates) error

func (*Client) UpdateReplica

func (c *Client) UpdateReplica(replicaID int64, updates DBUpdates) error

func (*Client) WaitForOperation

func (c *Client) WaitForOperation(operationID int64) (bool, error)

Waits for operation to succeed.

type Configuration

type Configuration struct {
	ID  int64
	Env interface{}
}

type DBCreateAttrs

type DBCreateAttrs struct {
	Handle           *string
	Type             string
	ContainerSize    int64
	DiskSize         int64
	ContainerProfile string
	DatabaseImageID  int64
}

type DBUpdates

type DBUpdates struct {
	ContainerSize    int64
	DiskSize         int64
	ContainerProfile string
	Handle           string
	// SkipOperationUpdate - changing a DB can incur multiple API calls. To contain it to only update the handle
	// 						 set this to true then you only make one API call (to update database itself) without
	// 						 triggering an operation
	SkipOperationUpdate bool
}

DBUpdates - struct to define what operations you contain your DB update to. Add values to this struct

to eventually pass it around for consumption by the go sdk

type Database

type Database struct {
	ID                int64
	DefaultConnection string
	ConnectionURLs    []string
	ContainerSize     int64
	DiskSize          int64
	ContainerProfile  string
	Deleted           bool
	Handle            string
	Type              string
	EnvironmentID     int64
	InitializeFromID  int64
	Service           Service
	DatabaseImage     DatabaseImage
}

type DatabaseImage

type DatabaseImage struct {
	ID      int64
	Type    string
	Version string
}

type Disk

type Disk struct {
	ID               int64
	Size             int64
	AvailabilityZone string
}

type Endpoint

type Endpoint struct {
	ID             int64
	ExternalHost   string
	ContainerPort  int64
	ContainerPorts []int64
	IPWhitelist    []string
	Platform       string
	Deleted        bool
	Acme           bool
	Default        bool
	UserDomain     string
	VirtualDomain  string
	Service        Service
	Type           string
	Internal       bool
	AcmeChallenges []AcmeChallenge
}

type EndpointCreateAttrs

type EndpointCreateAttrs struct {
	ResourceType       string
	ServiceProcessType string
	Type               *string
	Default            bool
	Internal           bool
	ContainerPort      int64
	ContainerPorts     []int64
	IPWhitelist        []string
	Platform           string
	Acme               bool
	UserDomain         string
}

type EndpointUpdates

type EndpointUpdates struct {
	ContainerPort  int64
	ContainerPorts []int64
	IPWhitelist    []string
	Platform       string
}

type Environment added in v0.3.0

type Environment struct {
	Deleted        bool
	Handle         string
	ID             int64
	StackID        int64
	OrganizationID string
}

type EnvironmentCreateAttrs added in v0.3.0

type EnvironmentCreateAttrs struct {
	Handle string
}

type EnvironmentUpdates added in v0.3.0

type EnvironmentUpdates struct {
	Handle string
}

type HALOrganizationParent added in v0.4.0

type HALOrganizationParent struct {
	Organizations []Organization `json:"organizations"`
}

type HALOrganizationResponse added in v0.4.0

type HALOrganizationResponse struct {
	Embedded HALOrganizationParent `json:"_embedded"`
}

type LogDrain added in v0.1.5

type LogDrain struct {
	Deleted                bool
	ID                     int64
	Handle                 string
	DrainType              string
	DrainUsername          string
	DrainPassword          string
	DrainApps              bool
	DrainDatabases         bool
	DrainEphemeralSessions bool
	DrainProxies           bool
	DrainHost              string
	DrainPort              int64
	LoggingToken           string
	URL                    string
	DatabaseID             int64
	AccountID              int64
}

type LogDrainCreateAttrs added in v0.1.5

type LogDrainCreateAttrs struct {
	Database               strfmt.URI
	DatabaseID             int64
	DrainApps              bool
	DrainDatabases         bool
	DrainEphemeralSessions bool
	DrainProxies           bool
	DrainHost              strfmt.URI
	DrainPassword          string
	DrainUsername          string
	DrainPort              int64
	DrainType              *string
	LoggingToken           string
	URL                    strfmt.URI
}

type MetricDrain added in v0.2.0

type MetricDrain struct {
	Deleted    bool
	ID         int64
	Handle     string
	DrainType  string
	DatabaseID int64
	URL        strfmt.URI
	Username   string
	Password   string
	Database   string
	APIKey     string
	SeriesURL  strfmt.URI
	AccountID  int64
}

type MetricDrainCreateAttrs added in v0.2.0

type MetricDrainCreateAttrs struct {
	DatabaseID   int64
	DrainType    string
	LoggingToken string
	URL          strfmt.URI
	Username     string
	Password     string
	Database     string
	APIKey       string
	SeriesURL    strfmt.URI
}

type Organization added in v0.4.0

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type ReplicaIdentifiers

type ReplicaIdentifiers struct {
	ReplicaID     int64
	ProvisionOpID int64
}

type ReplicateAttrs

type ReplicateAttrs struct {
	EnvID         int64
	DatabaseID    int64
	ReplicaHandle string
	ContainerSize int64
	DiskSize      int64
}

type Service

type Service struct {
	ID                     int64
	ContainerCount         int64
	ContainerMemoryLimitMb int64
	ProcessType            string
	Command                string
	ResourceType           string
	ResourceID             int64
	EnvironmentID          int64
	ContainerProfile       string
}

type Stack added in v0.3.0

type Stack struct {
	ID             int64
	OrganizationID string
	Name           string
}

Jump to

Keyboard shortcuts

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