-
Notifications
You must be signed in to change notification settings - Fork 1
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 #34 from silinternational/develop
Release 3.4.0 - Google Sheets destination
- Loading branch information
Showing
15 changed files
with
348 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,69 @@ Note: `Source` fields should be adjusted to fit the actual source adapter. | |
|
||
Configurations for `BatchSize`, `BatchDelaySeconds`, `DisableAdd`, `DisableUpdate`, and `DisableDelete` are all optional with defaults as shown in example. | ||
|
||
### Google Sheets | ||
The Google Sheets destination creates a copy of the source data in a Google Sheets | ||
document. | ||
|
||
If any of the disable options, DisableAdd, DisableDelete, or DisableUpdate are | ||
set to true, no sync will be performed. | ||
|
||
There must be at least two rows in the sheet to begin with. The first row must | ||
be pre-filled with field names. The second row must be present, but will be | ||
ignored and may be overwritten. | ||
|
||
The entire sheet will be overwritten with new data on every sync | ||
|
||
If not specified in the configuration, the sheet updated is "Sheet1" | ||
|
||
Example config: | ||
```json | ||
{ | ||
"Destination": { | ||
"Type": "GoogleSheets", | ||
"ExtraJSON": { | ||
"DelegatedAdminEmail": "[email protected]", | ||
"GoogleAuth": { | ||
"type": "service_account", | ||
"project_id": "abc-theme-123456", | ||
"private_key_id": "abc123", | ||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIabc...\nabc...\n...xyz\n-----END PRIVATE KEY-----\n", | ||
"client_email": "[email protected]", | ||
"client_id": "123456789012345678901", | ||
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | ||
"token_uri": "https://oauth2.googleapis.com/token", | ||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", | ||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/my-sync-bot%40abc-theme-123456.iam.gserviceaccount.com" | ||
} | ||
} | ||
}, | ||
"AttributeMap": [ | ||
{ | ||
"Source": "email", | ||
"Destination": "email" | ||
}, | ||
{ | ||
"Source": "employee_id", | ||
"Destination": "employee_id" | ||
} | ||
], | ||
"SyncSets": [ | ||
{ | ||
"Name": "Sync from Xyz API to Google Sheets", | ||
"Source": { | ||
"Paths": ["/user"] | ||
}, | ||
"Destination": { | ||
"SheetID": "putAnActualSheetIDHerejD70xAjqPnOCHlDK3YomH", | ||
"SheetName": "Sheet2" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Note: `Source` fields should be adjusted to fit the actual source adapter. | ||
|
||
### Google Users | ||
This destination can update User records in the Google Directory. The compare | ||
attribute is `primaryEmail`. A limited subset of user properties are available | ||
|
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
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 |
---|---|---|
|
@@ -46,7 +46,9 @@ func TestNewGoogleContactsDestination(t *testing.T) { | |
ExtraJSON: json.RawMessage(extraJSON), | ||
}, | ||
want: GoogleContacts{ | ||
GoogleContactsConfig: GoogleContactsConfig{ | ||
BatchSize: 5, | ||
BatchDelaySeconds: 1, | ||
GoogleConfig: GoogleConfig{ | ||
DelegatedAdminEmail: "[email protected]", | ||
Domain: "example.com", | ||
GoogleAuth: GoogleAuth{ | ||
|
@@ -61,8 +63,6 @@ func TestNewGoogleContactsDestination(t *testing.T) { | |
AuthProviderX509CertURL: "https://www.googleapis.com/oauth2/v1/certs", | ||
ClientX509CertURL: "https://www.googleapis.com/robot/v1/metadata/x509/my-sync-bot%40abc-theme-123456.iam.gserviceaccount.com", | ||
}, | ||
BatchSize: 5, | ||
BatchDelaySeconds: 1, | ||
}, | ||
}, | ||
wantErr: false, | ||
|
@@ -92,8 +92,8 @@ func TestNewGoogleContactsDestination(t *testing.T) { | |
return | ||
} | ||
g := got.(*GoogleContacts) | ||
if !reflect.DeepEqual(g.GoogleContactsConfig, tt.want.GoogleContactsConfig) { | ||
t.Errorf("incorrect GoogleContactsConfig \ngot: %#v, \nwant: %#v", got, tt.want) | ||
if !reflect.DeepEqual(g.GoogleConfig, tt.want.GoogleConfig) { | ||
t.Errorf("incorrect GoogleConfig \ngot: %#v, \nwant: %#v", got, tt.want) | ||
} | ||
}) | ||
} | ||
|
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,23 @@ | ||
package googledest | ||
|
||
const DefaultBatchSize = 10 | ||
const DefaultBatchDelaySeconds = 3 | ||
|
||
type GoogleConfig struct { | ||
DelegatedAdminEmail string | ||
Domain string | ||
GoogleAuth GoogleAuth | ||
} | ||
|
||
type GoogleAuth struct { | ||
Type string `json:"type"` | ||
ProjectID string `json:"project_id"` | ||
PrivateKeyID string `json:"private_key_id"` | ||
PrivateKey string `json:"private_key"` | ||
ClientEmail string `json:"client_email"` | ||
ClientID string `json:"client_id"` | ||
AuthURI string `json:"auth_uri"` | ||
TokenURI string `json:"token_uri"` | ||
AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"` | ||
ClientX509CertURL string `json:"client_x509_cert_url"` | ||
} |
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
Oops, something went wrong.