Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,19 @@ generate-alerting-client: ## generate Kibana alerting client
-g go \
-o /local/generated/alerting
@ rm -rf generated/alerting/go.mod generated/alerting/go.sum generated/alerting/test
@ go fmt ./generated/...
@ go fmt ./generated/alerting/...

.PHONY: generate-kibana-actions
generate-kibana-actions-client: ## generate Kibana actions client
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
-i https://raw.githubusercontent.com/elastic/kibana/$(SWAGGER_VERSION)/x-pack/plugins/actions/docs/openapi/bundled.json \
--skip-validate-spec \
--git-repo-id terraform-provider-elasticstack \
--git-user-id elastic \
-p isGoSubmodule=true \
-p packageName=kibanaactions \
-p generateInterfaces=true \
-g go \
-o /local/generated/kibanaactions
@ rm -rf generated/kibanaactions/go.mod generated/kibanaactions/go.sum generated/kibanaactions/test
@ go fmt ./generated/kibanaactions/...
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,18 @@ go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.

### Generating Kibana clients

Kibana clients for some APIs are generated based on Kibana OpenAPI specs.
Please see [Makefile](./Makefile) tasks for more details.

#### Known issues
OpenAPI generator produces incorrect code for `RunConnector200ResponseData` struct
in [model_run_connector_200_response_data.go](./generated/kibanaactions/model_run_connector_200_response_data.go).
It doesn't strip curly braces from the struct field names.

[There is a fix for the issue](https://github.com/OpenAPITools/openapi-generator/pull/13167) but it's not yet merged.
Currently the file is fixed manually.

Also the specs don't include models for some connector types, e.g. they miss models for update requests for few connector types like `Slack`, `Webhook`, etc.
58 changes: 58 additions & 0 deletions docs/resources/kibana_action_connector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "elasticstack_kibana_action_connector Resource - terraform-provider-elasticstack"
subcategory: ""
description: |-
Creates a Kibana action connector. See https://www.elastic.co/guide/en/kibana/8.7/action-types.html
---

# elasticstack_kibana_action_connector (Resource)

Creates a Kibana action connector. See https://www.elastic.co/guide/en/kibana/8.7/action-types.html

## Example Usage

```terraform
provider "elasticstack" {
elasticsearch {}
}

resource "elasticstack_kibana_action_connector" "example" {
name = "%s"
config = jsonencode({
index = ".kibana"
refresh = true
})
connector_type_id = ".index"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `config` (String) The configuration for the connector. Configuration properties vary depending on the connector type.
- `connector_type_id` (String) The ID of the connector type, e.g. `.index`.
- `name` (String) The name of the connector. While this name does not have to be unique, a distinctive name can help you identify a connector.
- `secrets` (String) The secrets configuration for the connector. Secrets configuration properties vary depending on the connector type.

### Optional

- `connector_id` (String) A UUID v1 or v4 to use instead of a randomly generated ID.
- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used.

### Read-Only

- `id` (String) The ID of this resource.
- `is_deprecated` (Boolean) Indicates whether the connector type is deprecated.
- `is_missing_secrets` (Boolean) Indicates whether secrets are missing for the connector.
- `is_preconfigured` (Boolean) Indicates whether it is a preconfigured connector.

## Import

Import is supported using the following syntax:

```shell
terraform import elasticstack_kibana_action_connector.my_connector <space id>/<connector id>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import elasticstack_kibana_action_connector.my_connector <space id>/<connector id>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
provider "elasticstack" {
elasticsearch {}
}

resource "elasticstack_kibana_action_connector" "example" {
name = "%s"
config = jsonencode({
index = ".kibana"
refresh = true
})
connector_type_id = ".index"
}
24 changes: 24 additions & 0 deletions generated/kibanaactions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof
23 changes: 23 additions & 0 deletions generated/kibanaactions/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Loading