summaryrefslogtreecommitdiff
path: root/docs/API.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/API.md')
-rw-r--r--docs/API.md128
1 files changed, 124 insertions, 4 deletions
diff --git a/docs/API.md b/docs/API.md
index 91a40d7..5778216 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -58,8 +58,8 @@ func main() {
| [`RemoveBucket`](#RemoveBucket) | [`StatObject`](#StatObject) | [`StatObject`](#StatObject) | | [`GetBucketNotification`](#GetBucketNotification) | [`TraceOff`](#TraceOff) |
| [`ListObjects`](#ListObjects) | [`RemoveObject`](#RemoveObject) | | | [`RemoveAllBucketNotification`](#RemoveAllBucketNotification) | [`SetS3TransferAccelerate`](#SetS3TransferAccelerate) |
| [`ListObjectsV2`](#ListObjectsV2) | [`RemoveObjects`](#RemoveObjects) | | | [`ListenBucketNotification`](#ListenBucketNotification) | |
-| [`ListIncompleteUploads`](#ListIncompleteUploads) | [`RemoveIncompleteUpload`](#RemoveIncompleteUpload) | | | | |
-| | [`FPutObject`](#FPutObject) | [`FPutObject`](#FPutObject) | | | |
+| [`ListIncompleteUploads`](#ListIncompleteUploads) | [`RemoveIncompleteUpload`](#RemoveIncompleteUpload) | | | [`SetBucketLifecycle`](#SetBucketLifecycle) | |
+| | [`FPutObject`](#FPutObject) | [`FPutObject`](#FPutObject) | | [`GetBucketLifecycle`](#GetBucketLifecycle) | |
| | [`FGetObject`](#FGetObject) | [`FGetObject`](#FGetObject) | | | |
| | [`ComposeObject`](#ComposeObject) | [`ComposeObject`](#ComposeObject) | | | |
| | [`NewSourceInfo`](#NewSourceInfo) | [`NewSourceInfo`](#NewSourceInfo) | | | |
@@ -68,7 +68,8 @@ func main() {
| | [`GetObjectWithContext`](#GetObjectWithContext) | [`GetObjectWithContext`](#GetObjectWithContext) | | |
| | [`FPutObjectWithContext`](#FPutObjectWithContext) | [`FPutObjectWithContext`](#FPutObjectWithContext) | | |
| | [`FGetObjectWithContext`](#FGetObjectWithContext) | [`FGetObjectWithContext`](#FGetObjectWithContext) | | |
-| | [`RemoveObjectsWithContext`](#RemoveObjectsWithContext) | | | |
+| | [`RemoveObjectsWithContext`](#RemoveObjectsWithContext) | | | |
+| | [`SelectObjectContent`](#SelectObjectContent) | |
## 1. Constructor
<a name="Minio"></a>
@@ -1038,7 +1039,7 @@ Parameters
|:---|:---| :---|
|`ctx` | _context.Context_ |Request context |
|`bucketName` | _string_ |Name of the bucket |
-|`objectsCh` | _chan string_ | Channel of objects to be removed |
+|`objectsCh` | _chan string_ | Channel of objects to be removed |
__Return Values__
@@ -1068,6 +1069,59 @@ for rErr := range minioClient.RemoveObjects(ctx, "my-bucketname", objectsCh) {
fmt.Println("Error detected during deletion: ", rErr)
}
```
+<a name="SelectObjectContent"></a>
+### SelectObjectContent(ctx context.Context, bucketName string, objectsName string, expression string, options SelectObjectOptions) *SelectResults
+Parameters
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`ctx` | _context.Context_ |Request context |
+|`bucketName` | _string_ |Name of the bucket |
+|`objectName` | _string_ |Name of the object |
+|`options` | _SelectObjectOptions_ | Query Options |
+
+__Return Values__
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`SelectResults` | _SelectResults_ | Is an io.ReadCloser object which can be directly passed to csv.NewReader for processing output. |
+
+```go
+ // Initialize minio client object.
+ minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ opts := minio.SelectObjectOptions{
+ Expression: "select count(*) from s3object",
+ ExpressionType: minio.QueryExpressionTypeSQL,
+ InputSerialization: minio.SelectObjectInputSerialization{
+ CompressionType: minio.SelectCompressionNONE,
+ CSV: &minio.CSVInputOptions{
+ FileHeaderInfo: minio.CSVFileHeaderInfoNone,
+ RecordDelimiter: "\n",
+ FieldDelimiter: ",",
+ },
+ },
+ OutputSerialization: minio.SelectObjectOutputSerialization{
+ CSV: &minio.CSVOutputOptions{
+ RecordDelimiter: "\n",
+ FieldDelimiter: ",",
+ },
+ },
+ }
+
+ reader, err := s3Client.SelectObjectContent(context.Background(), "mycsvbucket", "mycsv.csv", opts)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ defer reader.Close()
+
+ if _, err := io.Copy(os.Stdout, reader); err != nil {
+ log.Fatalln(err)
+ }
+```
<a name="RemoveIncompleteUpload"></a>
### RemoveIncompleteUpload(bucketName, objectName string) error
@@ -1445,6 +1499,72 @@ for notificationInfo := range minioClient.ListenBucketNotification("mybucket", "
}
```
+<a name="SetBucketLifecycle"></a>
+### SetBucketLifecycle(bucketname, lifecycle string) error
+Set lifecycle on bucket or an object prefix.
+
+__Parameters__
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`bucketName` | _string_ |Name of the bucket|
+|`lifecycle` | _string_ |Lifecycle to be set |
+
+__Return Values__
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`err` | _error_ |Standard Error |
+
+__Example__
+
+```go
+lifecycle := `<LifecycleConfiguration>
+ <Rule>
+ <ID>expire-bucket</ID>
+ <Prefix></Prefix>
+ <Status>Enabled</Status>
+ <Expiration>
+ <Days>365</Days>
+ </Expiration>
+ </Rule>
+</LifecycleConfiguration>`
+
+err = minioClient.SetBucketLifecycle("my-bucketname", lifecycle)
+if err != nil {
+ fmt.Println(err)
+ return
+}
+```
+
+<a name="GetBucketLifecycle"></a>
+### GetBucketLifecycle(bucketName) (lifecycle string, error)
+Get lifecycle on a bucket or a prefix.
+
+__Parameters__
+
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`bucketName` | _string_ |Name of the bucket |
+
+__Return Values__
+
+
+|Param |Type |Description |
+|:---|:---| :---|
+|`lifecycle` | _string_ |Lifecycle returned from the server |
+|`err` | _error_ |Standard Error |
+
+__Example__
+
+```go
+lifecycle, err := minioClient.GetBucketLifecycle("my-bucketname")
+if err != nil {
+ log.Fatalln(err)
+}
+```
+
## 7. Client custom settings
<a name="SetAppInfo"></a>