api

package
v0.0.0-...-3ae3623 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2016 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DEFAULT_API_URL              = "https://api.fortycloud.net/restapi/v0.4"
	DEFAULT_FIND_GATEWAY_TIMEOUT = "5m"
)

Variables

This section is empty.

Functions

func IsErrorObjectNotExists

func IsErrorObjectNotExists(err error) bool

Types

type Api

type Api struct {
	Gateways         *GatewaysEndpoint
	IPAddressSets    *IpAddressSetsEndpoint
	IPSecConnections *IPSecConnectionsEndpoint
	Subnets          *SubnetsEndpoint
	// contains filtered or unexported fields
}

func NewApi

func NewApi(config *ApiConfig) *Api

func (*Api) FindGatewayByPublicIP

func (ap *Api) FindGatewayByPublicIP(public_ip string, wait bool) (*Gateway, error)

func (*Api) FindSubnet

func (ap *Api) FindSubnet(cidr string, gatewayID string) (*Subnet, error)

func (*Api) SetAccessCredentials

func (ap *Api) SetAccessCredentials(key string, secret string)

func (*Api) SetFindGatewayTimeout

func (ap *Api) SetFindGatewayTimeout(timeout string)

func (*Api) SetURL

func (ap *Api) SetURL(url string)

type ApiConfig

type ApiConfig struct {
	URL                string
	AccessKey          string
	SecretKey          string
	FindGatewayTimeout string
}

func DefaultApiConfig

func DefaultApiConfig() *ApiConfig

type Gateway

type Gateway struct {
	Fqdn                 string   `json:"fqdn"`
	PublicIP             string   `json:"publicIP"`
	OverlayAddress       string   `json:"overlayAddress"`
	VpnUsersSubnet       string   `json:"vpnUsersSubnet"`
	Region               string   `json:"region"`
	Enable               bool     `json:"enable"`
	AllowSSHToEveryone   bool     `json:"allowSSHToEveryone"`
	RouteAllTrafficViaGW bool     `json:"routeAllTrafficViaGW"`
	PrivateIP            string   `json:"privateIP"`
	State                string   `json:"state"`
	Name                 string   `json:"name"`
	Description          string   `json:"description"`
	SecurityGroup        string   `json:"securityGroup"`
	OpenVPNProtocol      string   `json:"openVPNProtocol"`
	ClientRoutes         []string `json:"clientRoutes"`
	GatewayAsDNS         bool     `json:"gatewayAsDNS"`
	DirectRoutesOnly     bool     `json:"directRoutesOnly"`
	HaState              string   `json:"haState"`
	Id                   string   `json:"id,omitempty"`
	Release              string   `json:"release,omitempty"`
	IdentityServerName   string   `json:"identityServerName,omitempty"`
}

type GatewaysEndpoint

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

func NewGatewaysEndpoint

func NewGatewaysEndpoint(service *internal.JsonService) *GatewaysEndpoint

func (*GatewaysEndpoint) All

func (endpoint *GatewaysEndpoint) All() ([]Gateway, error)

func (*GatewaysEndpoint) Delete

func (endpoint *GatewaysEndpoint) Delete(id string) error

func (*GatewaysEndpoint) Get

func (endpoint *GatewaysEndpoint) Get(id string) (*Gateway, error)

func (*GatewaysEndpoint) GetInstallationScript

func (endpoint *GatewaysEndpoint) GetInstallationScript(platform string, license string) (string, error)

func (*GatewaysEndpoint) GetRegistrationToken

func (endpoint *GatewaysEndpoint) GetRegistrationToken(platform string, license string) (string, error)

func (*GatewaysEndpoint) Update

func (endpoint *GatewaysEndpoint) Update(id string, gateway *Gateway) (*Gateway, error)

type IPSecConnection

type IPSecConnection struct {
	Name                 string `json:"name"`
	Description          string `json:"description"`
	StateAB              string `json:"stateAB"`
	ForceIPSecOverUDP    bool   `json:"forceIPSecOverUDP"`
	Enable               bool   `json:"enable"`
	GatewayA             string `json:"gatewayA"`
	NetworkArchitectureA string `json:"networkArchitectureA"`
	GatewayB             string `json:"gatewayB"`
	NetworkArchitectureB string `json:"networkArchitectureB"`
	IKEPhaseAlgorithm    string `json:"iKEPhaseAlgorithm"`
	Pfs                  bool   `json:"pfs"`
	DiffieHellmanGroup   string `json:"diffieHellmanGroup"`
	IKESessionLifetime   string `json:"iKESessionLifetime"`
	IPSecPhaseAlgorithm  string `json:"iPSecPhaseAlgorithm"`
	IPSecSessionLifetime string `json:"iPSecSessionLifetime"`
	DPDTimeout           int    `json:"dPDTimeout"`
	DPDAction            string `json:"dPDAction"`
	Id                   string `json:"id,omitempty"`
}

type IPSecConnectionsEndpoint

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

func NewIPSecConnectionsEndpoint

