Skip to content

Commit

Permalink
Merge pull request #1 from ConductorOne/goldschmidt/lucidchart-start
Browse files Browse the repository at this point in the history
Lucidchart connector
  • Loading branch information
btipling authored Feb 6, 2025
2 parents 87b3524 + b34125b commit 1452525
Show file tree
Hide file tree
Showing 59 changed files with 3,949 additions and 505 deletions.
59 changes: 42 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
![Baton Logo](./baton-logo.png)

# `baton-lucidchart` [![Go Reference](https://pkg.go.dev/badge/github.com/conductorone/baton-lucidchart.svg)](https://pkg.go.dev/github.com/conductorone/baton-lucidchart) ![main ci](https://github.com/conductorone/baton-lucidchart/actions/workflows/main.yaml/badge.svg)
#

`baton-lucidchart` [![Go Reference](https://pkg.go.dev/badge/github.com/conductorone/baton-lucidchart.svg)](https://pkg.go.dev/github.com/conductorone/baton-lucidchart) ![main ci](https://github.com/conductorone/baton-lucidchart/actions/workflows/main.yaml/badge.svg)

`baton-lucidchart` is a connector for built using the [Baton SDK](https://github.com/conductorone/baton-sdk).

Check out [Baton](https://github.com/conductorone/baton) to learn more the project in general.

# Getting Started

1. Create an api key from [Lucidchart](https://developer.lucid.co/reference/creating-a-key)
1. Required Api Permission
1. FolderRead
2. DocumentRead
3. FolderEdit (Provisioning)
2. Create oAuth2 client from [Lucidchart](https://developer.lucid.co/reference/client-creation)
1. Generate the code using `authorizeAccount` https://developer.lucid.co/reference/obtaining-an-access-token
2. Use the code or token/refresh-token on the connector

## Usage

```
baton-lucidchart \
--lucid-client-id="" \
--lucid-client-secret="" \
--lucid-redirect-url="" \
--lucid-api-key="" \
--lucid-code=""
```

## brew

```
Expand Down Expand Up @@ -37,6 +59,7 @@ baton resources
# Data Model

`baton-lucidchart` will pull down information about the following resources:

- Users

# Contributing, Support and Issues
Expand All @@ -54,24 +77,26 @@ See [CONTRIBUTING.md](https://github.com/ConductorOne/baton/blob/main/CONTRIBUTI
baton-lucidchart
Usage:
baton-lucidchart [flags]
baton-lucidchart [command]
baton-lucidchart completion [command]
Available Commands:
capabilities Get connector capabilities
completion Generate the autocompletion script for the specified shell
help Help about any command
bash Generate the autocompletion script for bash
fish Generate the autocompletion script for fish
powershell Generate the autocompletion script for powershell
zsh Generate the autocompletion script for zsh
Flags:
--client-id string The client ID used to authenticate with ConductorOne ($BATON_CLIENT_ID)
--client-secret string The client secret used to authenticate with ConductorOne ($BATON_CLIENT_SECRET)
-f, --file string The path to the c1z file to sync with ($BATON_FILE) (default "sync.c1z")
-h, --help help for baton-lucidchart
--log-format string The output format for logs: json, console ($BATON_LOG_FORMAT) (default "json")
--log-level string The log level: debug, info, warn, error ($BATON_LOG_LEVEL) (default "info")
-p, --provisioning If this connector supports provisioning, this must be set in order for provisioning actions to be enabled ($BATON_PROVISIONING)
--ticketing This must be set to enable ticketing support ($BATON_TICKETING)
-v, --version version for baton-lucidchart
Use "baton-lucidchart [command] --help" for more information about a command.
-h, --help help for completion
Global Flags:
--client-id string The client ID used to authenticate with ConductorOne ($BATON_CLIENT_ID)
--client-secret string The client secret used to authenticate with ConductorOne ($BATON_CLIENT_SECRET)
-f, --file string The path to the c1z file to sync with ($BATON_FILE) (default "sync.c1z")
--log-format string The output format for logs: json, console ($BATON_LOG_FORMAT) (default "json")
--log-level string The log level: debug, info, warn, error ($BATON_LOG_LEVEL) (default "info")
-p, --provisioning This must be set in order for provisioning actions to be enabled ($BATON_PROVISIONING)
--skip-full-sync This must be set to skip a full sync ($BATON_SKIP_FULL_SYNC)
--ticketing This must be set to enable ticketing support ($BATON_TICKETING)
Use "baton-lucidchart completion [command] --help" for more information about a command.
```
43 changes: 42 additions & 1 deletion cmd/baton-lucidchart/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,51 @@ import (
)

var (
LucidApiKeyField = field.StringField(
"lucid-api-key",
field.WithDescription("The API key for the Lucidchart API."),
field.WithRequired(true),
)

LucidCodeKeyField = field.StringField(
"lucid-code",
field.WithDescription("The code key for the Lucidchart API."),
)

LucidClientIdField = field.StringField(
"lucid-client-id",
field.WithDescription("The client ID for the Lucidchart API."),
field.WithRequired(true),
)

LucidClientSecretField = field.StringField(
"lucid-client-secret",
field.WithDescription("The client secret for the Lucidchart API."),
field.WithRequired(true),
)

LucidRedirectUrlField = field.StringField(
"lucid-redirect-url",
field.WithDescription("The redirect URL for the Lucidchart API."),
field.WithRequired(true),
)

LucidRefreshTokenField = field.StringField(
"lucid-refresh-token",
field.WithDescription("The refresh token for the Lucidchart API."),
)

// ConfigurationFields defines the external configuration required for the
// connector to run. Note: these fields can be marked as optional or
// required.
ConfigurationFields = []field.SchemaField{}
ConfigurationFields = []field.SchemaField{
LucidApiKeyField,
LucidCodeKeyField,
LucidClientIdField,
LucidClientSecretField,
LucidRedirectUrlField,
LucidRefreshTokenField,
}

// FieldRelationships defines relationships between the fields listed in
// ConfigurationFields that can be automatically validated. For example, a
Expand Down
11 changes: 9 additions & 2 deletions cmd/baton-lucidchart/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"os"

"github.com/conductorone/baton-lucidchart/pkg/connector"
"github.com/conductorone/baton-sdk/pkg/config"
"github.com/conductorone/baton-sdk/pkg/connectorbuilder"
"github.com/conductorone/baton-sdk/pkg/field"
"github.com/conductorone/baton-sdk/pkg/types"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
"github.com/spf13/viper"
"github.com/conductorone/baton-lucidchart/pkg/connector"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -48,7 +48,14 @@ func getConnector(ctx context.Context, v *viper.Viper) (types.ConnectorServer, e
return nil, err
}

cb, err := connector.New(ctx)
apiKey := v.GetString(LucidApiKeyField.FieldName)
code := v.GetString(LucidCodeKeyField.FieldName)
clientID := v.GetString(LucidClientIdField.FieldName)
clientSecret := v.GetString(LucidClientSecretField.FieldName)
redirectURL := v.GetString(LucidRedirectUrlField.FieldName)
refreshToken := v.GetString(LucidRefreshTokenField.FieldName)

cb, err := connector.New(ctx, apiKey, code, clientID, clientSecret, redirectURL, refreshToken)
if err != nil {
l.Error("error creating connector", zap.Error(err))
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module github.com/conductorone/baton-lucidchart
go 1.22.10

require (
github.com/conductorone/baton-sdk v0.2.64
github.com/conductorone/baton-sdk v0.2.66
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
go.uber.org/zap v1.27.0
google.golang.org/grpc v1.63.3
)

require (
Expand Down Expand Up @@ -70,7 +72,6 @@ require (
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
Expand All @@ -87,7 +88,6 @@ require (
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/grpc v1.63.3 // indirect
google.golang.org/protobuf v1.36.3 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-sdk v0.2.64 h1:I1XboeRjE2/rBuL86pRRIPEgqCMp0QGaCd6/04Bi78k=
github.com/conductorone/baton-sdk v0.2.64/go.mod h1:++OGHvXelWE8B/n4539ZgsXkwyV376AF/AAP+HhXJ1M=
github.com/conductorone/baton-sdk v0.2.66 h1:1lZViGp4FWX4jTwzyGFhyoo4guy/Ny9yYupi7FjmKeQ=
github.com/conductorone/baton-sdk v0.2.66/go.mod h1:++OGHvXelWE8B/n4539ZgsXkwyV376AF/AAP+HhXJ1M=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
Loading

0 comments on commit 1452525

Please sign in to comment.