[#1] Add examples
Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
parent
230b6e9083
commit
cbf6ad5a77
1 changed files with 62 additions and 0 deletions
62
README.md
62
README.md
|
@ -16,3 +16,65 @@ cat <path_to_your_wallet> | jq .accounts[0].address | tr -d '"'
|
||||||
neo-go wallet export -w <path_to_your_wallet> -d <address_from_p1>
|
neo-go wallet export -w <path_to_your_wallet> -d <address_from_p1>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
### Container
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using FrostFS.SDK.ClientV2;
|
||||||
|
using FrostFS.SDK.ModelsV2;
|
||||||
|
using FrostFS.SDK.ModelsV2.Enums;
|
||||||
|
using FrostFS.SDK.ModelsV2.Netmap;
|
||||||
|
|
||||||
|
var fsClient = new Client(<your_key>, <your_host>);
|
||||||
|
|
||||||
|
// List containers
|
||||||
|
var containersIds = await fsClient.ListContainersAsync();
|
||||||
|
|
||||||
|
// Create container
|
||||||
|
var placementPolicy = new PlacementPolicy(true, new Replica(1));
|
||||||
|
var containerId = await fsClient.CreateContainerAsync(
|
||||||
|
new Container(
|
||||||
|
BasicAcl.PublicRW,
|
||||||
|
placementPolicy
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get container
|
||||||
|
var container = await fsClient.GetContainerAsync(cId);
|
||||||
|
|
||||||
|
// Delete container
|
||||||
|
await fsClient.DeleteContainerAsync(containerId);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Object
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using FrostFS.SDK.ClientV2;
|
||||||
|
using FrostFS.SDK.ModelsV2;
|
||||||
|
using FrostFS.SDK.ModelsV2.Enums;
|
||||||
|
using FrostFS.SDK.ModelsV2.Netmap;
|
||||||
|
|
||||||
|
var fsClient = new Client(<your_key>, <your_host>);
|
||||||
|
|
||||||
|
// Search regular objects
|
||||||
|
var objectsIds = await fsClient.SearchObjectAsync(
|
||||||
|
cId,
|
||||||
|
ObjectFilter.RootFilter()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Put object
|
||||||
|
var f = File.OpenRead("cat.jpg");
|
||||||
|
var cat = new ObjectHeader(
|
||||||
|
containerId: cId,
|
||||||
|
type: ObjectType.Regular,
|
||||||
|
new ObjectAttribute("Filename", "cat.jpg")
|
||||||
|
);
|
||||||
|
var oId = await fsClient.PutObjectAsync(cat, f);
|
||||||
|
|
||||||
|
// Get object header
|
||||||
|
var objHeader = await fsClient.GetObjectHeadAsync(cId, oId);
|
||||||
|
|
||||||
|
// Get object
|
||||||
|
var obj = await fsClient.GetObjectAsync(cId, oId);
|
||||||
|
```
|
Loading…
Reference in a new issue