.openapi-generator | ||
api | ||
docs | ||
.gitignore | ||
.openapi-generator-ignore | ||
.travis.yml | ||
api_bucket.go | ||
api_key.go | ||
api_layout.go | ||
api_nodes.go | ||
client.go | ||
configuration.go | ||
git_push.sh | ||
go.mod | ||
go.sum | ||
model_add_key_request.go | ||
model_add_node_200_response_inner.go | ||
model_allow_bucket_key_request.go | ||
model_allow_bucket_key_request_permissions.go | ||
model_bucket_info.go | ||
model_bucket_info_quotas.go | ||
model_bucket_info_website_config.go | ||
model_bucket_key_info.go | ||
model_cluster_layout.go | ||
model_create_bucket_request.go | ||
model_create_bucket_request_local_alias.go | ||
model_create_bucket_request_local_alias_allow.go | ||
model_get_nodes_200_response.go | ||
model_import_key_request.go | ||
model_key_info.go | ||
model_key_info_buckets_inner.go | ||
model_key_info_buckets_inner_permissions.go | ||
model_key_info_permissions.go | ||
model_layout_version.go | ||
model_list_buckets_200_response_inner.go | ||
model_list_buckets_200_response_inner_local_aliases_inner.go | ||
model_list_keys_200_response_inner.go | ||
model_node_cluster_info.go | ||
model_node_network_info.go | ||
model_update_bucket_request.go | ||
model_update_bucket_request_quotas.go | ||
model_update_bucket_request_website_access.go | ||
model_update_key_request.go | ||
model_update_key_request_allow.go | ||
model_update_key_request_deny.go | ||
README.md | ||
response.go | ||
utils.go |
Go API client for garage
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!
Overview
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.8.0
- Package version: 0.8.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
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")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), garage.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.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.
URLs Configuration per Operation
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 sw.ContextOperationServerIndices
and sw.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",
},
})
Documentation for API Endpoints
All URIs are relative to http://localhost:3903/v0
Class | Method | HTTP request | Description |
---|---|---|---|
BucketApi | AllowBucketKey | Post /bucket/allow | Allow key |
BucketApi | CreateBucket | Post /bucket | Create a bucket |
BucketApi | DeleteBucket | Delete /bucket?id={bucket_id} | 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 | FindBucketInfo | Get /bucket?globalAlias={alias} | Find a bucket |
BucketApi | GetBucketInfo | Get /bucket?id={bucket_id} | Get a bucket |
BucketApi | ListBuckets | Get /bucket | 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?id={bucket_id} | Update a bucket |
KeyApi | AddKey | Post /key | Create a new API key |
KeyApi | DeleteKey | Delete /key?id={access_key} | Delete a key |
KeyApi | GetKey | Get /key?id={access_key} | Get key information |
KeyApi | ImportKey | Post /key/import | Import an existing key |
KeyApi | ListKeys | Get /key | List all keys |
KeyApi | SearchKey | Get /key?search={pattern} | Select key by pattern |
KeyApi | UpdateKey | Post /key?id={access_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 target node to other Garage nodes |
NodesApi | GetNodes | Get /status | Status of this node and other nodes in the cluster |
Documentation For Models
- AddKeyRequest
- AddNode200ResponseInner
- AllowBucketKeyRequest
- AllowBucketKeyRequestPermissions
- BucketInfo
- BucketInfoQuotas
- BucketInfoWebsiteConfig
- BucketKeyInfo
- ClusterLayout
- CreateBucketRequest
- CreateBucketRequestLocalAlias
- CreateBucketRequestLocalAliasAllow
- GetNodes200Response
- ImportKeyRequest
- KeyInfo
- KeyInfoBucketsInner
- KeyInfoBucketsInnerPermissions
- KeyInfoPermissions
- LayoutVersion
- ListBuckets200ResponseInner
- ListBuckets200ResponseInnerLocalAliasesInner
- ListKeys200ResponseInner
- NodeClusterInfo
- NodeNetworkInfo
- UpdateBucketRequest
- UpdateBucketRequestQuotas
- UpdateBucketRequestWebsiteAccess
- UpdateKeyRequest
- UpdateKeyRequestAllow
- UpdateKeyRequestDeny
Documentation For Authorization
bearerAuth
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
Documentation for Utility Methods
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