client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIDomain = "%s.twingate.com"
	APIPath   = "api"
	Path      = "graphql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ListUsers(ctx context.Context, pagination string) (*UsersResponse, error)
	ListRoles(ctx context.Context, pagination string) ([]*Role, error)
	ListGroups(ctx context.Context, pagination string) (*GroupResourcesResponse, error)
	ListRoleGrants(ctx context.Context, roleID string, pagination string) (*RoleGrantsResponse, error)
	ListGroupGrants(ctx context.Context, groupID string, pagination string) (*GroupGrantsResponse, error)
}

type ConnectorClient

type ConnectorClient struct {
	Domain string
	Client *http.Client
	ApiKey string
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, apiKey string, domain string) (*ConnectorClient, error)

func (*ConnectorClient) GrantGroupMembership

func (c *ConnectorClient) GrantGroupMembership(ctx context.Context, groupID string, userID string) (*GrantEntitlementResponse, error)

func (*ConnectorClient) ListGroupGrants

func (c *ConnectorClient) ListGroupGrants(ctx context.Context, groupID string) (*GroupGrantsResponse, error)

func (*ConnectorClient) ListGroups

func (c *ConnectorClient) ListGroups(ctx context.Context, pagination string, pageSize uint32) (*GroupResourcesResponse, error)

func (*ConnectorClient) ListRoleGrants

func (c *ConnectorClient) ListRoleGrants(ctx context.Context, roleID string, pagination string, pageSize uint32) (*RoleGrantsResponse, error)

func (*ConnectorClient) ListRoles

func (c *ConnectorClient) ListRoles(ctx context.Context) ([]*Role, error)

func (*ConnectorClient) ListUsers

func (c *ConnectorClient) ListUsers(ctx context.Context, pagination string, pageSize uint32) (*UsersResponse, error)

func (*ConnectorClient) RevokeGroupMembership

func (c *ConnectorClient) RevokeGroupMembership(ctx context.Context, groupID string, userID string) (*RevokeEntitlementResponse, error)

type GrantAndRevokeGroupResponse

type GrantAndRevokeGroupResponse struct {
	Data struct {
		GroupUpdate struct {
			Ok    bool    `json:"ok"`
			Error *string `json:"error"`
		} `json:"groupUpdate"`
	} `json:"data"`
}

type GrantEntitlementResponse

type GrantEntitlementResponse struct {
	RateLimitDescription *v2.RateLimitDescription
}

type Group

type Group struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	IsActive bool   `json:"isActive,omitempty"`
}

type GroupGrant

type GroupGrant struct {
	GroupID     string
	PrincipalID string
}

type GroupGrantsResponse

type GroupGrantsResponse struct {
	Grants               []GroupGrant
	RateLimitDescription *v2.RateLimitDescription
	Pagination           string
}

type GroupMembersQueryResponse

type GroupMembersQueryResponse struct {
	Data struct {
		Group struct {
			Id    string `json:"id"`
			Name  string `json:"name"`
			Users struct {
				Edges []struct {
					User *User `json:"node"`
				} `json:"edges"`
			} `json:"users"`
		} `json:"group"`
	} `json:"data"`
}

type GroupResourcesResponse

type GroupResourcesResponse struct {
	Groups               []Group
	RateLimitDescription *v2.RateLimitDescription
	Pagination           string
}

type GroupsQueryResponse

type GroupsQueryResponse struct {
	Data struct {
		Groups struct {
			Edges []struct {
				Group *Group `json:"node"`
			} `json:"edges"`
			Pagination PageInfo `json:"pageInfo"`
		} `json:"groups"`
	} `json:"data"`
}

type InfoResponse

type InfoResponse struct {
	User                 *User
	RateLimitDescription *v2.RateLimitDescription
}

type PageInfo

type PageInfo struct {
	EndCursor   string `json:"endCursor"`
	HasNextPage bool   `json:"hasNextPage"`
}

type Query

type Query struct {
	Query     string            `json:"query"`
	Variables map[string]string `json:"variables,omitempty"`
}

type RevokeEntitlementResponse

type RevokeEntitlementResponse struct {
	RateLimitDescription *v2.RateLimitDescription
}

type Role

type Role struct {
	Name string
	Id   string
}

type RoleGrant

type RoleGrant struct {
	RoleID      string
	PrincipalID string
}

type RoleGrantsQueryResponse

type RoleGrantsQueryResponse struct {
	Data struct {
		Users []struct {
			Id       string `json:"id"`
			Email    string `json:"email"`
			Fullname string `json:"fullname"`
			Roles    []struct {
				Id int `json:"id"`
			} `json:"roles"`
		} `json:"users"`
	} `json:"data"`
}

type RoleGrantsResponse

type RoleGrantsResponse struct {
	Grants               []RoleGrant
	RateLimitDescription *v2.RateLimitDescription
	Pagination           string
}

type RolesQueryResponse

type RolesQueryResponse struct {
	Data struct {
		Roles []*Role `json:"roles"`
	} `json:"data"`
}

type User

type User struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	IsAdmin   bool   `json:"isAdmin"`
}

type UsersQueryResponse

type UsersQueryResponse struct {
	Data struct {
		Users struct {
			Edges []struct {
				User *User `json:"node"`
			} `json:"edges"`
			Pagination PageInfo `json:"pageInfo"`
		} `json:"users"`
	} `json:"data"`
}

type UsersResponse

type UsersResponse struct {
	Users                []*User
	RateLimitDescription *v2.RateLimitDescription
	Pagination           string
}

Jump to

Keyboard shortcuts

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