From 2fb801ae08b1ef11ab4ccb8102e2596df10d0ef7 Mon Sep 17 00:00:00 2001 From: Topper Date: Wed, 18 Sep 2024 14:31:21 +0100 Subject: [PATCH] Add new capabilties and update docs --- axiom/resource_tokens.go | 60 +++++++++++++++++++++++++++++++ docs/data-sources/monitor.md | 2 ++ docs/data-sources/notifier.md | 21 +++++------ docs/data-sources/token.md | 63 +++++++++++++++++++++++++++++++++ docs/resources/monitor.md | 2 ++ docs/resources/notifier.md | 14 ++++++++ docs/resources/token.md | 66 +++++++++++++++++++++++++++++++++++ 7 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 docs/data-sources/token.md create mode 100644 docs/resources/token.md diff --git a/axiom/resource_tokens.go b/axiom/resource_tokens.go index b4f54ab..b6f869c 100644 --- a/axiom/resource_tokens.go +++ b/axiom/resource_tokens.go @@ -61,6 +61,9 @@ type DatasetCapabilities struct { Query types.List `tfsdk:"query"` StarredQueries types.List `tfsdk:"starred_queries"` VirtualFields types.List `tfsdk:"virtual_fields"` + Data types.List `tfsdk:"data"` + Trim types.List `tfsdk:"trim"` + Vacuum types.List `tfsdk:"vacuum"` } func (m DatasetCapabilities) Types() map[string]attr.Type { @@ -69,12 +72,16 @@ func (m DatasetCapabilities) Types() map[string]attr.Type { "query": types.ListType{ElemType: types.StringType}, "starred_queries": types.ListType{ElemType: types.StringType}, "virtual_fields": types.ListType{ElemType: types.StringType}, + "data": types.ListType{ElemType: types.StringType}, + "trim": types.ListType{ElemType: types.StringType}, + "vacuum": types.ListType{ElemType: types.StringType}, } } type OrgCapabilities struct { Annotations types.List `tfsdk:"annotations"` APITokens types.List `tfsdk:"api_tokens"` + Auditlog types.List `tfsdk:"audit_log"` Billing types.List `tfsdk:"billing"` Dashboards types.List `tfsdk:"dashboards"` Datasets types.List `tfsdk:"datasets"` @@ -92,6 +99,7 @@ func (o OrgCapabilities) Types() map[string]attr.Type { return map[string]attr.Type{ "annotations": types.ListType{ElemType: types.StringType}, "api_tokens": types.ListType{ElemType: types.StringType}, + "audit_log": types.ListType{ElemType: types.StringType}, "billing": types.ListType{ElemType: types.StringType}, "dashboards": types.ListType{ElemType: types.StringType}, "datasets": types.ListType{ElemType: types.StringType}, @@ -210,6 +218,45 @@ func (r *TokenResource) Schema(_ context.Context, _ resource.SchemaRequest, resp listplanmodifier.RequiresReplace(), }, }, + "data": schema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + Description: "Ability to manage the data in a dataset", + Validators: []validator.List{ + listvalidator.ValueStringsAre( + stringvalidator.OneOf(Delete), + ), + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + "trim": schema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + Description: "Ability to trim the data in a dataset", + Validators: []validator.List{ + listvalidator.ValueStringsAre( + stringvalidator.OneOf(Update), + ), + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + "vacuum": schema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + Description: "Ability to vacuum the fields in a dataset", + Validators: []validator.List{ + listvalidator.ValueStringsAre( + stringvalidator.OneOf(Update), + ), + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, }, }, }, @@ -243,6 +290,19 @@ func (r *TokenResource) Schema(_ context.Context, _ resource.SchemaRequest, resp listplanmodifier.RequiresReplace(), }, }, + "audit_log": schema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + Description: "Ability to read the audit log", + Validators: []validator.List{ + listvalidator.ValueStringsAre( + stringvalidator.OneOf(Read), + ), + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, "billing": schema.ListAttribute{ Optional: true, ElementType: types.StringType, diff --git a/docs/data-sources/monitor.md b/docs/data-sources/monitor.md index 3a2dbdb..44f3e7f 100644 --- a/docs/data-sources/monitor.md +++ b/docs/data-sources/monitor.md @@ -28,6 +28,8 @@ description: |- - `interval_minutes` (Number) How often the monitor should run - `name` (String) Monitor name - `notifier_ids` (List of String) A list of notifier id's to be used when this monitor triggers +- `notify_by_group` (Boolean) If the monitor should track non-time groups separately - `operator` (String) Operator used in monitor trigger evaluation - `range_minutes` (Number) Query time range from now +- `resolvable` (Boolean) Determines whether the events triggered by the monitor are individually resolvable. This has no effect on threshold monitors - `threshold` (Number) The threshold where the monitor should trigger diff --git a/docs/data-sources/notifier.md b/docs/data-sources/notifier.md index 51f9fbd..5f74e52 100644 --- a/docs/data-sources/notifier.md +++ b/docs/data-sources/notifier.md @@ -29,6 +29,7 @@ description: |- Read-Only: +- `custom_webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--custom_webhook)) - `discord` (Attributes) (see [below for nested schema](#nestedatt--properties--discord)) - `discord_webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--discord_webhook)) - `email` (Attributes) (see [below for nested schema](#nestedatt--properties--email)) @@ -36,7 +37,16 @@ Read-Only: - `pagerduty` (Attributes) (see [below for nested schema](#nestedatt--properties--pagerduty)) - `slack` (Attributes) (see [below for nested schema](#nestedatt--properties--slack)) - `webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--webhook)) -- `custom_webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--custom_webhook)) + + +### Nested Schema for `properties.custom_webhook` + +Read-Only: + +- `body` (String) The JSON body +- `headers` (Map of String) Any headers associated with the request +- `url` (String) The webhook URL + ### Nested Schema for `properties.discord` @@ -95,12 +105,3 @@ Read-Only: Read-Only: - `url` (String) The webhook URL - - -### Nested Schema for `properties.custom_webhook` - -Read-Only: - -- `url` (String) The custom webhook URL -- `headers` (Map of String) Headers to include in the webhook request -- `body` (String) The body of the webhook request diff --git a/docs/data-sources/token.md b/docs/data-sources/token.md new file mode 100644 index 0000000..e38596b --- /dev/null +++ b/docs/data-sources/token.md @@ -0,0 +1,63 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "axiom_token Data Source - terraform-provider-axiom" +subcategory: "" +description: |- + +--- + +# axiom_token (Data Source) + + + + + + +## Schema + +### Required + +- `id` (String) The unique identifier of the token to be used when interacting with the token + +### Read-Only + +- `dataset_capabilities` (Attributes Map) The capabilities available to the token for each dataset (see [below for nested schema](#nestedatt--dataset_capabilities)) +- `description` (String) The description of the token +- `expires_at` (String) The time when the token expires. If not set, the token will not expire. Must be in RFC3339 format +- `name` (String) The name of the token +- `org_capabilities` (Attributes) The organisation capabilities available to the token (see [below for nested schema](#nestedatt--org_capabilities)) +- `token` (String) The token value to be used in API calls + + +### Nested Schema for `dataset_capabilities` + +Read-Only: + +- `data` (List of String) Ability to manage the data in a dataset +- `ingest` (List of String) Ability to ingest into the specified dataset +- `query` (List of String) Ability to query the specified dataset +- `starred_queries` (List of String) Ability to perform actions on starred queries for the specified dataset +- `trim` (List of String) Ability to trim the data in a dataset +- `vacuum` (List of String) Ability to vacuum the fields in a dataset +- `virtual_fields` (List of String) Ability to perform actions on virtual fields for the provided dataset + + + +### Nested Schema for `org_capabilities` + +Read-Only: + +- `annotations` (List of String) Ability to perform actions on annotations +- `api_tokens` (List of String) Ability to manage api tokens +- `audit_log` (List of String) Ability to read the audit log +- `billing` (List of String) Ability to manage billing information +- `dashboards` (List of String) Ability to manage dashboards +- `datasets` (List of String) Ability to manage datasets +- `endpoints` (List of String) Ability to manage endpoints +- `flows` (List of String) Ability to manage flows +- `integrations` (List of String) Ability to manage integrations +- `monitors` (List of String) Ability to manage monitors +- `notifiers` (List of String) Ability to manage notifiers +- `rbac` (List of String) Ability to manage roles and groups +- `shared_access_keys` (List of String) Ability to manage shared access keys +- `users` (List of String) Ability to manage users diff --git a/docs/resources/monitor.md b/docs/resources/monitor.md index c8855bf..60bd998 100644 --- a/docs/resources/monitor.md +++ b/docs/resources/monitor.md @@ -21,6 +21,7 @@ description: |- - `apl_query` (String) The query used inside the monitor - `interval_minutes` (Number) How often the monitor should run - `name` (String) Monitor name +- `notify_by_group` (Boolean) If the monitor should track non-time groups separately - `operator` (String) Operator used in monitor trigger evaluation - `range_minutes` (Number) Query time range from now - `threshold` (Number) The threshold where the monitor should trigger @@ -30,6 +31,7 @@ description: |- - `description` (String) Monitor description - `disabled_until` (String) The time the monitor will be disabled until - `notifier_ids` (List of String) A list of notifier id's to be used when this monitor triggers +- `resolvable` (Boolean) Determines whether the events triggered by the monitor are individually resolvable. This has no effect on threshold monitors ### Read-Only diff --git a/docs/resources/notifier.md b/docs/resources/notifier.md index 8091556..db3b4cc 100644 --- a/docs/resources/notifier.md +++ b/docs/resources/notifier.md @@ -29,6 +29,7 @@ description: |- Optional: +- `custom_webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--custom_webhook)) - `discord` (Attributes) (see [below for nested schema](#nestedatt--properties--discord)) - `discord_webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--discord_webhook)) - `email` (Attributes) (see [below for nested schema](#nestedatt--properties--email)) @@ -37,6 +38,19 @@ Optional: - `slack` (Attributes) (see [below for nested schema](#nestedatt--properties--slack)) - `webhook` (Attributes) (see [below for nested schema](#nestedatt--properties--webhook)) + +### Nested Schema for `properties.custom_webhook` + +Required: + +- `body` (String) The JSON body +- `url` (String) The webhook URL + +Optional: + +- `headers` (Map of String, Sensitive) Any headers associated with the request + + ### Nested Schema for `properties.discord` diff --git a/docs/resources/token.md b/docs/resources/token.md new file mode 100644 index 0000000..8375db3 --- /dev/null +++ b/docs/resources/token.md @@ -0,0 +1,66 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "axiom_token Resource - terraform-provider-axiom" +subcategory: "" +description: |- + +--- + +# axiom_token (Resource) + + + + + + +## Schema + +### Required + +- `name` (String) The name of the token + +### Optional + +- `dataset_capabilities` (Attributes Map) The capabilities available to the token for each dataset (see [below for nested schema](#nestedatt--dataset_capabilities)) +- `description` (String) The description of the token +- `expires_at` (String) The time when the token expires. If not set, the token will not expire. Must be in RFC3339 format +- `org_capabilities` (Attributes) The organisation capabilities available to the token (see [below for nested schema](#nestedatt--org_capabilities)) + +### Read-Only + +- `id` (String) The unique identifier of the token to be used when interacting with the token +- `token` (String, Sensitive) The token value to be used in API calls + + +### Nested Schema for `dataset_capabilities` + +Optional: + +- `data` (List of String) Ability to manage the data in a dataset +- `ingest` (List of String) Ability to ingest into the specified dataset +- `query` (List of String) Ability to query the specified dataset +- `starred_queries` (List of String) Ability to perform actions on starred queries for the specified dataset +- `trim` (List of String) Ability to trim the data in a dataset +- `vacuum` (List of String) Ability to vacuum the fields in a dataset +- `virtual_fields` (List of String) Ability to perform actions on virtual fields for the provided dataset + + + +### Nested Schema for `org_capabilities` + +Optional: + +- `annotations` (List of String) Ability to perform actions on annotations +- `api_tokens` (List of String) Ability to manage api tokens +- `audit_log` (List of String) Ability to read the audit log +- `billing` (List of String) Ability to manage billing information +- `dashboards` (List of String) Ability to manage dashboards +- `datasets` (List of String) Ability to manage datasets +- `endpoints` (List of String) Ability to manage endpoints +- `flows` (List of String) Ability to manage flows +- `integrations` (List of String) Ability to manage integrations +- `monitors` (List of String) Ability to manage monitors +- `notifiers` (List of String) Ability to manage notifiers +- `rbac` (List of String) Ability to manage roles and groups +- `shared_access_keys` (List of String) Ability to manage shared access keys +- `users` (List of String) Ability to manage users