api

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 14 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Not Found")
View Source
var ErrUnknown = errors.New("An unknown server error occured, please try again")

Functions

func GetAccessToken

func GetAccessToken(email, password, otp string) (string, error)

func IsClientError

func IsClientError(err error) bool

func IsNotAuthenticatedError

func IsNotAuthenticatedError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsServerError

func IsServerError(err error) bool

func SetBaseURL

func SetBaseURL(url string)

Types

type AllocateIPAddressInput

type AllocateIPAddressInput struct {
	AppID string `json:"appId"`
	Type  string `json:"type"`
}

type Allocation

type Allocation struct {
	ID            string
	Version       int
	LatestVersion bool
	Status        string
	DesiredStatus string
	Region        string
	CreatedAt     time.Time
}

type AllocationEvent

type AllocationEvent struct {
	Timestamp time.Time
	Type      string
	Message   string
}

type AllocationStatus

type AllocationStatus struct {
	ID                 string
	IDShort            string
	Version            int
	Region             string
	Status             string
	DesiredStatus      string
	Healthy            bool
	Canary             bool
	Failed             bool
	CreatedAt          time.Time
	UpdatedAt          time.Time
	Checks             []CheckState
	Events             []AllocationEvent
	LatestVersion      bool
	PassingCheckCount  int
	WarningCheckCount  int
	CriticalCheckCount int
	Transitioning      bool
}

type ApiError

type ApiError struct {
	WrappedError error
	Message      string
	Status       int
}

func ErrorFromResp

func ErrorFromResp(resp *http.Response) *ApiError

func (*ApiError) Error

func (e *ApiError) Error() string

type App

type App struct {
	ID             string
	Name           string
	Status         string
	Deployed       bool
	Hostname       string
	AppURL         string
	Version        int
	Release        *Release
	Organization   Organization
	Tasks          []Task
	Secrets        []Secret
	CurrentRelease *Release
	Releases       struct {
		Nodes []Release
	}
	IPAddresses struct {
		Nodes []IPAddress
	}
	IPAddress *IPAddress
	Builds    struct {
		Nodes []Build
	}
	Changes struct {
		Nodes []AppChange
	}
	Certificates struct {
		Nodes []AppCertificate
	}
	Certificate      AppCertificate
	Services         []Service
	Config           AppConfig
	ParseConfig      AppConfig
	Allocations      []AllocationStatus
	DeploymentStatus *DeploymentStatus
}

type AppCertificate

type AppCertificate struct {
	ID                        string
	AcmeDNSConfigured         bool
	CertificateAuthority      string
	CreatedAt                 time.Time
	DNSProvider               string
	DNSValidationInstructions string
	DNSValidationHostname     string
	DNSValidationTarget       string
	Hostname                  string
	Source                    string
	ClientStatus              string
	Issued                    struct {
		Nodes []struct {
			ExpiresAt time.Time
			Type      string
		}
	}
}

type AppChange

type AppChange struct {
	ID        string
	CreatedAt time.Time
	UpdatedAt time.Time
	Actor     struct {
		Type string
	}
	Status      string
	Description string
	Reason      string
	User        User
}

type AppConfig

type AppConfig struct {
	Definition Definition
	Services   []Service
	Valid      bool
	Errors     []string
}

type Build

