Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthServerDomain string
View Source
var ClientID string
These variables are injected at build time.
View Source
var ClientSecret string
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct {
// UserID is the ID or email for the user or service account.
UserID string `json:"user_id"`
// UserSecret is the secret for the user or service account.
UserSecret string `json:"user_secret"`
// The following fields are optional as the default behaviour
// is to use the equivalent variables defined at package level
// and injected at build time.
// ClientID is the oauth2 client ID.
ClientID string `json:"client_id,omitempty"`
// ClientSecret is the oauth2 client secret.
ClientSecret string `json:"client_secret,omitempty"`
// AuthServerDomain is the domain for the auth server.
AuthServerDomain string `json:"auth_server_domain,omitempty"`
}
Credentials defines the format of the credentials.json file.
func ParseCredentials ¶
func ParseCredentials(data []byte) (*Credentials, error)
ParseCredentials reads credentials into a struct used. Performs validations.
func (*Credentials) IsClientSet ¶
func (c *Credentials) IsClientSet() bool
IsClientSet returns whether the client credentials are set or not.
type PreflightClient ¶
type PreflightClient struct {
// contains filtered or unexported fields
}
PreflightClient can be used to talk to the Preflight backend.
func New ¶
func New(agentMetadata *api.AgentMetadata, credentials *Credentials, baseURL string) (*PreflightClient, error)
New creates a new client that uses OAuth2.
func NewWithNoAuth ¶ added in v0.1.20
func NewWithNoAuth(agentMetadata *api.AgentMetadata, baseURL string) (*PreflightClient, error)
NewWithNoAuth creates a new client with no authentication.
func (*PreflightClient) PostDataReadings ¶
func (c *PreflightClient) PostDataReadings(orgID string, readings []*api.DataReading) error
PostDataReadings sends a slice of readings to Preflight.
Click to show internal directories.
Click to hide internal directories.