Documentation ¶
Overview ¶
Package sdk provide an abstraction for communication with API.
Index ¶
- Constants
- func IsObjectAvailable(o Object) bool
- type AnyJSONObj
- type Client
- func (c *Client) ApplyObjects(objects []AnyJSONObj) error
- func (c Client) Authorization() string
- func (c *Client) DeleteObjects(objects []AnyJSONObj) error
- func (c *Client) DeleteObjectsByName(object Object, names ...string) error
- func (c *Client) GetAWSExternalID() (string, error)
- func (c *Client) GetAgentCredentials(agentsName string) (M2MAppCredentials, error)
- func (c *Client) GetObject(object Object, timestamp string, filterLabel map[string][]string, ...) ([]AnyJSONObj, error)
- func (c *Client) Organization() string
- func (c *Client) PostMetrics(ctx context.Context, points models.Points, accessToken string) error
- func (c *Client) SetAuth(authorization string)
- func (c *Client) SetOrganization(organization string)
- func (c Client) UserAgent() string
- type M2MAppCredentials
- type Object
- type Operation
Constants ¶
const ( HeaderOrganization = "organization" HeaderProject = "project" HeaderAuthorization = "Authorization" HeaderUserAgent = "User-Agent" HeaderClientID = "ClientID" )
HTTP headers keys used across app
const ( QueryKeyName = "name" QueryKeyTime = "t" QueryKeyFrom = "from" QueryKeyTo = "to" QueryKeySeries = "series" QueryKeySteps = "steps" QueryKeySlo = "slo" QueryKeyTimeWindow = "window" QueryKeyPercentiles = "q" QueryKeyPermissionFilter = "pf" QueryKeyLabelsFilter = "labels" QueryKeyTextSearch = "text_search" QueryServiceName = "service_name" )
HTTP GET query keys used across app
const DefaultProject = "default"
DefaultProject is a value of the default project.
const ProjectsWildcard = "*"
ProjectsWildcard is used in HeaderProject when requesting for all projects.
const (
Timeout = 10 * time.Second
)
Timeout use for every request
Variables ¶
This section is empty.
Functions ¶
func IsObjectAvailable ¶
IsObjectAvailable returns true if given object is available in SDK.
Types ¶
type AnyJSONObj ¶
type AnyJSONObj = map[string]interface{}
AnyJSONObj can store a generic representation on any valid JSON.
func Annotate ¶
func Annotate( object AnyJSONObj, annotations map[string]string, project string, isProjectOverwritten bool, ) (AnyJSONObj, error)
Annotate injects to objects additional fields with values passed as map in parameter If objects does not contain project - default value is added.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents API high level client.
func NewClient ¶
func NewClient(ingestURL, intakeURL, organization, project, userAgent string, client *http.Client) (Client, error)
NewClient returns fully configured instance of API high level client with default timeout.
func NewClientWithTimeout ¶
func NewClientWithTimeout( ingestURL, intakeURL, organization, project, userAgent string, client *http.Client, ) (Client, error)
NewClientWithTimeout returns fully configured instance of API high level client with timeout used for every request.
func (*Client) ApplyObjects ¶
func (c *Client) ApplyObjects(objects []AnyJSONObj) error
ApplyObjects applies (create or update) list of objects passed as argument via API.
func (Client) Authorization ¶
Authorization returns authorization header value that is used in the requests.
func (*Client) DeleteObjects ¶
func (c *Client) DeleteObjects(objects []AnyJSONObj) error
DeleteObjects deletes list of objects passed as argument via API.
func (*Client) DeleteObjectsByName ¶
DeleteObjectsByName makes a call to endpoint for deleting objects with passed names and object types.
func (*Client) GetAWSExternalID ¶
func (*Client) GetAgentCredentials ¶ added in v0.2.0
func (c *Client) GetAgentCredentials(agentsName string) (M2MAppCredentials, error)
GetAgentCredentials gets agent credentials from Okta.
func (*Client) GetObject ¶
func (c *Client) GetObject( object Object, timestamp string, filterLabel map[string][]string, names ...string, ) ([]AnyJSONObj, error)
GetObject returns array of supported type of Objects, when names are passed - query for these names otherwise returns list of all available objects.
func (*Client) Organization ¶
Organization gets an organization that will be used in future requests.
func (*Client) PostMetrics ¶
func (*Client) SetOrganization ¶
SetOrganization sets an organization which should used in future requests.
type M2MAppCredentials ¶ added in v0.2.0
type M2MAppCredentials struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` }
M2MAppCredentials is used for storing client_id and client_secret.
type Object ¶
type Object string
Object represents available objects in API to perform operations.
const ( ObjectSLO Object = "SLO" ObjectService Object = "Service" ObjectAgent Object = "Agent" ObjectAlertPolicy Object = "AlertPolicy" ObjectAlertSilence Object = "AlertSilence" // ObjectAlert represents object used only to return list of Alerts. Applying and deleting alerts is disabled. ObjectAlert Object = "Alert" // ObjectProject represents object used only to return list of Projects. // Applying and deleting projects is not supported. ObjectProject Object = "Project" ObjectAlertMethod Object = "AlertMethod" // ObjectMetricSource represents ephemeral object used only to return concatenated list of Agents and Directs. ObjectMetricSource Object = "MetricSource" ObjectDirect Object = "Direct" ObjectDataExport Object = "DataExport" ObjectUsageSummary Object = "UsageSummary" ObjectRoleBinding Object = "RoleBinding" ObjectSLOErrorBudgetStatus Object = "SLOErrorBudgetStatus" ObjectAnnotation Object = "Annotation" )
List of available objects in API.
func ObjectName ¶
type Operation ¶
type Operation int
Operation is an enum that represents an operation that can be done over an object kind.
func ParseOperation ¶
ParseOperation return Operation matching given string.
Directories ¶
Path | Synopsis |
---|---|
Package credentials provides utilities for working with customer identity credentials and the credentials file.
|
Package credentials provides utilities for working with customer identity credentials and the credentials file. |
Package ts provides basic types work with time series in SDK
|
Package ts provides basic types work with time series in SDK |