Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.mdの更新 #26

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,58 @@ Go言語向けのさくらのクラウド オブジェクトストレージAPI

## 概要

:baby_symbol: object-storage-api-goは設計/開発中です。
概要や設計、実装方針については[docs/overview.md](https://github.com/sacloud/object-storage-api-go/blob/main/docs/design/overview.md)を参照してください。
sacloud/object-storage-api-goはさくらのクラウド オブジェクトストレージAPIをGo言語から利用するためのAPIライブラリです。

- 概要/設計/実装方針: [docs/overview.md](https://github.com/sacloud/object-storage-api-go/blob/main/docs/design/overview.md)

利用イメージ:

```go
import (
"context"
"os"

objectstorage "github.com/sacloud/object-storage-api-go"
v1 "github.com/sacloud/object-storage-api-go/apis/v1"
)

func main() {
token := os.Getenv("SAKURACLOUD_ACCESS_TOKEN")
secret := os.Getenv("SAKURACLOUD_ACCESS_TOKEN_SECRET")

client := &objectstorage.Client{
Token: token,
Secret: secret,
}
ctx := context.Background()

// サイト一覧を取得
siteOp := objectstorage.NewSiteOp(client)
sites, err := siteOp.List(ctx)
if err != nil {
panic(err)
}
siteId := sites[0].Id

// バケットの作成
bucketName := "your-bucket-name"
bucketAPI := objectstorage.NewBucketOp(client)
bucket, err := bucketAPI.Create(ctx, siteId, bucketName)
if err != nil {
panic(err)
}

// バケットの削除
defer func() {
if err := bucketAPI.Delete(ctx, siteId, bucketName); err != nil {
panic(err)
}
}()

fmt.Println(bucket.Name)
}
```


:warning: v1.0に達するまでは互換性のない形で変更される可能性がありますのでご注意ください。

Expand Down