api

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PrefixURI is the root of the Section API
	PrefixURI = &url.URL{Scheme: "https", Host: "aperture.section.io"}
	// Timeout specifies a time limit for requests made by the API client
	Timeout = 20 * time.Second
	// Token is the token for authenticating to the Section API
	Token string

	// ErrAuthDenied represents all authentication and authorization errors
	ErrAuthDenied = errors.New("denied")
	// ErrStatusUnauthorized (401) indicates that the request has not been applied because it lacks valid authentication credentials for the target resource.
	ErrStatusUnauthorized = fmt.Errorf("check your token? API request is unauthorized: %w", ErrAuthDenied)
	// ErrStatusForbidden (403) indicates that the server understood the request but refuses to authorize it.
	ErrStatusForbidden = fmt.Errorf("check your token? API request is forbidden: %w", ErrAuthDenied)
)
View Source
var (
	// ErrApplicationAlreadyCreated indicates an app has already been created with that FQDN.
	ErrApplicationAlreadyCreated = errors.New("an application has already been created with that domain name")
	// ErrSystemLimitExceeded indicates you have hit a soft limit on your account. Contact Section support to increase the limit.
	ErrSystemLimitExceeded = errors.New("system limit exceeded")
)
View Source
var (
	// ErrStatusBadRequest indicates the request was malformed
	ErrStatusBadRequest = errors.New("malformed request")
	// ErrStatusNotFound indicates the requested resource was not found
	ErrStatusNotFound = errors.New("application not found")
	// ErrStatusInternalServerError indicates the server errored when handling your request
	ErrStatusInternalServerError = errors.New("unexpected condition when handling request")
)

Functions

func ApplicationEnvironmentModuleUpdate added in v1.3.0

func ApplicationEnvironmentModuleUpdate(accountID int, applicationID int, env string, filePath string, up []EnvironmentUpdateCommand) (err error)

ApplicationEnvironmentModuleUpdate updates a module's configuration

func BaseURL

func BaseURL() (u url.URL)

BaseURL returns a URL for building requests on

Types

type Account

type Account struct {
	ID          int    `json:"id"`
	Href        string `json:"href"`
	AccountName string `json:"account_name"`
	IsAdmin     bool   `json:"is_admin"`
	BillingUser int    `json:"billing_user"`
	Requires2FA bool   `json:"requires_2fa"`
}

Account represents an account on Section

func Accounts

func Accounts() (as []Account, err error)

Accounts returns a list of account the current user has access to.

type App

type App struct {
	ID              int           `json:"id"`
	Href            string        `json:"href"`
	ApplicationName string        `json:"application_name"`
	Environments    []Environment `json:"environments"`
}

App represents an application deployed on Section

func Application

func Application(accountID int, applicationID int) (a App, err error)

Application returns detailed information about a given application.

func Applications

func Applications(accountID int) (as []App, err error)

Applications returns a list of applications on a given account.

type AppLogs added in v1.5.0

type AppLogs struct {
	Timestamp    string `json:"timestamp"`
	InstanceName string `json:"instanceName"`
	Type         string `json:"type"`
	Message      string `json:"message"`
}

AppLogs represents the logs from an application deployed on Section

func ApplicationLogs added in v1.5.0

func ApplicationLogs(accountID int, applicationID int, moduleName string, instanceName string, number int, startTimestampRfc3339 string) (al []AppLogs, err error)

ApplicationLogs returns a module's logs from Section's delivery platform

type AppStatus added in v1.3.0

type AppStatus struct {
	InService    bool   `json:"inService"`
	State        string `json:"state"`
	InstanceName string `json:"instanceName"`
	PayloadID    string `json:"payloadID"`
	IsLatest     bool   `json:"isLatest"`
}

AppStatus represents the status of an application deployed on Section

func ApplicationStatus added in v1.3.0

func ApplicationStatus(accountID int, applicationID int, moduleName string) (as []AppStatus, err error)

ApplicationStatus returns a module's current status on Section's delivery platform

