api-v1, generator #2
1 changed files with 29 additions and 0 deletions
|
@ -54,4 +54,33 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
fmt.Printf(strings.Join(msg.Message, "\n"))
|
||||
|
||||
// Key
|
||||
// -- create
|
||||
key := "openapi-key"
|
||||
keyInfo, r, err := client.KeyApi.AddKey(ctx).AddKeyRequest(garage.AddKeyRequest{Name: *garage.NewNullableString(&key) }).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.AddKey`\n")
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("AWS_ACCESS_KEY_ID=%s\nAWS_SECRET_ACCESS_KEY=%s\n", *keyInfo.AccessKeyId, *keyInfo.SecretAccessKey.Get())
|
||||
|
||||
// Bucket
|
||||
// -- create
|
||||
global_name := "global-ns-openapi-bucket"
|
||||
local_name := "local-ns-openapi-bucket"
|
||||
bucketInfo, r, err := client.BucketApi.CreateBucket(ctx).CreateBucketRequest(garage.CreateBucketRequest{
|
||||
GlobalAlias: &global_name,
|
||||
LocalAlias: &garage.CreateBucketRequestLocalAlias {
|
||||
AccessKeyId: keyInfo.AccessKeyId,
|
||||
Alias: &local_name,
|
||||
},
|
||||
}).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.CreateBucket`\n")
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Bucket id: %s\n", *bucketInfo.Id)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue