Skip to content
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
44 changes: 44 additions & 0 deletions .github/workflows/capabilities_and_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Generate capabilities and config schema

on:
push:
branches:
- main

jobs:
generate_outputs:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.RELENG_GITHUB_TOKEN }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Build
run: go build -o connector ./cmd/baton-tableau

- name: Run and save config output
run: ./connector config > config_schema.json

- name: Run and save capabilities output
env:
BATON_ACCESS_TOKEN_NAME: ${{ secrets.BATON_ACCESS_TOKEN_NAME }}
BATON_ACCESS_TOKEN_SECRET: ${{ secrets.BATON_ACCESS_TOKEN_SECRET }}
BATON_SERVER_PATH: ${{ secrets.BATON_SERVER_PATH }}
run: ./connector capabilities > baton_capabilities.json

- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Updating baton config schema and capabilities."
add: |
config_schema.json
baton_capabilities.json
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
release:
uses: ConductorOne/github-workflows/.github/workflows/release.yaml@v2
with:
lambda: false
tag: ${{ github.ref_name }}
secrets:
RELENG_GITHUB_TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }}
Expand Down
13 changes: 0 additions & 13 deletions .gon-amd64.json

This file was deleted.

13 changes: 0 additions & 13 deletions .gon-arm64.json

This file was deleted.

55 changes: 0 additions & 55 deletions .goreleaser.docker.yaml

This file was deleted.

84 changes: 0 additions & 84 deletions .goreleaser.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile.lambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM public.ecr.aws/lambda/provided:al2023
ENTRYPOINT ["/baton-tableau", "lambda"]
COPY baton-tableau /
16 changes: 8 additions & 8 deletions cmd/baton-tableau/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
_, cmd, err := config.DefineConfiguration(
ctx,
"baton-tableau",
getConnector[*cfg.Tableau],
getConnector,
cfg.Config,
)
if err != nil {
Expand All @@ -42,18 +42,18 @@ func main() {
}
}

func getConnector[T field.Configurable](ctx context.Context, config T) (types.ConnectorServer, error) {
func getConnector(ctx context.Context, tc *cfg.Tableau) (types.ConnectorServer, error) {
l := ctxzap.Extract(ctx)
if err := field.Validate(cfg.Config, config); err != nil {
if err := field.Validate(cfg.Config, tc); err != nil {
return nil, err
}

apiVersion := config.GetString(cfg.APIVersion.FieldName)
apiVersion := tc.ApiVersion
if apiVersion == "" {
apiVersion = "3.17"
}

serverPath := config.GetString(cfg.ServerPath.FieldName)
serverPath := tc.ServerPath
baseUrl, err := url.JoinPath("https://", serverPath, "api", apiVersion)
if err != nil {
l.Error("error creating base url", zap.Error(err))
Expand All @@ -62,9 +62,9 @@ func getConnector[T field.Configurable](ctx context.Context, config T) (types.Co
cb, err := connector.New(
ctx,
baseUrl,
config.GetString(cfg.SiteID.FieldName),
config.GetString(cfg.AccessTokenName.FieldName),
config.GetString(cfg.AccessTokenSecret.FieldName),
tc.SiteId,
tc.AccessTokenName,
tc.AccessTokenSecret,
)
if err != nil {
l.Error("error creating connector", zap.Error(err))
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ import (
var (
AccessTokenName = field.StringField(
"access-token-name",
field.WithRequired(true),
field.WithDisplayName("Access Token Name"),
field.WithDescription("Access token name used to connect to the Tableau API"),
)

AccessTokenSecret = field.StringField(
"access-token-secret",
field.WithRequired(true),
field.WithDisplayName("Access Token Secret"),
field.WithDescription("Access token secret used to connect to the Tableau API"),
field.WithIsSecret(true),
)

ServerPath = field.StringField(
"server-path",
field.WithRequired(true),
field.WithDisplayName("Server Path"),
field.WithDescription("Base URL of your Tableau Server or Tableau Cloud instance"),
)
Expand Down