Skip to content

Commit

Permalink
added example to action usage with dataset in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pazhersh committed Mar 6, 2024
1 parent 945de47 commit 2fe6f29
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 0 deletions.
155 changes: 155 additions & 0 deletions docs/resources/port_action.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,80 @@ description: |-
}
}
```
Create the same resources as in the previous example, but the action's entity selection properties will only allow entities which pass the datasets:
```hcl
resource "port_blueprint" "parent" {
icon = "Terraform"
title = "Parent"
identifier = "parent"
properties = {}
}
resource "portblueprint" "child" {
icon = "Terraform"
title = "Child"
identifier = "child"
properties = {}
relations = {
"childOf" = {
title = "Child Of"
many = true
required = false
target = portblueprint.parent.identifier
}
}
}
resource "portaction" "myAction" {
title = "My Action"
blueprint = portblueprint.child.identifier
identifier = "myAction"
trigger = "CREATE"
requiredapproval = false
githubmethod = {
org = "your-org"
repo = "your-repo"
workflow = "your-workflow"
omitpayload = true
omituserinputs = true
reportworkflowstatus = true
}
userproperties = {
stringprops = {
singleParent = {
title = "Single Parent Entity Selection"
format = "entity"
blueprint = portblueprint.parent.identifier
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jqquery = "\"specificValue\""
}
}]
}
}
}
arrayprops = {
miltipleParents = {
title = "Single Parent Entity Selection"
stringitems = {
format = "entity"
blueprint = portblueprint.parent.identifier
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
}
}
}
}
}
```
---

# port_action (Resource)
Expand Down Expand Up @@ -220,6 +294,87 @@ resource "port_action" "myAction" {
```


Create the same resources as in the previous example, but the action's entity selection properties will only allow entities which pass the `dataset`s:

```hcl
resource "port_blueprint" "parent" {
icon = "Terraform"
title = "Parent"
identifier = "parent"
properties = {}
}
resource "port_blueprint" "child" {
icon = "Terraform"
title = "Child"
identifier = "child"
properties = {}
relations = {
"childOf" = {
title = "Child Of"
many = true
required = false
target = port_blueprint.parent.identifier
}
}
}
resource "port_action" "myAction" {
title = "My Action"
blueprint = port_blueprint.child.identifier
identifier = "myAction"
trigger = "CREATE"
required_approval = false
github_method = {
org = "your-org"
repo = "your-repo"
workflow = "your-workflow"
omit_payload = true
omit_user_inputs = true
report_workflow_status = true
}
user_properties = {
string_props = {
singleParent = {
title = "Single Parent Entity Selection"
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
}
}
array_props = {
miltipleParents = {
title = "Single Parent Entity Selection"
string_items = {
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
}
}
}
}
}
```



<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
83 changes: 83 additions & 0 deletions port/action/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,4 +818,87 @@ resource "port_action" "myAction" {
` + "```" + `
Create the same resources as in the previous example, but the action's entity selection properties will only allow entities which pass the ` + "`dataset`s" + `:
` + "```hcl" + `
resource "port_blueprint" "parent" {
icon = "Terraform"
title = "Parent"
identifier = "parent"
properties = {}
}
resource "port_blueprint" "child" {
icon = "Terraform"
title = "Child"
identifier = "child"
properties = {}
relations = {
"childOf" = {
title = "Child Of"
many = true
required = false
target = port_blueprint.parent.identifier
}
}
}
resource "port_action" "myAction" {
title = "My Action"
blueprint = port_blueprint.child.identifier
identifier = "myAction"
trigger = "CREATE"
required_approval = false
github_method = {
org = "your-org"
repo = "your-repo"
workflow = "your-workflow"
omit_payload = true
omit_user_inputs = true
report_workflow_status = true
}
user_properties = {
string_props = {
singleParent = {
title = "Single Parent Entity Selection"
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
}
}
array_props = {
miltipleParents = {
title = "Single Parent Entity Selection"
string_items = {
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
}
}
}
}
}
` + "```" + `
`

0 comments on commit 2fe6f29

Please sign in to comment.