vania-janet/multiturn-rag-retrieval-data huggingface dataset:
def delete_legal_hold_from_object(bucket_name, object_name, legal_hold_id):
print("Deleting legal hold {0} from object {1} in bucket {2}n".format(legal_hold_id, object_name, bucket_name))

cos.delete_legal_hold(
Bucket=bucket_name,
Key=object_name,
RetentionLegalHoldId=legal_hold_id
)

print("Legal hold {0} deleted from object {1} in bucket {2}!n".format(legal_hold_id, object_name, bucket_name))
Show more





 Extend the retention period of a protected object 

The retention period of an object can only be extended. It cannot be decreased from the currently configured value.

The retention expansion value is set in one of three ways:



* additional time from the current value (Additional-Retention-Period or similar method)
* new extension period in seconds (Extend-Retention-From-Current-Time or similar method)
* new retention expiry date of the object (New-Retention-Expiration-Date or similar method)



The current retention period that is stored in the object metadata is either increased by the given more time or replaced with the new value, depending on the parameter that is set in the extendRetention request. In all cases, the extend retention parameter is checked against the current retention period and the extended parameter is only accepted if the updated retention period is greater than the current retention period.

Objects in protected buckets that are no longer under retention (retention period has expired and the object does not have any legal holds), when overwritten, will again come under retention. The new retention period can be provided as part of the object overwrite request or the default retention time of the bucket will be given to the object.

def extend_retention_period_on_object(bucket_name, object_name, additional_seconds):
print("Extend the retention period on {0} in bucket {1} by {2} seconds.n".format(object_name, bucket_name, additional_seconds))

