Merge pull request 'api-v1 golang' (#1) from v0.9.x into main

Reviewed-on: #1
This commit is contained in:
Quentin 2023-11-28 15:36:12 +00:00
commit 8b81fae65e
63 changed files with 2978 additions and 1011 deletions

View file

@ -12,6 +12,7 @@ docs/AddKeyRequest.md
docs/AddNode200ResponseInner.md
docs/AllowBucketKeyRequest.md
docs/AllowBucketKeyRequestPermissions.md
docs/ApplyLayout200Response.md
docs/BucketApi.md
docs/BucketInfo.md
docs/BucketInfoQuotas.md
@ -21,6 +22,7 @@ docs/ClusterLayout.md
docs/CreateBucketRequest.md
docs/CreateBucketRequestLocalAlias.md
docs/CreateBucketRequestLocalAliasAllow.md
docs/GetHealth200Response.md
docs/GetNodes200Response.md
docs/ImportKeyRequest.md
docs/KeyApi.md
@ -35,6 +37,9 @@ docs/ListBuckets200ResponseInnerLocalAliasesInner.md
docs/ListKeys200ResponseInner.md
docs/NodeClusterInfo.md
docs/NodeNetworkInfo.md
docs/NodeRoleChange.md
docs/NodeRoleRemove.md
docs/NodeRoleUpdate.md
docs/NodesApi.md
docs/UpdateBucketRequest.md
docs/UpdateBucketRequestQuotas.md
@ -49,6 +54,7 @@ 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_apply_layout_200_response.go
model_bucket_info.go
model_bucket_info_quotas.go
model_bucket_info_website_config.go
@ -57,6 +63,7 @@ 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_health_200_response.go
model_get_nodes_200_response.go
model_import_key_request.go
model_key_info.go
@ -69,6 +76,9 @@ 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_node_role_change.go
model_node_role_remove.go
model_node_role_update.go
model_update_bucket_request.go
model_update_bucket_request_quotas.go
model_update_bucket_request_website_access.go

View file

@ -8,8 +8,8 @@ Administrate your Garage cluster programatically, including status, layout, keys
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
- API version: v0.8.0
- Package version: 0.8.0
- API version: v0.9.0
- Package version: 0.9.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation
@ -77,35 +77,34 @@ ctx = context.WithValue(context.Background(), garage.ContextOperationServerVaria
## Documentation for API Endpoints
All URIs are relative to *http://localhost:3903/v0*
All URIs are relative to *http://localhost:3903/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*BucketApi* | [**AllowBucketKey**](docs/BucketApi.md#allowbucketkey) | **Post** /bucket/allow | Allow key
*BucketApi* | [**CreateBucket**](docs/BucketApi.md#createbucket) | **Post** /bucket | Create a bucket
*BucketApi* | [**DeleteBucket**](docs/BucketApi.md#deletebucket) | **Delete** /bucket?id={bucket_id} | Delete a bucket
*BucketApi* | [**DeleteBucket**](docs/BucketApi.md#deletebucket) | **Delete** /bucket | Delete a bucket
*BucketApi* | [**DeleteBucketGlobalAlias**](docs/BucketApi.md#deletebucketglobalalias) | **Delete** /bucket/alias/global | Delete a global alias
*BucketApi* | [**DeleteBucketLocalAlias**](docs/BucketApi.md#deletebucketlocalalias) | **Delete** /bucket/alias/local | Delete a local alias
*BucketApi* | [**DenyBucketKey**](docs/BucketApi.md#denybucketkey) | **Post** /bucket/deny | Deny key
*BucketApi* | [**FindBucketInfo**](docs/BucketApi.md#findbucketinfo) | **Get** /bucket?globalAlias={alias} | Find a bucket
*BucketApi* | [**GetBucketInfo**](docs/BucketApi.md#getbucketinfo) | **Get** /bucket?id={bucket_id} | Get a bucket
*BucketApi* | [**ListBuckets**](docs/BucketApi.md#listbuckets) | **Get** /bucket | List all buckets
*BucketApi* | [**GetBucketInfo**](docs/BucketApi.md#getbucketinfo) | **Get** /bucket | Get a bucket
*BucketApi* | [**ListBuckets**](docs/BucketApi.md#listbuckets) | **Get** /bucket?list | List all buckets
*BucketApi* | [**PutBucketGlobalAlias**](docs/BucketApi.md#putbucketglobalalias) | **Put** /bucket/alias/global | Add a global alias
*BucketApi* | [**PutBucketLocalAlias**](docs/BucketApi.md#putbucketlocalalias) | **Put** /bucket/alias/local | Add a local alias
*BucketApi* | [**UpdateBucket**](docs/BucketApi.md#updatebucket) | **Put** /bucket?id={bucket_id} | Update a bucket
*KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key | Create a new API key
*KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key?id={access_key} | Delete a key
*KeyApi* | [**GetKey**](docs/KeyApi.md#getkey) | **Get** /key?id={access_key} | Get key information
*BucketApi* | [**UpdateBucket**](docs/BucketApi.md#updatebucket) | **Put** /bucket | Update a bucket
*KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key?list | Create a new API key
*KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key | Delete a key
*KeyApi* | [**GetKey**](docs/KeyApi.md#getkey) | **Get** /key | Get key information
*KeyApi* | [**ImportKey**](docs/KeyApi.md#importkey) | **Post** /key/import | Import an existing key
*KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key | List all keys
*KeyApi* | [**SearchKey**](docs/KeyApi.md#searchkey) | **Get** /key?search={pattern} | Select key by pattern
*KeyApi* | [**UpdateKey**](docs/KeyApi.md#updatekey) | **Post** /key?id={access_key} | Update a key
*KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key?list | List all keys
*KeyApi* | [**UpdateKey**](docs/KeyApi.md#updatekey) | **Post** /key | Update a key
*LayoutApi* | [**AddLayout**](docs/LayoutApi.md#addlayout) | **Post** /layout | Send modifications to the cluster layout
*LayoutApi* | [**ApplyLayout**](docs/LayoutApi.md#applylayout) | **Post** /layout/apply | Apply staged layout
*LayoutApi* | [**GetLayout**](docs/LayoutApi.md#getlayout) | **Get** /layout | Details on the current and staged layout
*LayoutApi* | [**RevertLayout**](docs/LayoutApi.md#revertlayout) | **Post** /layout/revert | Clear staged layout
*NodesApi* | [**AddNode**](docs/NodesApi.md#addnode) | **Post** /connect | Connect target node to other Garage nodes
*NodesApi* | [**GetNodes**](docs/NodesApi.md#getnodes) | **Get** /status | Status of this node and other nodes in the cluster
*NodesApi* | [**AddNode**](docs/NodesApi.md#addnode) | **Post** /connect | Connect a new node
*NodesApi* | [**GetHealth**](docs/NodesApi.md#gethealth) | **Get** /health | Cluster health report
*NodesApi* | [**GetNodes**](docs/NodesApi.md#getnodes) | **Get** /status | Describe cluster
## Documentation For Models
@ -114,6 +113,7 @@ Class | Method | HTTP request | Description
- [AddNode200ResponseInner](docs/AddNode200ResponseInner.md)
- [AllowBucketKeyRequest](docs/AllowBucketKeyRequest.md)
- [AllowBucketKeyRequestPermissions](docs/AllowBucketKeyRequestPermissions.md)
- [ApplyLayout200Response](docs/ApplyLayout200Response.md)
- [BucketInfo](docs/BucketInfo.md)
- [BucketInfoQuotas](docs/BucketInfoQuotas.md)
- [BucketInfoWebsiteConfig](docs/BucketInfoWebsiteConfig.md)
@ -122,6 +122,7 @@ Class | Method | HTTP request | Description
- [CreateBucketRequest](docs/CreateBucketRequest.md)
- [CreateBucketRequestLocalAlias](docs/CreateBucketRequestLocalAlias.md)
- [CreateBucketRequestLocalAliasAllow](docs/CreateBucketRequestLocalAliasAllow.md)
- [GetHealth200Response](docs/GetHealth200Response.md)
- [GetNodes200Response](docs/GetNodes200Response.md)
- [ImportKeyRequest](docs/ImportKeyRequest.md)
- [KeyInfo](docs/KeyInfo.md)
@ -134,6 +135,9 @@ Class | Method | HTTP request | Description
- [ListKeys200ResponseInner](docs/ListKeys200ResponseInner.md)
- [NodeClusterInfo](docs/NodeClusterInfo.md)
- [NodeNetworkInfo](docs/NodeNetworkInfo.md)
- [NodeRoleChange](docs/NodeRoleChange.md)
- [NodeRoleRemove](docs/NodeRoleRemove.md)
- [NodeRoleUpdate](docs/NodeRoleUpdate.md)
- [UpdateBucketRequest](docs/UpdateBucketRequest.md)
- [UpdateBucketRequestQuotas](docs/UpdateBucketRequestQuotas.md)
- [UpdateBucketRequestWebsiteAccess](docs/UpdateBucketRequestWebsiteAccess.md)

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -16,7 +16,6 @@ import (
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@ -259,7 +258,13 @@ func (a *BucketApiService) CreateBucketExecute(r ApiCreateBucketRequest) (*Bucke
type ApiDeleteBucketRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
}
// The exact bucket identifier, a 32 bytes hexadecimal string
func (r ApiDeleteBucketRequest) Id(id string) ApiDeleteBucketRequest {
r.id = &id
return r
}
func (r ApiDeleteBucketRequest) Execute() (*http.Response, error) {
@ -275,14 +280,12 @@ Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is no
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiDeleteBucketRequest
*/
func (a *BucketApiService) DeleteBucket(ctx context.Context, bucketId string) ApiDeleteBucketRequest {
func (a *BucketApiService) DeleteBucket(ctx context.Context) ApiDeleteBucketRequest {
return ApiDeleteBucketRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -299,13 +302,16 @@ func (a *BucketApiService) DeleteBucketExecute(r ApiDeleteBucketRequest) (*http.
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return nil, reportError("id is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -721,114 +727,23 @@ func (a *BucketApiService) DenyBucketKeyExecute(r ApiDenyBucketKeyRequest) (*Buc
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiFindBucketInfoRequest struct {
ctx context.Context
ApiService *BucketApiService
alias string
}
func (r ApiFindBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error) {
return r.ApiService.FindBucketInfoExecute(r)
}
/*
FindBucketInfo Find a bucket
Find a bucket by its global alias
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param alias The exact global alias of one of the existing buckets
@return ApiFindBucketInfoRequest
*/
func (a *BucketApiService) FindBucketInfo(ctx context.Context, alias string) ApiFindBucketInfoRequest {
return ApiFindBucketInfoRequest{
ApiService: a,
ctx: ctx,
alias: alias,
}
}
// Execute executes the request
// @return BucketInfo
func (a *BucketApiService) FindBucketInfoExecute(r ApiFindBucketInfoRequest) (*BucketInfo, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *BucketInfo
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketApiService.FindBucketInfo")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?globalAlias={alias}"
localVarPath = strings.Replace(localVarPath, "{"+"alias"+"}", url.PathEscape(parameterToString(r.alias, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetBucketInfoRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
alias *string
}
// The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`.
func (r ApiGetBucketInfoRequest) Id(id string) ApiGetBucketInfoRequest {
r.id = &id
return r
}
// The exact global alias of one of the existing buckets. Incompatible with `id`.
func (r ApiGetBucketInfoRequest) Alias(alias string) ApiGetBucketInfoRequest {
r.alias = &alias
return r
}
func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error) {
@ -838,21 +753,19 @@ func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error)
/*
GetBucketInfo Get a bucket
Given a bucket identifier, get its information.
Given a bucket identifier (`id`) or a global alias (`alias`), get its information.
It includes its aliases, its web configuration, keys that have some permissions
on it, some statistics (number of objects, size), number of dangling multipart uploads,
and its quotas (if any).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiGetBucketInfoRequest
*/
func (a *BucketApiService) GetBucketInfo(ctx context.Context, bucketId string) ApiGetBucketInfoRequest {
func (a *BucketApiService) GetBucketInfo(ctx context.Context) ApiGetBucketInfoRequest {
return ApiGetBucketInfoRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -871,13 +784,18 @@ func (a *BucketApiService) GetBucketInfoExecute(r ApiGetBucketInfoRequest) (*Buc
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id != nil {
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
}
if r.alias != nil {
localVarQueryParams.Add("alias", parameterToString(*r.alias, ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -972,7 +890,7 @@ func (a *BucketApiService) ListBucketsExecute(r ApiListBucketsRequest) ([]ListBu
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket"
localVarPath := localBasePath + "/bucket?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -1285,10 +1203,16 @@ func (a *BucketApiService) PutBucketLocalAliasExecute(r ApiPutBucketLocalAliasRe
type ApiUpdateBucketRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
updateBucketRequest *UpdateBucketRequest
}
// The exact bucket identifier, a 32 bytes hexadecimal string
func (r ApiUpdateBucketRequest) Id(id string) ApiUpdateBucketRequest {
r.id = &id
return r
}
// Requested changes on the bucket. Both root fields are optionals.
func (r ApiUpdateBucketRequest) UpdateBucketRequest(updateBucketRequest UpdateBucketRequest) ApiUpdateBucketRequest {
r.updateBucketRequest = &updateBucketRequest
@ -1302,7 +1226,7 @@ func (r ApiUpdateBucketRequest) Execute() (*BucketInfo, *http.Response, error) {
/*
UpdateBucket Update a bucket
All fields (`websiteAccess` and `quotas`) are optionnal.
All fields (`websiteAccess` and `quotas`) are optional.
If they are present, the corresponding modifications are applied to the bucket, otherwise nothing is changed.
In `websiteAccess`: if `enabled` is `true`, `indexDocument` must be specified.
@ -1316,14 +1240,12 @@ to change only one of the two quotas.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiUpdateBucketRequest
*/
func (a *BucketApiService) UpdateBucket(ctx context.Context, bucketId string) ApiUpdateBucketRequest {
func (a *BucketApiService) UpdateBucket(ctx context.Context) ApiUpdateBucketRequest {
return ApiUpdateBucketRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -1342,16 +1264,19 @@ func (a *BucketApiService) UpdateBucketExecute(r ApiUpdateBucketRequest) (*Bucke
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return localVarReturnValue, nil, reportError("id is required and must be specified")
}
if r.updateBucketRequest == nil {
return localVarReturnValue, nil, reportError("updateBucketRequest is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -16,7 +16,6 @@ import (
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@ -29,7 +28,7 @@ type ApiAddKeyRequest struct {
addKeyRequest *AddKeyRequest
}
// \"You can set a friendly name for this key, send an empty string instead\"
// You can set a friendly name for this key. If you don't want to, you can set the name to `null`. *Note: the secret key is returned in the response.*
func (r ApiAddKeyRequest) AddKeyRequest(addKeyRequest AddKeyRequest) ApiAddKeyRequest {
r.addKeyRequest = &addKeyRequest
return r
@ -70,7 +69,7 @@ func (a *KeyApiService) AddKeyExecute(r ApiAddKeyRequest) (*KeyInfo, *http.Respo
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key"
localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -138,7 +137,13 @@ func (a *KeyApiService) AddKeyExecute(r ApiAddKeyRequest) (*KeyInfo, *http.Respo
type ApiDeleteKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
accessKey string
id *string
}
// The exact API access key generated by Garage
func (r ApiDeleteKeyRequest) Id(id string) ApiDeleteKeyRequest {
r.id = &id
return r
}
func (r ApiDeleteKeyRequest) Execute() (*http.Response, error) {
@ -152,14 +157,12 @@ Delete a key from the cluster. Its access will be removed from all the buckets.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param accessKey The exact API access key generated by Garage
@return ApiDeleteKeyRequest
*/
func (a *KeyApiService) DeleteKey(ctx context.Context, accessKey string) ApiDeleteKeyRequest {
func (a *KeyApiService) DeleteKey(ctx context.Context) ApiDeleteKeyRequest {
return ApiDeleteKeyRequest{
ApiService: a,
ctx: ctx,
accessKey: accessKey,
}
}
@ -176,13 +179,16 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarPath := localBasePath + "/key"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return nil, reportError("id is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -231,7 +237,27 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
type ApiGetKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
accessKey string
id *string
search *string
showSecretKey *string
}
// The exact API access key generated by Garage. Incompatible with `search`.
func (r ApiGetKeyRequest) Id(id string) ApiGetKeyRequest {
r.id = &id
return r
}
// A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`.
func (r ApiGetKeyRequest) Search(search string) ApiGetKeyRequest {
r.search = &search
return r
}
// Wether or not the secret key should be returned in the response
func (r ApiGetKeyRequest) ShowSecretKey(showSecretKey string) ApiGetKeyRequest {
r.showSecretKey = &showSecretKey
return r
}
func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
@ -241,18 +267,19 @@ func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
/*
GetKey Get key information
Return information about a specific key and return its information
Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions.
You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`).
For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param accessKey The exact API access key generated by Garage
@return ApiGetKeyRequest
*/
func (a *KeyApiService) GetKey(ctx context.Context, accessKey string) ApiGetKeyRequest {
func (a *KeyApiService) GetKey(ctx context.Context) ApiGetKeyRequest {
return ApiGetKeyRequest{
ApiService: a,
ctx: ctx,
accessKey: accessKey,
}
}
@ -271,13 +298,21 @@ func (a *KeyApiService) GetKeyExecute(r ApiGetKeyRequest) (*KeyInfo, *http.Respo
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarPath := localBasePath + "/key"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id != nil {
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
}
if r.search != nil {
localVarQueryParams.Add("search", parameterToString(*r.search, ""))
}
if r.showSecretKey != nil {
localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -486,111 +521,7 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiSearchKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
pattern string
}
func (r ApiSearchKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
return r.ApiService.SearchKeyExecute(r)
}
/*
SearchKey Select key by pattern
Find the first key matching the given pattern based on its identifier aor friendly name and return its information.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param pattern A pattern (beginning or full string) corresponding to a key identifier or friendly name
@return ApiSearchKeyRequest
*/
func (a *KeyApiService) SearchKey(ctx context.Context, pattern string) ApiSearchKeyRequest {
return ApiSearchKeyRequest{
ApiService: a,
ctx: ctx,
pattern: pattern,
}
}
// Execute executes the request
// @return KeyInfo
func (a *KeyApiService) SearchKeyExecute(r ApiSearchKeyRequest) (*KeyInfo, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KeyInfo
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KeyApiService.SearchKey")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?search={pattern}"
localVarPath = strings.Replace(localVarPath, "{"+"pattern"+"}", url.PathEscape(parameterToString(r.pattern, "")), -1)
localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -653,10 +584,16 @@ func (a *KeyApiService) SearchKeyExecute(r ApiSearchKeyRequest) (*KeyInfo, *http
type ApiUpdateKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
accessKey string
id *string
updateKeyRequest *UpdateKeyRequest
}
// The exact API access key generated by Garage
func (r ApiUpdateKeyRequest) Id(id string) ApiUpdateKeyRequest {
r.id = &id
return r
}
// For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
func (r ApiUpdateKeyRequest) UpdateKeyRequest(updateKeyRequest UpdateKeyRequest) ApiUpdateKeyRequest {
r.updateKeyRequest = &updateKeyRequest
@ -672,16 +609,16 @@ UpdateKey Update a key
Updates information about the specified API access key.
*Note: the secret key is not returned in the response, `null` is sent instead.*
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param accessKey The exact API access key generated by Garage
@return ApiUpdateKeyRequest
*/
func (a *KeyApiService) UpdateKey(ctx context.Context, accessKey string) ApiUpdateKeyRequest {
func (a *KeyApiService) UpdateKey(ctx context.Context) ApiUpdateKeyRequest {
return ApiUpdateKeyRequest{
ApiService: a,
ctx: ctx,
accessKey: accessKey,
}
}
@ -700,16 +637,19 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarPath := localBasePath + "/key"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return localVarReturnValue, nil, reportError("id is required and must be specified")
}
if r.updateKeyRequest == nil {
return localVarReturnValue, nil, reportError("updateKeyRequest is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -25,16 +25,16 @@ type LayoutApiService service
type ApiAddLayoutRequest struct {
ctx context.Context
ApiService *LayoutApiService
requestBody *map[string]NodeClusterInfo
nodeRoleChange *[]NodeRoleChange
}
// To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
func (r ApiAddLayoutRequest) RequestBody(requestBody map[string]NodeClusterInfo) ApiAddLayoutRequest {
r.requestBody = &requestBody
// To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`). To remove a node, simply pass the `remove: true` field. This logic is represented in OpenAPI with a \"One Of\" object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
func (r ApiAddLayoutRequest) NodeRoleChange(nodeRoleChange []NodeRoleChange) ApiAddLayoutRequest {
r.nodeRoleChange = &nodeRoleChange
return r
}
func (r ApiAddLayoutRequest) Execute() (*http.Response, error) {
func (r ApiAddLayoutRequest) Execute() (*ClusterLayout, *http.Response, error) {
return r.ApiService.AddLayoutExecute(r)
}
@ -42,7 +42,12 @@ func (r ApiAddLayoutRequest) Execute() (*http.Response, error) {
AddLayout Send modifications to the cluster layout
Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /layout`. Once the set of staged changes is satisfactory, the user may call `POST /layout/apply` to apply the changed changes, or `POST /layout/revert` to clear all of the staged changes in the layout.
Note that setting the capacity to `null` will configure the node as a gateway.
Setting the capacity to `null` will configure the node as a gateway.
Otherwise, capacity must be now set in bytes (before Garage 0.9 it was arbitrary weights).
For example to declare 100GB, you must set `capacity: 100000000000`.
Garage uses internally the International System of Units (SI), it assumes that 1kB = 1000 bytes, and displays storage as kB, MB, GB (and not KiB, MiB, GiB that assume 1KiB = 1024 bytes).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@ -56,16 +61,18 @@ func (a *LayoutApiService) AddLayout(ctx context.Context) ApiAddLayoutRequest {
}
// Execute executes the request
func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*http.Response, error) {
// @return ClusterLayout
func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*ClusterLayout, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ClusterLayout
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LayoutApiService.AddLayout")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/layout"
@ -73,8 +80,8 @@ func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*http.Respon
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.requestBody == nil {
return nil, reportError("requestBody is required and must be specified")
if r.nodeRoleChange == nil {
return localVarReturnValue, nil, reportError("nodeRoleChange is required and must be specified")
}
// to determine the Content-Type header
@ -87,7 +94,7 @@ func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*http.Respon
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -95,22 +102,22 @@ func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*http.Respon
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.requestBody
localVarPostBody = r.nodeRoleChange
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -118,10 +125,19 @@ func (a *LayoutApiService) AddLayoutExecute(r ApiAddLayoutRequest) (*http.Respon
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiApplyLayoutRequest struct {
@ -136,7 +152,7 @@ func (r ApiApplyLayoutRequest) LayoutVersion(layoutVersion LayoutVersion) ApiApp
return r
}
func (r ApiApplyLayoutRequest) Execute() (*http.Response, error) {
func (r ApiApplyLayoutRequest) Execute() (*ApplyLayout200Response, *http.Response, error) {
return r.ApiService.ApplyLayoutExecute(r)
}
@ -145,6 +161,8 @@ ApplyLayout Apply staged layout
Applies to the cluster the layout changes currently registered as staged layout changes.
*Note: do not try to parse the `message` field of the response, it is given as an array of string specifically because its format is not stable.*
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiApplyLayoutRequest
@ -157,16 +175,18 @@ func (a *LayoutApiService) ApplyLayout(ctx context.Context) ApiApplyLayoutReques
}
// Execute executes the request
func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*http.Response, error) {
// @return ApplyLayout200Response
func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*ApplyLayout200Response, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ApplyLayout200Response
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LayoutApiService.ApplyLayout")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/layout/apply"
@ -175,7 +195,7 @@ func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*http.Re
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.layoutVersion == nil {
return nil, reportError("layoutVersion is required and must be specified")
return localVarReturnValue, nil, reportError("layoutVersion is required and must be specified")
}
// to determine the Content-Type header
@ -188,7 +208,7 @@ func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*http.Re
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -199,19 +219,19 @@ func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*http.Re
localVarPostBody = r.layoutVersion
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -219,10 +239,19 @@ func (a *LayoutApiService) ApplyLayoutExecute(r ApiApplyLayoutRequest) (*http.Re
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetLayoutRequest struct {
@ -241,6 +270,7 @@ Returns the cluster's current layout, including:
- Currently configured cluster layout
- Staged changes to the cluster layout
*Capacity is given in bytes*
*The info returned by this endpoint is a subset of the info returned by `GET /status`.*

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -38,7 +38,7 @@ func (r ApiAddNodeRequest) Execute() ([]AddNode200ResponseInner, *http.Response,
}
/*
AddNode Connect target node to other Garage nodes
AddNode Connect a new node
Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
@ -133,6 +133,106 @@ func (a *NodesApiService) AddNodeExecute(r ApiAddNodeRequest) ([]AddNode200Respo
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetHealthRequest struct {
ctx context.Context
ApiService *NodesApiService
}
func (r ApiGetHealthRequest) Execute() (*GetHealth200Response, *http.Response, error) {
return r.ApiService.GetHealthExecute(r)
}
/*
GetHealth Cluster health report
Returns the global status of the cluster, the number of connected nodes (over the number of known ones), the number of healthy storage nodes (over the declared ones), and the number of healthy partitions (over the total).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetHealthRequest
*/
func (a *NodesApiService) GetHealth(ctx context.Context) ApiGetHealthRequest {
return ApiGetHealthRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return GetHealth200Response
func (a *NodesApiService) GetHealthExecute(r ApiGetHealthRequest) (*GetHealth200Response, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *GetHealth200Response
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodesApiService.GetHealth")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/health"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetNodesRequest struct {
ctx context.Context
ApiService *NodesApiService
@ -143,7 +243,7 @@ func (r ApiGetNodesRequest) Execute() (*GetNodes200Response, *http.Response, err
}
/*
GetNodes Status of this node and other nodes in the cluster
GetNodes Describe cluster
Returns the cluster's current status, including:
- ID of the node being queried and its version of the Garage daemon
@ -151,6 +251,8 @@ Returns the cluster's current status, including:
- Currently configured cluster layout
- Staged changes to the cluster layout
*Capacity is given in bytes*
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetNodesRequest

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -41,7 +41,7 @@ var (
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
)
// APIClient manages communication with the Garage Administration API v0+garage-v0.8.0 API vv0.8.0
// APIClient manages communication with the Garage Administration API v0+garage-v0.9.0 API vv0.9.0
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration

View file

@ -1,9 +1,9 @@
/*
Garage Administration API v0+garage-v0.8.0
Garage Administration API v0+garage-v0.9.0
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!*
API version: v0.8.0
API version: v0.9.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
@ -101,11 +101,11 @@ type Configuration struct {
func NewConfiguration() *Configuration {
cfg := &Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/0.8.0/go",
UserAgent: "OpenAPI-Generator/0.9.0/go",
Debug: false,
Servers: ServerConfigurations{
{
URL: "http://localhost:3903/v0",
URL: "http://localhost:3903/v1",
Description: "A local server",
},
},

View file

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **NullableString** | | [optional]
## Methods
@ -50,6 +50,16 @@ SetName sets Name field to given value.
HasName returns a boolean if a field has been set.
### SetNameNil
`func (o *AddKeyRequest) SetNameNil(b bool)`
SetNameNil sets the value for Name to be an explicit nil
### UnsetName
`func (o *AddKeyRequest) UnsetName()`
UnsetName ensures that no value is present for Name, not even an explicit nil
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,72 @@
# ApplyLayout200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Message** | **[]string** | |
**Layout** | [**ClusterLayout**](ClusterLayout.md) | |
## Methods
### NewApplyLayout200Response
`func NewApplyLayout200Response(message []string, layout ClusterLayout, ) *ApplyLayout200Response`
NewApplyLayout200Response instantiates a new ApplyLayout200Response object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewApplyLayout200ResponseWithDefaults
`func NewApplyLayout200ResponseWithDefaults() *ApplyLayout200Response`
NewApplyLayout200ResponseWithDefaults instantiates a new ApplyLayout200Response object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetMessage
`func (o *ApplyLayout200Response) GetMessage() []string`