type Build struct {
	ID         string
	InProgress bool
	Status     string
	User       User
	Logs       string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type CLISessionAuth

type CLISessionAuth struct {
	ID          string `json:"id"`
	AuthURL     string `json:"auth_url"`
	AccessToken string `json:"access_token"`
}

func GetAccessTokenForCLISession

func GetAccessTokenForCLISession(id string) (CLISessionAuth, error)

func StartCLISessionWebAuth

func StartCLISessionWebAuth(machineName string, signup bool) (CLISessionAuth, error)

type Check

type Check struct {
	Type              string       `json:"type"`
	Interval          *uint64      `json:"interval"`
	Timeout           *uint64      `json:"timeout"`
	HTTPMethod        *string      `json:"httpMethod"`
	HTTPPath          *string      `json:"httpPath"`
	HTTPProtocol      *string      `json:"httpProtocol"`
	HTTPSkipTLSVerify *bool        `json:"httpTlsSkipVerify"`
	HTTPHeaders       []HTTPHeader `json:"httpHeaders"`
}

type CheckState

type CheckState struct {
	Name        string
	Status      string
	Output      string
	ServiceName string
}

type Client

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

func NewClient

func NewClient(accessToken string, version string) (*Client, error)

func (*Client) AddCertificate

func (c *Client) AddCertificate(appName string, hostname string) (*AppCertificate, error)

func (*Client) AllocateIPAddress

func (c *Client) AllocateIPAddress(appName string, addrType string) (*IPAddress, error)

func (*Client) CheckAppCertificate

func (c *Client) CheckAppCertificate(appName string, hostname string) (*AppCertificate, error)

func (*Client) CreateApp

func (c *Client) CreateApp(name string, orgId string) (*App, error)

func (*Client) CreateBuild

func (c *Client) CreateBuild(appId string, sourceUrl, sourceType string) (*Build, error)

func (*Client) CreateSignedUrls

func (c *Client) CreateSignedUrls(appId string, filename string) (getUrl string, putUrl string, err error)

func (*Client) DeleteApp

func (client *Client) DeleteApp(appName string) error

func (*Client) DeleteCertificate

func (c *Client) DeleteCertificate(appName string, hostname string) (*DeleteCertificatePayload, error)

func (*Client) DeployImage

func (client *Client) DeployImage(input DeployImageInput) (*Release, error)

func (*Client) FindIPAddress

func (c *Client) FindIPAddress(appName string, address string) (*IPAddress, error)

func (*Client) GetApp

func (c *Client) GetApp(appName string) (*App, error)

func (*Client) GetAppCertificate

func (c *Client) GetAppCertificate(appName string, hostname string) (*AppCertificate, error)

func (*Client) GetAppCertificates

func (c *Client) GetAppCertificates(appName string) ([]AppCertificate, error)

func (*Client) GetAppChanges

func (c *Client) GetAppChanges(appName string) ([]AppChange, error)

func (*Client) GetAppCurrentRelease

func (c *Client) GetAppCurrentRelease(appName string) (*Release, error)

func (*Client) GetAppLogs

func (c *Client) GetAppLogs(appName string, nextToken string, region string, instanceId string) ([]LogEntry, string, error)

func (*Client) GetAppReleaseVersion

func (c *Client) GetAppReleaseVersion(appName string, version int) (*Release, error)

func (*Client) GetAppReleases

func (c *Client) GetAppReleases(appName string, limit int) ([]Release, error)

func (*Client) GetAppSecrets

func (c *Client) GetAppSecrets(appName string) ([]Secret, error)

func (*Client) GetAppServices

func (c *Client) GetAppServices(appName string) ([]Service, error)

func (*Client) GetAppStatus

func (c *Client) GetAppStatus(appName string, showCompleted bool) (*App, error)

func (*Client) GetApps

func (c *Client) GetApps() ([]App, error)

func (*Client) GetBuild

func (c *Client) GetBuild(buildId string) (*Build, error)

func (*Client) GetConfig

func (client *Client) GetConfig(appName string) (*AppConfig, error)

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser() (*User, error)

func (*Client) GetDeploymentStatus

func (c *Client) GetDeploymentStatus(appName string, deploymentID string) (*DeploymentStatus, error)

func (*Client) GetIPAddresses

func (c *Client) GetIPAddresses(appName string) ([]IPAddress, error)

func (*Client) GetOrganizations

func (client *Client) GetOrganizations() ([]Organization, error)

func (*Client) ListBuilds

func (c *Client) ListBuilds(appName string) ([]Build, error)

func (*Client) MoveApp

func (client *Client) MoveApp(appName string, orgID string) (*App, error)

func (*Client) NewRequest

func (c *Client) NewRequest(q string) *graphql.Request

func (*Client) OptimizeImage

func (client *Client) OptimizeImage(appId string, image string) (string, error)

func (*Client) ParseConfig

func (client *Client) ParseConfig(appName string, definition Definition) (*AppConfig, error)

func (*Client) ReleaseIPAddress

func (c *Client) ReleaseIPAddress(id string) error

func (*Client) Run

func (c *Client) Run(req *graphql.Request) (Query, error)

func (*Client) RunWithContext

func (c *Client) RunWithContext(ctx context.Context, req *graphql.Request) (Query, error)

func (*Client) SetSecrets

func (c *Client) SetSecrets(appName string, secrets map[string]string) (*Release, error)

func (*Client) UnsetSecrets

func (c *Client) UnsetSecrets(appName string, keys []string) (*Release, error)

type CreateAppInput

type CreateAppInput struct {
	OrganizationID string `json:"organizationId"`
	Runtime        string `json:"runtime"`
	Name           string `json:"name"`
}

type Definition

type Definition map[string]interface{}

type DeleteCertificatePayload

type DeleteCertificatePayload struct {
	App         App
	Certificate AppCertificate
}

type DeployImageInput

type DeployImageInput struct {
	AppID      string      `json:"appId"`
	Image      string      `json:"image"`
	Services   *[]Service  `json:"services"`
	Definition *Definition `json:"definition"`
}

type DeploymentStatus

type DeploymentStatus struct {
	ID             string
	Status         string
	Description    string
	InProgress     bool
	Successful     bool
	Tasks          []TaskDeploymentStatus
	CreatedAt      time.Time
	Allocations    []AllocationStatus
	Version        int
	DesiredCount   int
	PlacedCount    int
	HealthyCount   int
	UnhealthyCount int
}

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type IPAddress

type IPAddress struct {
	ID        string
	Address   string
	Type      string
	CreatedAt time.Time
}

type LogEntry

type LogEntry struct {
	Timestamp string
	Message   string
	Level     string
	Meta      struct {
		Instance string
		Region   string
	}
}

type LoggingTransport

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

func (*LoggingTransport) RoundTrip

func (t *LoggingTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Organization

type Organization struct {
	ID   string
	Name string
	Slug string
}

type PortHandler

type PortHandler struct {
	Port     int      `json:"port"`
	Handlers []string `json:"handlers"`
}

type Query

type Query struct {
	Apps struct {
		Nodes []App
	}
	App           App
	CurrentUser   User
	Organizations struct {
		Nodes []Organization
	}

	Build Build

	// mutations
	CreateApp struct {
		App App
	}

	SetSecrets struct {
		Release Release
	}

	UnsetSecrets struct {
		Release Release
	}

	DeployImage struct {
		Release Release
	}

	OptimizeImage struct {
		Status string
	}

	CreateSignedUrl SignedUrls

	CreateBuild struct {
		Build Build
	}

	AddCertificate struct {
		Certificate AppCertificate
	}

	DeleteCertificate DeleteCertificatePayload

	AllocateIPAddress struct {
		App       App
		IPAddress IPAddress
	}
	ReleaseIPAddress struct {
		App App
	}
}

type Release

type Release struct {
	ID                 string
	Version            int
	Stable             bool
	InProgress         bool
	Reason             string
	Description        string
	Status             string
	DeploymentStrategy string
	Deployment         DeploymentStatus
	User               User
	CreatedAt          time.Time
}

type ReleaseIPAddressInput

type ReleaseIPAddressInput struct {
	IPAddressID string `json:"ipAddressId"`
}

type Secret

type Secret struct {
	Name      string
	Digest    string
	CreatedAt time.Time
}

type Service

type Service struct {
	Description     string        `json:"description"`
	Protocol        string        `json:"protocol"`
	InternalPort    int           `json:"internalPort"`
	Ports           []PortHandler `json:"ports"`
	Checks          []Check       `json:"checks"`
	SoftConcurrency int           `json:"softConcurrency"`
	HardConcurrency int           `json:"hardConcurrency"`
}

mostly duplicate of TaskService but works with the deployImage mutation. clean up when we figure out groups/tasks/services

type SetSecretsInput

type SetSecretsInput struct {
	AppID   string                  `json:"appId"`
	Secrets []SetSecretsInputSecret `json:"secrets"`
}

type SetSecretsInputSecret

type SetSecretsInputSecret struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type SignedUrls

type SignedUrls struct {
	GetUrl string
	PutUrl string
}

type Task

type Task struct {
	ID              string
	Name            string
	Status          string
	ServicesSummary string
	Services        []TaskService
	Allocations     []Allocation
}

type TaskDeploymentStatus

type TaskDeploymentStatus struct {
	Name             string
	Promoted         bool
	ProgressDeadline time.Time
	Canaries         int
	Desired          int
	Healthy          int
	Unhealthy        int
	Placed           int
}

type TaskService

type TaskService struct {
	ID           string
	Protocol     string
	Ports        []PortHandler
	InternalPort int
	Description  string
}

type UnsetSecretsInput

type UnsetSecretsInput struct {
	AppID string   `json:"appId"`
	Keys  []string `json:"keys"`
}

type User

type User struct {
	ID    string
	Name  string
	Email string
}

Jump to

Keyboard shortcuts

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