You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Quentin d012cff7c5
Update repo URL
3 weeks ago
.openapi-generator Fix gitHost & co 3 weeks ago
api Initial commit 3 weeks ago
docs Initial commit 3 weeks ago
.gitignore Initial commit 3 weeks ago
.openapi-generator-ignore Initial commit 3 weeks ago
.travis.yml Initial commit 3 weeks ago
README.md Update repo URL 3 weeks ago
api_bucket.go Initial commit 3 weeks ago
api_key.go Initial commit 3 weeks ago
api_layout.go Initial commit 3 weeks ago
api_nodes.go Initial commit 3 weeks ago
client.go Initial commit 3 weeks ago
configuration.go Initial commit 3 weeks ago
git_push.sh Update repo URL 3 weeks ago
go.mod Update repo URL 3 weeks ago
go.sum Initial commit 3 weeks ago
model_add_key_request.go Initial commit 3 weeks ago
model_add_node_200_response_inner.go Initial commit 3 weeks ago
model_allow_bucket_key_request.go Initial commit 3 weeks ago
model_allow_bucket_key_request_permissions.go Initial commit 3 weeks ago
model_bucket_info.go Initial commit 3 weeks ago
model_bucket_info_quotas.go Initial commit 3 weeks ago
model_bucket_info_website_config.go Initial commit 3 weeks ago
model_bucket_key_info.go Initial commit 3 weeks ago
model_cluster_layout.go Initial commit 3 weeks ago
model_create_bucket_request.go Initial commit 3 weeks ago
model_create_bucket_request_local_alias.go Initial commit 3 weeks ago
model_create_bucket_request_local_alias_allow.go Initial commit 3 weeks ago
model_get_nodes_200_response.go Initial commit 3 weeks ago
model_import_key_request.go Initial commit 3 weeks ago
model_key_info.go Initial commit 3 weeks ago
model_key_info_buckets_inner.go Initial commit 3 weeks ago
model_key_info_buckets_inner_permissions.go Initial commit 3 weeks ago
model_key_info_permissions.go Initial commit 3 weeks ago
model_layout_version.go Initial commit 3 weeks ago
model_list_buckets_200_response_inner.go Initial commit 3 weeks ago
model_list_buckets_200_response_inner_local_aliases_inner.go Initial commit 3 weeks ago
model_list_keys_200_response_inner.go Initial commit 3 weeks ago
model_node_cluster_info.go Initial commit 3 weeks ago
model_node_network_info.go Initial commit 3 weeks ago
model_update_bucket_request.go Initial commit 3 weeks ago
model_update_bucket_request_quotas.go Initial commit 3 weeks ago
model_update_bucket_request_website_access.go Initial commit 3 weeks ago
model_update_key_request.go Initial commit 3 weeks ago
model_update_key_request_allow.go Initial commit 3 weeks ago
model_update_key_request_deny.go Initial commit 3 weeks ago
response.go Initial commit 3 weeks ago
utils.go Initial commit 3 weeks ago

README.md

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

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

Author