-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ConductorOne/goldschmidt/workato-connector
Implement baton-workato Connector
- Loading branch information
Showing
43 changed files
with
3,111 additions
and
149 deletions.
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"), | ||
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.