Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: v0.9.0
- Package version: 0.9.0
- Generator version: 7.13.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import garage "git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value garage.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), garage.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value garage.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), garage.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using garage.ContextOperationServerIndices
and garage.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), garage.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), garage.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to http://localhost:3903/v1
Class | Method | HTTP request | Description |
---|---|---|---|
BucketAPI | AllowBucketKey | Post /bucket/allow | Allow key |
BucketAPI | CreateBucket | Post /bucket | Create a bucket |
BucketAPI | DeleteBucket | Delete /bucket | Delete a bucket |
BucketAPI | DeleteBucketGlobalAlias | Delete /bucket/alias/global | Delete a global alias |
BucketAPI | DeleteBucketLocalAlias | Delete /bucket/alias/local | Delete a local alias |
BucketAPI | DenyBucketKey | Post /bucket/deny | Deny key |
BucketAPI | GetBucketInfo | Get /bucket | Get a bucket |
BucketAPI | ListBuckets | Get /bucket?list | List all buckets |
BucketAPI | PutBucketGlobalAlias | Put /bucket/alias/global | Add a global alias |
BucketAPI | PutBucketLocalAlias | Put /bucket/alias/local | Add a local alias |
BucketAPI | UpdateBucket | Put /bucket | Update a bucket |
KeyAPI | AddKey | Post /key?list | Create a new API key |
KeyAPI | DeleteKey | Delete /key | Delete a key |
KeyAPI | GetKey | Get /key | Get key information |
KeyAPI | ImportKey | Post /key/import | Import an existing key |
KeyAPI | ListKeys | Get /key?list | List all keys |
KeyAPI | UpdateKey | Post /key | Update a key |
LayoutAPI | AddLayout | Post /layout | Send modifications to the cluster layout |
LayoutAPI | ApplyLayout | Post /layout/apply | Apply staged layout |
LayoutAPI | GetLayout | Get /layout | Details on the current and staged layout |
LayoutAPI | RevertLayout | Post /layout/revert | Clear staged layout |
NodesAPI | AddNode | Post /connect | Connect a new node |
NodesAPI | GetHealth | Get /health | Cluster health report |
NodesAPI | GetNodes | Get /status | Describe cluster |
- AddKeyRequest
- AddNode200ResponseInner
- AllowBucketKeyRequest
- AllowBucketKeyRequestPermissions
- ApplyLayout200Response
- BucketInfo
- BucketInfoQuotas
- BucketInfoWebsiteConfig
- BucketKeyInfo
- ClusterLayout
- CreateBucketRequest
- CreateBucketRequestLocalAlias
- CreateBucketRequestLocalAliasAllow
- GetHealth200Response
- GetNodes200Response
- ImportKeyRequest
- KeyInfo
- KeyInfoBucketsInner
- KeyInfoBucketsInnerPermissions
- KeyInfoPermissions
- LayoutVersion
- ListBuckets200ResponseInner
- ListBuckets200ResponseInnerLocalAliasesInner
- ListKeys200ResponseInner
- NodeClusterInfo
- NodeNetworkInfo
- NodeRoleChange
- NodeRoleRemove
- NodeRoleUpdate
- UpdateBucketRequest
- UpdateBucketRequestQuotas
- UpdateBucketRequestWebsiteAccess
- UpdateKeyRequest
- UpdateKeyRequestAllow
- UpdateKeyRequestDeny
Authentication schemes defined for the API:
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), garage.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime