Skip to content

Commit

Permalink
feat: Extending rss data source (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
traut authored Jan 11, 2025
1 parent 898b365 commit 0dfddd6
Show file tree
Hide file tree
Showing 75 changed files with 980 additions and 295 deletions.
2 changes: 2 additions & 0 deletions cmd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ var renderCmd = &cobra.Command{
if diags.Extend(diag) {
return
}
// Do not print to stdout if publishing is requested
return
}

logger.InfoContext(ctx, "Printing to stdout", "format", format)
Expand Down
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 = "user@example.com"
# 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
Loading

0 comments on commit 0dfddd6

Please sign in to comment.