Skip to content

Commit

Permalink
Add new capabilties and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
toppercodes committed Sep 18, 2024
1 parent 4a16624 commit 2fb801a
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 10 deletions.
60 changes: 60 additions & 0 deletions axiom/resource_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
Expand All @@ -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},
Expand Down Expand Up @@ -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(),
},
},
},
},
},
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions docs/data-sources/monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 11 additions & 10 deletions docs/data-sources/notifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@ 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))
- `opsgenie` (Attributes) (see [below for nested schema](#nestedatt--properties--opsgenie))
- `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))

<a id="nestedatt--properties--custom_webhook"></a>
### 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


<a id="nestedatt--properties--discord"></a>
### Nested Schema for `properties.discord`
Expand Down Expand Up @@ -95,12 +105,3 @@ Read-Only:
Read-Only:

- `url` (String) The webhook URL

<a id="nestedatt--properties--custom_webhook"></a>
### 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
63 changes: 63 additions & 0 deletions docs/data-sources/token.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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

<a id="nestedatt--dataset_capabilities"></a>
### 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


<a id="nestedatt--org_capabilities"></a>
### 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
2 changes: 2 additions & 0 deletions docs/resources/monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
14 changes: 14 additions & 0 deletions docs/resources/notifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))

<a id="nestedatt--properties--custom_webhook"></a>
### 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


<a id="nestedatt--properties--discord"></a>
### Nested Schema for `properties.discord`

Expand Down
66 changes: 66 additions & 0 deletions docs/resources/token.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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

<a id="nestedatt--dataset_capabilities"></a>
### 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


<a id="nestedatt--org_capabilities"></a>
### 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

0 comments on commit 2fb801a

Please sign in to comment.