Skip to content

Commit

Permalink
Address review comments by Ersan
Browse files Browse the repository at this point in the history
  • Loading branch information
prakashsvmx committed Jun 4, 2021
1 parent 56da9c9 commit 83d8dd0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
12 changes: 6 additions & 6 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1607,27 +1607,27 @@ __Parameters__
| `callback(err)` | _function_ |Callback function is called with non `null` value in case of error. If no callback is passed, a `Promise` is returned. |


__Example__
__Example 1__

Get Legal hold of an object.

```js
minioClient.getObjectLegalHold('bucketName', 'objectName', {}, function(err, res) {
if (err) {
return console.log('Unable to get legal hold config for the object', err)
return console.log('Unable to get legal hold config for the object', err.message)
}
console.log('Success', res)
})
```

__Example 1__
__Example 2__

Get Legal hold of an object with versionId.

```js
minioClient.getObjectLegalHold('bucketName', 'objectName', { versionId:'my-obj-version-uuid' }, function(err, res) {
if (err) {
return console.log('Unable to get legal hold config for the object', err)
return console.log('Unable to get legal hold config for the object', err.message)
}
console.log('Success', res)
})
Expand Down Expand Up @@ -1656,7 +1656,7 @@ Set Legal hold of an object.
```js
minioClient.setObjectLegalHold('bucketName', 'objectName', {Status:"ON"}, function(err, res) {
if (err) {
return console.log('Unable to set legal hold config for the object', err)
return console.log('Unable to set legal hold config for the object', err.message)
}
console.log('Success')
})
Expand All @@ -1668,7 +1668,7 @@ Set Legal hold of an object with versionId.
```js
minioClient.setObjectLegalHold('bucketName', 'objectName', { Status:"ON", versionId:'my-obj-version-uuid' }, function(err, res) {
if (err) {
return console.log('Unable to set legal hold config for the object version', err)
return console.log('Unable to set legal hold config for the object version', err.message)
}
console.log('Success')
})
Expand Down
18 changes: 15 additions & 3 deletions examples/get-object-legal-hold.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,27 @@ var s3Client = new Minio.Client({
//Get Legalhold config
s3Client.getObjectLegalHold('bucketName', 'objectName', {}, function(err, res) {
if (err) {
return console.log('Unable to get legal hold config for the object', err)
return console.log('Unable to get legal hold config for the object', err.message) // Print only the message.
}
console.log(res)
})

//With versionId
s3Client.getObjectLegalHold('bucketName', 'objectName', { versionId:'my-obj-version-uuid' }, function(err, res) {
if (err) {
return console.log('Unable to get legal hold config for the object', err)
return console.log('Unable to get legal hold config for the object', err.message) // Print only the message.
}
console.log(res)
})
})

//Promise based version:
const objectLegalHoldPromise = s3Client.getObjectLegalHold('bucketName', 'objectName', { versionId:'my-obj-version-uuid' })
objectLegalHoldPromise.then((data) => {
console.log("Success...", data)
})
.catch((e)=>{
// Print only the error message. if called on an object without object lock config.
// e.g: "The specified object does not have a ObjectLock configuration"
console.log(e.message)

})
4 changes: 2 additions & 2 deletions examples/set-object-legal-hold.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ s3Client.setObjectLegalHold('bucketName', 'objectName', {status:"ON"}, function(
if (err) {
return console.log('Unable to set legal hold config for the object', err)
}
console.log('Success', res)
console.log('Success')
})

//Set legal hold config of an object with versionId.
s3Client.setObjectLegalHold('bucketName', 'objectName', { status:"ON", versionId:'my-obj-version-uuid' }, function(err, res) {
if (err) {
return console.log('Unable to set legal hold config for the object version', err)
}
console.log('Success', res)
console.log('Success')
})

0 comments on commit 83d8dd0

Please sign in to comment.