diff --git a/axiom/tokens.go b/axiom/tokens.go index 1bc42a41..3c4d6c61 100644 --- a/axiom/tokens.go +++ b/axiom/tokens.go @@ -9,56 +9,86 @@ import ( "time" ) -type Actions []string - type APIToken struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - ExpiresAt time.Time `json:"expiresAt"` + // ID is the unique ID of the token. + ID string `json:"id"` + // Name is the name of the token. + Name string `json:"name"` + // Description is the description of the token. + Description string `json:"description"` + // ExpiresAt is the time when the token expires. + ExpiresAt time.Time `json:"expiresAt"` + // DatasetCapabilities is a map of dataset names to the capabilities available to that dataset for the token. DatasetCapabilities map[string]DatasetCapabilities `json:"datasetCapabilities"` - OrgCapabilities OrgCapabilities `json:"orgCapabilities"` + // OrgCapabilities is the organisation capabilities available to the token. + OrgCapabilities OrgCapabilities `json:"orgCapabilities"` } type DatasetCapabilities struct { - Ingest []string `json:"ingest"` - Query []string `json:"query"` + // Ingest is the ingest capability and the actions that can be performed on them. + Ingest []string `json:"ingest"` + // Query is the query capability and the actions that can be performed on them. + Query []string `json:"query"` + // StarredQueries is the starred queries capability and the actions that can be performed on them. StarredQueries []string `json:"starredQueries"` - VirtualFields []string `json:"virtualFields"` + // VirtualFields is the VirtualFields capability and the actions that can be performed on them. + VirtualFields []string `json:"virtualFields"` } type OrgCapabilities struct { - Annotations []string `json:"annotations,omitempty"` - APITokens []string `json:"apiTokens,omitempty"` - Billing []string `json:"billing,omitempty"` - Dashboards []string `json:"dashboards,omitempty"` - Datasets []string `json:"datasets,omitempty"` - Endpoints []string `json:"endpoints,omitempty"` - Flows []string `json:"flows,omitempty"` - Integrations []string `json:"integrations,omitempty"` - Monitors []string `json:"monitors,omitempty"` - Notifiers []string `json:"notifiers,omitempty"` - Rbac []string `json:"rbac,omitempty"` + // Annotations is the Annotations capability and the actions that can be performed on them. + Annotations []string `json:"annotations,omitempty"` + // APITokens is the APITokens capability and the actions that can be performed on them. + APITokens []string `json:"apiTokens,omitempty"` + // Billing is the Billing capability and the actions that can be performed on them. + Billing []string `json:"billing,omitempty"` + // Dashboards is the Dashboards capability and the actions that can be performed on them. + Dashboards []string `json:"dashboards,omitempty"` + // Datasets is the Datasets capability and the actions that can be performed on them. + Datasets []string `json:"datasets,omitempty"` + // Endpoints is the Endpoints capability and the actions that can be performed on them. + Endpoints []string `json:"endpoints,omitempty"` + // Flows is the Flows capability and the actions that can be performed on them. + Flows []string `json:"flows,omitempty"` + // Integrations is the Integrations capability and the actions that can be performed on them. + Integrations []string `json:"integrations,omitempty"` + // Monitors is the Monitors capability and the actions that can be performed on them. + Monitors []string `json:"monitors,omitempty"` + // Notifiers is the Notifiers capability and the actions that can be performed on them. + Notifiers []string `json:"notifiers,omitempty"` + // Rbac is the Rbac capability and the actions that can be performed on them. + Rbac []string `json:"rbac,omitempty"` + // SharedAccessKeys is the SharedAccessKeys capability and the actions that can be performed on them. SharedAccessKeys []string `json:"sharedAccessKeys,omitempty"` - Users []string `json:"users,omitempty"` + // Users is the Users capability and the actions that can be performed on them. + Users []string `json:"users,omitempty"` } type CreateTokenRequest struct { - Name string `json:"name"` - Description string `json:"description"` - ExpiresAt time.Time `json:"expiresAt"` + // Name is the name of the token. + Name string `json:"name"` + // Description is the description of the token. + Description string `json:"description"` + // ExpiresAt is the time when the token expires. + ExpiresAt time.Time `json:"expiresAt"` + + // DatasetCapabilities is a map of dataset names to the capabilities available to that dataset for the token. DatasetCapabilities map[string]DatasetCapabilities `json:"datasetCapabilities"` - OrgCapabilities OrgCapabilities `json:"orgCapabilities"` + // OrgCapabilities is the organisation capabilities available to the token. + OrgCapabilities OrgCapabilities `json:"orgCapabilities"` } type CreateTokenResponse struct { APIToken + // Token is the token value to be used in api calls Token string `json:"token"` } type RegenerateTokenRequest struct { + // ExistingTokenExpiresAt is the time when the existing token will expire. ExistingTokenExpiresAt time.Time `json:"existingTokenExpiresAt"` - NewTokenExpiresAt time.Time `json:"newTokenExpiresAt"` + // NewTokenExpiresAt is the time when the new token will expire. + NewTokenExpiresAt time.Time `json:"newTokenExpiresAt"` } // Axiom API Reference: /v2/tokens