Documentation
¶
Overview ¶
Package api is a client for the NeuralTrust console's CLI API, /api/cli/v1: organizations, private TrustGate and TrustGuard instances, and the tokens an install needs. Responses carrying tokens are never logged.
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, p Product, org, name string) (*Instance, error)
- func (c *Client) Finalize(ctx context.Context, p Product, org, id, endpoint string) error
- func (c *Client) InstallConfig(ctx context.Context, p Product, org, id string, rotate bool) (*InstallConfig, error)
- func (c *Client) Instances(ctx context.Context, p Product, org string) ([]Instance, error)
- func (c *Client) Me(ctx context.Context) (*Me, error)
- func (c *Client) Orgs(ctx context.Context) ([]Org, error)
- type Error
- type InstallConfig
- type Instance
- type Me
- type Org
- type Product
- type Tokens
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls the CLI API of one console.
func (*Client) Create ¶
Create creates a private instance. A retry after a lost answer reuses the idempotency key, so the console returns the same instance.
func (*Client) InstallConfig ¶
func (c *Client) InstallConfig(ctx context.Context, p Product, org, id string, rotate bool) (*InstallConfig, error)
InstallConfig issues credentials for an instance. With rotate, the credentials issued before stop working.
type Error ¶
type Error struct {
Status int `json:"-"`
Code string `json:"code"`
Message string `json:"message"`
}
Error is an error answer from the console.
type InstallConfig ¶
type InstallConfig struct {
TenantID string `json:"tenantId"`
ConfigSyncToken string `json:"configSyncToken"`
EnrolmentToken string `json:"enrolmentToken"`
// ConfigSyncEndpoint and DataBridgeAddr are where the console's control
// plane listens, host:port: the tokens are valid only there.
ConfigSyncEndpoint string `json:"configSyncGrpcEndpoint,omitempty"`
DataBridgeAddr string `json:"databridgeAddr,omitempty"`
}
InstallConfig are the credentials an install of one instance needs.
func (InstallConfig) GoString ¶
func (c InstallConfig) GoString() string
GoString keeps the tokens out of %#v.
func (InstallConfig) String ¶
func (c InstallConfig) String() string
String keeps the tokens out of any formatted output.
type Instance ¶
type Instance struct {
ID string `json:"id"`
Name string `json:"name"`
Region string `json:"region,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
CreatedAt time.Time `json:"createdAt,omitzero"`
}
Instance is a private TrustGate or TrustGuard.
type Me ¶
type Me struct {
ID string `json:"id"`
Email string `json:"email"`
Region string `json:"region"`
Org *Org `json:"org,omitempty"`
}
Me is the signed-in user, and the organization chosen at sign-in.
type Org ¶
type Org struct {
ID string `json:"id"`
Name string `json:"name"`
Region string `json:"region"`
Role string `json:"role"`
}
Org is an organization the user belongs to.