twingate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MPL-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultHTTPTimeout  = "10"
	DefaultHTTPMaxRetry = "10"
)

Variables

View Source
var (
	ErrTooManyGroupsError = fmt.Errorf("provider does not support more than %d groups per resource", readResourceQueryGroupsSize)

	ErrGraphqlIDIsEmpty        = errors.New("id is empty")
	ErrGraphqlNameIsEmpty      = errors.New("name is empty")
	ErrGraphqlResourceNotFound = errors.New("not found")

	ErrGraphqlResultIsEmpty      = errors.New("query result is empty")
	ErrGraphqlConnectorIDIsEmpty = errors.New("connector id is empty")
	ErrGraphqlNetworkIDIsEmpty   = errors.New("network id is empty")
	ErrGraphqlNetworkNameIsEmpty = errors.New("network name is empty")
	ErrGraphqlGroupNameIsEmpty   = errors.New("group name is empty")
)
View Source
var ErrNotAllowChangeRemoteNetworkID = errors.New("connectors cannot be moved between Remote Networks: you must either create a new Connector or destroy and recreate the existing one")

Functions

func ErrInvalidPortRange

func ErrInvalidPortRange(portRange string, err error) error

func Provider

func Provider(version string) *schema.Provider

Types

type APIError

type APIError struct {
	WrappedError error
	Operation    string
	Resource     string
	ID           graphql.ID
	Name         string
}

func NewAPIError

func NewAPIError(wrappedError error, operation string, resource string) *APIError

func NewAPIErrorWithID

func NewAPIErrorWithID(wrappedError error, operation string, resource string, id graphql.ID) *APIError

func NewAPIErrorWithName added in v0.1.9

func NewAPIErrorWithName(wrappedError error, operation string, resource string, name string) *APIError

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Unwrap added in v0.1.9

func (e *APIError) Unwrap() error

type Client

type Client struct {
	RetryableClient  *retryablehttp.Client
	GraphqlClient    *graphql.Client
	HTTPClient       *http.Client
	ServerURL        string
	GraphqlServerURL string
	APIServerURL     string
	APIToken         string
	Version          string
}

func NewClient

func NewClient(url string, apiToken string, network string, httpTimeout time.Duration, httpRetryMax int, version string) *Client

type Connector

type Connector struct {
	ID              graphql.ID
	RemoteNetwork   *remoteNetwork
	Name            graphql.String
	ConnectorTokens *connectorTokens
}

type Connectors

type Connectors struct {
	ID   string
	Name string
}

type Edges

type Edges struct {
	Node *IDName `json:"node"`
}

type Group

type Group struct {
	ID       graphql.ID
	Name     graphql.String
	Type     graphql.String
	IsActive graphql.Boolean
}

type GroupsFilter added in v0.1.9

type GroupsFilter struct {
	Name     *string
	Type     *string
	IsActive *bool
}

func (*GroupsFilter) HasName added in v0.1.9

func (f *GroupsFilter) HasName() bool

func (*GroupsFilter) Match added in v0.1.9

func (f *GroupsFilter) Match(group *Group) bool

type HTTPError

type HTTPError struct {
	RequestURI string
	StatusCode int
	Body       []byte
}

func NewHTTPError

func NewHTTPError(requestURI string, statusCode int, body []byte) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type IDName

type IDName struct {
	ID   graphql.ID     `json:"id"`
	Name graphql.String `json:"name"`
}

func (*IDName) StringID

func (in *IDName) StringID() string

func (*IDName) StringName

func (in *IDName) StringName() string

type MutationError

type MutationError struct {
	Message graphql.String
}

func NewMutationError

func NewMutationError(message graphql.String) *MutationError

func (*MutationError) Error

func (e *MutationError) Error() string

type OkError

type OkError struct {
	Ok    graphql.Boolean `json:"ok"`
	Error graphql.String  `json:"error"`
}

type PortNotInRangeError

type PortNotInRangeError struct {
	Port int64
}

func NewPortNotInRangeError

func NewPortNotInRangeError(port int64) *PortNotInRangeError

func (*PortNotInRangeError) Error

func (e *PortNotInRangeError) Error() string

type PortRangeInput

type PortRangeInput struct {
	Start graphql.Int `json:"start"`
	End   graphql.Int `json:"end"`
}

type PortRangeNotRisingSequenceError

type PortRangeNotRisingSequenceError struct {
	Start int64
	End   int64
}

func NewPortRangeNotRisingSequenceError

func NewPortRangeNotRisingSequenceError(start int64, end int64) *PortRangeNotRisingSequenceError

func (*PortRangeNotRisingSequenceError) Error

type ProtocolInput

type ProtocolInput struct {
	Ports  []*PortRangeInput `json:"ports"`
	Policy graphql.String    `json:"policy"`
}

type ProtocolsInput

type ProtocolsInput struct {
	UDP       *ProtocolInput  `json:"udp"`
	TCP       *ProtocolInput  `json:"tcp"`
	AllowIcmp graphql.Boolean `json:"allowIcmp"`
}

type Resource

type Resource struct {
	ID              graphql.ID
	RemoteNetworkID graphql.ID
	Address         graphql.String
	Name            graphql.String
	GroupsIds       []*graphql.ID
	Protocols       *ProtocolsInput
	IsActive        graphql.Boolean
}

type StringProtocolsInput

type StringProtocolsInput struct {
	AllowIcmp bool
	UDPPolicy string
	UDPPorts  []string
	TCPPolicy string
	TCPPorts  []string
}

type User added in v0.2.0

type User struct {
	ID        string
	FirstName string
	LastName  string
	Email     string
	Role      string
}

func (User) IsAdmin added in v0.2.0

func (u User) IsAdmin() bool

Jump to

Keyboard shortcuts

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