cos.extend_object_retention(
In both cases, you are billed until the end of the current billing cycle, and billing stops for the next billing cycle. After your storage is canceled, you might still see your storage instance in the console or the CLI for up to 72 hours.



* Immediate cancellation: Choose this option to immediately remove your storage. Neither you nor your users can use the storage anymore or recover the data.



* Anniversary date: Choose this option to cancel your storage on the next anniversary date. Your storage instances remain active until the next anniversary date and you can continue to use them until this date, such as to give your team time to make backups of your data.



* When you dynamically provisioned the storage with a storage class that sets reclaimPolicy: Delete and you choose to remove the PVC, the PV and the storage instance are immediately removed. For hourly billed storage, billing stops immediately. For monthly billed storage, you are still charged for the remainder of the month. After your storage is removed and billing stops, you might still see your storage instance in the console or the CLI for up to 72 hours.



What do I need to be aware of before I delete persistent storage?
: When you clean up persistent storage, you delete all the data that is stored in it. If you need a copy of the data, make a backup for [file storage](https://cloud.ibm.com/docs/openshift?topic=openshift-file_storagefile_backup_restore) or [block storage](https://cloud.ibm.com/docs/openshift?topic=openshift-block_storageblock_backup_restore).

I deleted my storage instance. Why can I still see my instance?
: After you remove persistent storage, it can take up to 72 hours for the removal to be fully processed and for the storage to disappear from your IBM Cloud console or CLI.

I deleted my cluster. How do I remove the remaining storage volumes?
: See the steps in [Why am I still seeing charges for block storage devices after deleting my cluster](https://cloud.ibm.com/docs/containers?topic=containers-ts_storage_clean_volume).
: After you remove persistent storage, it can take up to 72 hours for the removal to be fully processed and for the storage to disappear from your IBM Cloud console or CLI.

I deleted my cluster. How do I remove the remaining storage volumes?
: See the steps in [Why am I still seeing charges for block storage devices after deleting my cluster](https://cloud.ibm.com/docs/containers?topic=containers-ts_storage_clean_volume).





 Cleaning up persistent storage 

Remove the PVC, PV, and the storage instance from your IBM Cloud account to avoid further charges for your persistent storage.

Before you begin:



* Make sure that you backed up any data that you want to keep.
* [Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.](https://cloud.ibm.com/docs/containers?topic=containers-access_cluster)



To clean up persistent data:



1. List the PVCs in your cluster and note the NAME of the PVC, the STORAGECLASS, and the name of the PV that is bound to the PVC and shown as VOLUME.

kubectl get pvc

Example output

NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
claim1-block-bronze Bound pvc-06886b77-102b-11e8-968a-f6612bb731fb 20Gi RWO ibmc-block-bronze 78d
claim-file-bronze Bound pvc-457a2b96-fafc-11e7-8ff9-b6c8f770356c 4Gi RWX ibmc-file-bronze-retain 105d
claim-file-silve Bound pvc-1efef0ba-0c48-11e8-968a-f6612bb731fb 24Gi RWX ibmc-file-silver 83d
2. Review the ReclaimPolicy and billingType for the storage class.

kubectl describe storageclass <storageclass_name>
: After you remove persistent storage, it can take up to 72 hours for the removal to be fully processed and for the storage to disappear from your IBM Cloud console or CLI.

I deleted my cluster. How do I remove the remaining storage volumes?
: See the steps in [Why am I still seeing charges for block storage devices after deleting my cluster](https://cloud.ibm.com/docs/containers?topic=containers-ts_storage_clean_volume).





 Cleaning up persistent storage 

Remove the PVC, PV, and the storage instance from your IBM Cloud account to avoid further charges for your persistent storage.

Before you begin:



* Make sure that you backed up any data that you want to keep.
* [Access your Red Hat OpenShift cluster](https://cloud.ibm.com/docs/openshift?topic=openshift-access_cluster).



To clean up persistent data:



1. List the PVCs in your cluster and note the NAME of the PVC, the STORAGECLASS, and the name of the PV that is bound to the PVC and shown as VOLUME.

oc get pvc

Example output

NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
claim1-block-bronze Bound pvc-06886b77-102b-11e8-968a-f6612bb731fb 20Gi RWO ibmc-block-bronze 78d
claim-file-bronze Bound pvc-457a2b96-fafc-11e7-8ff9-b6c8f770356c 4Gi RWX ibmc-file-bronze-retain 105d
claim-file-silve Bound pvc-1efef0ba-0c48-11e8-968a-f6612bb731fb 24Gi RWX ibmc-file-silver 83d
2. Review the ReclaimPolicy and billingType for the storage class.

oc describe storageclass <storageclass_name>

If the reclaim policy says Delete, your PV and the physical storage are removed when you remove the PVC.
: After you remove persistent storage, it can take up to 72 hours for the removal to be fully processed and for the storage to disappear from your IBM Cloud console or CLI.

I deleted my cluster. How do I remove the remaining storage volumes?
: See the steps in [Why am I still seeing charges for block storage devices after deleting my cluster](https://cloud.ibm.com/docs/containers?topic=containers-ts_storage_clean_volume).



 Cleaning up Block Storage for VPC 

Remove the PVC, PV, and the storage instance from your IBM Cloud account to avoid further charges for your persistent storage.

Before you begin:



* Make sure that you backed up any data that you want to keep.
* [Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.](https://cloud.ibm.com/docs/containers?topic=containers-access_cluster)



To clean up persistent data:



1. List the PVCs in your cluster and note the NAME of the PVC, the STORAGECLASS, and the name of the PV that is bound to the PVC and shown as VOLUME.

kubectl get pvc

Example output

NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
claim1-block-bronze Bound pvc-06886b77-102b-11e8-968a-f6612bb731fb 20Gi RWO ibmc-block-bronze 78d
claim-file-bronze Bound pvc-457a2b96-fafc-11e7-8ff9-b6c8f770356c 4Gi RWX ibmc-file-bronze-retain 105d
claim-file-silve Bound pvc-1efef0ba-0c48-11e8-968a-f6612bb731fb 24Gi RWX ibmc-file-silver 83d
2. Review the ReclaimPolicy and billingType for the storage class.

kubectl describe storageclass <storageclass_name>
: After you remove persistent storage, it can take up to 72 hours for the removal to be fully processed and for the storage to disappear from your IBM Cloud console or CLI.

I deleted my cluster. How do I remove the remaining storage volumes?
: See the steps in [Why am I still seeing charges for block storage devices after deleting my cluster](https://cloud.ibm.com/docs/containers?topic=containers-ts_storage_clean_volume).



 Cleaning up Block Storage for VPC 

Remove the PVC, PV, and the storage instance from your IBM Cloud account to avoid further charges for your persistent storage.

Before you begin:



* Make sure that you backed up any data that you want to keep.
* [Access your Red Hat OpenShift cluster](https://cloud.ibm.com/docs/openshift?topic=openshift-access_cluster).



To clean up persistent data:



1. List the PVCs in your cluster and note the NAME of the PVC, the STORAGECLASS, and the name of the PV that is bound to the PVC and shown as VOLUME.

oc get pvc

Example output

NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
claim1-block-bronze Bound pvc-06886b77-102b-11e8-968a-f6612bb731fb 20Gi RWO ibmc-block-bronze 78d
claim-file-bronze Bound pvc-457a2b96-fafc-11e7-8ff9-b6c8f770356c 4Gi RWX ibmc-file-bronze-retain 105d
claim-file-silve Bound pvc-1efef0ba-0c48-11e8-968a-f6612bb731fb 24Gi RWX ibmc-file-silver 83d
2. Review the ReclaimPolicy and billingType for the storage class.

oc describe storageclass <storageclass_name>

If the reclaim policy says Delete, your PV and the physical storage are removed when you remove the PVC.
For requests using a version query parameter of 2021-01-19 or later, memory for virtual server instances is now expressed in gibibytes (GiB), instead of gigabytes (GB). For example, the memory property returned from GET /instances/{id} now reports in GiB (truncated to a whole number).







 16 December 2020 



 For all version dates 

Customer-managed encryption for block storage volumes and encrypted custom images. When you disable or delete a customer root key (CRK) that is encrypting your block storage or custom image resources, the API displays a status of unusable for these resources, along with the reason codes encryption_key_deleted or encryption_key_disabled.

The unusable status appears in the following API methods:



* [List all volumes](https://cloud.ibm.com/apidocs/vpclist-volumes) (GET /volumes)
* [Retrieve a specific volume](https://cloud.ibm.com/apidocs/vpcget-volume) (GET /volumes/{id})
* [List all images](https://cloud.ibm.com/apidocs/vpclist-volumes) (GET /images)
* [Retrieve the specified image](https://cloud.ibm.com/apidocs/vpcget-image) (GET /images/{id})



For more information on key states and resource statuses, see [User actions that impact root key states and resource status](https://cloud.ibm.com/docs/vpc?topic=vpc-vpc-encryption-managingbyok-root-key-states).

Dedicated hosts are now supported in the VPC API. Learn more about using [dedicated hosts](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-dedicated-hosts-instances&interface=api) and explore the new [API methods](https://cloud.ibm.com/apidocs/vpclist-dedicated-host-groups).







 20 November 2020 



 For all version dates
Key: 'STRING_VALUE', /* required /
};
s3.headObject(params, function(err,data) {
if (err) console.log(err, err.stack); // an error occurred
else
console.log(data); // successful response
});

Method Summary



 Method Description 

 clone() Returns a clone of this ObjectMetadata. 
 getRestoreExpirationTime() Returns the time at which an object that has been temporarily restored from ARCHIVE will expire, and will need to be restored again in order to be accessed. 
 getStorageClass() Returns the original storage class of the bucket. 
 getIBMTransition() Return the transition storage class and time of transition. 









 Next Steps 

In addition to cold storage, IBM Cloud currently provides several additional object storage classes for different user needs, all of which are accessible through web-based portals and RESTful APIs. Learn more about all [storage classes](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-classes) available at IBM Cloud Object Storage.
<LastModified>2016-08-25T17:49:06.006Z</LastModified>
<ETag>"37d4c94839ee181a2224d6242176c4b5"</ETag>
<Size>11</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>worker-bee</Key>
<LastModified>2016-08-25T17:46:53.288Z</LastModified>
<ETag>"d34d8aada2996fc42e6948b926513907"</ETag>
<Size>467</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
Show more

--------------------







 Delete a bucket 

A DELETE issued to an empty bucket deletes the bucket. The name of the bucket will be held in reserve by the system for 10 minutes after the deletion. After 10 minutes the name will be released for re-use. Only empty buckets can be deleted.

If the Object Storage service instance is deleted, all bucket names in that instance will be held in reserve by the system for 7 days. After 7 days the names will be released for re-use.

Not all operations are supported in Satellite environments. For details, see [supported Satellite APIs](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-apis-cos-satellite)

Syntax
At the end of the period, the copy of the object is deleted, while maintaining the archived object.





 Restoring an object using the AWS CLI 

The following examples uses environment variables for clarity. These must be set to the desired values, for example $ENDPOINT would be set to https://s3.us.cloud-object-storage.appdomain.cloud, or https://s3.eu-de.private.cloud-object-storage.appdomain.cloud, or any other required value.



1. Check object status: aws --endpoint-url $ENDPOINT s3api head-object --bucket $BUCKET --key $KEY The storage class will be shown as ("StorageClass": "GLACIER")
2. Restore the object: aws --endpoint-url $ENDPOINT s3api restore-object ---bucket $BUCKET --key $KEY --restore-request '{"Days":25,"GlacierJobParameters":{"Tier":"Bulk"}}'
3. Check the status: aws --endpoint-url $ENDPOINT s3api head-object --bucket $BUCKET --key $KEY









 Limitations 

Archive policies are implemented using subset of the PUT Bucket Lifecycle Configuration S3 API operation.

Supported functionality includes:



* Specifying either a date or the number of days in the future when objects transition to an archived state.
* Setting [expiration rules](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-expiry) for objects.



Policies specifying a date in the past may take up to a few days to complete.

Unsupported functionality includes:



* Multiple transition rules per bucket.
* Filtering objects to archive using a prefix or object key.
* Tiering between storage classes.



Classic Infrastructure (non-IAM) users are unable to set the transition storage class to ACCELERATED.





 Using the REST API and SDKs 



 Create a bucket lifecycle configuration 

This implementation of the PUT operation uses the lifecycle query parameter to set lifecycle settings for the bucket.
If you do not first empty and then delete the bucket, and instead [delete or schedule the Object Storage service instance for deletion](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-provisiondeleting-a-service-instance), the bucket names will be held in reserve for a [default period of seven (7) days until the account reclamation process](https://cloud.ibm.com/docs/cli?topic=cli-ibmcloud_commands_resourceibmcloud_resource_reclamations) is completed. Until the reclamation process is complete, it is possible to restore the instance, along with the buckets and objects. After reclamation is complete, all buckets and objects will be irrevocably deleted and can not be restored, although the bucket names will be made available for new buckets to reuse.
* Why do CredentialRetrievalError occur while uploading data to Object Storage or while retrieving credentials?

CredentialRetrievalError can occur due to the following reasons:



* The API key is not valid.
* The IAM endpoint is incorrect.



However, if the issue persists, contact IBM customer support.
* How do I ensure communication with Object Storage?

You can check the communication with Object Storage by using one of the following:



* Use a COS API HEAD call to a bucket that will return the headers for that bucket. See [api-head-bucket](https://cloud.ibm.com/docs/cloud-object-storage/api-reference?topic=cloud-object-storage-compatibility-api-bucket-operationscompatibility-api-head-bucket).
* Use SDK : See [headbucket property](https://ibm.github.io/ibm-cos-sdk-js/AWS/S3.htmlheadBucket-property).



* Can I migrate a bucket from one COS instance to another?

Yes, You can achieve the same by creating a bucket in the target Object Storage instance and perform a sync.
For details, see [supported Satellite APIs](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-apis-cos-satellite)

Syntax

PUT https://{endpoint}/{bucket-name}/{object-name}?retention path style
PUT https://{bucket-name}.{endpoint}/{object-name}?retention virtual host style

Payload Elements

The body of the request must contain an XML block with the following schema:



 Element Type Children Ancestor Notes 

 Retention Container Mode, RetainUntilDate <br><br> * <br><br><br> Required 
 Mode String <br><br> * <br><br><br> Retention Required - valid value is COMPLIANCE 
 RetainUntilDate Timestamp <br><br> * <br><br><br> Retention Required 



The following code shows one example of how to create the necessary representation of the header content:

echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64



Example request

This is an example of adding or extending retention on an object.

PUT /apiary/myObject?retention HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Content-MD5: cDeRJIdLuEXWmLpA79K2kg==
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 119

<Retention>
<Mode>COMPLIANCE</Mode>
<RetainUntilDate>2023-04-12T23:01:00.000Z</RetainUntilDate>
</Retention>

Example response

HTTP/1.1 200 OK
Date: Wed, 5 Oct 2020 15:39:38 GMT
X-Clv-Request-Id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Accept-Ranges: bytes
Content-Length: 0
function getProtectionConfigurationOnBucket(bucketName) {
console.log(Retrieve the protection on bucket ${bucketName});
return cos.getBucketProtectionConfiguration({
Bucket: bucketName
}).promise()
.then((data) => {
console.log(Configuration on bucket ${bucketName}:);
console.log(data);
})
.catch((e) => {
console.log(ERROR: ${e.code} - ${e.message}n);
});
}





 Upload a protected object 

Objects in protected buckets that are no longer under retention (retention period has expired and the object does not have any legal holds), when overwritten, will again come under retention. The new retention period can be provided as part of the object overwrite request or the default retention time of the bucket will be given to the object.



 Value Type Description 

 Retention-Period Non-negative integer (seconds) Retention period to store on the object in seconds. The object can be neither overwritten nor deleted until the amount of time specified in the retention period has elapsed. If this field and Retention-Expiration-Date are specified a 400 error is returned. If neither is specified the bucket's DefaultRetention period will be used. Zero (0) is a legal value assuming the bucket's minimum retention period is also 0. 
 Retention-expiration-date Date (ISO 8601 Format) Date on which it will be legal to delete or modify the object. You can only specify this or the Retention-Period header. If both are specified a 400 error will be returned. If neither is specified the bucket's DefaultRetention period will be used. 
 Retention-legal-hold-id string A single legal hold to apply to the object. A legal hold is a Y character long string. The object cannot be overwritten or deleted until all legal holds associated with the object are removed. 



function putObjectAddLegalHold(bucketName, objectName, legalHoldId) {
function putObjectLockRetention(bucketName,keyName) {
console.log(Putting Objectlock Retention on : ${keyName});
var inFiveSecond = (new Date(Date.now() + (1000 * 5)))
var rule = {Mode: 'COMPLIANCE', RetainUntilDate: inFiveSecond}
// Putting objectlock retention
return cos.putObjectRetention({
Bucket: bucketName,
Key: keyName,
Retention: rule
}).promise()
.then(() => {
console.log(Object lock Retention added!!);
logDone();
})
.catch(logError);

}

function getObjectLockRetention(bucketName,keyName) {
console.log(Getting Objectlock Retention for : ${keyName});
// Getting objectlock retention
return cos.getObjectRetention({
Bucket: bucketName,
Key: keyName
}).promise()
.then((data) => {
console.log(Objectlock retention for : ${keyName} );
console.log( JSON.stringify(data.Retention, null, " ") );
logDone();
})
.catch(logError);

}

function putObjectLockLegalhold(bucketName,keyName) {
console.log(Putting Objectlock Legalhold status ON for : ${keyName});
// Putting objectlock legalhold status
return cos.putObjectLegalHold({
Bucket: bucketName,
Key: keyName,
LegalHold: {Status: 'ON'}
}).promise()
.then(() => {
console.log(Object lock legalhold added!!);
logDone();
})
.catch(logError);

}

function getObjectLockLegalhold(bucketName,keyName) {
When drives are decommissioned, IBM destroys them before they are disposed of. The drives become unusable. Any data that was written to that drive becomes inaccessible.





 I cannot cancel a Block Storage for Classic volume because the Cancel action in the Cloud console is disabled. What’s happening? 

The cancellation process for this storage device is in progress so the Cancel action is no longer available. The volume remains visible for at least 24 hours until it is reclaimed. An hourglass or clock icon appears next to the device name to indicate that it’s in a waiting period. The minimum 24-hour waiting period gives you a chance to void the cancel request if needed.





 My Windows® 2012 host is supposed to have access to multiple Storage LUNs, but I can't see them in Disk Manager. How do I fix it? 

If you use more than two iSCSI LUNs with the same host, and if all the iSCSI connections are from the same Storage device, you might find that you can see only two devices in Disk Manager. When this situation happens, you need to manually connect to each device in the iSCSI Initiator. For more information, see [troubleshooting Windows® 2012 R2 - multiple iSCSI devices](https://cloud.ibm.com/docs/BlockStorage?topic=BlockStorage-troubleshootingWin12).





 My storage appears offline or read-only. Why did it happen and how do I fix it? 

In a couple of scenarios a host (bare metal or VM) might lose connection to the storage briefly and as a result, the host considers that storage read-only to avoid data corruption. Most of the time the loss of connectivity is network-related but the status of the storage remains read-only from the host's perspective even when the network connection is restored. A restart of the host solves the read-only state issue.

This issue can be observed with hosts that have incorrect MPIO settings. When MPIO is not configured correctly, the host loses connection to the storage, and might not be able to reconnect to the storage when the connectivity issue is resolved.





 Can I attach the Block Storage for Classic with a single path? Do I need to use multipath?