Skip to content

Commit 600f9ad

Browse files
committed
Improved integration, notifier show & list commands.
1 parent ee5adf3 commit 600f9ad

File tree

10 files changed

+94
-92
lines changed

10 files changed

+94
-92
lines changed

.devcontainer/devcontainer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
"mounts": [
1010
"source=${localWorkspaceFolder}/../pipe-fittings,target=/workspaces/pipe-fittings,type=bind,consistency=cached",
11-
"source=${localWorkspaceFolder}/../flowpipe-sdk-go,target=/workspaces/flowpipe-sdk-go,type=bind,consistency=cached"
11+
"source=${localWorkspaceFolder}/../flowpipe-sdk-go,target=/workspaces/flowpipe-sdk-go,type=bind,consistency=cached",
12+
"source=go-build-cache,target=/root/.cache/go-build,type=volume"
1213
],
1314

1415
"features": {
@@ -33,6 +34,6 @@
3334
"HashiCorp.HCL"]
3435
}
3536
},
36-
37+
3738
"postStartCommand": ".devcontainer/scripts/post-start-command.sh"
3839
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
**/*.fp linguist-language=HCL
2+
**/*.fpc linguist-language=HCL

.github/workflows/devcontainer-release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout Flowpipe repository
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020
with:
2121
path: flowpipe
2222

.github/workflows/flowpipe-container.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
# Checks out the Flowpipe repository code.
2323
- name: Checkout Flowpipe repository
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
with:
2626
path: flowpipe # Directory path under $GITHUB_WORKSPACE to place the repository.
2727

.github/workflows/flowpipe-release.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,21 @@ jobs:
7878
fi
7979
8080
- name: Checkout
81-
uses: actions/checkout@v3
81+
uses: actions/checkout@v4
8282
with:
8383
path: flowpipe
8484
ref: ${{ github.event.ref }}
8585

8686
- name: Checkout Pipe Fittings Components repository
87-
uses: actions/checkout@v3
87+
uses: actions/checkout@v4
8888
with:
8989
ssh-key: ${{ secrets.PIPE_FITTINGS_DEPLOY_PRIVATE_KEY }}
9090
repository: turbot/pipe-fittings
9191
path: pipe-fittings
9292
ref: main
9393

9494
- name: Checkout Flowpipe SDK Go repository
95-
uses: actions/checkout@v3
95+
uses: actions/checkout@v4
9696
with:
9797
ssh-key: ${{ secrets.FLOWPIPE_GO_SDK_DEPLOY_PRIVATE_KEY }}
9898
repository: turbot/flowpipe-sdk-go

.github/workflows/test-integration.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
MARIADB_DATABASE: flowpipe-test
4242
ports:
4343
- 3306:3306
44-
options: >-
45-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
46-
--health-interval=10s
47-
--health-timeout=5s
44+
options: >-
45+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
46+
--health-interval=10s
47+
--health-timeout=5s
4848
--health-retries=3
4949
5050
# Install MailHog for SMTP mail testing
@@ -56,20 +56,20 @@ jobs:
5656

5757
steps:
5858
- name: Checkout Flowpipe repository
59-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
6060
with:
6161
path: flowpipe
6262

6363
- name: Checkout Pipe Fittings Components repository
64-
uses: actions/checkout@v3
64+
uses: actions/checkout@v4
6565
with:
6666
ssh-key: ${{ secrets.PIPE_FITTINGS_DEPLOY_PRIVATE_KEY }}
6767
repository: turbot/pipe-fittings
6868
path: pipe-fittings
6969
ref: main
7070

7171
- name: Checkout Flowpipe SDK Go repository
72-
uses: actions/checkout@v3
72+
uses: actions/checkout@v4
7373
with:
7474
ssh-key: ${{ secrets.FLOWPIPE_GO_SDK_DEPLOY_PRIVATE_KEY }}
7575
repository: turbot/flowpipe-sdk-go

.github/workflows/test-lint-test.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ jobs:
4040
MARIADB_DATABASE: flowpipe-test
4141
ports:
4242
- 3306:3306
43-
options: >-
44-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
45-
--health-interval=10s
46-
--health-timeout=5s
43+
options: >-
44+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
45+
--health-interval=10s
46+
--health-timeout=5s
4747
--health-retries=3
4848
4949
# Install MailHog for SMTP mail testing
@@ -55,20 +55,20 @@ jobs:
5555

5656
steps:
5757
- name: Checkout Flowpipe repository
58-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
5959
with:
6060
path: flowpipe
6161

6262
- name: Checkout Pipe Fittings Components repository
63-
uses: actions/checkout@v3
63+
uses: actions/checkout@v4
6464
with:
6565
ssh-key: ${{ secrets.PIPE_FITTINGS_DEPLOY_PRIVATE_KEY }}
6666
repository: turbot/pipe-fittings
6767
path: pipe-fittings
6868
ref: main
6969

7070
- name: Checkout Flowpipe SDK Go repository
71-
uses: actions/checkout@v3
71+
uses: actions/checkout@v4
7272
with:
7373
ssh-key: ${{ secrets.FLOWPIPE_GO_SDK_DEPLOY_PRIVATE_KEY }}
7474
repository: turbot/flowpipe-sdk-go

internal/es/estest/test_suite_mod/integrations.fpc

+25-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ integration "slack" "my_slack_app" {
55
signing_secret = "Q#$$#@#$$#W"
66
}
77

8+
integration "email" "email_integration_1" {
9+
10+
}
11+
812
notifier "my_notifier" {
913
description = "my notifier with 2 notifies"
1014

1115
notify {
1216
integration = integration.webform.default
1317
channel = "fake one"
18+
subject = "bar"
1419
}
1520

1621
notify {
1722
integration = integration.webform.default
18-
to = ["just some things here"]
23+
to = ["a", "b", "c"]
24+
channel = "foo"
1925
}
2026
}
2127

