Skip to content
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

Adding Azure Blob Storage #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Azure Blob Storage/Config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"Services": [
{
"Url": "https://9hs2v7a4ca.execute-api.us-east-1.amazonaws.com/prod",
"Paging": {
"OffsetType": "cursor",
"NextPageKey": "body.EnumerationResults.NextMarker",
"PageSize": 20,
"Parameters": {
"Offset": "marker",
"Limit": "maxresults"
}
},
"Endpoints": [
{
"Method": "POST",
"PayloadJsonContent": "{\"url\": \"https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]?si=all&spr=https&sv=2022-11-02&sr=c&sig=[SAS]&restype=container&comp=list\"}",
"Path": "/",
"ItemPath": "body.EnumerationResults.Blobs.Blob",
"ItemType": "Document",
"Uri": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[Name]",
"ClickableUri": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[Name]",
"Title": "%[Name]",
"ModifiedDate": "%[Properties.Last-Modified]",
"Metadata": {
"id": "%[Name]"
},
"SubQueries": [
{
"Path": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[coveo_parent.id]",
"Method": "GET",
"QueryParameters": {
"si": "all",
"spr": "https",
"sv": "2022-11-02",
"sr": "c",
"sig": "[SAS]"
},
"IsBinaryBody": true
}
]
}
]
}
]
}
49 changes: 49 additions & 0 deletions Azure Blob Storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Indexing Azure Blob Storage Using the REST API Connector

## Use Case

This example shows how to index Azure Blob Storage files from a specific container.

- List Blobs in the container: `&restype=container&comp=list`
- `maxresults`: maximum number of results to fetch
- return: `NextMarker` for next call
- then use `marker` parameter in URI
- Get the actual blob is using the container name + the name of the document
Comment on lines +7 to +11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I get this part, do you mind adding a bit of context?


## Enable logging in your JSON of the source

Add to the `parameters`:

```json
"Log4netLoggers": {
"value": "{ \"Coveo.Connectors.GenericRest\": \"TRACE\", \"Coveo.CES.CustomCrawlers.GenericRest\": \"TRACE\", \"Coveo.Platform\": \"TRACE\" }"
},
"Log4netAppenderName": {
"value": "AsyncBufferingForwardingAppender"
},
```

## Prerequisites

To fully understand how to use this example, you must:

1. Have a Coveo Platform organization.
2. Learn about [Coveo Connectivity](https://docs.coveo.com/en/1702/).
3. Learn [how to configure a REST API source](https://docs.coveo.com/en/1896/).

## Instructions

1. [Create an Access Policy](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/accesspolicy/storageAccountId/). Make sure to enable `Read` and `List`.
2. [Create an Shared Access Token](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/sas/storageAccountId). Use Stored Access Policy from Step 1.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. [Create an Shared Access Token](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/sas/storageAccountId). Use Stored Access Policy from Step 1.
2. [Create a Shared Access Token](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/sas/storageAccountId). Use Stored Access Policy from Step 1.

3. Generate SAS token and URL. Use the Blob SAS URL for the Generic Rest Configuration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Generate SAS token and URL. Use the Blob SAS URL for the Generic Rest Configuration.
3. Generate SAS token and URL. Use the Blob SAS URL for the REST API source configuration.

4. Create a REST API source.
5. Use the example in [`SourceJSONConfig.json`](https://github.com/coveooss/connectivity-library/blob/master/Azure%20Blob%20Storage/Config.json) as a base to build your source JSON configuration. Replace the [YOURSTORAGE] and [CONTAINER] to your own. Also replace all the SAS token parameters in all requests.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Use the example in [`SourceJSONConfig.json`](https://github.com/coveooss/connectivity-library/blob/master/Azure%20Blob%20Storage/Config.json) as a base to build your source JSON configuration. Replace the [YOURSTORAGE] and [CONTAINER] to your own. Also replace all the SAS token parameters in all requests.
5. Use the example in [`SourceJSONConfig.json`](https://github.com/coveooss/connectivity-library/blob/master/Azure%20Blob%20Storage/Config.json) as a base to build your source JSON configuration. Replace the [YOURSTORAGE] and [CONTAINER] with your own. Also replace all the SAS token parameters in all requests.

6. [Create the appropiate fields and mappings](https://docs.coveo.com/en/1896/#completion).

## Limitation

Content [refresh](https://docs.coveo.com/en/2039/#refresh) isn't possible, not supported by the `List Blobs` API call.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Content [refresh](https://docs.coveo.com/en/2039/#refresh) isn't possible, not supported by the `List Blobs` API call.
Content [refresh](https://docs.coveo.com/en/2039/#refresh) isn't possible, as it's not supported by the `List Blobs` API call.


## Reference

[Azure Storage API documentation](https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs?tabs=azure-ad)