func NewIPSecConnectionsEndpoint(service *internal.JsonService) *IPSecConnectionsEndpoint

func (*IPSecConnectionsEndpoint) All

func (endpoint *IPSecConnectionsEndpoint) All() ([]IPSecConnection, error)

func (*IPSecConnectionsEndpoint) Create

func (endpoint *IPSecConnectionsEndpoint) Create(connection *IPSecConnection) (*IPSecConnection, error)

func (*IPSecConnectionsEndpoint) Delete

func (endpoint *IPSecConnectionsEndpoint) Delete(id string) error

func (*IPSecConnectionsEndpoint) Get

func (endpoint *IPSecConnectionsEndpoint) Get(id string) (*IPSecConnection, error)

func (*IPSecConnectionsEndpoint) Update

func (endpoint *IPSecConnectionsEndpoint) Update(id string, connection *IPSecConnection) (*IPSecConnection, error)

type IpAddressSet

type IpAddressSet struct {
	Id            string `json:"id,omitempty"`
	Name          string `json:"name"`
	Ips           string `json:"ips"`
	Active        bool   `json:"active"`
	ResourceGroup string `json:"resourceGroup"`
}

type IpAddressSetsEndpoint

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

func NewIpAddressSetsEndpoint

func NewIpAddressSetsEndpoint(service *internal.JsonService) *IpAddressSetsEndpoint

func (*IpAddressSetsEndpoint) All

func (endpoint *IpAddressSetsEndpoint) All() ([]IpAddressSet, error)

func (*IpAddressSetsEndpoint) Create

func (endpoint *IpAddressSetsEndpoint) Create(set *IpAddressSet) (*IpAddressSet, error)

func (*IpAddressSetsEndpoint) Delete

func (endpoint *IpAddressSetsEndpoint) Delete(id string) error

func (*IpAddressSetsEndpoint) Get

func (endpoint *IpAddressSetsEndpoint) Get(id string) (*IpAddressSet, error)

func (*IpAddressSetsEndpoint) Update

func (endpoint *IpAddressSetsEndpoint) Update(set *IpAddressSet) (*IpAddressSet, error)

type MissingGatewayError

type MissingGatewayError struct {
	PublicIP string
}

func (MissingGatewayError) Error

func (err MissingGatewayError) Error() string

type MockApi

type MockApi struct {
	Api
	// contains filtered or unexported fields
}

func NewMockApi

func NewMockApi() *MockApi

func (*MockApi) Close

func (b *MockApi) Close()

func (*MockApi) Handle

func (b *MockApi) Handle(handler http.HandlerFunc)

type Session

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

func DefaultSession

func DefaultSession() *Session

func (*Session) Set

func (session *Session) Set(key string, secret string)

func (*Session) SignRequest

func (session *Session) SignRequest(req *http.Request) error

type Subnet

type Subnet struct {
	Id               string `json:"id,omitempty"`
	Name             string `json:"name"`
	Description      string `json:"description"`
	Cidr             string `json:"cidr"`
	DisableAutoNAT   bool   `json:"disableAutoNAT"`
	GatewayRef       string `json:"gatewayRef,omitempty"`
	ResourceGroupRef string `json:"resourceGroupRef,omitempty"`
}

func (*Subnet) GatewayID

func (s *Subnet) GatewayID() string

func (*Subnet) ResourceGroupID

func (s *Subnet) ResourceGroupID() string

func (*Subnet) SetGatewayID

func (s *Subnet) SetGatewayID(id string)

func (*Subnet) SetResourceGroupID

func (s *Subnet) SetResourceGroupID(id string)

type SubnetsEndpoint

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

func NewSubnetsEndpoint

func NewSubnetsEndpoint(service *internal.JsonService) *SubnetsEndpoint

func (*SubnetsEndpoint) All

func (endpoint *SubnetsEndpoint) All() ([]Subnet, error)

func (*SubnetsEndpoint) AssignGateway

func (endpoint *SubnetsEndpoint) AssignGateway(subnetId string, gatewayId string) (*Subnet, error)

func (*SubnetsEndpoint) AssignResourceGroup

func (endpoint *SubnetsEndpoint) AssignResourceGroup(subnetId string, resourceGroupId string) (*Subnet, error)

func (*SubnetsEndpoint) ClearGateway

func (endpoint *SubnetsEndpoint) ClearGateway(subnetId string) (*Subnet, error)

func (*SubnetsEndpoint) Create

func (endpoint *SubnetsEndpoint) Create(subnet *Subnet) (*Subnet, error)

func (*SubnetsEndpoint) Delete

func (endpoint *SubnetsEndpoint) Delete(id string) error

func (*SubnetsEndpoint) Get

func (endpoint *SubnetsEndpoint) Get(id string) (*Subnet, error)

func (*SubnetsEndpoint) Update

func (endpoint *SubnetsEndpoint) Update(id string, subnet *Subnet) (*Subnet, error)

Jump to

Keyboard shortcuts

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