client

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthPayload

type AuthPayload struct {
	Username string `json:"email"`
	Password string `json:"password"`
}

type BowtiePolicy

type BowtiePolicy struct {
	ID string `json:"id"`
}

type BowtiePolicySource

type BowtiePolicySource struct {
	ID        string `json:"id"`
	Predicate string `json:"predicate"`
}

type BowtieResource

type BowtieResource struct {
	ID       string                 `json:"id"`
	Name     string                 `json:"name"`
	Protocol string                 `json:"protocol"`
	Location BowtieResourceLocation `json:"location"`
	Ports    BowtieResourcePorts    `json:"ports"`
}

type BowtieResourceGroup

type BowtieResourceGroup struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Inherited []string `json:"inherited"`
	Resources []string `json:"resources"`
}

type BowtieResourceLocation

type BowtieResourceLocation struct {
	Untagged *BowtieResourceLocationUntagged
	Tagged   *BowtieResourceLocationTagged
}

TODO: This can be collapsed down into the tagged-only variant once the old style API is sunset.

func (BowtieResourceLocation) MarshalJSON added in v0.6.0

func (rl BowtieResourceLocation) MarshalJSON() ([]byte, error)

func (*BowtieResourceLocation) UnmarshalJSON added in v0.6.0

func (rl *BowtieResourceLocation) UnmarshalJSON(data []byte) error

type BowtieResourceLocationTagged added in v0.6.0

type BowtieResourceLocationTagged struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type BowtieResourceLocationUntagged added in v0.6.0

type BowtieResourceLocationUntagged struct {
	IP   string `json:"ip,omitempty"`
	CIDR string `json:"cidr,omitempty"`
	DNS  string `json:"dns,omitempty"`
}

type BowtieResourcePortCollection

type BowtieResourcePortCollection struct {
	Ports []int64 `json:"ports,omitempty"`
}

type BowtieResourcePorts

type BowtieResourcePorts struct {
	Range      []int64                       `json:"range,omitempty"`
	Collection *BowtieResourcePortCollection `json:"collection,omitempty"`
}

type BowtieUser

type BowtieUser struct {
	ID                string `json:"id"`
	Name              string `json:"name,omitempty"`
	Email             string `json:"email,omitempty"`
	AuthzDevices      *bool  `json:"authz_devices,omitempty"`
	AuthzPolicies     *bool  `json:"authz_policies,omitempty"`
	AuthzControlPlane *bool  `json:"authz_control_plane,omitempty"`
	AuthzUsers        *bool  `json:"authz_users,omitempty"`
	Status            string `json:"status,omitempty"`
	Role              string `json:"role,omitempty"`
}

type Client

type Client struct {
	HTTPClient       *http.Client
	Tagged_locations bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host, username, password string, lazy_auth bool, tagged_locations bool) (*Client, error)

func (*Client) AddUserToGroup

func (c *Client) AddUserToGroup(groupID string, userIDs []string) (*ModifyUserGroupResponse, error)

func (*Client) CreateSite

func (c *Client) CreateSite(id string, name string) error

func (*Client) DeleteDNS

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

func (*Client) DeleteDNSBlockList added in v0.4.0

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

func (*Client) DeleteDevice

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

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(groupID string) error

func (*Client) DeletePolicy

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

func (*Client) DeleteResource

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

func (*Client) DeleteResourceGroup

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

func (*Client) DeleteSite

func (c *Client) DeleteSite(siteID string) error

func (*Client) DeleteSiteRange

func (c *Client) DeleteSiteRange(siteID, id string) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id string) error

func (*Client) DisableUser

func (c *Client) DisableUser(ctx context.Context, id string) error

func (*Client) FindSiteRange added in v0.5.3

func (c *Client) FindSiteRange(site *Site, id string) (*RoutableRange, error)

func (*Client) GetDNS

func (c *Client) GetDNS() (map[string]DNS, error)

func (*Client) GetDNSBlockLists added in v0.4.0

func (c *Client) GetDNSBlockLists() (map[string]DNSBlockList, error)

func (*Client) GetGroups added in v0.5.3

func (c *Client) GetGroups() (map[string]Group, error)

