Skip to content

Commit

Permalink
Merge branch 'main' into feat/misp
Browse files Browse the repository at this point in the history
  • Loading branch information
traut authored Nov 29, 2024
2 parents 87764e9 + 379e2f8 commit 1a24b58
Show file tree
Hide file tree
Showing 37 changed files with 2,164 additions and 59 deletions.
9 changes: 9 additions & 0 deletions .goreleaser-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,12 @@ builds:
no_unique_dist_dir: true
tags:
- fabricplugin

- id: atlassian
main: ./internal/atlassian/cmd
binary: "plugins/blackstork/atlassian@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
gcflags: all=-N -l
no_unique_dist_dir: true
tags:
- fabricplugin
27 changes: 27 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ builds:
tags:
- fabricplugin

- id: plugin_atlassian
main: ./internal/atlassian/cmd
binary: "atlassian@{{ .Version }}"
flags: "-trimpath"
hooks:
post:
- go run ./tools/pluginmeta --namespace blackstork --version {{.Version}} patch --plugin {{.Path}} --os {{.Os}} --arch {{.Arch}}
goos:
- linux
- windows
- darwin
tags:
- fabricplugin

archives:
- id: fabric
format: tar.gz
Expand Down Expand Up @@ -457,6 +471,7 @@ archives:
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
- id: plugin_iris
format: tar.gz
builds:
Expand All @@ -469,6 +484,18 @@ archives:
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
- id: plugin_atlassian
format: tar.gz
builds:
- plugin_atlassian
name_template: >-
plugin_atlassian_
{{- .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
dockers:
- use: buildx
goos: linux
Expand Down
12 changes: 12 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,25 @@ packages:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/microsoft/client:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/builtin/hubapi:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/microsoft:
config:
interfaces:
AzureClient:
AzureOpenAIClient:
MicrosoftGraphClient:
MicrosoftSecurityClient:
github.com/blackstork-io/fabric/internal/atlassian/client:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/crowdstrike:
config:
interfaces:
Expand Down
34 changes: 34 additions & 0 deletions docs/plugins/atlassian/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: blackstork/atlassian
weight: 20
plugin:
name: blackstork/atlassian
description: "The `atlassian` plugin for Atlassian Cloud."
tags: []
version: "v0.4.2"
source_github: "https://github.com/blackstork-io/fabric/tree/main/internal/atlassian/"
type: docs
hideInMenu: true
---

{{< plugin-header "blackstork/atlassian" "atlassian" "v0.4.2" >}}

## Description
The `atlassian` plugin for Atlassian Cloud.

## Installation

To install the plugin, add it to `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), with a version constraint restricting which available versions of the plugin the codebase is compatible with:

```hcl
fabric {
plugin_versions = {
"blackstork/atlassian" = ">= v0.4.2"
}
}
```


## Data sources

{{< plugin-resources "atlassian" "data-source" >}}
114 changes: 114 additions & 0 deletions docs/plugins/atlassian/data-sources/jira_issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: "`jira_issues` data source"
plugin:
name: blackstork/atlassian
description: "Retrieve issues from Jira"
tags: []
version: "v0.4.2"
source_github: "https://github.com/blackstork-io/fabric/tree/main/internal/atlassian/"
resource:
type: data-source
type: docs
---

{{< breadcrumbs 2 >}}

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

## Description
Retrieve issues from Jira.

## Installation

To use `jira_issues` data source, you must install the plugin `blackstork/atlassian`.

To install the plugin, add the full plugin name to the `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), as shown below:

```hcl
fabric {
plugin_versions = {
"blackstork/atlassian" = ">= v0.4.2"
}
}
```

Note the version constraint set for the plugin.

## Configuration

The data source supports the following configuration arguments:

```hcl
config data jira_issues {
# Account Domain.
#
# 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"
}
```

## Usage

The data source supports the following execution arguments:

```hcl
data jira_issues {
# Use expand to include additional information about issues in the response.
#
# 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
# Default value:
properties = []
# Size limit to retrieve.
#
# Optional number.
# Must be >= 0
# Default value:
size = 0
}
```
69 changes: 69 additions & 0 deletions docs/plugins/builtin/publishers/hub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "`hub` publisher"
plugin:
name: blackstork/builtin
description: "Publish documents to Blackstork Hub."
tags: []
version: "v0.4.2"
source_github: "https://github.com/blackstork-io/fabric/tree/main/internal/builtin/"
resource:
type: publisher
type: docs
---

{{< breadcrumbs 2 >}}

{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "hub" "publisher" >}}

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

#### Formats

The publisher supports the following document formats:

- `unknown`

To set the output format, specify it inside `publish` block with `format` argument.


#### Configuration

The publisher supports the following configuration arguments:

```hcl
config publish hub {
# API url.
#
# Required string.
# Must be non-empty
# For example:
api_url = "some string"
# API url.
#
# Required string.
# Must be non-empty
# For example:
api_token = "some string"
}
```

#### Usage

The publisher supports the following execution arguments:

```hcl
# In addition to the arguments listed, `publish` block accepts `format` argument.
publish hub {
# Hub Document title override. By default uses title configured in the document.
#
# Optional string.
# Must be non-empty
# Default value:
title = null
}
```

34 changes: 34 additions & 0 deletions docs/plugins/plugins.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
[
{
"name": "blackstork/atlassian",
"version": "v0.4.2",
"shortname": "atlassian",
"resources": [
{
"name": "jira_issues",
"type": "data-source",
"config_params": [
"account_email",
"api_token",
"domain"
],
"arguments": [
"expand",
"fields",
"jql",
"properties",
"size"
]
}
]
},
{
"name": "blackstork/builtin",
"version": "v0.4.2",
Expand Down Expand Up @@ -50,6 +73,17 @@
"url"
]
},
{
"name": "hub",
"type": "publisher",
"config_params": [
"api_token",
"api_url"
],
"arguments": [
"title"
]
},
{
"name": "image",
"type": "content-provider",
Expand Down
4 changes: 4 additions & 0 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (e *Engine) FileMap() map[string]*hcl.File {
return e.fileMap
}

func (e *Engine) ParsedBlocks() *parser.DefinedBlocks {
return e.blocks
}

func (e *Engine) Install(ctx context.Context, upgrade bool) (diags diagnostics.Diag) {
ctx, span := e.tracer.Start(ctx, "Engine.Install", trace.WithAttributes(
attribute.Bool("upgrade", upgrade),
Expand Down
28 changes: 28 additions & 0 deletions examples/templates/atlassian/example.fabric
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
fabric {
plugin_versions = {
"blackstork/atlassian" = ">= 0.5 < 1.0 || 0.5.0-rev0"
}
}

config data jira_issues {
domain = env.JIRA_DOMAIN
account_email = env.JIRA_ACCOUNT_EMAIL
api_token = env.JIRA_API_TOKEN
}

document "example" {
title = "Using atlassian plugin"
data jira_issues "my_issues" {
expand = "names"
fields = ["*all"]
jql = "project = TEST"
size = 5
}
content title {
value = "My Jira Issues"
}
content list {
item_template = "{{.key}}: {{.fields.summary}}"
items = query_jq(".data.jira_issues.my_issues")
}
}
Loading

0 comments on commit 1a24b58

Please sign in to comment.