type ApplicationCreateResponse added in v1.5.0

type ApplicationCreateResponse struct {
	ID              int      `json:"id"`
	Href            string   `json:"href"`
	ApplicationName string   `json:"application_name"`
	PathPrefix      string   `json:"path_prefix"`
	PathPrefixes    []string `json:"path_prefixes"`
	Message         string   `json:"message"` // for errors
}

ApplicationCreateResponse represents an API response for application create requests

func ApplicationCreate added in v1.5.0

func ApplicationCreate(accountID int, hostname, origin, stackName string) (r ApplicationCreateResponse, err error)

ApplicationCreate creates an application on the Section platform.

type ApplicationDeleteResponse added in v1.5.0

type ApplicationDeleteResponse struct {
	Message string `json:"message"` // for errors
}

ApplicationDeleteResponse respresents an API response for application delete requests

func ApplicationDelete added in v1.5.0

func ApplicationDelete(accountID, appID int) (r ApplicationDeleteResponse, err error)

ApplicationDelete deletes an application on the Section platform.

type Domain

type Domain struct {
	Name     string `json:"name"`
	ZoneName string `json:"zoneName"`
	CNAME    string `json:"cname"`
	Mode     string `json:"mode"`
}

Domain represents an applications environments' domains

type DomainsResponse added in v1.7.0

type DomainsResponse struct {
	DomainName string `json:"domain_name"`
	Engaged    bool   `json:"engaged"`
}

DomainsResponse represents an API response to GET /account/{accountId}/domains

func Domains added in v1.7.0

func Domains(accountID int) (d []DomainsResponse, err error)

Domains returns a list of an account's domains

type Environment

type Environment struct {
	ID              int      `json:"id"`
	Href            string   `json:"href"`
	EnvironmentName string   `json:"environment_name"`
	Domains         []Domain `json:"domains"`
	Stack           []Module `json:"stack"`
}

Environment represents an application's environments on Section

func ApplicationEnvironments

func ApplicationEnvironments(accountID int, applicationID int) (es []Environment, err error)

ApplicationEnvironments returns environment information for a given application.

type EnvironmentUpdateCommand added in v1.3.0

type EnvironmentUpdateCommand struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value"`
}

EnvironmentUpdateCommand is a blah

type Module

type Module struct {
	Name  string `json:"name"`
	Image string `json:"image"`
	Href  string `json:"href"`
}

Module represents a proxy in the traffic delivery stack

func ApplicationEnvironmentStack

func ApplicationEnvironmentStack(accountID int, applicationID int, environmentName string) (s []Module, err error)

ApplicationEnvironmentStack returns the stack for a given application and environment.

type RenewCertResponse added in v1.1.0

type RenewCertResponse struct {
	Issued    bool      `json:"issued"`
	Message   string    `json:"message"`
	Expiry    time.Time `json:"expiry"`
	RenewFrom time.Time `json:"renewFrom"`
}

RenewCertResponse represents an API response to POST /account/{accountId}/domain/{hostName}/renewCertificate

func DomainsRenewCert added in v1.1.0

func DomainsRenewCert(accountID int, hostname string) (r RenewCertResponse, err error)

DomainsRenewCert handles renewing a certificate for a given account and domain.

type Stack added in v1.9.0

type Stack struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

Stack represents a deployable application stack on Section

func Stacks added in v1.9.0

func Stacks() (s []Stack, err error)

Stacks returns the available deployable stacks

type User

type User struct {
	ID          int    `json:"id"`
	Email       string `json:"email"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	CompanyName string `json:"company_name"`
	PhoneNumber string `json:"phone_number"`
	Verified    bool   `json:"verified"`
	Requires2FA bool   `json:"requires2fa"`
	Enforce2FA  bool   `json:"enforce2fa"`
}

User represents a user account known to Section

func CurrentUser

func CurrentUser() (u User, err error)

CurrentUser returns details for the currently authenticated user

Jump to

Keyboard shortcuts

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