vania-janet/multiturn-rag-retrieval-data huggingface dataset:
After generating a [Service Credential](https://cloud.ibm.com/docs/services/cloud-object-storage/iam?topic=cloud-object-storage-service-credentials), the resulting JSON document can be saved to /.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation. If the cos_credentials file contains HMAC keys the client authenticates with a signature, otherwise the client uses the provided API key to authenticate with a bearer token.

The default section heading specifies a default profile and associated values for credentials. You can create more profiles in the same shared configuration file, each with its own credential information. The following example shows a configuration file with the default profile:

[default]
ibm_api_key_id = <DEFAULT_IBM_API_KEY>
ibm_service_instance_id = <DEFAULT_IBM_SERVICE_INSTANCE_ID>
ibm_auth_endpoint = <DEFAULT_IBM_AUTH_ENDPOINT>

If migrating from AWS S3, you can also source credentials data from /.aws/credentials in the format:

aws_access_key_id = <DEFAULT_ACCESS_KEY_ID>
aws_secret_access_key = <DEFAULT_SECRET_ACCESS_KEY>

If both /.bluemix/cos_credentials and /.aws/credentials exist, cos_credentials takes preference.







 Code Examples 

In your code, you must remove the angled brackets or any other excess characters that are provided here as illustration.

Getting started with [Node.js](https://nodejs.org/en/about/)—once it's installed—usually involves configuration and invocation, like in [this example from Nodejs.org](https://nodejs.org/en/docs/guides/getting-started-guide/). We'll follow a similar model



 Initializing configuration 

const IBM = require('ibm-cos-sdk');

var config = {
endpoint: '<endpoint>',
* Name - Enter a name for your destination.
* Description - Optionally, enter a description for your destination.
* Type - Under Destination, for the Type, select IBM Cloud Object Storage from the list as your destination type.
* Instance name - Select the IBM Cloud Object Storage instance name from the list, if you already have an IBM Cloud Object Storage instance. Otherwise, click the Create new instance link, to create an IBM Cloud Object Storage instance.

When you select an IBM Cloud Object Storage instance, the authorization between the services will be created internally between the two service instances, if the authorization between the services doesn't exist.
* Bucket name - Enter the Bucket name to be used for creating a new object per notification into the IBM Cloud Object Storage instance.

You can get the bucket name from your IBM Cloud Object Storage instance. For more information, see [Bucket name](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-destinations-cloud-object-storageen-cos-bucket-name).

The pattern (is a combination of destination name and notification ID) that Event Notifications uses to store the object in IBM Cloud Object Storage bucket is similar to the example below:

Rhonda Macejkovic/013f87bc-0537-4dad-8511-8cb054890ffc.json,

where Rhonda Macejkovic is destination name and 013f87bc-0537-4dad-8511-8cb054890ffc is notification ID. .json is the payload format.
* Endpoint - Enter the IBM Cloud Object Storage endpoint URL. For more information, see [Endpoint url](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-destinations-cloud-object-storageen-endpoint-url).



4. Click Add.







 Using authorizations to grant access between services 

Use IBM Cloud® Identity and Access Management (IAM) to create or remove an authorization that grants one service access to another service.



 Creating an authorization in the console 



1.
-H "content-type: application/json"
-H "servicekey: <SERVICE_KEY>"
-d '{"integration": "ibm", "bucket": "<BUCKET>", "endpoint": "<COS_ENDPOINT>", "apikey": "<API_KEY>", "resourceinstanceid": "<ID>"}'



* Replace <ENDPOINT> with the IBM Cloud Activity Tracker API endpoint. To see the list of endpoints, see [Endpoints](https://cloud.ibm.com/docs/activity-tracker?topic=activity-tracker-endpointsendpoints_api-at).
* Replace the <SERVICE_KEY> with a valid service key for the IBM Cloud Activity Tracker instance where you plan to configure archiving. For more information, see [Service keys by using the API](https://cloud.ibm.com/docs/activity-tracker?topic=activity-tracker-service_keysservice_keys_api).
* Replace <BUCKET> with the name of your IBM Cloud Object Storage bucket.
* Replace <COS_ENDPOINT> with your IBM Cloud Object Storage endpoint associated with the bucket.
* Replace <API_KEY> with the API key required to authenticate with IBM Cloud Object Storage.
* Replace <ID> With the CRN of the IBM Cloud Object Storage instance where the bucket is located.



The response will be similar to the following if the configuration is successfully updated:

{"integration":"ibm","bucket":"my-bucket","endpoint":"s3.private.us-south.cloud-object-storage.appdomain.cloud","apikey":"xxxxxxxxx>","resourceinstanceid":"crn:v1:bluemix:public:cloud-object-storage:global:a/yyyyyyy::"}

If archiving is not configured, the following will be returned when trying to do an update:

{"error":"Active archiving configuration does not exist for this account. Try creating one instead."
ibmcloud atracker target validate --target <TARGET> [--region <REGION>] [--output JSON]



 Command options 

--target <TARGET>
: The ID or name of the target.

--region <REGION> | -r <REGION>
: Name of the region, for example, us-south or eu-gb. If not specified, the region logged into, or targeted, will be used.

--output JSON
: If specified, output will be returned in JSON format. If JSON is not specified, output will be returned in a tabular format.

help | --help | -h
: List options available for the command.





 Example 

The following is an example using the ibmcloud atracker target validate --target new-target-name command.

This example shows a successfully validated target.

Target
Name: new-target-name
ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
CRN: crn:v1:staging:public:atracker:us-south:a/xxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
Type: cloud_object_storage
COS Endpoint: s3.us-west.cloud-object-storage.appdomain.cloud
COS Target CRN: crn:v1:staging:public:cloud-object-storage:global:a/xxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx:
COS Bucket: cloud-object-my-target
COS API Key: REDACTED
COS Write Status: success
Created: 2021-07-21T16:04:15.174Z
Updated: 2021-07-21T17:49:56.452Z







 Getting information about a target using the CLI 

Use this command to get information about a target for an IBM Cloud Activity Tracker Event Routing region.
* No parameters to provide.
* Optional: Sets the IBM Service Instance ID in the request.



* Flag: --ibm-service-instance-id



* Optional: Output FORMAT can be only json or text.



* Flag: --output FORMAT









 Extended Bucket Listing 



* Action: Print a list of all the buckets in a user's IBM Cloud Object Storage account. Buckets might be located in different regions.
* Usage:ibmcloud cos buckets-extended [--ibm-service-instance-id ID] [--marker KEY] [--prefix PREFIX] [--page-size SIZE] [--max-items NUMBER] [--output FORMAT]



* Note that you must provide a CRN if you are using IAM authentication. This can be set by using the [ibmcloud cos config crn](https://cloud.ibm.com/docs/cli?topic=cli-ic-cos-cliic-config) command.



* Parameters to provide:



* No parameters to provide.
* Optional: Sets the IBM Service Instance ID in the request.



* Flag: --ibm-service-instance-id



* Optional: Specifies the KEY to start with when listing objects in a bucket.



* Flag: --marker KEY



* Optional: Limits the response to keys that begin with the specified PREFIX.



* Flag: --prefix PREFIX



* Optional: The SIZE of each page to get in the service call. This does not affect the number of items returned in the command's output. Setting a smaller page size results in more calls to the service, retrieving fewer items in each call. This can help prevent the service calls from timing out.



* Flag: --page-size SIZE



* Optional: The total NUMBER of items to return in the command's output.



* Flag: --max-items NUMBER



* Optional: Output FORMAT can be only json or text.



* Flag: --output FORMAT













 List in-progress multipart uploads 



* Action: Lists in-progress multipart uploads.
COS Endpoint: s3.us-west.cloud-object-storage.appdomain.cloud
COS Target CRN: crn:v1:staging:public:cloud-object-storage:global:a/xxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx:
COS Bucket: cloud-object-my-target
COS API Key: REDACTED
COS Write Status: success
Created: 2021-07-21T16:04:15.174Z
Updated: 2021-07-21T16:04:15.174Z







 Updating a target using the CLI 

Use this command to update a target for an IBM Cloud Activity Tracker Event Routing region. Any specified value that is different from when the target was originally created will be updated to the value specified in the command.

ibmcloud atracker target update --target <TARGET> [--name <TARGET_NAME>] [ --file <COS_ENDPOINT_DEFINITION_JSON_FILE> | --endpoint <COS_ENDPOINT>] --bucket <COS_BUCKET>] --target-crn <COS_TARGET_CRN>] --api-key ( <COS_API_KEY> | <@COS_API_KEY_FILE> )] ) ] [--region <REGION>] [--output JSON]



 Command options 

--target <TARGET>
: The ID or current target name.

--region <REGION> | -r <REGION>
: Name of the region, for example, us-south or eu-gb. If not specified, the region logged into, or targeted, will be used.

--name <TARGET_NAME>
: The name to be given to the target.

Do not include any personal identifying information (PII) in any resource names.

--file <@COS_ENDPOINT_DEFINITION_JSON_FILE>
: A file containing an endpoint definition in the following format:

{
"endpoint": "aaaaa",
"target_crn": "yyyyy",
curl -X POST "https://containers.cloud.ibm.com/global/v2/storage/satellite/createStorageConfigurationByController" -H "accept: application/json" -H "Authorization: TOKEN" -H "Content-Type: application/json" -d "{ "config-name": "string", "controller": "string", "storage-class-parameters": [ { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" } ], "storage-template-name": "aws-efs-csi-driver", "storage-template-version": "1.4.2", "update-assignments": true, "user-config-parameters":"user-secret-parameters": { "entry.name": "AWS-ACCESS-KEY",{ "entry.name": "AWS-SECRET-ACCESS-KEY",}







 Adding a custom AWS EFS storage class to your configuration 

After you create a Satellite storage configuration, you can add a custom storage class by using the ibmcloud sat config sc add command.

You can't add storage classes to Satellite storage configurations after the configurations are assigned to clusters or cluster groups. Make sure to add storage classes before assigning your configuration.



1. List the storage class parameters for the template that you used to create your configuration and decide how you want to create your storage class.

ibmcloud sat storage template get --name aws-efs-csi-driver --version <version>
2. Create the storage class and pass in any custom parameters. Enter the name of the storage configuration you created earlier, the storage class name, and the custom parameters that you want to provide.

ibmcloud sat storage config sc add --config-name <config-name> --name <storage-class-name> --param "key=value"

basePath
: Specify the BasePath. Base path is a path on the file system under which access point root directory is created.

directoryPerms
: Specify directory permissions.
ibmcloud fn action invoke /<namespace_ID>/cloud-object-storage/object-write --blocking --result --param bucket <bucket-name> --param key <object_name> --param body <body> --param endpoint <bucket_endpoint>

Verify the output.







 Reading objects from a bucket 

You can use the object-read action to write an object to an IBM Cloud Object Storage bucket. You can use this action from the console or the CLI.

If you [bound your bucket and endpoint parameters](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_param_bind) to the cloud-object-storage package or to the object-write action, you do not need to specify them during invocation.



 Reading an object with the console 



1. Go to the [Actions page](https://cloud.ibm.com/functions/actions) in the Cloud Functions console.
2. Under the cloud-object-storage package, click the object-read action.
3. In the Code pane, click Change Input.
4. Copy the following JSON object and replace the variables.

{
"bucket": "bucket-name",
"key": "object-name",
}
5. Click Apply.
6. Click Invoke.
7. Verify the response.
8. Check your IBM Cloud Object Storage bucket for the new object.







 Reading an object with the CLI 

Copy the following object-read command and replace the variables with your bucket name and object name.

ibmcloud fn action invoke /<namespace_ID>/cloud-object-storage/object-read --blocking --result --param bucket <bucket-name> --param key <object_name>

Verify the output.





 Reference for Object Storage and Cloud Functions 

The IBM Cloud Object Storage package includes the following entities:



Table 5. Object storage package entities
[_doc_ids](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsthe-_doc_ids-filter)
: Accepts only changes for documents whose ID is specified in the doc_ids parameter or supplied JSON document.

[_selector](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsthe-_selector-filter)
: Accepts only changes for documents that match a specified selector that is defined by using the same [selector syntax](https://cloud.ibm.com/apidocs/cloudantpostfind) as described in the Request section, which is used for [_find](https://cloud.ibm.com/apidocs/cloudantgetdatabaseinformation).

[_view](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsthe-_view-filter)
: With this function, you can use an existing [map function](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-creating-views-mapreducea-simple-view) as the filter.



 The _design filter 

The _design filter accepts changes only for design documents within the requested database.

The filter doesn't require any arguments.

Changes are listed for all the design documents within the database.

See the following example application of the _design filter by using HTTP:

POST /$DATABASE/_changes?filter=_design HTTP/1.1

See the following example applications of the _design filter:



* Curl
* Java
* Node
* Python
* Go



curl -X POST "$SERVICE_URL/orders/_changes?filter=_design" -H "Content-Type: application/json" -d '{}'

import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.cloudant.v1.model.ChangesResult;
import com.ibm.cloud.cloudant.v1.model.PostChangesOptions;
In the IBM Cloud Object Storage web UI, select your bucket and you can find Bucket instance CRN in the Configurations tab.

--cos-backup-file value
: The name of the backup file to be restored (required). The backup file name identifies the date and time yyyy-mm-dd-hhmmssZ (UTC) when the backup was generated. You can get a list of COS backup files in either of the following ways.



1. Using the UI. In the IBM Cloud Object Storage web UI, select your bucket and you can find the available file names in the Object name column in the Objects tab.
2. Using the IBM Cloud Object Storage CLI plugin.



1. [Install and configure the IBM Cloud Object Storage plugin](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-cli-plugin-ic-cos-cliic-installation).
2. List backup files with the [ibmcloud cos objects --bucket BUCKET](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-cli-plugin-ic-cos-cliic-list-objects) command.











 ibmcloud dbaas backup configuration 

This command shows the backup configuration of a database cluster.

ibmcloud dbaas backup configuration RESOURCE_NAME [--output json]



 Command options 

RESOURCE_NAME
: The name or CRN of the source DBaaS service instance. To find the resource name or CRN, use the IBM Cloud command ibmcloud resource service-instances --long.

--output value
: Use the --output option with value json to format output in JSON.







 ibmcloud dbaas backup configure 

This command changes the configuration of backup to IBM Cloud Object Storage for a database cluster.
This can be set by using the [ibmcloud cos config crn](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-cli-plugin-ic-cos-cliic-config) command.



* Parameters to provide:



* The name of the bucket.



* Flag: --bucket BUCKET_NAME



* Optional: The name of the Class.



* Flag: --class CLASS_NAME



* Optional: Sets the IBM Service Instance ID in the request.



* Flag: --ibm-service-instance-id ID



* Optional: The REGION where the bucket is present. If this flag is not provided, the program uses the default option that is specified in config.



* Flag: --region REGION



* Optional: Output FORMAT can be only json or text.



* Flag: --output FORMAT











 Create a new multipart upload 



* Action: Begin the multipart file upload process by creating a new multipart upload instance.
* Usage:ibmcloud cos multipart-upload-create --bucket BUCKET_NAME --key KEY [--cache-control CACHING_DIRECTIVES] [--content-disposition DIRECTIVES] [--content-encoding CONTENT_ENCODING] [--content-language LANGUAGE] [--content-type MIME] [--metadata MAP] [--region REGION] [--output FORMAT]
* Parameters to provide:



* The name of the bucket.



* Flag: --bucket BUCKET_NAME



* The KEY of the object.



* Flag: --key KEY



* Optional: Specifies CACHING_DIRECTIVES for the request and reply chain.



* Flag: --cache-control CACHING_DIRECTIVES



* Optional: Specifies presentation information (DIRECTIVES).



* Flag: --content-disposition DIRECTIVES



* Optional: Specifies the content encoding (CONTENT_ENCODING) of the object..



* Flag: --content-encoding CONTENT_ENCODING



* Optional: The LANGUAGE the content is in.



* Flag: --content-language LANGUAGE
"target_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/<account-id>:<instance-id>::",
"bucket": "my-activity-tracking-bucket",
"api_key": "xxxxxxxxxxxxxxxxxx",
"service_to_service_enabled": false
}
}'
In the response, you get information about the target such as the id, that indicates the GUID of the target, and the crn, that indicates the CRN of the target.<-- </section "class="ph" id="section-target-create-api-cos" "> --><-- <section "class="ph" id="section-target-update-api-cos" "> --> Updating a COS target using the API When you update an IBM Cloud Object Storage (COS) target, you must include the target information in the data section of the request.<-- <ul> --> * You must pass all fields. * Update the fields that need to be changed. * You cannot change the target_type of a target once created.<-- </ul> -->You can use the following cURL command to update a target: curl -X PUT <ENDPOINT>/api/v2/targets/TARGET_ID -H "Authorization: $ACCESS_TOKEN" -H "content-type: application/json" -d '{
"name": "TARGET_NAME",
"target_type": "TARGET_TYPE",
"cos_endpoint": {
"endpoint": "PRIVATE_COS_ENDPOINT",
"target_crn": "COS_CRN",
"bucket": "BUCKET_NAME",
"api_key": "API_KEY",
"service_to_service_enabled": SERVICE_TO_SERVICE
}
}'
Where<-- <ul> --> * <ENDPOINT> is the API endpoint in the region where you plan to configure or manage a target.
ibmcloud atracker target create --name TARGET_NAME --type TARGET_TYPE ( [--file COS_ENDPOINT_DEFINITION_JSON_FILE] | ( [--endpoint COS_ENDPOINT] [--bucket COS_BUCKET] [--target-crn COS_TARGET_CRN] ( [--api-key ( COS_API_KEY | @COS_API_KEY_FILE )] | [--service-to-service-enabled ( TRUE | FALSE )] ) ) ) [--region REGION] [--output FORMAT]



 Command options 

--region REGION | -r REGION
: Name of the region, for example, us-south or eu-gb. If not specified, the region logged into, or targeted, will be used.

--name TARGET_NAME
: The name to be given to the target.

Do not include any personal identifying information (PII) in any resource names.

--type TARGET_TYPE
: Set the TARGET_TYPE to cloud_object_storage for a COS target.

--file @COS_ENDPOINT_DEFINITION_JSON_FILE
: A file containing an endpoint definition in the following format:

{
"endpoint": "aaaaa",
"target_crn": "yyyyy",
"bucket": "zzzzzz",
"api_key": "xxxxxx"
}

--endpoint COS_ENDPOINT
: The IBM Cloud Object Storage endpoint to be associated with the IBM Cloud Object Storage bucket.

--bucket BUCKET
: The name of the IBM Cloud Object Storage bucket to be associated with the target.

--target-crn COS_TARGET_CRN
: The CRN of the IBM Cloud Object Storage instance.

--api-key COS_API_KEY | @COS_API_KEY_FILE
: Your [API key](https://cloud.ibm.com/docs/account?topic=account-manapikey) value or a reference to the API Key file used to gain access.
|| changes | An array of objects, each of which has a rev field that contains the revision ID of the document. |<-- </table ""> -->The following example is a JSON representation of the trigger activation. {
"dbname": "test",
"id": "6ca436c44074c4c2aa6a40c9a188b348",
"seq": "2-g1AAAAL9aJyV-GJCaEuqx4-BktQkYp_dmIfC",
"changes":
{
"rev": "2-da3f80848a480379486fb4a2ad98fa16"
}
] ! ! !
}
<-- </section "id="section-cloudant_struct" "> --><-- </section "id="section-cloudant_trigger" "> --><-- <section "id="section-cloudant_filter" "> --> Filter database change events You might define a filter function to avoid having unnecessary change events that fire your trigger.Before you beginCreate a /whisk.system/cloudantpackage binding]] ! ! ! that is configured for your IBM Cloudant account.To create a filter function, you can use an action.<-- <ol> -->1. Save the following JSON in a file called design_doc.json.
{
"doc": {
"_id": "_design/mailbox",
"filters": {
"by_status": "function(doc, req){if (doc.status = req.query.status){return false;} return true;}"
}
}
}
2. Create a design document in the database with the following filter function. Replace <database_name> with the name of your database and <file_path> with the file path of your design_doc.json.
"access_key_id": "abc",
"secret_access_key": "xyz"
}
}

--cos-endpoint value
: Endpoint of IBM Cloud Object Storage. This parameter is required if --cos-bucket-crn is set. In the IBM Cloud Object Storage web UI, select your bucket and you can find Endpoints in the Configuration tab. Only public endpoints are supported for now. Support for private endpoints will come soon.

--cos-bucket-crn value
: IBM Cloud Object Storage bucket CRN. This parameter is required if --cos-endpoint is set. In the IBM Cloud Object Storage web UI, select your bucket and you can find Bucket instance CRN in the Configurations tab.

--cos-frequency value
: The frequency of the backups to IBM Cloud Object Storage. This option is only available for PostgreSQL. You can use the [ibmcloud dbaas backup configuration](https://cloud.ibm.com/docs/cli?topic=cli-dbaas_cli_pluginshow-backup-configuration) command to get the current value. Valid values are 1h, 2h, 4h, 8h, 1d, 2d, and 1w.

--output value
: Use the --output option with value json to format output in JSON.