Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Refactoring attr doc gen to use Go templates #274

Merged
merged 5 commits into from
Jan 11, 2025
Merged
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
14 changes: 10 additions & 4 deletions docs/plugins/atlassian/data-sources/jira_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,23 @@ config data jira_issues {
#
# Required string.
# Must be non-empty
#
# For example:
domain = "some string"

# Account Email.
#
# Required string.
# Must be non-empty
#
# For example:
account_email = "some string"

# API Token.
#
# Required string.
# Must be non-empty
#
# For example:
api_token = "some string"
}
Expand All @@ -73,34 +76,37 @@ data jira_issues {
#
# Optional string.
# Must be one of: "renderedFields", "names", "schema", "changelog"
#
# For example:
# expand = "names"
#
#
# Default value:
expand = null

# A list of fields to return for each issue.
#
# Optional list of string.
#
# For example:
# fields = ["*all"]
#
#
# Default value:
fields = null

# A JQL expression. For performance reasons, this field requires a bounded query. A bounded query is a query with a search restriction.
#
# Optional string.
#
# For example:
# jql = "order by key desc"
#
#
# Default value:
jql = null

# A list of up to 5 issue properties to include in the results.
#
# Optional list of string.
# Must have a length of at most 5
# Must contain no more than 5 elements.
# Default value:
properties = []

Expand Down
1 change: 1 addition & 0 deletions docs/plugins/builtin/content-providers/blockquote.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The content provider supports the following execution arguments:
```hcl
content blockquote {
# Required string.
#
# For example:
value = "Text to be formatted as a quote"
}
Expand Down
4 changes: 3 additions & 1 deletion docs/plugins/builtin/content-providers/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ The content provider supports the following execution arguments:
```hcl
content code {
# Required string.
#
# For example:
value = "Text to be formatted as a code block"
# Specifiy the language for syntax highlighting
#
# Optional string.
#
# For example:
# language = "python3"
#
#
# Default value:
language = ""
}
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/builtin/content-providers/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ content frontmatter {
#
# Required jq queriable.
# Must be non-empty
#
# For example:
content = {
key = "arbitrary value"
Expand Down
4 changes: 3 additions & 1 deletion docs/plugins/builtin/content-providers/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ The content provider supports the following execution arguments:
content image {
# Required string.
# Must be non-empty
#
# For example:
src = "https://example.com/img.png"

# Optional string.
#
# For example:
# alt = "Text description of the image"
#
#
# Default value:
alt = null
}
Expand Down
4 changes: 3 additions & 1 deletion docs/plugins/builtin/content-providers/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ content list {
# Go template for the item of the list
#
# Optional string.
#
# For example:
# item_template = "[{{.Title}}]({{.URL}})"
#
#
# Default value:
item_template = "{{.}}"

Expand All @@ -49,6 +50,7 @@ content list {
#
# Required list of jq queriable.
# Must be non-empty
#
# For example:
items = ["First item", "Second item", "Third item"]
}
Expand Down
2 changes: 2 additions & 0 deletions docs/plugins/builtin/content-providers/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "table" "content provider" >}}

## Description

Produces a table.

Each cell template has access to the data context and the following variables:
Expand Down Expand Up @@ -51,6 +52,7 @@ content table {
#
# Required list of object.
# Must be non-empty
#
# For example:
columns = [{
header = "1st column header template"
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/builtin/content-providers/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ content text {
# A string to render. Can use go template syntax.
#
# Required string.
#
# For example:
value = "Hello world!"
}
Expand Down
3 changes: 3 additions & 0 deletions docs/plugins/builtin/content-providers/title.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "title" "content provider" >}}

## Description

Produces a title.

The title size after calculations must be in an interval [0; 5] inclusive, where 0
corresponds to the largest size (`<h1>`) and 5 corresponds to (`<h6>`)


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


Expand All @@ -37,6 +39,7 @@ content title {
# Title content
#
# Required string.
#
# For example:
value = "Vulnerability Report"

Expand Down
2 changes: 2 additions & 0 deletions docs/plugins/builtin/content-providers/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "toc" "content provider" >}}

## Description

Produces table of contents.

Inspects the rendered document for headers of a certain size and creates a linked
table of contents


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


Expand Down
7 changes: 5 additions & 2 deletions docs/plugins/builtin/data-sources/csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "csv" "data source" >}}

