No description
Find a file
2023-11-23 08:54:51 +01:00
.openapi-generator api-v1, initial commit 2023-11-22 18:28:14 +01:00
api fix key query param 2023-11-23 08:54:51 +01:00
docs fix key query param 2023-11-23 08:54:51 +01:00
.gitignore Initial commit 2022-11-13 14:22:00 +01:00
.openapi-generator-ignore Initial commit 2022-11-13 14:22:00 +01:00
.travis.yml Initial commit 2022-11-13 14:22:00 +01:00
api_bucket.go api-v1, 2nd iter 2023-11-22 21:17:35 +01:00
api_key.go fix key query param 2023-11-23 08:54:51 +01:00
api_layout.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
api_nodes.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
client.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
configuration.go api-v1, 2nd iter 2023-11-22 21:17:35 +01:00
git_push.sh Update repo URL 2022-11-13 15:51:20 +01:00
go.mod Update repo URL 2022-11-13 15:51:20 +01:00
go.sum Initial commit 2022-11-13 14:22:00 +01:00
model_add_key_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_add_node_200_response_inner.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_allow_bucket_key_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_allow_bucket_key_request_permissions.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_apply_layout_200_response.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_bucket_info.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_bucket_info_quotas.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_bucket_info_website_config.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_bucket_key_info.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_cluster_layout.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_create_bucket_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_create_bucket_request_local_alias.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_create_bucket_request_local_alias_allow.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_get_nodes_200_response.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_import_key_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_key_info.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_key_info_buckets_inner.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_key_info_buckets_inner_permissions.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_key_info_permissions.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_layout_version.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_list_buckets_200_response_inner.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_list_buckets_200_response_inner_local_aliases_inner.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_list_keys_200_response_inner.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_node_cluster_info.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_node_network_info.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_node_role_change.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_node_role_remove.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_node_role_update.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_bucket_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_bucket_request_quotas.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_bucket_request_website_access.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_key_request.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_key_request_allow.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
model_update_key_request_deny.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
README.md api-v1, 2nd iter 2023-11-22 21:17:35 +01:00
response.go api-v1, initial commit 2023-11-22 18:28:14 +01:00
utils.go api-v1, initial commit 2023-11-22 18:28:14 +01:00

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.9.0
  • Package version: 0.9.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/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 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