diff --git a/API.md b/API.md index 9f89afad..ace979bf 100644 --- a/API.md +++ b/API.md @@ -6220,12 +6220,29 @@ const microsoftSharepointOnlineObject: MicrosoftSharepointOnlineObject = { ... } | **Name** | **Type** | **Description** | | --- | --- | --- | -| drives | string[] | An array of Microsoft Sharepoint Online site drives from which the documents are to be retrieved. | | site | string | The Microsoft Sharepoint Online site from which the documents are to be retrieved. | +| drives | string[] | An array of Microsoft Sharepoint Online site drives from which the documents are to be retrieved. | +| entities | string[] | An array of Microsoft Sharepoint Online site entities from which the documents are to be retrieved. | + +--- + +##### `site`Required + +```typescript +public readonly site: string; +``` + +- *Type:* string + +The Microsoft Sharepoint Online site from which the documents are to be retrieved. + +Note: requires full name starting with 'sites/' --- -##### `drives`Required +##### ~~`drives`~~Optional + +- *Deprecated:* . This property is deprecated and will be removed in a future release. Use {@link entities} instead ```typescript public readonly drives: string[]; @@ -6239,20 +6256,27 @@ Note: each drive requires full name starting with 'drives/' --- -##### `site`Required +##### `entities`Optional ```typescript -public readonly site: string; +public readonly entities: string[]; ``` -- *Type:* string +- *Type:* string[] -The Microsoft Sharepoint Online site from which the documents are to be retrieved. +An array of Microsoft Sharepoint Online site entities from which the documents are to be retrieved. -Note: requires full name starting with 'sites/' +Note: each entity requires full name starting with 'drives/' followed by driveID and optional '/items/' followed by itemID --- +*Example* + +```typescript +: 'drives/${driveID}/items/${itemID}' +``` + + ### MicrosoftSharepointOnlineRefreshTokenGrantFlow #### Initializer diff --git a/src/microsoftsharepointonline/source.ts b/src/microsoftsharepointonline/source.ts index cf5029d9..3cb0ed33 100644 --- a/src/microsoftsharepointonline/source.ts +++ b/src/microsoftsharepointonline/source.ts @@ -26,8 +26,18 @@ export interface MicrosoftSharepointOnlineObject { * An array of Microsoft Sharepoint Online site drives from which the documents are to be retrieved. * * Note: each drive requires full name starting with 'drives/' + * @deprecated. This property is deprecated and will be removed in a future release. Use {@link entities} instead */ - readonly drives: string[]; + readonly drives?: string[]; + + /** + * An array of Microsoft Sharepoint Online site entities from which the documents are to be retrieved. + * + * Note: each entity requires full name starting with 'drives/' followed by driveID and optional '/items/' followed by itemID + * @example: 'drives/${driveID}' + * @example: 'drives/${driveID}/items/${itemID}' + */ + readonly entities?: string[]; } /** @@ -65,15 +75,20 @@ export class MicrosoftSharepointOnlineSource implements ISource { private buildSourceConnectorProperties(): CfnFlow.SourceConnectorPropertiesProperty { - if (this.props.object.drives.length < 1) { - throw new Error('At least one drive must be specified'); + if (this.props.object.entities && this.props.object.drives) { + throw new Error('Only one of the properties entities or drives should be specified'); + } + + const entities = this.props.object.entities ?? this.props.object.drives ?? []; + if (entities.length < 1) { + throw new Error('At least one entity must be specified'); } return { customConnector: { entityName: this.props.object.site, customProperties: { - subEntities: `["${Fn.join('","', this.props.object.drives)}"]`, + subEntities: `["${Fn.join('","', entities)}"]`, }, }, }; @@ -84,4 +99,4 @@ export class MicrosoftSharepointOnlineSource implements ISource { scope.node.addDependency(resource); } } -} \ No newline at end of file +} diff --git a/test/integ/ondemand-microsoftsharepointonline-to-s3.integ.ts b/test/integ/ondemand-microsoftsharepointonline-to-s3.integ.ts index 9bb06cbe..94b3a7f8 100644 --- a/test/integ/ondemand-microsoftsharepointonline-to-s3.integ.ts +++ b/test/integ/ondemand-microsoftsharepointonline-to-s3.integ.ts @@ -34,7 +34,7 @@ const source = new MicrosoftSharepointOnlineSource({ apiVersion: MicrosoftSharepointOnlineApiVersion.V1, object: { site: secret.secretValueFromJson('site').toString(), - drives: [secret.secretValueFromJson('drive').toString()], + entities: [secret.secretValueFromJson('drive').toString()], }, }); diff --git a/test/microsoftsharepointonline/source.test.ts b/test/microsoftsharepointonline/source.test.ts index b443fde2..02f6992c 100644 --- a/test/microsoftsharepointonline/source.test.ts +++ b/test/microsoftsharepointonline/source.test.ts @@ -24,7 +24,7 @@ describe('MicrosoftSharepointOnlineSource', () => { profile: MicrosoftSharepointOnlineConnectorProfile.fromConnectionProfileName(stack, 'TestProfile', 'dummy-profile'), object: { site: 'sites/dummysite.sharepoint.com,3f42g340-bc23-4a31-b7e5-722e57c39cb8,5bbc39fb-2b17-423b-a007-40ca508389a5', - drives: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], + entities: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], }, apiVersion: MicrosoftSharepointOnlineApiVersion.V1, }); @@ -42,7 +42,7 @@ describe('MicrosoftSharepointOnlineSource', () => { profile: MicrosoftSharepointOnlineConnectorProfile.fromConnectionProfileName(stack, 'TestProfile', 'dummy-profile'), object: { site: 'sites/dummysite.sharepoint.com,3f42g340-bc23-4a31-b7e5-722e57c39cb8,5bbc39fb-2b17-423b-a007-40ca508389a5', - drives: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], + entities: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], }, apiVersion: MicrosoftSharepointOnlineApiVersion.V1, }); @@ -128,7 +128,7 @@ describe('MicrosoftSharepointOnlineSource', () => { profile: profile, object: { site: 'sites/dummysite.sharepoint.com,3f42g340-bc23-4a31-b7e5-722e57c39cb8,5bbc39fb-2b17-423b-a007-40ca508389a5', - drives: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], + entities: ['drives/b!fcPDltwTLSougEJuDFjE?U5qHuXbkzlvSaA5oNoMW4tB0y6mebcx9m-ckwA9KtKE'], }, apiVersion: MicrosoftSharepointOnlineApiVersion.V1, }); @@ -227,4 +227,4 @@ describe('MicrosoftSharepointOnlineSource', () => { ], }); }); -}); \ No newline at end of file +});