Documentation ¶
Index ¶
- type ClientHandler
- type ResponseError
- type RestClient
- func (restClient *RestClient) CreateTunnelAPI(subdomain string, publicKey string, protocol []string) (Tunnel, error)
- func (restClient *RestClient) DeleteTunnelAPI(subdomainName string) error
- func (restClient *RestClient) GetSubdomainName(subdomainID string) (string, error)
- func (restClient *RestClient) ListSubdomainAPI() ([]Subdomain, error)
- func (restClient *RestClient) ListTunnelsAPI() ([]Tunnel, error)
- func (restClient *RestClient) Login(username string, password string) (SessionResponse, error)
- func (restClient *RestClient) ReleaseSubdomainAPI(subdomainName string) error
- func (restClient *RestClient) ResendConfirmationEmail(email string) error
- func (restClient *RestClient) ReserveSubdomainAPI(subdomainName string) (Subdomain, error)
- func (restClient *RestClient) SetAPIKey(apiKey string)
- func (restClient *RestClient) SetRefreshToken(refreshToken string)
- func (restClient *RestClient) StartSession(refreshToken string) error
- type SessionResponse
- type Subdomain
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientHandler ¶
ClientHandler struct to store header and roundtrip info
func WithHeader ¶
func WithHeader(rt http.RoundTripper) ClientHandler
WithHeader Adds ability to edit headers without remaking everything
type ResponseError ¶
type ResponseError struct { Data struct { Type string `json:"type"` Attributes struct { Title string `json:"title"` Status string `json:"status"` Detail string `json:"detail"` } `json:"attributes"` ID string `json:"id"` } `json:"data"` }
ResponseError JSONapi response error
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type RestClient ¶
RestClient A stuct to hold persistent data that is used between rest calls
func NewRestClient ¶
func NewRestClient(apiEndpoint string, refreshToken string) RestClient
NewRestClient Use this method to create a new rest client so headers can be setup
func (*RestClient) CreateTunnelAPI ¶
func (restClient *RestClient) CreateTunnelAPI(subdomain string, publicKey string, protocol []string) (Tunnel, error)
CreateTunnelAPI calls holepunch web api to get tunnel details
func (*RestClient) DeleteTunnelAPI ¶
func (restClient *RestClient) DeleteTunnelAPI(subdomainName string) error
DeleteTunnelAPI deletes tunnel
func (*RestClient) GetSubdomainName ¶
func (restClient *RestClient) GetSubdomainName(subdomainID string) (string, error)
GetSubdomainName Returns subdomain name of a given subdomain id
func (*RestClient) ListSubdomainAPI ¶
func (restClient *RestClient) ListSubdomainAPI() ([]Subdomain, error)
ListSubdomainAPI get list of subdomains reserved
func (*RestClient) ListTunnelsAPI ¶
func (restClient *RestClient) ListTunnelsAPI() ([]Tunnel, error)
ListTunnelsAPI get list of tunnels
func (*RestClient) Login ¶
func (restClient *RestClient) Login(username string, password string) (SessionResponse, error)
Login Login user with given username and password. Returns sessionresponse so cmd can set viper configs
func (*RestClient) ReleaseSubdomainAPI ¶
func (restClient *RestClient) ReleaseSubdomainAPI(subdomainName string) error
ReleaseSubdomainAPI deletes subdomain
func (*RestClient) ResendConfirmationEmail ¶
func (restClient *RestClient) ResendConfirmationEmail(email string) error
ResendConfirmationEmail If user is unconfirmed this will resend a confirmation email
func (*RestClient) ReserveSubdomainAPI ¶
func (restClient *RestClient) ReserveSubdomainAPI(subdomainName string) (Subdomain, error)
ReserveSubdomainAPI calls holepunch web api to get reserve a subdomain
func (*RestClient) SetAPIKey ¶
func (restClient *RestClient) SetAPIKey(apiKey string)
SetAPIKey set api key header
func (*RestClient) SetRefreshToken ¶
func (restClient *RestClient) SetRefreshToken(refreshToken string)
func (*RestClient) StartSession ¶
func (restClient *RestClient) StartSession(refreshToken string) error
StartSession Start a session and set the restClient to the current access token
type SessionResponse ¶
type SessionResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires-in"` RefreshToken string `json:"refresh_token"` }
SessionResponse Json response for login/session refresh
type Subdomain ¶
type Subdomain struct { ID string `jsonapi:"primary,subdomain"` Name string `jsonapi:"attr,name"` InUse bool `jsonapi:"attr,inUse"` Reserved bool `jsonapi:"attr,reserved"` }
Subdomain Subdomain object that holds all needed info
type Tunnel ¶
type Tunnel struct { ID string `jsonapi:"primary,tunnel"` PortTypes []string `jsonapi:"attr,port,omitempty"` PublicKey string `jsonapi:"attr,sshKey,omitempty"` SSHPort string `jsonapi:"attr,sshPort,omitempty"` TCPPorts []string `jsonapi:"attr,allocatedTcpPorts,omitempty"` IPAddress string `jsonapi:"attr,ipAddress,omitempty"` Subdomain *Subdomain `jsonapi:"relation,subdomain,omitempty"` }
Tunnel JSONAPI response of tunnel object