-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement baton-workato Connector #1
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1ce230d
feat: collaborator List
MarcusGoldschmidt d3aac57
feat: implement privileges
MarcusGoldschmidt d98ebe9
feat: list folder project
MarcusGoldschmidt 5f6fb88
feat: add recursive list for folders
MarcusGoldschmidt 949a254
update capabilities
MarcusGoldschmidt 623897d
add pagination for folders
MarcusGoldschmidt cd6e53e
feat: add grants for folder
MarcusGoldschmidt 706e4ec
feat: add grants for roles
MarcusGoldschmidt 151c4fc
refactor: pagination
MarcusGoldschmidt d5fcf7d
fix: lint
MarcusGoldschmidt 7dc65cc
fix pagination add role grants
MarcusGoldschmidt d81ded3
feat: add env for field
MarcusGoldschmidt 3e8ca25
feat: provisioningV2 roles to user
MarcusGoldschmidt 3bfa617
remove usuless test
MarcusGoldschmidt 0914f6a
feat: add CI
MarcusGoldschmidt 6d4e48d
fix: ci
MarcusGoldschmidt 47ef35b
fix: linter
MarcusGoldschmidt e4c6a7e
fix: add workato env for ci
MarcusGoldschmidt 9a8eef4
fix: provisioning and ci
MarcusGoldschmidt c6a835b
PR requested changes
MarcusGoldschmidt 0f89a65
fix: status code for http client
MarcusGoldschmidt cca67dc
Fix linter
MarcusGoldschmidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,60 @@ | ||
{ | ||
"@type": "type.googleapis.com/c1.connector.v2.ConnectorCapabilities", | ||
"resourceTypeCapabilities": [ | ||
"@type": "type.googleapis.com/c1.connector.v2.ConnectorCapabilities", | ||
"resourceTypeCapabilities": [ | ||
{ | ||
"resourceType": { | ||
"id": "user", | ||
"displayName": "User", | ||
"traits": [ | ||
"resourceType": { | ||
"id": "collaborator", | ||
"displayName": "Collaborator", | ||
"traits": [ | ||
"TRAIT_USER" | ||
] | ||
}, | ||
"capabilities": [ | ||
"capabilities": [ | ||
"CAPABILITY_SYNC" | ||
] | ||
}, | ||
{ | ||
"resourceType": { | ||
"id": "folder", | ||
"displayName": "Folder" | ||
}, | ||
"capabilities": [ | ||
"CAPABILITY_SYNC" | ||
] | ||
}, | ||
{ | ||
"resourceType": { | ||
"id": "privilege", | ||
"displayName": "Privilege" | ||
}, | ||
"capabilities": [ | ||
"CAPABILITY_SYNC" | ||
] | ||
}, | ||
{ | ||
"resourceType": { | ||
"id": "project", | ||
"displayName": "Project" | ||
}, | ||
"capabilities": [ | ||
"CAPABILITY_SYNC" | ||
] | ||
}, | ||
{ | ||
"resourceType": { | ||
"id": "role", | ||
"displayName": "Roles", | ||
"traits": [ | ||
"TRAIT_ROLE" | ||
] | ||
}, | ||
"capabilities": [ | ||
"CAPABILITY_SYNC" | ||
] | ||
} | ||
], | ||
"connectorCapabilities": [ | ||
"connectorCapabilities": [ | ||
"CAPABILITY_SYNC" | ||
], | ||
"credentialDetails": {} | ||
"credentialDetails": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package conf | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/conductorone/baton-workato/pkg/connector/workato" | ||
|
||
"github.com/conductorone/baton-sdk/pkg/field" | ||
"github.com/conductorone/baton-workato/pkg/connector/client" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
var ( | ||
ApiKeyField = field.StringField( | ||
"workato-api-key", | ||
field.WithRequired(true), | ||
field.WithDescription("Your workato API key"), | ||
) | ||
|
||
WorkatoDataCenterFiekd = field.StringField( | ||
"workato-data-center", | ||
field.WithDescription("Your workato data center (us, eu, jp, sg, au) default is 'us' see more on https://docs.workato.com/workato-api.html#base-url"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we don't have a field type that is "one of these values". Maybe we should add that to baton-sdk at some point. |
||
field.WithDefaultValue("us"), | ||
) | ||
|
||
WorkatoEnv = field.StringField( | ||
"workato-env", | ||
field.WithDescription("Your workato environment (dev, test, prod) default is 'dev'"), | ||
field.WithDefaultValue("dev"), | ||
) | ||
|
||
// ConfigurationFields defines the external configuration required for the | ||
// connector to run. Note: these fields can be marked as optional or | ||
// required. | ||
ConfigurationFields = []field.SchemaField{ | ||
ApiKeyField, | ||
WorkatoDataCenterFiekd, | ||
WorkatoEnv, | ||
} | ||
|
||
// FieldRelationships defines relationships between the fields listed in | ||
// ConfigurationFields that can be automatically validated. For example, a | ||
// username and password can be required together, or an access token can be | ||
// marked as mutually exclusive from the username password pair. | ||
FieldRelationships = []field.SchemaFieldRelationship{} | ||
) | ||
|
||
// ValidateConfig is run after the configuration is loaded, and should return an | ||
// error if it isn't valid. Implementing this function is optional, it only | ||
// needs to perform extra validations that cannot be encoded with configuration | ||
// parameters. | ||
func ValidateConfig(v *viper.Viper) error { | ||
if _, ok := client.WorkatoDataCenters[v.GetString(WorkatoDataCenterFiekd.FieldName)]; !ok { | ||
return errors.New("invalid workato data center") | ||
} | ||
|
||
_, err := workato.EnvFromString(v.GetString(WorkatoEnv.FieldName)) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
2 changes: 1 addition & 1 deletion
2
cmd/baton-workato/config_test.go → cmd/baton-workato/conf/config_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package conf | ||
|
||
import ( | ||
"testing" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong opinions about max line length, but it'd be nice to keep this the same in every repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some description from privileges have more then 250 lenght