Documentation ¶
Overview ¶
Package axiom implements Go bindings for the Axiom API.
Usage:
import "github.com/axiomhq/axiom-go/axiom" import "github.com/axiomhq/axiom-go/axiom/ingest" // When ingesting data import "github.com/axiomhq/axiom-go/axiom/otel" // When using OpenTelemetry import "github.com/axiomhq/axiom-go/axiom/query" // When constructing APL queries import "github.com/axiomhq/axiom-go/axiom/querylegacy" // When constructing legacy queries
Construct a new Axiom client, then use the various services on the client to access different parts of the Axiom API. The package automatically takes its configuration from the environment if not specified otherwise. Refer to NewClient for details. The token can be an api or personal token. The api token however, will just allow ingestion or querying into or from the datasets the token is valid for, depending on its assigned permissions.
To construct a client:
client, err := axiom.NewClient()
or with Option functions:
client, err := axiom.NewClient( axiom.SetToken("..."), axiom.SetOrganizationID("..."), )
Get the current authenticated user:
user, err := client.Users.Current(ctx)
NOTE: Every client method mapping to an API method takes a context.Context as its first parameter to pass cancellation signals and deadlines to requests. In case there is no context available, then context.Background can be used as a starting point.
For more code samples, check out the examples.
Example ¶
package main import ( "context" "fmt" "log" "github.com/axiomhq/axiom-go/axiom" ) func main() { client, err := axiom.NewClient() if err != nil { log.Fatal(err) } user, err := client.Users.Current(context.Background()) if err != nil { log.Fatal(err) } fmt.Printf("Hello %s!\n", user.Name) }
Output:
Index ¶
- Variables
- func AddURLOptions(s string, opt any) (string, error)
- func DefaultHTTPClient() *http.Client
- func DefaultHTTPTransport() http.RoundTripper
- func ValidateCredentials(ctx context.Context) error
- func ValidateEnvironment() error
- type Client
- func (c *Client) Call(ctx context.Context, method, path string, body, v any) error
- func (c *Client) Do(req *http.Request, v any) (*Response, error)
- func (c *Client) Ingest(ctx context.Context, id string, r io.Reader, typ ContentType, ...) (*ingest.Status, error)
- func (c *Client) IngestChannel(ctx context.Context, id string, events <-chan Event, options ...ingest.Option) (*ingest.Status, error)
- func (c *Client) IngestEvents(ctx context.Context, id string, events []Event, options ...ingest.Option) (*ingest.Status, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
- func (c *Client) Options(options ...Option) error
- func (c *Client) Query(ctx context.Context, apl string, options ...query.Option) (*query.Result, error)
- func (c *Client) QueryLegacy(ctx context.Context, id string, q querylegacy.Query, opts querylegacy.Options) (*querylegacy.Result, error)deprecated
- func (c *Client) ValidateCredentials(ctx context.Context) error
- type ContentEncoder
- type ContentEncoding
- type ContentType
- type Dataset
- type DatasetCreateRequest
- type DatasetUpdateRequest
- type DatasetsService
- func (s *DatasetsService) Create(ctx context.Context, req DatasetCreateRequest) (*Dataset, error)
- func (s *DatasetsService) Delete(ctx context.Context, id string) error
- func (s *DatasetsService) Get(ctx context.Context, id string) (*Dataset, error)
- func (s *DatasetsService) Ingest(ctx context.Context, id string, r io.Reader, typ ContentType, ...) (*ingest.Status, error)
- func (s *DatasetsService) IngestChannel(ctx context.Context, id string, events <-chan Event, options ...ingest.Option) (*ingest.Status, error)
- func (s *DatasetsService) IngestEvents(ctx context.Context, id string, events []Event, options ...ingest.Option) (*ingest.Status, error)
- func (s *DatasetsService) List(ctx context.Context) ([]*Dataset, error)
- func (s *DatasetsService) Query(ctx context.Context, apl string, options ...query.Option) (*query.Result, error)
- func (s *DatasetsService) QueryLegacy(ctx context.Context, id string, q querylegacy.Query, opts querylegacy.Options) (*querylegacy.Result, error)deprecated
- func (s *DatasetsService) Trim(ctx context.Context, id string, maxDuration time.Duration) (*TrimResult, error)
- func (s *DatasetsService) Update(ctx context.Context, id string, req DatasetUpdateRequest) (*Dataset, error)
- type Error
- type Event
- type License
- type Limit
- type LimitError
- type LimitScope
- type Option
- func SetAPITokenConfig(apiToken string) Option
- func SetClient(httpClient *http.Client) Option
- func SetNoEnv() Option
- func SetNoRetry() Option
- func SetOrganizationID(organizationID string) Option
- func SetPersonalTokenConfig(personalToken, organizationID string) Option
- func SetToken(accessToken string) Option
- func SetURL(baseURL string) Option
- func SetUserAgent(userAgent string) Option
- type Organization
- type OrganizationsService
- type PaymentStatus
- type Plan
- type Response
- type TrimResultdeprecated
- type User
- type UserRole
- type UsersService
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExists = errors.New("entity exists")
ErrExists is returned when the requested resource already exists.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the requested resource is not found.
var ErrUnauthenticated = errors.New("invalid authentication credentials")
ErrUnauthenticated is raised when the authentication on the request is not valid.
ErrUnauthorized is raised when the user or authentication token misses permissions to perform the requested operation.
var ErrUnknownContentEncoding = errors.New("unknown content encoding")
ErrUnknownContentEncoding is raised when the given ContentEncoding is not valid.
var ErrUnknownContentType = errors.New("unknown content type")
ErrUnknownContentType is raised when the given ContentType is not valid.
var ErrUnprivilegedToken = errors.New("using api token for non-ingest or non-query operation")
ErrUnprivilegedToken is raised when a Client tries to call an ingest or query endpoint with an api token configured.
Functions ¶
func AddURLOptions ¶ added in v0.15.0
AddURLOptions adds the parameters in opt as url query parameters to s. opt must be a struct whose fields may contain "url" tags.
Ref: https://github.com/google/go-github/blob/master/github/github.go#L232.
func DefaultHTTPClient ¶
DefaultHTTPClient returns the default http.Client used for making requests.
func DefaultHTTPTransport ¶ added in v0.13.0
func DefaultHTTPTransport() http.RoundTripper
DefaultHTTPTransport returns the default http.Client.Transport used by DefaultHTTPClient.
func ValidateCredentials ¶ added in v0.6.0
ValidateCredentials returns nil if the environment variables that configure a Client are valid. Otherwise, it returns an appropriate error. This function establishes a connection to the configured Axiom deployment.
func ValidateEnvironment ¶ added in v0.5.0
func ValidateEnvironment() error
ValidateEnvironment returns nil if the environment variables, needed to configure a new Client, are present and syntactically valid. Otherwise, it returns an appropriate error.
Types ¶
type Client ¶
type Client struct { // Services for communicating with different parts of the Axiom API. Datasets *DatasetsService Organizations *OrganizationsService Users *UsersService // contains filtered or unexported fields }
Client provides the Axiom HTTP API operations.
func NewClient ¶
NewClient returns a new Axiom API client. It automatically takes its configuration from the environment. To connect, export the following environment variables:
- AXIOM_TOKEN
- AXIOM_ORG_ID (only when using a personal token)
The configuration can be set manually using options which are prefixed with "Set".
The token must be an api or personal token which can be created on the settings or user profile page on Axiom.
func (*Client) Call ¶ added in v0.13.0
Call creates a new API request and executes it. The response body is JSON decoded or directly written to v, depending on v being an io.Writer or not.
func (*Client) Do ¶ added in v0.13.0
Do sends an API request and returns the API response. The response body is JSON decoded or directly written to v, depending on v being an io.Writer or not.
func (*Client) Ingest ¶ added in v0.14.0
func (c *Client) Ingest(ctx context.Context, id string, r io.Reader, typ ContentType, enc ContentEncoding, options ...ingest.Option) (*ingest.Status, error)
Ingest data into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
The reader is streamed to the server until EOF is reached on a single connection. Keep that in mind when dealing with slow readers.
This function is an alias to DatasetsService.Ingest.
func (*Client) IngestChannel ¶ added in v0.14.0
func (c *Client) IngestChannel(ctx context.Context, id string, events <-chan Event, options ...ingest.Option) (*ingest.Status, error)
IngestChannel ingests events from a channel into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
Events are ingested in batches. A batch is either 1000 events for unbuffered channels or the capacity of the channel for buffered channels. The maximum batch size is 1000. A batch is sent to the server as soon as it is full, after one second or when the channel is closed.
The method returns with an error when the context is marked as done or an error occurs when sending the events to the server. A partial ingestion is possible and the returned ingest status is valid to use. When the context is marked as done, no attempt is made to send the buffered events to the server.
The method returns without an error if the channel is closed and the buffered events are successfully sent to the server.
This function is an alias to DatasetsService.IngestChannel.
func (*Client) IngestEvents ¶ added in v0.14.0
func (c *Client) IngestEvents(ctx context.Context, id string, events []Event, options ...ingest.Option) (*ingest.Status, error)
IngestEvents ingests events into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
For ingesting large amounts of data, consider using the Client.Ingest or Client.IngestChannel method.
This function is an alias to DatasetsService.IngestEvents.
func (*Client) NewRequest ¶ added in v0.13.0
func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
NewRequest creates an API request. If specified, the value pointed to by body will be included as the request body. If it is not an io.Reader, it will be included as a JSON encoded request body.
func (*Client) Query ¶ added in v0.14.0
func (c *Client) Query(ctx context.Context, apl string, options ...query.Option) (*query.Result, error)
Query executes the given query specified using the Axiom Processing Language (APL).
To learn more about APL, please refer to our documentation.
This function is an alias to DatasetsService.Query.
func (*Client) QueryLegacy
deprecated
added in
v0.14.0
func (c *Client) QueryLegacy(ctx context.Context, id string, q querylegacy.Query, opts querylegacy.Options) (*querylegacy.Result, error)
QueryLegacy executes the given legacy query on the dataset identified by its id.
This function is an alias to DatasetsService.Query.
Deprecated: Legacy queries will be replaced by queries specified using the Axiom Processing Language (APL) and the legacy query API will be removed in the future. Use Client.Query instead.
type ContentEncoder ¶ added in v0.8.0
ContentEncoder is a function that wraps a given reader with encoding functionality and returns that enhanced reader. The content type of the encoded content must obviously be accepted by the server.
See GzipEncoder and ZstdEncoder for implementation reference.
func GzipEncoder ¶ added in v0.8.0
func GzipEncoder() ContentEncoder
GzipEncoder returns a content encoder that gzip compresses the data it reads from the provided reader. The compression level defaults to gzip.BestSpeed.
func GzipEncoderWithLevel ¶ added in v0.8.0
func GzipEncoderWithLevel(level int) ContentEncoder
GzipEncoderWithLevel returns a content encoder that gzip compresses data using the specified compression level.
func ZstdEncoder ¶ added in v0.8.0
func ZstdEncoder() ContentEncoder
ZstdEncoder is a content encoder that zstd compresses the data it reads from the provided reader.
type ContentEncoding ¶
type ContentEncoding uint8
ContentEncoding describes the content encoding of the data to ingest.
const ( // Identity marks the data as not being encoded. Identity ContentEncoding = iota + 1 // // Gzip marks the data as being gzip encoded. A [GzipEncoder] can be used to // encode the data. Gzip // gzip // Zstd marks the data as being zstd encoded. A [ZstdEncoder] can be used to // encode the data. Zstd // zstd )
func (ContentEncoding) String ¶
func (i ContentEncoding) String() string
type ContentType ¶
type ContentType uint8
ContentType describes the content type of the data to ingest.
const ( // JSON treats the data as JSON array. JSON ContentType = iota + 1 // application/json // NDJSON treats the data as newline delimited JSON objects. Preferred // data format. NDJSON // application/x-ndjson // CSV treats the data as CSV content. CSV // text/csv )
func DetectContentType ¶
DetectContentType detects the content type of a readers data. The returned reader must be used instead of the passed one. Compressed content is not detected.
func (ContentType) String ¶
func (i ContentType) String() string
type Dataset ¶
type Dataset struct { // ID of the dataset. ID string `json:"id"` // Name is the unique name of the dataset. Name string `json:"name"` // Description of the dataset. Description string `json:"description"` // CreatedBy is the ID of the user who created the dataset. CreatedBy string `json:"who"` // CreatedAt is the time the dataset was created at. CreatedAt time.Time `json:"created"` }
Dataset represents an Axiom dataset.
type DatasetCreateRequest ¶
type DatasetCreateRequest struct { // Name of the dataset to create. Restricted to 80 characters of [a-zA-Z0-9] // and special characters "-", "_" and ".". Special characters cannot be a // prefix or suffix. The prefix cannot be "axiom-". Name string `json:"name"` // Description of the dataset to create. Description string `json:"description"` }
DatasetCreateRequest is a request used to create a dataset.
type DatasetUpdateRequest ¶
type DatasetUpdateRequest struct { // Description of the dataset to update. Description string `json:"description"` }
DatasetUpdateRequest is a request used to update a dataset.
type DatasetsService ¶
type DatasetsService service
DatasetsService handles communication with the dataset related operations of the Axiom API.
Axiom API Reference: /v1/datasets
func (*DatasetsService) Create ¶
func (s *DatasetsService) Create(ctx context.Context, req DatasetCreateRequest) (*Dataset, error)
Create a dataset with the given properties.
func (*DatasetsService) Delete ¶
func (s *DatasetsService) Delete(ctx context.Context, id string) error
Delete the dataset identified by the given id.
func (*DatasetsService) Ingest ¶
func (s *DatasetsService) Ingest(ctx context.Context, id string, r io.Reader, typ ContentType, enc ContentEncoding, options ...ingest.Option) (*ingest.Status, error)
Ingest data into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
The reader is streamed to the server until EOF is reached on a single connection. Keep that in mind when dealing with slow readers.
func (*DatasetsService) IngestChannel ¶ added in v0.12.0
func (s *DatasetsService) IngestChannel(ctx context.Context, id string, events <-chan Event, options ...ingest.Option) (*ingest.Status, error)
IngestChannel ingests events from a channel into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
Events are ingested in batches. A batch is either 1000 events for unbuffered channels or the capacity of the channel for buffered channels. The maximum batch size is 1000. A batch is sent to the server as soon as it is full, after one second or when the channel is closed.
The method returns with an error when the context is marked as done or an error occurs when sending the events to the server. A partial ingestion is possible and the returned ingest status is valid to use. When the context is marked as done, no attempt is made to send the buffered events to the server.
The method returns without an error if the channel is closed and the buffered events are successfully sent to the server.
func (*DatasetsService) IngestEvents ¶
func (s *DatasetsService) IngestEvents(ctx context.Context, id string, events []Event, options ...ingest.Option) (*ingest.Status, error)
IngestEvents ingests events into the dataset identified by its id.
The timestamp of the events will be set by the server to the current server time if the "_time" field is not set. The server can be instructed to use a different field as the timestamp by setting the ingest.SetTimestampField option. If not explicitly specified by ingest.SetTimestampFormat, the timestamp format is auto detected.
Restrictions for field names (JSON object keys) can be reviewed in our documentation.
For ingesting large amounts of data, consider using the DatasetsService.Ingest or DatasetsService.IngestChannel method.
func (*DatasetsService) List ¶
func (s *DatasetsService) List(ctx context.Context) ([]*Dataset, error)
List all available datasets.
func (*DatasetsService) Query ¶
func (s *DatasetsService) Query(ctx context.Context, apl string, options ...query.Option) (*query.Result, error)
Query executes the given query specified using the Axiom Processing Language (APL).
To learn more about APL, please refer to our documentation.
func (*DatasetsService) QueryLegacy
deprecated
added in
v0.13.0
func (s *DatasetsService) QueryLegacy(ctx context.Context, id string, q querylegacy.Query, opts querylegacy.Options) (*querylegacy.Result, error)
QueryLegacy executes the given legacy query on the dataset identified by its id.
Deprecated: Legacy queries will be replaced by queries specified using the Axiom Processing Language (APL) and the legacy query API will be removed in the future. Use DatasetsService.Query instead.
func (*DatasetsService) Trim ¶
func (s *DatasetsService) Trim(ctx context.Context, id string, maxDuration time.Duration) (*TrimResult, error)
Trim the dataset identified by its id to a given length. The max duration given will mark the oldest timestamp an event can have. Older ones will be deleted from the dataset.
func (*DatasetsService) Update ¶
func (s *DatasetsService) Update(ctx context.Context, id string, req DatasetUpdateRequest) (*Dataset, error)
Update the dataset identified by the given id with the given properties.
type Error ¶
Error is the generic error response returned on non 2xx HTTP status codes. Either one of the two fields is populated. However, calling the Error.Error method is preferred.
type Event ¶
An Event is a map of key-value pairs.
If you want to set a timestamp for the event you can either use ingest.TimestampField as map key for the timestamp or specify any other field that carries the timestamp by passing ingest.SetTimestampField to DatasetsService.Ingest, DatasetsService.IngestEvents or DatasetsService.IngestChannel as an Option.
type License ¶
type License struct { // ID of the license. ID string `json:"id"` // Issuer of the license. Issuer string `json:"issuer"` // IssuedTo describes who the license was issued to. IssuedTo string `json:"issuedTo"` // IssuedAt is the time the license was issued at. IssuedAt time.Time `json:"issuedAt"` // ValidFrom is the time the license is valid from. ValidFrom time.Time `json:"validFrom"` // ExpiresAt is the time the license expires. ExpiresAt time.Time `json:"expiresAt"` // Plan associated with the license. Plan Plan `json:"tier"` // MonthlyIngestGB is the monthly amount of data in gigabytes that can be // ingested as part of the license. MonthlyIngestGB uint64 `json:"monthlyIngestGb"` // MaxUsers is the maximum amount of teams allowed. MaxUsers uint64 `json:"maxUsers"` // MaxTeams is the maximum amount of user allowed. MaxTeams uint64 `json:"maxTeams"` // MaxDatasets is the maximum amount of datasets allowed. MaxDatasets uint64 `json:"maxDatasets"` // MaxQueryWindow is the maximum query window allowed. MaxQueryWindow time.Duration `json:"maxQueryWindowSeconds"` // MaxAuditWindow is the maximum audit window allowed. MaxAuditWindow time.Duration `json:"maxAuditWindowSeconds"` // WithRBAC specifies it RBAC is enabled. WithRBAC bool `json:"withRBAC"` // WithAuths specifies the supported authentication modes. WithAuths []string `json:"withAuths"` // Error is the last error (if any) on token refresh. Error string `json:"error"` }
License of an Organization.
func (License) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It is in place to marshal the MaxQueryWindow and MaxAuditWindow to seconds because that's what the server expects.
func (*License) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It is in place to unmarshal the MaxQueryWindow and MaxAuditWindow into a proper time.Duration value because the server returns it in seconds.
type Limit ¶ added in v0.10.0
type Limit struct { // Scope a limit is enforced for. Only present on rate limited requests. Scope LimitScope // The maximum limit a client is limited to for a specified time window // which resets at the time indicated by [Limit.Reset]. Limit uint64 // The remaining count towards the maximum limit. Remaining uint64 // The time at which the current limit time window will reset. Reset time.Time // contains filtered or unexported fields }
Limit represents a limit for the current client.
Axiom API Reference: https://www.axiom.co/docs/restapi/api-limits
func (Limit) String ¶ added in v0.10.0
String returns a string representation of the limit.
It implements fmt.Stringer.
type LimitError ¶ added in v0.10.0
type LimitError struct { Limit Limit // contains filtered or unexported fields }
LimitError occurs when http status code 429 (TooManyRequests) is encountered.
func (*LimitError) Error ¶ added in v0.10.0
func (e *LimitError) Error() string
Error returns the string representation of the limit error.
It implements error.
func (*LimitError) Is ¶ added in v0.10.0
func (e *LimitError) Is(target error) bool
Is returns whether the provided error equals this error.
type LimitScope ¶ added in v0.10.0
type LimitScope uint8
LimitScope is the scope of a Limit.
const ( LimitScopeUnknown LimitScope = iota // unknown LimitScopeUser // user LimitScopeOrganization // organization LimitScopeAnonymous // anonymous )
All available Limit scopes.
func (LimitScope) String ¶ added in v0.10.0
func (i LimitScope) String() string
type Option ¶
An Option modifies the behaviour of the client. If not otherwise specified by a specific option, they are safe to use even after methods have been called. However, they are not safe to use while the client is performing an operation.
func SetAPITokenConfig ¶ added in v0.13.0
SetAPITokenConfig specifies all properties needed in order to successfully connect to Axiom with an api token.
func SetNoEnv ¶ added in v0.6.1
func SetNoEnv() Option
SetNoEnv prevents the Client from deriving its configuration from the environment (by auto reading "AXIOM_*" environment variables).
func SetNoRetry ¶ added in v0.14.1
func SetNoRetry() Option
SetNoRetry prevents the Client from auto-retrying failed HTTP requests under certain circumstances.
func SetOrganizationID ¶ added in v0.13.0
SetOrganizationID specifies the organization ID used by the Client.
When a personal token is used, this method can be used to switch between organizations by passing it to the Client.Options method.
Can also be specified using the "AXIOM_ORG_ID" environment variable.
func SetPersonalTokenConfig ¶ added in v0.13.0
SetPersonalTokenConfig specifies all properties needed in order to successfully connect to Axiom with a personal token.
func SetToken ¶ added in v0.13.1
SetToken specifies the token used by the Client.
Can also be specified using the "AXIOM_TOKEN" environment variable.
func SetURL ¶ added in v0.4.0
SetURL specifies the base URL used by the Client.
Can also be specified using the "AXIOM_URL" environment variable.
func SetUserAgent ¶
SetUserAgent specifies the user agent used by the Client.
type Organization ¶
type Organization struct { // ID is the unique ID of the organization. ID string `json:"id"` // Name of the organization. Name string `json:"name"` // Slug of the organization. Slug string `json:"slug"` // Trial describes if the plan is trialed or not. Trial bool `json:"inTrial"` // Plan the organization is on. Plan Plan `json:"plan"` // PlanCreated is the time the plan was created. PlanCreated time.Time `json:"planCreated"` // LastUsageSync is the last time the usage instance usage statistics were // synchronized. LastUsageSync time.Time `json:"lastUsageSync"` // Role the requesting user has on the deployment or the organization. Role UserRole `json:"role"` // PrimaryEmail of the user that issued the request. PrimaryEmail string `json:"primaryEmail"` // License of the organization. License License `json:"license"` // PaymentStatus is the status of the current payment for the organization. PaymentStatus PaymentStatus `json:"paymentStatus"` // CreatedAt is the time the organization was created. CreatedAt time.Time `json:"metaCreated"` // ModifiedAt is the time the organization was last modified. ModifiedAt time.Time `json:"metaModified"` }
Organization represents an organization.
type OrganizationsService ¶
type OrganizationsService service
OrganizationsService handles communication with the organization related operations of the Axiom API.
Axiom API Reference: /v1/orgs
func (*OrganizationsService) Get ¶
func (s *OrganizationsService) Get(ctx context.Context, id string) (*Organization, error)
Get an organization by id.
func (*OrganizationsService) List ¶
func (s *OrganizationsService) List(ctx context.Context) ([]*Organization, error)
List all available organizations.
type PaymentStatus ¶ added in v0.14.0
type PaymentStatus uint8
PaymentStatus represents the payment status of an Organization.
const ( Success PaymentStatus // success NotAvailable // na Failed // failed Blocked // blocked )
All available Organization payment statuses.
func (PaymentStatus) MarshalJSON ¶ added in v0.14.0
func (ps PaymentStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. It is in place to marshal the payment status to its string representation because that's what the server expects.
func (PaymentStatus) String ¶ added in v0.14.0
func (i PaymentStatus) String() string
func (*PaymentStatus) UnmarshalJSON ¶ added in v0.14.0
func (ps *PaymentStatus) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON implements json.Unmarshaler. It is in place to unmarshal the payment status from the string representation the server returns.
type Plan ¶
type Plan uint8
Plan represents the plan of an Organization.
const ( Personal Plan // personal Basic // basic Team // teamMonthly Enterprise // enterprise Comped // comped )
All available Organization plans.
func (Plan) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It is in place to marshal the plan to its string representation because that's what the server expects.
func (*Plan) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It is in place to unmarshal the plan from the string representation the server returns.
type Response ¶ added in v0.13.0
Response wraps the default http response type. It never has an open body.
type TrimResult
deprecated
type TrimResult struct { // BlocksDeleted is the amount of blocks deleted by the trim operation. // // Deprecated: BlocksDeleted is deprecated and will be removed in the // future. BlocksDeleted int `json:"numDeleted"` }
TrimResult is the result of a trim operation.
Deprecated: TrimResult is deprecated and will be removed in a future release.
type User ¶
type User struct { // ID is the unique ID of the user. ID string `json:"id"` // Name of the user. Name string `json:"name"` // Emails are the email addresses of the user. Emails []string `json:"emails"` }
User represents an user.
type UserRole ¶
type UserRole uint8
UserRole represents the role of an User.
const ( RoleReadOnly UserRole // read-only RoleUser // user RoleAdmin // admin RoleOwner // owner )
All available User roles.
func (UserRole) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It is in place to marshal the UserRole to its string representation because that's what the server expects.
func (*UserRole) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It is in place to unmarshal the UserRole from the string representation the server returns.
type UsersService ¶
type UsersService service
UsersService handles communication with the user related operations of the Axiom API.
Axiom API Reference: /v1/users
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ingest provides the datatypes and functions helping with ingesting data into Axiom.
|
Package ingest provides the datatypes and functions helping with ingesting data into Axiom. |
Package otel provides helpers for using [OpenTelemetry] with Axiom.
|
Package otel provides helpers for using [OpenTelemetry] with Axiom. |
Package query provides the datatypes and functions for construction queries using the Axiom Processing Language (APL) and working with their results.
|
Package query provides the datatypes and functions for construction queries using the Axiom Processing Language (APL) and working with their results. |
Package querylegacy provides the datatypes and functions for construction legacy queries and working with their results.
|
Package querylegacy provides the datatypes and functions for construction legacy queries and working with their results. |