func (*Client) GetOrganization

func (c *Client) GetOrganization() (*Organization, error)

func (*Client) GetPoliciesAndResources

func (c *Client) GetPoliciesAndResources() (*PoliciesEndpointResponse, error)

func (*Client) GetPolicy

func (c *Client) GetPolicy(id string) (BowtiePolicy, error)

func (*Client) GetResourceGroups added in v0.5.3

func (c *Client) GetResourceGroups() (map[string]BowtieResourceGroup, error)

func (*Client) GetResources added in v0.5.3

func (c *Client) GetResources() (map[string]BowtieResource, error)

func (*Client) GetSites added in v0.5.3

func (c *Client) GetSites() ([]Site, error)

func (*Client) GetUser added in v0.3.0

func (c *Client) GetUser(id string) (BowtieUser, error)

func (*Client) GetUserByEmail

func (c *Client) GetUserByEmail(ctx context.Context, email string) (BowtieUser, error)

func (*Client) GetUsers

func (c *Client) GetUsers() (map[string]BowtieUser, error)

func (*Client) ListDevices

func (c *Client) ListDevices() (map[string]Device, error)

func (*Client) ListGroups

func (c *Client) ListGroups() (map[string]Group, error)

func (*Client) ListSites

func (c *Client) ListSites() ([]Site, error)

func (*Client) ListUsersInGroup

func (c *Client) ListUsersInGroup(id string) (*Group, error)

func (*Client) Login

func (c *Client) Login() error

func (*Client) RemoveUserFromGroup

func (c *Client) RemoveUserFromGroup(groupID string, userIDs []string) (*ModifyUserGroupResponse, error)

func (*Client) SetGroupMembership

func (c *Client) SetGroupMembership(groupID string, users []string) error

func (*Client) UpsertDNS

func (c *Client) UpsertDNS(id, name string, serverAddrs []Server, includeOnlySites []string, isDNS64, isCounted, isLog, isDropA, isDropAll, isSearchDomain bool, exlude []DNSExclude) error

func (*Client) UpsertDNSBlockList added in v0.4.0

func (c *Client) UpsertDNSBlockList(id string, name string, upstream string, override_to_allow string) error

func (*Client) UpsertGroup

func (c *Client) UpsertGroup(id, name string) (string, error)

func (*Client) UpsertOrganization added in v0.5.0

func (c *Client) UpsertOrganization(name string, domain string) error

func (*Client) UpsertResource

func (c *Client) UpsertResource(id, name, protocol string, location BowtieResourceLocation, portRange, portCollection []int64) (BowtieResource, error)

func (*Client) UpsertResourceGroup

func (c *Client) UpsertResourceGroup(id, name string, resources, resource_groups []string) error

func (*Client) UpsertSite

func (c *Client) UpsertSite(id, name string) error

func (*Client) UpsertSiteRange

func (c *Client) UpsertSiteRange(siteID, id, name, description, cidr string, isV4, isV6 bool, weight, metric int64) error

func (*Client) UpsertUser added in v0.3.0

func (c *Client) UpsertUser(id, name, email, role string, authzPolicies, authzUsers, authzControlPlane, authzDevices, enabled bool) (string, error)

func (*Client) WhoAmI

func (c *Client) WhoAmI() (*Me, error)

type Controller

type Controller struct {
	ID                  string   `json:"id"`
	SiteID              string   `json:"site_id"`
	PublicAddress       string   `json:"public_address"`
	SyncAddress         string   `json:"sync_address"`
	SyncState           string   `json:"sync_state"`
	Status              string   `json:"status"`
	Features            []string `json:"features"`
	WireguardPort       int      `json:"wireguard_port"`
	PublicKey           string   `json:"public_key"`
	HTTPSEndpoint       string   `json:"https_endpoint"`
	PersistentKeepalive int      `json:"persistent_keepalive"`
	DeviceID            string   `json:"device_id"`
	IPV6                string   `json:"ipv6"`
}

type DNS

