segment

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseUrl = "https://api.segmentapis.com/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client, token string) *Client

func (*Client) AddGroupMembers

func (c *Client) AddGroupMembers(ctx context.Context, groupId, userEmail string) error

AddGroupMembers adds user to a group.

func (*Client) GetGroup added in v0.0.2

func (c *Client) GetGroup(ctx context.Context, groupID string) (*Group, error)

GetGroup returns single group details.

func (*Client) GetUser added in v0.0.2

func (c *Client) GetUser(ctx context.Context, userID string) (*User, error)

GetUser returns single user details.

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(ctx context.Context) (*Workspace, error)

GetWorkspace returns workspace of a current token.

func (*Client) ListFunctions added in v0.0.2

func (c *Client) ListFunctions(ctx context.Context, cursor string, fnType string) ([]Function, string, error)

ListFunctions returns a list of all functions.

func (*Client) ListGroupMembers

func (c *Client) ListGroupMembers(ctx context.Context, groupId, cursor string) ([]User, string, error)

ListGroupMembers returns a list of all user group members.

func (*Client) ListGroups

func (c *Client) ListGroups(ctx context.Context, cursor string) ([]Group, string, error)

ListGroups returns a list of all user groups.

func (*Client) ListRoles

func (c *Client) ListRoles(ctx context.Context, cursor string) ([]Role, string, error)

ListRoles returns a list of all roles.

func (*Client) ListSources added in v0.0.2

func (c *Client) ListSources(ctx context.Context, cursor string) ([]Source, string, error)

ListSources returns a list of all sources.

func (*Client) ListSpaces added in v0.0.2

func (c *Client) ListSpaces(ctx context.Context, cursor string) ([]Space, string, error)

ListSpaces returns a list of all spaces.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, cursor string) ([]User, string, error)

ListUsers returns a list of all users.

func (*Client) ListWarehouses added in v0.0.2

func (c *Client) ListWarehouses(ctx context.Context, cursor string) ([]Warehouse, string, error)

ListWarehouses returns a list of all warehouses.

func (*Client) RemoveGroupMember

func (c *Client) RemoveGroupMember(ctx context.Context, groupId, userEmail string) error

RemoveGroupMember removes member from the group.

func (*Client) UpdatePermissions added in v0.0.2

func (c *Client) UpdatePermissions(ctx context.Context, principalId, principalType string, newPermissions []Permission) error

UpdatePermissions updates permissions for a user or a group.

type Error

type Error struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

type Function added in v0.0.2

type Function struct {
	ID                string    `json:"id"`
	WorkspaceID       string    `json:"workspaceId"`
	DisplayName       string    `json:"displayName"`
	Description       string    `json:"description"`
	LogoURL           string    `json:"logoUrl"`
	Code              string    `json:"code"`
	CreatedAt         string    `json:"createdAt"`
	CreatedBy         string    `json:"createdBy"`
	PreviewWebhookURL string    `json:"previewWebhookUrl"`
	Settings          []Setting `json:"settings"`
	Buildpack         string    `json:"buildpack"`
	CatalogID         string    `json:"catalogId"`
	BatchMaxCount     int64     `json:"batchMaxCount"`
	ResourceType      string    `json:"resourceType"`
}

type Group

type Group struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	MemberCount int64        `json:"memberCount"`
	Permissions []Permission `json:"permissions,omitempty"`
}

type Logos added in v0.0.2

type Logos struct {
	Default string `json:"default"`
	Alt     string `json:"alt"`
}

type Metadata added in v0.0.2

type Metadata struct {
	ID                 string   `json:"id"`
	Slug               string   `json:"slug"`
	Name               string   `json:"name"`
	Categories         []string `json:"categories"`
	Description        string   `json:"description"`
	Options            []Option `json:"options"`
	IsCloudEventSource bool     `json:"isCloudEventSource"`
	Logos              Logos    `json:"logos"`
}

type Option added in v0.0.2

type Option struct {
	Name     string `json:"name"`
	Required bool   `json:"required"`
	Type     string `json:"type"`
}

type Pagination

type Pagination struct {
	Current      string `json:"current"`
	Next         string `json:"next,omitempty"`
	TotalEntries int64  `json:"totalEntries"`
}

type Payload

type Payload struct {
	Emails []string `json:"emails"`
}

type Permission

type Permission struct {
	RoleID    string     `json:"roleId"`
	RoleName  string     `json:"roleName,omitempty"`
	Resources []Resource `json:"resources"`
}

type PermissionRes added in v0.0.2

type PermissionRes struct {
	PolicyID    string     `json:"policyId"`
	RoleName    string     `json:"roleName"`
	RoleID      string     `json:"roleId"`
	SubjectID   string     `json:"subjectId"`
	SubjectType string     `json:"subjectType"`
	Resources   []Resource `json:"resources"`
}

type PermissionsPayload added in v0.0.2

type PermissionsPayload struct {
	Permissions []Permission `json:"permissions"`
}

type Resource

type Resource struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type Role

type Role struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Resources   []Resource `json:"resources,omitempty"`
}

type Setting added in v0.0.2

type Setting struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	Description string `json:"description"`
	Type        string `json:"type"`
	Required    bool   `json:"required"`
	Sensitive   bool   `json:"sensitive"`
}

type Source added in v0.0.2

type Source struct {
	ID          string        `json:"id"`
	Slug        string        `json:"slug"`
	Name        string        `json:"name"`
	WorkspaceID string        `json:"workspaceId"`
	Enabled     bool          `json:"enabled"`
	WriteKeys   []string      `json:"writeKeys"`
	Metadata    Metadata      `json:"metadata"`
	Labels      []interface{} `json:"labels"`
}

type Space added in v0.0.2

type Space struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type User

type User struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Email       string       `json:"email"`
	Permissions []Permission `json:"permissions,omitempty"`
}

type Warehouse added in v0.0.2

type Warehouse struct {
	ID          string   `json:"id"`
	WorkspaceID string   `json:"workspaceId"`
	Enabled     bool     `json:"enabled"`
	Metadata    Metadata `json:"metadata"`
}

type Workspace

type Workspace struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

Jump to

Keyboard shortcuts

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