api-v1, generator #2

Merged
quentin merged 15 commits from v0.9.x into main 2023-11-28 15:40:37 +00:00
Showing only changes of commit eb29f67298 - Show all commits

View file

@ -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)
}