## Description

Loads CSV files with the names that match provided `glob` pattern or a single file from a provided path.

Either `glob` or `path` argument must be set.
Expand Down Expand Up @@ -89,18 +90,20 @@ data csv {
# A glob pattern to select CSV files to read
#
# Optional string.
#
# For example:
# glob = "path/to/file*.csv"
#
#
# Default value:
glob = null

# A file path to a CSV file to read
#
# Optional string.
#
# For example:
# path = "path/to/file.csv"
#
#
# Default value:
path = null
}
Expand Down
5 changes: 5 additions & 0 deletions docs/plugins/builtin/data-sources/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "http" "data source" >}}

## Description

Loads data from a URL.

At the moment, the data source accepts only responses with UTF-8 charset and parses only responses
Expand All @@ -25,6 +26,7 @@ If MIME type of the response is `text/csv` or `application/json`, the response
content will be parsed and returned as a JSON structure (similar to the behaviour of CSV and JSON data
sources). Otherwise, the response content will be returned as text


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
Expand All @@ -42,12 +44,14 @@ data http {
# Optional
basic_auth {
# Required string.
#
# For example:
username = "[email protected]"

# Note: avoid storing credentials in the templates. Use environment variables instead.
#
# Required string.
#
# For example:
password = "passwd"
}
Expand All @@ -57,6 +61,7 @@ data http {
#
# Required string.
# Must be non-empty
#
# For example:
url = "https://example.localhost/file.json"

Expand Down
9 changes: 6 additions & 3 deletions docs/plugins/builtin/data-sources/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "json" "data source" >}}

## Description

Loads JSON 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.
Expand All @@ -30,7 +31,7 @@ When `glob` argument is specified, the data source returns a list of dicts that
"file_name": "file-a.json",
"content": {
"foo": "bar"
}
}
},
{
"file_path": "path/file-b.json",
Expand All @@ -57,18 +58,20 @@ data json {
# A glob pattern to select JSON files to read
#
# Optional string.
#
# For example:
# glob = "path/to/file*.json"
#
#
# Default value:
glob = null

# A file path to a JSON file to read
#
# Optional string.
#
# For example:
# path = "path/to/file.json"
#
#
# Default value:
path = null
}
Expand Down
31 changes: 24 additions & 7 deletions docs/plugins/builtin/data-sources/rss.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ type: docs
{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "rss" "data source" >}}

## Description

Fetches RSS / Atom / JSON feed from a provided URL.

The full content of the items can be fetched and added to the feed. The data source supports basic authentication.


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
Expand All @@ -37,18 +39,21 @@ data rss {
# Optional
basic_auth {
# Required string.
#
# For example:
username = "[email protected]"

# Note: avoid storing credentials in the templates. Use environment variables instead.
#
# Required string.
#
# For example:
password = "passwd"
}


# Required string.
#
# For example:
url = "https://www.elastic.co/security-labs/rss/feed.xml"

Expand All @@ -69,19 +74,31 @@ data rss {
#
# Optional number.
# Must be >= 0
#
# For example:
# max_items_to_fill = 10
#
# Default value:
max_items_to_fill = 10

# Return only items published after a specified timestamp. The timestamp format is "%Y-%m-%dT%H:%M:%S%Z".
#
# Optional string.
#
# For example:
# fill_in_max_items = false
#
# items_after = "2024-12-23T00:00:00Z"
#
# Default value:
fill_in_max_items = 10
items_after = null

# Return only items after a specified date time, in the format "%Y-%m-%dT%H:%M:%S%Z".
# Return only items published before a specified timestamp. The timestamp format is "%Y-%m-%dT%H:%M:%S%Z".
#
# Optional string.
#
# For example:
# only_items_after_time = "2024-12-23T00:00:00Z"
#
# items_before = "2024-12-23T00:00:00Z"
#
# Default value:
only_items_after_time = null
items_before = null
}
```
Loading
Loading