# S3 Operations

Below is a list of S3 operations that can be performed using Blimp:

[Create Bucket](#createbucket)\
[List Buckets](#listbuckets)\
[List Buckets Objects](#listbucketsobjects)\
[List Objects](#listobjects)\
[Get Object](#getobject)\
[Put Object](#putobject)\
[Remove Object](#removeobject)

## Terminology

To map AWS S3 terminology to Züs , the user should keep the following terms in mind:

1. An allocation owner on Züs can access their storage via s3 server in Blimp.
2. Each folder in the remotepath `/` of an allocation on Züs  is a bucket in Blimp  S3 server.

## Commands

### CreateBucket

This method will create a bucket stored on Züs allocation.

| Parameter       | Type   | Description                                                    |
| --------------- | ------ | -------------------------------------------------------------- |
| bucketName      | String | Name of the bucket                                             |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests        |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://blimp.zus.network/minioclient/?action=createBucket&bucketName=testbucket&accessKey=admin&secretAccessKey=admin'
```

Sample Response:

```
 {"Success":true,"Bucketname":"testbucket"}
```

### listBuckets

This method will list all the available buckets on Züs dStorage allocation.

| Parameter       | Type   | Description                                                    |
| --------------- | ------ | -------------------------------------------------------------- |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests        |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://blimp.zus.network/minioclient/?action=listBuckets&accessKey=admin&secretAccessKey=admin'
```

Sample Response:

```
 {"BucketName":"root","CreationDate":"2023-08-01T23:10:23Z"},
{"BucketName":"testbucket","CreationDate":"2023-08-01T23:10:23Z"}]
```

### listBucketsObjects

This method will list all the bucket and its contents on Züs dStorage allocation.

| Parameter       | Type   | Description                                                    |
| --------------- | ------ | -------------------------------------------------------------- |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests        |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://blimp.zus.network/minioclient/?action=listBucketsObjects&accessKey=rootroot&secretAccessKey=rootroot'
```

Sample Response:

```
 [{"BucketName":"root","CreationTime":"2022-12-01T23:10:23Z","BucketObjects":[{"Name":"/file1.txt","LastModified":"2022-12-01T23:26:08Z"}]},{"BucketName":"testbucket","CreationTime":"2022-12-01T23:10:23Z","BucketObjects":[]}]
```

### listObjects

This method will list all the objects for a specified bucket on Züs dStorage allocation.

| Parameter       | Type   | Description                                                         |
| --------------- | ------ | ------------------------------------------------------------------- |
| bucketName      | String | Provide Name of the bucket thats already there on 0chain allocation |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests             |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests      |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://blimp.zus.network/minioclient/?action=listObjects&bucketName=root&accessKey=rootroot&secretAccessKey=rootroot'
```

Sample Response:

```
[{"Name":"/file1.txt","LastModified":"2023-08-01T23:26:08Z"}]
```

### getObject

This method will return a stream of the object data that user will be able to download.

| Parameter       | Type   | Description                                                    |
| --------------- | ------ | -------------------------------------------------------------- |
| objectName      | String | Specify object/file name with its type .                       |
| bucketName      | String | Provide Name of the bucket in which object is stored.          |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests        |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://blimp.zus.network/minioclient/?action=getObject&bucketName=root&objectName=file1.txt&accessKey=rootroot&secretAccessKey=rootroot'
```

Sample Responses:

200 Successful: Will return contents of file

```
 <File_Contents>
```

### putObject

This method will upload an object on  Züs dStorage allocation.

| Parameter       | Type   | Description                                                               |
| --------------- | ------ | ------------------------------------------------------------------------- |
| File:           | Form   | A form filed with `file` so it can upload this file to dStorage.          |
| bucketName      | String | Provide Name of the bucket in which the uploaded object should be stored. |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests                   |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests            |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://localhost:3001/?action=putObject&bucketName=root&accessKey=rootroot&secretAccessKey=rootroot'
 File: /home/ubuntu/files/file1.txt
```

Sample Response:

```
 ​
```

### removeObject

This method will remove an object/file on Züs dStorage allocation.

| Parameter       | Type   | Description                                                        |
| --------------- | ------ | ------------------------------------------------------------------ |
| objectname      | String | Specify the object/file name with type to be removed.              |
| bucketName      | String | Provide name of the bucket from which the object has to be removed |
| accessKey       | String | Provide Access Key to validate Minio ClientAPI requests            |
| secretAccessKey | String | Provide Secret Access Key to validate Minio ClientAPI requests     |

Take a look at how you might call this method via `curl`:

```
 curl -X GET -i 'http://localhost:3001/?action=removeObject&bucketName=root&objectName=file1.txt&accessKey=rootroot&secretAccessKey=rootroot'
```

Sample Response:

```
 {"Success":true,"ObjectName":"file1.txt"}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-old.zus.network/products/blimp/use-blimp-as-s3-server/s3-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