@@ -24,4 +30,21 @@ integration "slack" "my_other_slack_app" {
2430

2531
# optional - if you want to verify the source
2632
signing_secret = "Q#$$#@#$$#W"
27-
}
33+
}
34+
35+
notifier "slack_notify" {
36+
description = "slack notifer with some notifies"
37+
38+
notify {
39+
integration = integration.slack.my_other_slack_app
40+
channel = "fake one"
41+
subject = "bar"
42+
}
43+
44+
notify {
45+
integration = integration.email.email_integration_1
46+
to = ["billie", "bob", "joe"]
47+
cc = ["angus", "brian", "charlie", "dave"]
48+
bcc = ["eddie", "frank", "george", "harry"]
49+
}
50+
}

internal/types/integration.go

+15-31
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package types
22

33
import (
44
"fmt"
5-
"github.com/turbot/go-kit/helpers"
65

76
"github.com/logrusorgru/aurora"
87
flowpipeapiclient "github.com/turbot/flowpipe-sdk-go"
@@ -20,16 +19,14 @@ type ListIntegrationResponse struct {
2019
}
2120

2221
type FpIntegration struct {
23-
Name string `json:"name"`
24-
Type string `json:"type"`
25-
Description *string `json:"description,omitempty"`
26-
Title *string `json:"title,omitempty"`
27-
Documentation *string `json:"documentation,omitempty"`
28-
Tags map[string]string `json:"tags,omitempty"`
29-
FileName string `json:"file_name,omitempty"`
30-
StartLineNumber int `json:"start_line_number,omitempty"`
31-
EndLineNumber int `json:"end_line_number,omitempty"`
32-
Url *string `json:"url,omitempty"`
22+
Name string `json:"name"`
23+
Type string `json:"type"`
24+
Description *string `json:"description,omitempty"`
25+
Title *string `json:"title,omitempty"`
26+
FileName string `json:"file_name,omitempty"`
27+
StartLineNumber int `json:"start_line_number,omitempty"`
28+
EndLineNumber int `json:"end_line_number,omitempty"`
29+
Url *string `json:"url,omitempty"`
3330
}
3431

3532
func (f FpIntegration) String(_ *sanitize.Sanitizer, opts sanitize.RenderOptions) string {
@@ -39,7 +36,7 @@ func (f FpIntegration) String(_ *sanitize.Sanitizer, opts sanitize.RenderOptions
3936
// left := au.BrightBlack("[")
4037
// right := au.BrightBlack("]")
4138
keyWidth := 10
42-
if f.Description != nil {
39+
if f.Description != nil || f.Url != nil {
4340
keyWidth = 13
4441
}
4542

@@ -52,13 +49,7 @@ func (f FpIntegration) String(_ *sanitize.Sanitizer, opts sanitize.RenderOptions
5249
output += fmt.Sprintf("%-*s%s\n", keyWidth, au.Blue("Description:"), *f.Description)
5350
}
5451
if f.Url != nil {
55-
output += fmt.Sprintf("%-*s%s\n", keyWidth, au.Blue("URL:"), *f.Url)
56-
}
57-
if len(f.Tags) > 0 {
58-
output += fmt.Sprintf("%s\n", au.Blue("Tags:"))
59-
for k, v := range f.Tags {
60-
output += fmt.Sprintf(" %s %s\n", au.Cyan(k+":"), v)
61-
}
52+
output += fmt.Sprintf("%-*s%s\n", keyWidth, au.Blue("Request URL:"), *f.Url)
6253
}
6354

6455
return output
@@ -81,16 +72,10 @@ func ListIntegrationResponseFromAPI(apiResp *flowpipeapiclient.ListIntegrationRe
8172

8273
func FpIntegrationFromAPI(apiIntegration flowpipeapiclient.FpIntegration) FpIntegration {
8374
res := FpIntegration{
84-
Name: typehelpers.SafeString(apiIntegration.Name),
85-
Type: typehelpers.SafeString(apiIntegration.Type),
86-
Description: apiIntegration.Description,
87-
Title: apiIntegration.Title,
88-
Documentation: apiIntegration.Documentation,
89-
}
90-
if !helpers.IsNil(apiIntegration.Tags) {
91-
res.Tags = *apiIntegration.Tags
92-
} else {
93-
res.Tags = make(map[string]string)
75+
Name: typehelpers.SafeString(apiIntegration.Name),
76+
Type: typehelpers.SafeString(apiIntegration.Type),
77+
Description: apiIntegration.Description,
78+
Title: apiIntegration.Title,
9479
}
9580
return res
9681
}
@@ -101,7 +86,6 @@ func FpIntegrationFromModIntegration(integration modconfig.Integration) (*FpInte
10186
Type: integration.GetIntegrationType(),
10287
Url: integration.GetIntegrationImpl().Url,
10388
Description: integration.GetHclResourceImpl().Description,
104-
Tags: integration.GetTags(),
10589
}
10690

10791
resp.FileName = integration.GetIntegrationImpl().FileName
@@ -156,5 +140,5 @@ func (p PrintableIntegration) GetTable() (*printers.Table, error) {
156140
}
157141

158142
func (PrintableIntegration) getColumns() (columns []string) {
159-
return []string{"NAME", "TYPE", "DESCRIPTION", "URL"}
143+
return []string{"NAME", "TYPE", "DESCRIPTION", "REQUEST URL"}
160144
}

0 commit comments

Comments
 (0)