type DNS struct {
	ID               string                `json:"id"`
	Name             string                `json:"name"`
	IsDNS64          bool                  `json:"is_dns64"`
	Servers          map[string]Server     `json:"servers"`
	IncludeOnlySites []string              `json:"include_only_sites"`
	IsCounted        bool                  `json:"is_counted"`
	IsLog            bool                  `json:"is_log"`
	IsDropA          bool                  `json:"is_drop_a"`
	IsDropAll        bool                  `json:"is_drop_all"`
	IsSearchDomain   bool                  `json:"is_search_domain"`
	DNS64Exclude     map[string]DNSExclude `json:"dns64_exclude"`
}

type DNSBlockList added in v0.4.0

type DNSBlockList struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	Upstream        string `json:"upstream,omitempty"`
	OverrideToAllow string `json:"override_to_allow"`
}

type DNSExclude

type DNSExclude struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Order int64  `json:"order"`
}

type Device

type Device struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	IPV6            string `json:"ipv6"`
	PublicKey       string `json:"public_key"`
	Serial          string `json:"serial"`
	State           string `json:"state"`
	ControllerID    string `json:"controller_id"`
	OwnedByOrg      string `json:"owned_by_org"`
	AssignedToUser  string `json:"assigned_to_user"`
	DeviceType      string `json:"device_type"`
	DeviceOS        string `json:"device_os"`
	LastSeen        string `json:"last_seen"`
	LastSeenVersion string `json:"last_seen_version"`
}

type DevicePayload

type DevicePayload struct {
	Devices map[string]Device `json:"devices"`
}

type Group

type Group struct {
	ID    string   `json:"id"`
	Name  string   `json:"name"`
	Users []string `json:"users,omitempty"`
}

type Me

type Me struct {
	User    User `json:"user"`
	Devices map[string]Device
}

type ModifyUserGroupPayload

type ModifyUserGroupPayload struct {
	GroupID string              `json:"group_id"`
	Users   []map[string]string `json:"users"`
}

type ModifyUserGroupResponse

type ModifyUserGroupResponse struct {
	Users map[string]bool `json:"users"`
}

type Organization

type Organization struct {
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Domain     string         `json:"domain"`
	DNS        map[string]DNS `json:"dns"`
	IPV6Ranges []string       `json:"ipv6_ranges"`
	Sites      []Site         `json:"sites"`
}

type OrganizationPayload added in v0.5.0

type OrganizationPayload struct {
	Name   string `json:"name"`
	Domain string `json:"domain"`
}

type PoliciesEndpointResponse

type PoliciesEndpointResponse struct {
	Policies       map[string]BowtiePolicy        `json:"policies"`
	ResourceGroups map[string]BowtieResourceGroup `json:"resource_groups"`
	Resources      map[string]BowtieResource      `json:"resources"`
}

type RoutableRange

type RoutableRange struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Range       string `json:"range"`
	Weight      int64  `json:"weight"`
	Metric      int64  `json:"metric"`
	Description string `json:"description"`
	ISV4        bool   `json:"is_v4,omitempty"`
	ISV6        bool   `json:"is_v6,omitempty"`
}

type Server

type Server struct {
	ID    string `json:"id"`
	Addr  string `json:"addr"`
	Order int64  `json:"order"`
}

type SetUserGroupMembershipPayload

type SetUserGroupMembershipPayload struct {
	Users []map[string]string `json:"users"`
}

type Site

type Site struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	RoutableRangesV4 []RoutableRange `json:"routeable_ranges_v4,omitempty"`
	RouteRangesV6    []RoutableRange `json:"routeable_ranges_v6,omitempty"`
	Controllers      []Controller    `json:"controllers,omitempty"`
}

func FindSite added in v0.5.3

func FindSite(siteID string, sites []Site) (*Site, error)

type SiteUpsertPayload

type SiteUpsertPayload struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type User

type User struct {
	ID                string `json:"id"`
	Name              string `json:"name"`
	Email             string `json:"email"`
	AuthZDevices      bool   `json:"authz_devices"`
	AuthZPolicies     bool   `json:"authz_policies"`
	AuthZControlPanel bool   `json:"authz_control_panel"`
	AuthZUsers        bool   `json:"authz_users"`
	Role              string `json:"role"`
}

Jump to

Keyboard shortcuts

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