Skip to content

Commit

Permalink
YAML data souce doc
Browse files Browse the repository at this point in the history
  • Loading branch information
traut committed Nov 29, 2024
1 parent e8f3856 commit 5ad1be1
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions docs/plugins/builtin/data-sources/yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: "`yaml` data source"
plugin:
name: blackstork/builtin
description: "Loads YAML files with the names that match provided `glob` pattern or a single file from provided `path`value"
tags: []
version: "v0.4.2"
source_github: "https://github.com/blackstork-io/fabric/tree/main/internal/builtin/"
resource:
type: data-source
type: docs
---

{{< breadcrumbs 2 >}}

{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "yaml" "data source" >}}

## Description
Loads YAML files with the names that match provided `glob` pattern or a single file from provided `path`value.

Either `glob` or `path` argument must be set.

When `path` argument is specified, the data source returns only the content of a file.
When `glob` argument is specified, the data source returns a list of dicts that contain the content of a file and file's metadata. For example:

```yaml
[
{
"file_path": "path/file-a.yaml",
"file_name": "file-a.yaml",
"content": {
"foo": "bar"
}
},
{
"file_path": "path/file-b.yaml",
"file_name": "file-b.yaml",
"content": [
{"x": "y"}
]
}
]
```

The data source is built-in, which means it's a part of `fabric` binary. It's available out-of-the-box, no installation required.

## Configuration

The data source doesn't support any configuration arguments.

## Usage

The data source supports the following execution arguments:

```hcl
data yaml {
# A glob pattern to select YAML files to read
#
# Optional string.
# For example:
# glob = "path/to/file*.yaml"
#
# Default value:
glob = null
# A file path to a YAML file to read
#
# Optional string.
# For example:
# path = "path/to/file.yaml"
#
# Default value:
path = null
}
```

0 comments on commit 5ad1be1

Please sign in to comment.