client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Details map[string]interface{} `json:"details,omitempty"` // Additional arbitrary metadata related to the actor.
	ID      string                 `json:"id"`                // A string representing the identity of the actor.
}

Actor specifies the identity that performed the action being logged. This may be a user or machine client. Consumers can filter based on this attribute.

type ApptrailEvent

type ApptrailEvent struct {
	Actor        *Actor                 `json:"actor,omitempty"`        // Actor specifies the identity that performed the action being logged. This may be a user; or machine client. Consumers can filter based on this attribute.
	Context      *Context               `json:"context,omitempty"`      // The context object contains fields that give customers additional information about the; environment in and source from which the activity recorded occurred
	EventDetails map[string]interface{} `json:"eventDetails,omitempty"` // Any additional custom information as a JSON object can be included in this field.
	EventName    string                 `json:"eventName"`              // The name of the event as a string. You should represent unique events with unique names.; For example if you are adding audit logs to an API, event names could correspond to your; API methods.
	EventTime    string                 `json:"eventTime"`              // The time the event occurred. Formatted as an ISO 8601 formatted string, e.g.; 2021-12-06T16:09:38Z.
	Resources    []Resource             `json:"resources,omitempty"`    // If applicable, contains information about the relevant resources that the action this; event is recording is related to.
	Tags         map[string]string      `json:"tags,omitempty"`         // Tags are key value metadata that you associate with events. Users can search and filter; events based on these tags.
	TenantID     string                 `json:"tenantId"`               // The ID of the tenant this event is associated with and will be delivered to. For more on; tenants @see https://apptrail.com/docs/applications/guide/working-with-tenants.
}

An Apptrail event is a record of a an activity performed on your customer resources in your application.

@see https://apptrail.com/docs/applications/guide/working-with-events/overview

func UnmarshalApptrailEvent

func UnmarshalApptrailEvent(data []byte) (ApptrailEvent, error)

func (*ApptrailEvent) Marshal

func (r *ApptrailEvent) Marshal() ([]byte, error)

type ApptrailEventsClient

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

The Apptrail Events Client allows you to send audit logs to Apptrail.

See Also

Working with events: https://apptrail.com/docs/applications/guide/working-with-events/overview

Sending events: https://apptrail.com/docs/applications/guide/working-with-events/sending-events

func NewApptrailEventsClient

func NewApptrailEventsClient(config ApptrailEventsClientConfig) (client *ApptrailEventsClient, err error)

Create a new Apptrail Events Client.

func (*ApptrailEventsClient) PutEvent

func (client *ApptrailEventsClient) PutEvent(event *ApptrailEvent) error

Send a single audit event to log to Apptrail.

Arguments

event: An Apptrail event. For details on the Apptrail event format, see https://apptrail.com/applications/guide/event-format

Errors

If an error occurs during sending events, e.g in the case of server errors or client side issues. The SDK includes automatic retries with exponential backoff but you should handle errors and sideline audit logs, especially for critical audit data.

func (*ApptrailEventsClient) PutEvents

func (client *ApptrailEventsClient) PutEvents(events []*ApptrailEvent) error

Send a list of up to 1000 audit events to log to Apptrail.

Arguments

events: A list of Apptrail events. For details on the Apptrail event format, see https://apptrail.com/applications/guide/event-format

Errors

If an error occurs during sending events, e.g in the case of server errors or client side issues. The SDK includes automatic retries with exponential backoff but you should handle errors and sideline audit logs, especially for critical audit data.

type ApptrailEventsClientConfig

type ApptrailEventsClientConfig struct {
	// Your Apptrail secret API Key. You can generate and retrieve API Keys from the Apptrail Dashboard.
	//
	// See: https://apptrail.com/docs/applications/guide/dashboard/managing-api-keys
	ApiKey string
	// The Apptrail region to send events to. Create a single instance of `ApptrailEventsClient` per region.
	// Regions are specified as strings, e.g. `us-west-2`.
	Region string
}

Configuration for the Apptrail Events client.

type Context

type Context struct {
	SourceIPAddress *string `json:"sourceIpAddress,omitempty"` // The IP address the activity/request being recorded was made from.
	UserAgent       *string `json:"userAgent,omitempty"`       // The agent through which the request was made, e.g. `Mozilla/5.0` or; `python-requests/2.20.1`.
}

The context object contains fields that give customers additional information about the environment in and source from which the activity recorded occurred

type Resource

type Resource struct {
	Details map[string]interface{} `json:"details,omitempty"` // Additional arbitrary metadata related to the resource.
	ID      string                 `json:"id"`                // A unique identifier for this resource.
}

A resource that was accessed, modified, or is related to the event being recorded.

Jump to

Keyboard shortcuts

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