client

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client implements a small Airlock Digital REST API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolInt

func BoolInt(v bool) string

func IntString

func IntString(v int64) string

func Values

func Values(kv ...string) url.Values

Types

type APIError

type APIError struct {
	StatusCode int
	Path       string
	AirlockErr string
}

APIError is returned for non-successful Airlock API calls. Response bodies are not included because they may contain environment data.

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client talks to the Airlock Digital REST API.

func New

func New(cfg Config) (*Client, error)

New returns a configured API client.

func (*Client) AddApplicationHash

func (c *Client) AddApplicationHash(ctx context.Context, applicationID string, hashes []string) error

func (*Client) AddBaselineHash

func (c *Client) AddBaselineHash(ctx context.Context, baselineID string, hashes []string) error

func (*Client) AddBlocklistHash

func (c *Client) AddBlocklistHash(ctx context.Context, hashes []string) error

func (*Client) AddGroupPath

func (c *Client) AddGroupPath(ctx context.Context, groupID, path, comment string) error

func (*Client) AddGroupProcess

func (c *Client) AddGroupProcess(ctx context.Context, groupID, process, typ, comment string) error

func (*Client) AddGroupPublisher

func (c *Client) AddGroupPublisher(ctx context.Context, groupID, publisher, comment string) error

func (*Client) AddHash

func (c *Client) AddHash(ctx context.Context, sha256, path string) error

func (*Client) CreateApplication

func (c *Client) CreateApplication(ctx context.Context, name, version, categoryID string) (string, error)

func (*Client) CreateApplicationCategory

func (c *Client) CreateApplicationCategory(ctx context.Context, name, parentID string) (string, error)

func (*Client) CreateBaseline

func (c *Client) CreateBaseline(ctx context.Context, name string) (string, error)

func (*Client) CreateBlocklist

func (c *Client) CreateBlocklist(ctx context.Context, name string) (string, error)

func (*Client) CreateGroup

func (c *Client) CreateGroup(ctx context.Context, name, parent string, hidden bool) (string, error)

func (*Client) DeleteApplication

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

func (*Client) DeleteApplicationCategory

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

func (*Client) DeleteBaseline

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

func (*Client) DeleteBlocklist

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

func (*Client) DeleteGroup

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

func (*Client) GetGroupPolicy

func (c *Client) GetGroupPolicy(ctx context.Context, groupID string) (*Policy, error)

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context) ([]Named, error)

func (*Client) ListApplicationCategories

func (c *Client) ListApplicationCategories(ctx context.Context) ([]Named, error)

func (*Client) ListApplications

func (c *Client) ListApplications(ctx context.Context) ([]Named, error)

func (*Client) ListBaselines

func (c *Client) ListBaselines(ctx context.Context) ([]Named, error)

func (*Client) ListBlocklists

func (c *Client) ListBlocklists(ctx context.Context) ([]Named, error)

func (*Client) ListGroups

func (c *Client) ListGroups(ctx context.Context) ([]Named, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, params url.Values, body any, out any) error

Post sends Airlock's POST-style API request. Parameters are encoded as query parameters unless body is non-nil.

func (*Client) RemoveApplicationHash

func (c *Client) RemoveApplicationHash(ctx context.Context, applicationID string, hashes []string) error

func (*Client) RemoveBaselineHash

func (c *Client) RemoveBaselineHash(ctx context.Context, baselineID string, hashes []string) error

func (*Client) RemoveBlocklistHash

func (c *Client) RemoveBlocklistHash(ctx context.Context, hashes []string) error

func (*Client) RemoveGroupPath

func (c *Client) RemoveGroupPath(ctx context.Context, groupID, path string) error

func (*Client) RemoveGroupProcess

func (c *Client) RemoveGroupProcess(ctx context.Context, groupID, process, typ string) error

func (*Client) RemoveGroupPublisher

func (c *Client) RemoveGroupPublisher(ctx context.Context, groupID, publisher string) error

func (*Client) SetGroupApplication

func (c *Client) SetGroupApplication(ctx context.Context, groupID, applicationID string, approved bool) error

func (*Client) SetGroupBaseline

func (c *Client) SetGroupBaseline(ctx context.Context, groupID, baselineID string, approved bool) error

func (*Client) SetGroupBlocklist

func (c *Client) SetGroupBlocklist(ctx context.Context, groupID, blocklistID string, approved bool, audit bool) error

type Config

type Config struct {
	URL       string
	APIKey    string
	Insecure  bool
	UserAgent string
	Timeout   time.Duration
}

Config holds Airlock client configuration.

type Named

type Named struct {
	ID    string            `json:"id"`
	Name  string            `json:"name"`
	Attrs map[string]string `json:"attrs,omitempty"`
}

Named is the common list shape used by provider resources and data sources.

func FindByID

func FindByID(items []Named, id string) (Named, bool)

func FindByName

func FindByName(items []Named, name string) (Named, bool)

type Policy

type Policy struct {
	GroupID      string
	Applications []Named
	Baselines    []Named
	Blocklists   []Named
	Paths        []Named
	Processes    []Named
	Publishers   []Named
}

Jump to

Keyboard shortcuts

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