From bdb4b9b29f5bef65fe7e700baa61d60aa9ee7294 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 22 Nov 2023 18:28:14 +0100 Subject: [PATCH 1/8] api-v1, initial commit --- .openapi-generator/FILES | 8 + README.md | 8 +- api/openapi.yaml | 440 +++++++++++++----- api_bucket.go | 6 +- api_key.go | 36 +- api_layout.go | 88 ++-- api_nodes.go | 6 +- client.go | 6 +- configuration.go | 6 +- docs/AddKeyRequest.md | 12 +- docs/ApplyLayout200Response.md | 72 +++ docs/BucketApi.md | 2 +- docs/ClusterLayout.md | 18 +- docs/GetNodes200Response.md | 73 ++- docs/ImportKeyRequest.md | 14 +- docs/KeyApi.md | 18 +- docs/KeyInfo.md | 12 +- docs/LayoutApi.md | 24 +- docs/NodeClusterInfo.md | 9 +- docs/NodeNetworkInfo.md | 26 ++ docs/NodeRoleChange.md | 150 ++++++ docs/NodeRoleRemove.md | 77 +++ docs/NodeRoleUpdate.md | 129 +++++ docs/NodesApi.md | 2 +- model_add_key_request.go | 36 +- model_add_node_200_response_inner.go | 4 +- model_allow_bucket_key_request.go | 4 +- model_allow_bucket_key_request_permissions.go | 4 +- model_apply_layout_200_response.go | 137 ++++++ model_bucket_info.go | 4 +- model_bucket_info_quotas.go | 4 +- model_bucket_info_website_config.go | 4 +- model_bucket_key_info.go | 4 +- model_cluster_layout.go | 30 +- model_create_bucket_request.go | 4 +- model_create_bucket_request_local_alias.go | 4 +- ...create_bucket_request_local_alias_allow.go | 4 +- model_get_nodes_200_response.go | 107 ++++- model_import_key_request.go | 20 +- model_key_info.go | 36 +- model_key_info_buckets_inner.go | 4 +- model_key_info_buckets_inner_permissions.go | 4 +- model_key_info_permissions.go | 4 +- model_layout_version.go | 4 +- model_list_buckets_200_response_inner.go | 4 +- ..._200_response_inner_local_aliases_inner.go | 4 +- model_list_keys_200_response_inner.go | 4 +- model_node_cluster_info.go | 37 +- model_node_network_info.go | 48 +- model_node_role_change.go | 148 ++++++ model_node_role_remove.go | 144 ++++++ model_node_role_update.go | 204 ++++++++ model_update_bucket_request.go | 4 +- model_update_bucket_request_quotas.go | 4 +- model_update_bucket_request_website_access.go | 4 +- model_update_key_request.go | 4 +- model_update_key_request_allow.go | 4 +- model_update_key_request_deny.go | 4 +- response.go | 4 +- utils.go | 4 +- 60 files changed, 1955 insertions(+), 334 deletions(-) create mode 100644 docs/ApplyLayout200Response.md create mode 100644 docs/NodeRoleChange.md create mode 100644 docs/NodeRoleRemove.md create mode 100644 docs/NodeRoleUpdate.md create mode 100644 model_apply_layout_200_response.go create mode 100644 model_node_role_change.go create mode 100644 model_node_role_remove.go create mode 100644 model_node_role_update.go diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index e7ad1c0..3ae0bd9 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -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 @@ -35,6 +36,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 +53,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 @@ -69,6 +74,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 diff --git a/README.md b/README.md index 98d53a5..cc3f11d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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 +- API version: v0.9.0 - Package version: 0.8.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen @@ -77,7 +77,7 @@ 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 ------------ | ------------- | ------------- | ------------- @@ -114,6 +114,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) @@ -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) diff --git a/api/openapi.yaml b/api/openapi.yaml index c4bb16f..e44e49a 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -4,11 +4,11 @@ info: 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!* - title: Garage Administration API v0+garage-v0.8.0 - version: v0.8.0 + title: Garage Administration API v0+garage-v0.9.0 + version: v0.9.0 servers: - description: A local server - url: http://localhost:3903/v0/ + url: http://localhost:3903/v1/ security: - bearerAuth: [] paths: @@ -20,6 +20,8 @@ paths: - Live nodes - Currently configured cluster layout - Staged changes to the cluster layout + + *Capacity is given in bytes* operationId: GetNodes responses: "500": @@ -79,8 +81,8 @@ paths: get: description: "Returns the cluster's current layout, including:\n - Currently\ \ configured cluster layout\n - Staged changes to the cluster layout\n \n\ - *The info returned by this endpoint is a subset of the info returned by `GET\ - \ /status`.*\n" + *Capacity is given in bytes*\n*The info returned by this endpoint is a subset\ + \ of the info returned by `GET /status`.*\n" operationId: GetLayout responses: "500": @@ -101,25 +103,32 @@ paths: post: description: | 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). operationId: AddLayout requestBody: content: application/json: schema: - additionalProperties: - $ref: '#/components/schemas/NodeClusterInfo' example: - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - zone: geneva - capacity: 4 - tags: - - gateway - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": null - type: object + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + zone: geneva + capacity: 100000000000 + tags: + - gateway + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + remove: true + items: + $ref: '#/components/schemas/NodeRoleChange' + type: array description: | - 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. + 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. required: true @@ -130,6 +139,10 @@ paths: "400": description: Invalid syntax or requested change "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ClusterLayout' description: The layout modification has been correctly staged summary: Send modifications to the cluster layout tags: @@ -138,6 +151,8 @@ paths: post: description: | 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.* operationId: ApplyLayout requestBody: content: @@ -154,6 +169,10 @@ paths: "400": description: Invalid syntax or requested change "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApplyLayout_200_response' description: "The staged layout has been applied as the new layout of the\ \ cluster, a rebalance has been triggered." summary: Apply staged layout @@ -220,7 +239,10 @@ paths: schema: $ref: '#/components/schemas/AddKey_request' description: | - "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.* required: true responses: "500": @@ -263,8 +285,10 @@ paths: tags: - Key get: - description: | - Return information about a specific key and return its information + description: "Return information about a specific key like its identifiers,\ + \ its permissions and buckets on which it has permissions. \n\nFor confidentiality\ + \ reasons, the secret key is not returned by default: you must pass the `showSecretKey`\ + \ query parameter to get it.\n" operationId: GetKey parameters: - description: The exact API access key generated by Garage @@ -276,6 +300,16 @@ paths: schema: type: string style: simple + - description: Wether or not the secret key should be returned in the response + example: true + explode: true + in: query + name: showSecretKey + required: false + schema: + default: false + type: boolean + style: form responses: "500": description: The server can not handle your request. Check your connectivity @@ -293,6 +327,8 @@ paths: post: description: | Updates information about the specified API access key. + + *Note: the secret key is not returned in the response, `null` is sent instead.* operationId: UpdateKey parameters: - description: The exact API access key generated by Garage @@ -331,7 +367,9 @@ paths: /key?search={pattern}: get: description: | - Find the first key matching the given pattern based on its identifier aor friendly name and return its information. + Find the first key matching the given pattern based on its identifier or friendly name and return its information. + + For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. operationId: SearchKey parameters: - description: A pattern (beginning or full string) corresponding to a key identifier @@ -344,6 +382,16 @@ paths: schema: type: string style: simple + - description: Wether or not the secret key should be returned in the response + example: true + explode: true + in: query + name: showSecretKey + required: false + schema: + default: false + type: boolean + style: form responses: "500": description: The server can not handle your request. Check your connectivity @@ -519,7 +567,7 @@ paths: - Bucket put: description: | - 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. @@ -846,13 +894,16 @@ components: schemas: NodeNetworkInfo: properties: + id: + example: 6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f + type: string addr: example: 10.0.0.11:3901 type: string - is_up: + isUp: example: true type: boolean - last_seen_secs_ago: + lastSeenSecsAgo: example: 9 nullable: true type: integer @@ -862,16 +913,10 @@ components: required: - addr - hostname - - is_up - - last_seen_secs_ago + - isUp + - lastSeenSecsAgo type: object NodeClusterInfo: - example: - zone: dc1 - capacity: 4 - tags: - - gateway - - fast properties: zone: example: dc1 @@ -890,6 +935,45 @@ components: type: string type: array required: + - id + - tags + - zone + type: object + NodeRoleChange: + oneOf: + - $ref: '#/components/schemas/NodeRoleRemove' + - $ref: '#/components/schemas/NodeRoleUpdate' + NodeRoleRemove: + properties: + id: + example: 6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f + type: string + remove: + example: true + type: boolean + required: + - remove + type: object + NodeRoleUpdate: + properties: + id: + example: 6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f + type: string + zone: + example: dc1 + type: string + capacity: + example: 150000000000 + nullable: true + type: integer + tags: + example: + - gateway + - fast + items: + type: string + type: array + required: - capacity - tags - zone @@ -897,54 +981,58 @@ components: ClusterLayout: example: roles: - ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f: - zone: madrid - capacity: 3 - tags: - - fast - - amd64 - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": - zone: geneva - capacity: 7 - tags: - - arm64 + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + zone: madrid + capacity: 300000000000 + tags: + - fast + - amd64 + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + zone: geneva + capacity: 700000000000 + tags: + - arm64 stagedRoleChanges: - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - zone: geneva - capacity: 4 - tags: - - gateway + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + zone: geneva + capacity: 800000000000 + tags: + - gateway + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + remove: true version: 12 properties: version: example: 12 type: integer roles: - additionalProperties: - $ref: '#/components/schemas/NodeClusterInfo' example: - ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f: - zone: madrid - capacity: 3 - tags: - - fast - - amd64 - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": - zone: geneva - capacity: 7 - tags: - - arm64 - type: object + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + zone: madrid + capacity: 300000000000 + tags: + - fast + - amd64 + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + zone: geneva + capacity: 700000000000 + tags: + - arm64 + items: + $ref: '#/components/schemas/NodeClusterInfo' + type: array stagedRoleChanges: - additionalProperties: - $ref: '#/components/schemas/NodeClusterInfo' example: - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - zone: geneva - capacity: 4 - tags: - - gateway - type: object + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + zone: geneva + capacity: 800000000000 + tags: + - gateway + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + remove: true + items: + $ref: '#/components/schemas/NodeRoleChange' + type: array required: - roles - stagedRoleChanges @@ -997,6 +1085,7 @@ components: type: string secretAccessKey: example: b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835 + nullable: true type: string permissions: $ref: '#/components/schemas/KeyInfo_permissions' @@ -1100,76 +1189,113 @@ components: example: layout: roles: - ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f: - zone: madrid - capacity: 3 - tags: - - fast - - amd64 - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": - zone: geneva - capacity: 7 - tags: - - arm64 + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + zone: madrid + capacity: 300000000000 + tags: + - fast + - amd64 + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + zone: geneva + capacity: 700000000000 + tags: + - arm64 stagedRoleChanges: - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - zone: geneva - capacity: 4 - tags: - - gateway + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + zone: geneva + capacity: 800000000000 + tags: + - gateway + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + remove: true version: 12 node: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + dbEngine: LMDB (using Heed crate) + rustVersion: 1.68.0 knownNodes: - ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f: - addr: 10.0.0.11:3901 - is_up: true - last_seen_secs_ago: 9 - hostname: orion - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": - addr: 10.0.0.12:3901 - is_up: true - last_seen_secs_ago: 13 - hostname: pegasus - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - addr: 10.0.0.13:3901 - is_up: true - last_seen_secs_ago: 2 - hostname: neptune - garageVersion: v0.7.3 + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + addr: 10.0.0.11:3901 + isUp: true + lastSeenSecsAgo: 9 + hostname: orion + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + addr: 10.0.0.12:3901 + isUp: true + lastSeenSecsAgo: 13 + hostname: pegasus + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + addr: 10.0.0.13:3901 + isUp: true + lastSeenSecsAgo: 2 + hostname: neptune + garageFeatures: + - k2v + - sled + - lmdb + - sqlite + - consul-discovery + - kubernetes-discovery + - metrics + - telemetry-otlp + - bundled-libs + garageVersion: v0.9.0 properties: node: example: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f type: string garageVersion: - example: v0.7.3 + example: v0.9.0 + type: string + garageFeatures: + example: + - k2v + - sled + - lmdb + - sqlite + - consul-discovery + - kubernetes-discovery + - metrics + - telemetry-otlp + - bundled-libs + items: + type: string + type: array + rustVersion: + example: 1.68.0 + type: string + dbEngine: + example: LMDB (using Heed crate) type: string knownNodes: - additionalProperties: - $ref: '#/components/schemas/NodeNetworkInfo' example: - ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f: - addr: 10.0.0.11:3901 - is_up: true - last_seen_secs_ago: 9 - hostname: orion - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff": - addr: 10.0.0.12:3901 - is_up: true - last_seen_secs_ago: 13 - hostname: pegasus - e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b: - addr: 10.0.0.13:3901 - is_up: true - last_seen_secs_ago: 2 - hostname: neptune - type: object + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + addr: 10.0.0.11:3901 + isUp: true + lastSeenSecsAgo: 9 + hostname: orion + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + addr: 10.0.0.12:3901 + isUp: true + lastSeenSecsAgo: 13 + hostname: pegasus + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + addr: 10.0.0.13:3901 + isUp: true + lastSeenSecsAgo: 2 + hostname: neptune + items: + $ref: '#/components/schemas/NodeNetworkInfo' + type: array layout: $ref: '#/components/schemas/ClusterLayout' required: + - dbEngine + - garageFeatures - garageVersion - knownNodes - layout - node + - rustVersion type: object AddNode_200_response_inner: properties: @@ -1181,6 +1307,76 @@ components: type: string example: null type: object + ApplyLayout_200_response: + example: + layout: + roles: + - id: ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f + zone: madrid + capacity: 300000000000 + tags: + - fast + - amd64 + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + zone: geneva + capacity: 700000000000 + tags: + - arm64 + stagedRoleChanges: + - id: e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b + zone: geneva + capacity: 800000000000 + tags: + - gateway + - id: 4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff + remove: true + version: 12 + message: + - ==== COMPUTATION OF A NEW PARTITION ASSIGNATION ==== + - "" + - Partitions are replicated 1 times on at least 1 distinct zones. + - "" + - "Optimal partition size: 419.4 MB (3 B in previous layout)" + - "Usable capacity / total cluster capacity: 107.4 GB / 107.4 GB (100.0\ + \ %)" + - "Effective capacity (replication factor 1): 107.4 GB" + - "" + - A total of 0 new copies of partitions need to be transferred. + - "" + - |+ + dc1 Tags Partitions Capacity Usable capacity + 6a8e08af2aab1083 a,v 256 (0 new) 107.4 GB 107.4 GB (100.0%) + TOTAL 256 (256 unique) 107.4 GB 107.4 GB (100.0%) + + properties: + message: + example: + - ==== COMPUTATION OF A NEW PARTITION ASSIGNATION ==== + - "" + - Partitions are replicated 1 times on at least 1 distinct zones. + - "" + - "Optimal partition size: 419.4 MB (3 B in previous\ + \ layout)" + - "Usable capacity / total cluster capacity: 107.4 GB / 107.4 GB (100.0\ + \ %)" + - "Effective capacity (replication factor 1): 107.4 GB" + - "" + - A total of 0 new copies of partitions need to be transferred. + - "" + - |+ + dc1 Tags Partitions Capacity Usable capacity + 6a8e08af2aab1083 a,v 256 (0 new) 107.4 GB 107.4 GB (100.0%) + TOTAL 256 (256 unique) 107.4 GB 107.4 GB (100.0%) + + items: + type: string + type: array + layout: + $ref: '#/components/schemas/ClusterLayout' + required: + - layout + - message + type: object ListKeys_200_response_inner: properties: id: @@ -1194,6 +1390,7 @@ components: properties: name: example: test-key + nullable: true type: string type: object UpdateKey_request_allow: @@ -1223,6 +1420,7 @@ components: properties: name: example: test-key + nullable: true type: string accessKeyId: example: GK31c2f218a2e44f485b94239e diff --git a/api_bucket.go b/api_bucket.go index 91ba87d..333e9f7 100644 --- a/api_bucket.go +++ b/api_bucket.go @@ -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. @@ -1302,7 +1302,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. diff --git a/api_key.go b/api_key.go index 902eaf2..0241848 100644 --- a/api_key.go +++ b/api_key.go @@ -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. @@ -29,7 +29,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 @@ -232,6 +232,13 @@ type ApiGetKeyRequest struct { ctx context.Context ApiService *KeyApiService accessKey string + showSecretKey *bool +} + +// Wether or not the secret key should be returned in the response +func (r ApiGetKeyRequest) ShowSecretKey(showSecretKey bool) ApiGetKeyRequest { + r.showSecretKey = &showSecretKey + return r } func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) { @@ -241,7 +248,9 @@ 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. + +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(). @@ -278,6 +287,9 @@ func (a *KeyApiService) GetKeyExecute(r ApiGetKeyRequest) (*KeyInfo, *http.Respo localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.showSecretKey != nil { + localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -550,6 +562,13 @@ type ApiSearchKeyRequest struct { ctx context.Context ApiService *KeyApiService pattern string + showSecretKey *bool +} + +// Wether or not the secret key should be returned in the response +func (r ApiSearchKeyRequest) ShowSecretKey(showSecretKey bool) ApiSearchKeyRequest { + r.showSecretKey = &showSecretKey + return r } func (r ApiSearchKeyRequest) Execute() (*KeyInfo, *http.Response, error) { @@ -559,7 +578,9 @@ func (r ApiSearchKeyRequest) Execute() (*KeyInfo, *http.Response, error) { /* SearchKey Select key by pattern -Find the first key matching the given pattern based on its identifier aor friendly name and return its information. +Find the first key matching the given pattern based on its identifier or friendly name and return its information. + +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(). @@ -596,6 +617,9 @@ func (a *KeyApiService) SearchKeyExecute(r ApiSearchKeyRequest) (*KeyInfo, *http localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.showSecretKey != nil { + localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -672,6 +696,8 @@ 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 diff --git a/api_layout.go b/api_layout.go index aa8d772..6e6f572 100644 --- a/api_layout.go +++ b/api_layout.go @@ -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`.* diff --git a/api_nodes.go b/api_nodes.go index a534a62..6d1bdfa 100644 --- a/api_nodes.go +++ b/api_nodes.go @@ -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. @@ -151,6 +151,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 diff --git a/client.go b/client.go index def2d91..6b72dd3 100644 --- a/client.go +++ b/client.go @@ -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 diff --git a/configuration.go b/configuration.go index e800b86..c7d19ac 100644 --- a/configuration.go +++ b/configuration.go @@ -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. @@ -105,7 +105,7 @@ func NewConfiguration() *Configuration { Debug: false, Servers: ServerConfigurations{ { - URL: "http://localhost:3903/v0", + URL: "http://localhost:3903/v1", Description: "A local server", }, }, diff --git a/docs/AddKeyRequest.md b/docs/AddKeyRequest.md index f56099e..0195b7d 100644 --- a/docs/AddKeyRequest.md +++ b/docs/AddKeyRequest.md @@ -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) diff --git a/docs/ApplyLayout200Response.md b/docs/ApplyLayout200Response.md new file mode 100644 index 0000000..d1b4a1b --- /dev/null +++ b/docs/ApplyLayout200Response.md @@ -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` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ApplyLayout200Response) GetMessageOk() (*[]string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ApplyLayout200Response) SetMessage(v []string)` + +SetMessage sets Message field to given value. + + +### GetLayout + +`func (o *ApplyLayout200Response) GetLayout() ClusterLayout` + +GetLayout returns the Layout field if non-nil, zero value otherwise. + +### GetLayoutOk + +`func (o *ApplyLayout200Response) GetLayoutOk() (*ClusterLayout, bool)` + +GetLayoutOk returns a tuple with the Layout field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLayout + +`func (o *ApplyLayout200Response) SetLayout(v ClusterLayout)` + +SetLayout sets Layout field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BucketApi.md b/docs/BucketApi.md index 37aabac..3991fc6 100644 --- a/docs/BucketApi.md +++ b/docs/BucketApi.md @@ -1,6 +1,6 @@ # \BucketApi -All URIs are relative to *http://localhost:3903/v0* +All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/ClusterLayout.md b/docs/ClusterLayout.md index 777d8fb..aca67db 100644 --- a/docs/ClusterLayout.md +++ b/docs/ClusterLayout.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Version** | **int32** | | -**Roles** | [**map[string]NodeClusterInfo**](NodeClusterInfo.md) | | -**StagedRoleChanges** | [**map[string]NodeClusterInfo**](NodeClusterInfo.md) | | +**Roles** | [**[]NodeClusterInfo**](NodeClusterInfo.md) | | +**StagedRoleChanges** | [**[]NodeRoleChange**](NodeRoleChange.md) | | ## Methods ### NewClusterLayout -`func NewClusterLayout(version int32, roles map[string]NodeClusterInfo, stagedRoleChanges map[string]NodeClusterInfo, ) *ClusterLayout` +`func NewClusterLayout(version int32, roles []NodeClusterInfo, stagedRoleChanges []NodeRoleChange, ) *ClusterLayout` NewClusterLayout instantiates a new ClusterLayout object This constructor will assign default values to properties that have it defined, @@ -49,40 +49,40 @@ SetVersion sets Version field to given value. ### GetRoles -`func (o *ClusterLayout) GetRoles() map[string]NodeClusterInfo` +`func (o *ClusterLayout) GetRoles() []NodeClusterInfo` GetRoles returns the Roles field if non-nil, zero value otherwise. ### GetRolesOk -`func (o *ClusterLayout) GetRolesOk() (*map[string]NodeClusterInfo, bool)` +`func (o *ClusterLayout) GetRolesOk() (*[]NodeClusterInfo, bool)` GetRolesOk returns a tuple with the Roles field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRoles -`func (o *ClusterLayout) SetRoles(v map[string]NodeClusterInfo)` +`func (o *ClusterLayout) SetRoles(v []NodeClusterInfo)` SetRoles sets Roles field to given value. ### GetStagedRoleChanges -`func (o *ClusterLayout) GetStagedRoleChanges() map[string]NodeClusterInfo` +`func (o *ClusterLayout) GetStagedRoleChanges() []NodeRoleChange` GetStagedRoleChanges returns the StagedRoleChanges field if non-nil, zero value otherwise. ### GetStagedRoleChangesOk -`func (o *ClusterLayout) GetStagedRoleChangesOk() (*map[string]NodeClusterInfo, bool)` +`func (o *ClusterLayout) GetStagedRoleChangesOk() (*[]NodeRoleChange, bool)` GetStagedRoleChangesOk returns a tuple with the StagedRoleChanges field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetStagedRoleChanges -`func (o *ClusterLayout) SetStagedRoleChanges(v map[string]NodeClusterInfo)` +`func (o *ClusterLayout) SetStagedRoleChanges(v []NodeRoleChange)` SetStagedRoleChanges sets StagedRoleChanges field to given value. diff --git a/docs/GetNodes200Response.md b/docs/GetNodes200Response.md index e389cc8..f1cc603 100644 --- a/docs/GetNodes200Response.md +++ b/docs/GetNodes200Response.md @@ -6,14 +6,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Node** | **string** | | **GarageVersion** | **string** | | -**KnownNodes** | [**map[string]NodeNetworkInfo**](NodeNetworkInfo.md) | | +**GarageFeatures** | **[]string** | | +**RustVersion** | **string** | | +**DbEngine** | **string** | | +**KnownNodes** | [**[]NodeNetworkInfo**](NodeNetworkInfo.md) | | **Layout** | [**ClusterLayout**](ClusterLayout.md) | | ## Methods ### NewGetNodes200Response -`func NewGetNodes200Response(node string, garageVersion string, knownNodes map[string]NodeNetworkInfo, layout ClusterLayout, ) *GetNodes200Response` +`func NewGetNodes200Response(node string, garageVersion string, garageFeatures []string, rustVersion string, dbEngine string, knownNodes []NodeNetworkInfo, layout ClusterLayout, ) *GetNodes200Response` NewGetNodes200Response instantiates a new GetNodes200Response object This constructor will assign default values to properties that have it defined, @@ -68,22 +71,82 @@ and a boolean to check if the value has been set. SetGarageVersion sets GarageVersion field to given value. +### GetGarageFeatures + +`func (o *GetNodes200Response) GetGarageFeatures() []string` + +GetGarageFeatures returns the GarageFeatures field if non-nil, zero value otherwise. + +### GetGarageFeaturesOk + +`func (o *GetNodes200Response) GetGarageFeaturesOk() (*[]string, bool)` + +GetGarageFeaturesOk returns a tuple with the GarageFeatures field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGarageFeatures + +`func (o *GetNodes200Response) SetGarageFeatures(v []string)` + +SetGarageFeatures sets GarageFeatures field to given value. + + +### GetRustVersion + +`func (o *GetNodes200Response) GetRustVersion() string` + +GetRustVersion returns the RustVersion field if non-nil, zero value otherwise. + +### GetRustVersionOk + +`func (o *GetNodes200Response) GetRustVersionOk() (*string, bool)` + +GetRustVersionOk returns a tuple with the RustVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRustVersion + +`func (o *GetNodes200Response) SetRustVersion(v string)` + +SetRustVersion sets RustVersion field to given value. + + +### GetDbEngine + +`func (o *GetNodes200Response) GetDbEngine() string` + +GetDbEngine returns the DbEngine field if non-nil, zero value otherwise. + +### GetDbEngineOk + +`func (o *GetNodes200Response) GetDbEngineOk() (*string, bool)` + +GetDbEngineOk returns a tuple with the DbEngine field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDbEngine + +`func (o *GetNodes200Response) SetDbEngine(v string)` + +SetDbEngine sets DbEngine field to given value. + + ### GetKnownNodes -`func (o *GetNodes200Response) GetKnownNodes() map[string]NodeNetworkInfo` +`func (o *GetNodes200Response) GetKnownNodes() []NodeNetworkInfo` GetKnownNodes returns the KnownNodes field if non-nil, zero value otherwise. ### GetKnownNodesOk -`func (o *GetNodes200Response) GetKnownNodesOk() (*map[string]NodeNetworkInfo, bool)` +`func (o *GetNodes200Response) GetKnownNodesOk() (*[]NodeNetworkInfo, bool)` GetKnownNodesOk returns a tuple with the KnownNodes field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetKnownNodes -`func (o *GetNodes200Response) SetKnownNodes(v map[string]NodeNetworkInfo)` +`func (o *GetNodes200Response) SetKnownNodes(v []NodeNetworkInfo)` SetKnownNodes sets KnownNodes field to given value. diff --git a/docs/ImportKeyRequest.md b/docs/ImportKeyRequest.md index fa051ee..4713c59 100644 --- a/docs/ImportKeyRequest.md +++ b/docs/ImportKeyRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | +**Name** | **NullableString** | | **AccessKeyId** | **string** | | **SecretAccessKey** | **string** | | @@ -12,7 +12,7 @@ Name | Type | Description | Notes ### NewImportKeyRequest -`func NewImportKeyRequest(name string, accessKeyId string, secretAccessKey string, ) *ImportKeyRequest` +`func NewImportKeyRequest(name NullableString, accessKeyId string, secretAccessKey string, ) *ImportKeyRequest` NewImportKeyRequest instantiates a new ImportKeyRequest object This constructor will assign default values to properties that have it defined, @@ -47,6 +47,16 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. +### SetNameNil + +`func (o *ImportKeyRequest) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *ImportKeyRequest) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil ### GetAccessKeyId `func (o *ImportKeyRequest) GetAccessKeyId() string` diff --git a/docs/KeyApi.md b/docs/KeyApi.md index ea294df..4699776 100644 --- a/docs/KeyApi.md +++ b/docs/KeyApi.md @@ -1,6 +1,6 @@ # \KeyApi -All URIs are relative to *http://localhost:3903/v0* +All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -35,7 +35,7 @@ import ( ) func main() { - addKeyRequest := *openapiclient.NewAddKeyRequest() // AddKeyRequest | \"You can set a friendly name for this key, send an empty string instead\" + addKeyRequest := *openapiclient.NewAddKeyRequest() // AddKeyRequest | 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.* configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -60,7 +60,7 @@ Other parameters are passed through a pointer to a apiAddKeyRequest struct via t Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **addKeyRequest** | [**AddKeyRequest**](AddKeyRequest.md) | \"You can set a friendly name for this key, send an empty string instead\" | + **addKeyRequest** | [**AddKeyRequest**](AddKeyRequest.md) | 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.* | ### Return type @@ -150,7 +150,7 @@ Name | Type | Description | Notes ## GetKey -> KeyInfo GetKey(ctx, accessKey).Execute() +> KeyInfo GetKey(ctx, accessKey).ShowSecretKey(showSecretKey).Execute() Get key information @@ -170,10 +170,11 @@ import ( func main() { accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage + showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.GetKey(context.Background(), accessKey).Execute() + resp, r, err := apiClient.KeyApi.GetKey(context.Background(), accessKey).ShowSecretKey(showSecretKey).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.GetKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -199,6 +200,7 @@ Other parameters are passed through a pointer to a apiGetKeyRequest struct via t Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false] ### Return type @@ -347,7 +349,7 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via ## SearchKey -> KeyInfo SearchKey(ctx, pattern).Execute() +> KeyInfo SearchKey(ctx, pattern).ShowSecretKey(showSecretKey).Execute() Select key by pattern @@ -367,10 +369,11 @@ import ( func main() { pattern := "test-k" // string | A pattern (beginning or full string) corresponding to a key identifier or friendly name + showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.SearchKey(context.Background(), pattern).Execute() + resp, r, err := apiClient.KeyApi.SearchKey(context.Background(), pattern).ShowSecretKey(showSecretKey).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.SearchKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -396,6 +399,7 @@ Other parameters are passed through a pointer to a apiSearchKeyRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false] ### Return type diff --git a/docs/KeyInfo.md b/docs/KeyInfo.md index b76a236..3762b14 100644 --- a/docs/KeyInfo.md +++ b/docs/KeyInfo.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | Pointer to **string** | | [optional] **AccessKeyId** | Pointer to **string** | | [optional] -**SecretAccessKey** | Pointer to **string** | | [optional] +**SecretAccessKey** | Pointer to **NullableString** | | [optional] **Permissions** | Pointer to [**KeyInfoPermissions**](KeyInfoPermissions.md) | | [optional] **Buckets** | Pointer to [**[]KeyInfoBucketsInner**](KeyInfoBucketsInner.md) | | [optional] @@ -104,6 +104,16 @@ SetSecretAccessKey sets SecretAccessKey field to given value. HasSecretAccessKey returns a boolean if a field has been set. +### SetSecretAccessKeyNil + +`func (o *KeyInfo) SetSecretAccessKeyNil(b bool)` + + SetSecretAccessKeyNil sets the value for SecretAccessKey to be an explicit nil + +### UnsetSecretAccessKey +`func (o *KeyInfo) UnsetSecretAccessKey()` + +UnsetSecretAccessKey ensures that no value is present for SecretAccessKey, not even an explicit nil ### GetPermissions `func (o *KeyInfo) GetPermissions() KeyInfoPermissions` diff --git a/docs/LayoutApi.md b/docs/LayoutApi.md index 1ff16b5..3e7f13d 100644 --- a/docs/LayoutApi.md +++ b/docs/LayoutApi.md @@ -1,6 +1,6 @@ # \LayoutApi -All URIs are relative to *http://localhost:3903/v0* +All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,7 +13,7 @@ Method | HTTP request | Description ## AddLayout -> AddLayout(ctx).RequestBody(requestBody).Execute() +> ClusterLayout AddLayout(ctx).NodeRoleChange(nodeRoleChange).Execute() Send modifications to the cluster layout @@ -32,15 +32,17 @@ import ( ) func main() { - requestBody := map[string]NodeClusterInfo{"key": *openapiclient.NewNodeClusterInfo("dc1", NullableInt32(4), []string{"Tags_example"})} // map[string]NodeClusterInfo | 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. + nodeRoleChange := []openapiclient.NodeRoleChange{openapiclient.NodeRoleChange{NodeRoleRemove: openapiclient.NewNodeRoleRemove(true)}} // []NodeRoleChange | 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. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.LayoutApi.AddLayout(context.Background()).RequestBody(requestBody).Execute() + resp, r, err := apiClient.LayoutApi.AddLayout(context.Background()).NodeRoleChange(nodeRoleChange).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.AddLayout``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } + // response from `AddLayout`: ClusterLayout + fmt.Fprintf(os.Stdout, "Response from `LayoutApi.AddLayout`: %v\n", resp) } ``` @@ -55,11 +57,11 @@ Other parameters are passed through a pointer to a apiAddLayoutRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **requestBody** | [**map[string]NodeClusterInfo**](NodeClusterInfo.md) | 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. | + **nodeRoleChange** | [**[]NodeRoleChange**](NodeRoleChange.md) | 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. | ### Return type - (empty response body) +[**ClusterLayout**](ClusterLayout.md) ### Authorization @@ -68,7 +70,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json -- **Accept**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -77,7 +79,7 @@ Name | Type | Description | Notes ## ApplyLayout -> ApplyLayout(ctx).LayoutVersion(layoutVersion).Execute() +> ApplyLayout200Response ApplyLayout(ctx).LayoutVersion(layoutVersion).Execute() Apply staged layout @@ -105,6 +107,8 @@ func main() { fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.ApplyLayout``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } + // response from `ApplyLayout`: ApplyLayout200Response + fmt.Fprintf(os.Stdout, "Response from `LayoutApi.ApplyLayout`: %v\n", resp) } ``` @@ -123,7 +127,7 @@ Name | Type | Description | Notes ### Return type - (empty response body) +[**ApplyLayout200Response**](ApplyLayout200Response.md) ### Authorization @@ -132,7 +136,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json -- **Accept**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/docs/NodeClusterInfo.md b/docs/NodeClusterInfo.md index 4582c28..1a3b537 100644 --- a/docs/NodeClusterInfo.md +++ b/docs/NodeClusterInfo.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Zone** | **string** | | -**Capacity** | **NullableInt32** | | +**Capacity** | Pointer to **NullableInt32** | | [optional] **Tags** | **[]string** | User defined tags, put whatever makes sense for you, these tags are not interpreted by Garage | ## Methods ### NewNodeClusterInfo -`func NewNodeClusterInfo(zone string, capacity NullableInt32, tags []string, ) *NodeClusterInfo` +`func NewNodeClusterInfo(zone string, tags []string, ) *NodeClusterInfo` NewNodeClusterInfo instantiates a new NodeClusterInfo object This constructor will assign default values to properties that have it defined, @@ -66,6 +66,11 @@ and a boolean to check if the value has been set. SetCapacity sets Capacity field to given value. +### HasCapacity + +`func (o *NodeClusterInfo) HasCapacity() bool` + +HasCapacity returns a boolean if a field has been set. ### SetCapacityNil diff --git a/docs/NodeNetworkInfo.md b/docs/NodeNetworkInfo.md index 71a52df..554e08d 100644 --- a/docs/NodeNetworkInfo.md +++ b/docs/NodeNetworkInfo.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] **Addr** | **string** | | **IsUp** | **bool** | | **LastSeenSecsAgo** | **NullableInt32** | | @@ -28,6 +29,31 @@ NewNodeNetworkInfoWithDefaults instantiates a new NodeNetworkInfo 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 +### GetId + +`func (o *NodeNetworkInfo) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NodeNetworkInfo) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NodeNetworkInfo) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *NodeNetworkInfo) HasId() bool` + +HasId returns a boolean if a field has been set. + ### GetAddr `func (o *NodeNetworkInfo) GetAddr() string` diff --git a/docs/NodeRoleChange.md b/docs/NodeRoleChange.md new file mode 100644 index 0000000..5c6322f --- /dev/null +++ b/docs/NodeRoleChange.md @@ -0,0 +1,150 @@ +# NodeRoleChange + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Remove** | **bool** | | +**Zone** | **string** | | +**Capacity** | **NullableInt32** | | +**Tags** | **[]string** | | + +## Methods + +### NewNodeRoleChange + +`func NewNodeRoleChange(remove bool, zone string, capacity NullableInt32, tags []string, ) *NodeRoleChange` + +NewNodeRoleChange instantiates a new NodeRoleChange 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 + +### NewNodeRoleChangeWithDefaults + +`func NewNodeRoleChangeWithDefaults() *NodeRoleChange` + +NewNodeRoleChangeWithDefaults instantiates a new NodeRoleChange 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 + +### GetId + +`func (o *NodeRoleChange) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NodeRoleChange) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NodeRoleChange) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *NodeRoleChange) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetRemove + +`func (o *NodeRoleChange) GetRemove() bool` + +GetRemove returns the Remove field if non-nil, zero value otherwise. + +### GetRemoveOk + +`func (o *NodeRoleChange) GetRemoveOk() (*bool, bool)` + +GetRemoveOk returns a tuple with the Remove field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRemove + +`func (o *NodeRoleChange) SetRemove(v bool)` + +SetRemove sets Remove field to given value. + + +### GetZone + +`func (o *NodeRoleChange) GetZone() string` + +GetZone returns the Zone field if non-nil, zero value otherwise. + +### GetZoneOk + +`func (o *NodeRoleChange) GetZoneOk() (*string, bool)` + +GetZoneOk returns a tuple with the Zone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetZone + +`func (o *NodeRoleChange) SetZone(v string)` + +SetZone sets Zone field to given value. + + +### GetCapacity + +`func (o *NodeRoleChange) GetCapacity() int32` + +GetCapacity returns the Capacity field if non-nil, zero value otherwise. + +### GetCapacityOk + +`func (o *NodeRoleChange) GetCapacityOk() (*int32, bool)` + +GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapacity + +`func (o *NodeRoleChange) SetCapacity(v int32)` + +SetCapacity sets Capacity field to given value. + + +### SetCapacityNil + +`func (o *NodeRoleChange) SetCapacityNil(b bool)` + + SetCapacityNil sets the value for Capacity to be an explicit nil + +### UnsetCapacity +`func (o *NodeRoleChange) UnsetCapacity()` + +UnsetCapacity ensures that no value is present for Capacity, not even an explicit nil +### GetTags + +`func (o *NodeRoleChange) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *NodeRoleChange) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *NodeRoleChange) SetTags(v []string)` + +SetTags sets Tags field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NodeRoleRemove.md b/docs/NodeRoleRemove.md new file mode 100644 index 0000000..423b69c --- /dev/null +++ b/docs/NodeRoleRemove.md @@ -0,0 +1,77 @@ +# NodeRoleRemove + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Remove** | **bool** | | + +## Methods + +### NewNodeRoleRemove + +`func NewNodeRoleRemove(remove bool, ) *NodeRoleRemove` + +NewNodeRoleRemove instantiates a new NodeRoleRemove 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 + +### NewNodeRoleRemoveWithDefaults + +`func NewNodeRoleRemoveWithDefaults() *NodeRoleRemove` + +NewNodeRoleRemoveWithDefaults instantiates a new NodeRoleRemove 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 + +### GetId + +`func (o *NodeRoleRemove) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NodeRoleRemove) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NodeRoleRemove) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *NodeRoleRemove) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetRemove + +`func (o *NodeRoleRemove) GetRemove() bool` + +GetRemove returns the Remove field if non-nil, zero value otherwise. + +### GetRemoveOk + +`func (o *NodeRoleRemove) GetRemoveOk() (*bool, bool)` + +GetRemoveOk returns a tuple with the Remove field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRemove + +`func (o *NodeRoleRemove) SetRemove(v bool)` + +SetRemove sets Remove field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NodeRoleUpdate.md b/docs/NodeRoleUpdate.md new file mode 100644 index 0000000..9e73fa1 --- /dev/null +++ b/docs/NodeRoleUpdate.md @@ -0,0 +1,129 @@ +# NodeRoleUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Zone** | **string** | | +**Capacity** | **NullableInt32** | | +**Tags** | **[]string** | | + +## Methods + +### NewNodeRoleUpdate + +`func NewNodeRoleUpdate(zone string, capacity NullableInt32, tags []string, ) *NodeRoleUpdate` + +NewNodeRoleUpdate instantiates a new NodeRoleUpdate 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 + +### NewNodeRoleUpdateWithDefaults + +`func NewNodeRoleUpdateWithDefaults() *NodeRoleUpdate` + +NewNodeRoleUpdateWithDefaults instantiates a new NodeRoleUpdate 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 + +### GetId + +`func (o *NodeRoleUpdate) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NodeRoleUpdate) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NodeRoleUpdate) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *NodeRoleUpdate) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetZone + +`func (o *NodeRoleUpdate) GetZone() string` + +GetZone returns the Zone field if non-nil, zero value otherwise. + +### GetZoneOk + +`func (o *NodeRoleUpdate) GetZoneOk() (*string, bool)` + +GetZoneOk returns a tuple with the Zone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetZone + +`func (o *NodeRoleUpdate) SetZone(v string)` + +SetZone sets Zone field to given value. + + +### GetCapacity + +`func (o *NodeRoleUpdate) GetCapacity() int32` + +GetCapacity returns the Capacity field if non-nil, zero value otherwise. + +### GetCapacityOk + +`func (o *NodeRoleUpdate) GetCapacityOk() (*int32, bool)` + +GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapacity + +`func (o *NodeRoleUpdate) SetCapacity(v int32)` + +SetCapacity sets Capacity field to given value. + + +### SetCapacityNil + +`func (o *NodeRoleUpdate) SetCapacityNil(b bool)` + + SetCapacityNil sets the value for Capacity to be an explicit nil + +### UnsetCapacity +`func (o *NodeRoleUpdate) UnsetCapacity()` + +UnsetCapacity ensures that no value is present for Capacity, not even an explicit nil +### GetTags + +`func (o *NodeRoleUpdate) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *NodeRoleUpdate) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *NodeRoleUpdate) SetTags(v []string)` + +SetTags sets Tags field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NodesApi.md b/docs/NodesApi.md index 792b107..dc108b7 100644 --- a/docs/NodesApi.md +++ b/docs/NodesApi.md @@ -1,6 +1,6 @@ # \NodesApi -All URIs are relative to *http://localhost:3903/v0* +All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/model_add_key_request.go b/model_add_key_request.go index 5773c11..ec230f5 100644 --- a/model_add_key_request.go +++ b/model_add_key_request.go @@ -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,7 @@ import ( // AddKeyRequest struct for AddKeyRequest type AddKeyRequest struct { - Name *string `json:"name,omitempty"` + Name NullableString `json:"name,omitempty"` } // NewAddKeyRequest instantiates a new AddKeyRequest object @@ -36,42 +36,52 @@ func NewAddKeyRequestWithDefaults() *AddKeyRequest { return &this } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *AddKeyRequest) GetName() string { - if o == nil || o.Name == nil { + if o == nil || o.Name.Get() == nil { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *AddKeyRequest) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *AddKeyRequest) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *AddKeyRequest) SetName(v string) { - o.Name = &v + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *AddKeyRequest) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *AddKeyRequest) UnsetName() { + o.Name.Unset() } func (o AddKeyRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } return json.Marshal(toSerialize) } diff --git a/model_add_node_200_response_inner.go b/model_add_node_200_response_inner.go index 76fbbd8..ff053db 100644 --- a/model_add_node_200_response_inner.go +++ b/model_add_node_200_response_inner.go @@ -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. diff --git a/model_allow_bucket_key_request.go b/model_allow_bucket_key_request.go index 25d9941..754cf82 100644 --- a/model_allow_bucket_key_request.go +++ b/model_allow_bucket_key_request.go @@ -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. diff --git a/model_allow_bucket_key_request_permissions.go b/model_allow_bucket_key_request_permissions.go index 2b082ed..8526783 100644 --- a/model_allow_bucket_key_request_permissions.go +++ b/model_allow_bucket_key_request_permissions.go @@ -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. diff --git a/model_apply_layout_200_response.go b/model_apply_layout_200_response.go new file mode 100644 index 0000000..1581ba4 --- /dev/null +++ b/model_apply_layout_200_response.go @@ -0,0 +1,137 @@ +/* +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.9.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package garage + +import ( + "encoding/json" +) + +// ApplyLayout200Response struct for ApplyLayout200Response +type ApplyLayout200Response struct { + Message []string `json:"message"` + Layout ClusterLayout `json:"layout"` +} + +// 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 +func NewApplyLayout200Response(message []string, layout ClusterLayout) *ApplyLayout200Response { + this := ApplyLayout200Response{} + this.Message = message + this.Layout = layout + return &this +} + +// 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 +func NewApplyLayout200ResponseWithDefaults() *ApplyLayout200Response { + this := ApplyLayout200Response{} + return &this +} + +// GetMessage returns the Message field value +func (o *ApplyLayout200Response) GetMessage() []string { + if o == nil { + var ret []string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ApplyLayout200Response) GetMessageOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Message, true +} + +// SetMessage sets field value +func (o *ApplyLayout200Response) SetMessage(v []string) { + o.Message = v +} + +// GetLayout returns the Layout field value +func (o *ApplyLayout200Response) GetLayout() ClusterLayout { + if o == nil { + var ret ClusterLayout + return ret + } + + return o.Layout +} + +// GetLayoutOk returns a tuple with the Layout field value +// and a boolean to check if the value has been set. +func (o *ApplyLayout200Response) GetLayoutOk() (*ClusterLayout, bool) { + if o == nil { + return nil, false + } + return &o.Layout, true +} + +// SetLayout sets field value +func (o *ApplyLayout200Response) SetLayout(v ClusterLayout) { + o.Layout = v +} + +func (o ApplyLayout200Response) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["message"] = o.Message + } + if true { + toSerialize["layout"] = o.Layout + } + return json.Marshal(toSerialize) +} + +type NullableApplyLayout200Response struct { + value *ApplyLayout200Response + isSet bool +} + +func (v NullableApplyLayout200Response) Get() *ApplyLayout200Response { + return v.value +} + +func (v *NullableApplyLayout200Response) Set(val *ApplyLayout200Response) { + v.value = val + v.isSet = true +} + +func (v NullableApplyLayout200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableApplyLayout200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApplyLayout200Response(val *ApplyLayout200Response) *NullableApplyLayout200Response { + return &NullableApplyLayout200Response{value: val, isSet: true} +} + +func (v NullableApplyLayout200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApplyLayout200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_bucket_info.go b/model_bucket_info.go index 38e7649..94dbd82 100644 --- a/model_bucket_info.go +++ b/model_bucket_info.go @@ -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. diff --git a/model_bucket_info_quotas.go b/model_bucket_info_quotas.go index 9d32a2e..9e79c3b 100644 --- a/model_bucket_info_quotas.go +++ b/model_bucket_info_quotas.go @@ -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. diff --git a/model_bucket_info_website_config.go b/model_bucket_info_website_config.go index 21b1ace..742bf5d 100644 --- a/model_bucket_info_website_config.go +++ b/model_bucket_info_website_config.go @@ -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. diff --git a/model_bucket_key_info.go b/model_bucket_key_info.go index 74d5d38..bbb8ab4 100644 --- a/model_bucket_key_info.go +++ b/model_bucket_key_info.go @@ -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. diff --git a/model_cluster_layout.go b/model_cluster_layout.go index 4461b15..c9d583a 100644 --- a/model_cluster_layout.go +++ b/model_cluster_layout.go @@ -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. @@ -17,15 +17,15 @@ import ( // ClusterLayout struct for ClusterLayout type ClusterLayout struct { Version int32 `json:"version"` - Roles map[string]NodeClusterInfo `json:"roles"` - StagedRoleChanges map[string]NodeClusterInfo `json:"stagedRoleChanges"` + Roles []NodeClusterInfo `json:"roles"` + StagedRoleChanges []NodeRoleChange `json:"stagedRoleChanges"` } // NewClusterLayout instantiates a new ClusterLayout 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 -func NewClusterLayout(version int32, roles map[string]NodeClusterInfo, stagedRoleChanges map[string]NodeClusterInfo) *ClusterLayout { +func NewClusterLayout(version int32, roles []NodeClusterInfo, stagedRoleChanges []NodeRoleChange) *ClusterLayout { this := ClusterLayout{} this.Version = version this.Roles = roles @@ -66,9 +66,9 @@ func (o *ClusterLayout) SetVersion(v int32) { } // GetRoles returns the Roles field value -func (o *ClusterLayout) GetRoles() map[string]NodeClusterInfo { +func (o *ClusterLayout) GetRoles() []NodeClusterInfo { if o == nil { - var ret map[string]NodeClusterInfo + var ret []NodeClusterInfo return ret } @@ -77,22 +77,22 @@ func (o *ClusterLayout) GetRoles() map[string]NodeClusterInfo { // GetRolesOk returns a tuple with the Roles field value // and a boolean to check if the value has been set. -func (o *ClusterLayout) GetRolesOk() (*map[string]NodeClusterInfo, bool) { +func (o *ClusterLayout) GetRolesOk() ([]NodeClusterInfo, bool) { if o == nil { return nil, false } - return &o.Roles, true + return o.Roles, true } // SetRoles sets field value -func (o *ClusterLayout) SetRoles(v map[string]NodeClusterInfo) { +func (o *ClusterLayout) SetRoles(v []NodeClusterInfo) { o.Roles = v } // GetStagedRoleChanges returns the StagedRoleChanges field value -func (o *ClusterLayout) GetStagedRoleChanges() map[string]NodeClusterInfo { +func (o *ClusterLayout) GetStagedRoleChanges() []NodeRoleChange { if o == nil { - var ret map[string]NodeClusterInfo + var ret []NodeRoleChange return ret } @@ -101,15 +101,15 @@ func (o *ClusterLayout) GetStagedRoleChanges() map[string]NodeClusterInfo { // GetStagedRoleChangesOk returns a tuple with the StagedRoleChanges field value // and a boolean to check if the value has been set. -func (o *ClusterLayout) GetStagedRoleChangesOk() (*map[string]NodeClusterInfo, bool) { +func (o *ClusterLayout) GetStagedRoleChangesOk() ([]NodeRoleChange, bool) { if o == nil { return nil, false } - return &o.StagedRoleChanges, true + return o.StagedRoleChanges, true } // SetStagedRoleChanges sets field value -func (o *ClusterLayout) SetStagedRoleChanges(v map[string]NodeClusterInfo) { +func (o *ClusterLayout) SetStagedRoleChanges(v []NodeRoleChange) { o.StagedRoleChanges = v } diff --git a/model_create_bucket_request.go b/model_create_bucket_request.go index 87b7c95..4f9edd7 100644 --- a/model_create_bucket_request.go +++ b/model_create_bucket_request.go @@ -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. diff --git a/model_create_bucket_request_local_alias.go b/model_create_bucket_request_local_alias.go index bf2661e..e1a492f 100644 --- a/model_create_bucket_request_local_alias.go +++ b/model_create_bucket_request_local_alias.go @@ -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. diff --git a/model_create_bucket_request_local_alias_allow.go b/model_create_bucket_request_local_alias_allow.go index 8a3344c..2b1c42d 100644 --- a/model_create_bucket_request_local_alias_allow.go +++ b/model_create_bucket_request_local_alias_allow.go @@ -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. diff --git a/model_get_nodes_200_response.go b/model_get_nodes_200_response.go index 4c613c8..a8b799e 100644 --- a/model_get_nodes_200_response.go +++ b/model_get_nodes_200_response.go @@ -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. @@ -18,7 +18,10 @@ import ( type GetNodes200Response struct { Node string `json:"node"` GarageVersion string `json:"garageVersion"` - KnownNodes map[string]NodeNetworkInfo `json:"knownNodes"` + GarageFeatures []string `json:"garageFeatures"` + RustVersion string `json:"rustVersion"` + DbEngine string `json:"dbEngine"` + KnownNodes []NodeNetworkInfo `json:"knownNodes"` Layout ClusterLayout `json:"layout"` } @@ -26,10 +29,13 @@ type GetNodes200Response struct { // 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 -func NewGetNodes200Response(node string, garageVersion string, knownNodes map[string]NodeNetworkInfo, layout ClusterLayout) *GetNodes200Response { +func NewGetNodes200Response(node string, garageVersion string, garageFeatures []string, rustVersion string, dbEngine string, knownNodes []NodeNetworkInfo, layout ClusterLayout) *GetNodes200Response { this := GetNodes200Response{} this.Node = node this.GarageVersion = garageVersion + this.GarageFeatures = garageFeatures + this.RustVersion = rustVersion + this.DbEngine = dbEngine this.KnownNodes = knownNodes this.Layout = layout return &this @@ -91,10 +97,82 @@ func (o *GetNodes200Response) SetGarageVersion(v string) { o.GarageVersion = v } -// GetKnownNodes returns the KnownNodes field value -func (o *GetNodes200Response) GetKnownNodes() map[string]NodeNetworkInfo { +// GetGarageFeatures returns the GarageFeatures field value +func (o *GetNodes200Response) GetGarageFeatures() []string { if o == nil { - var ret map[string]NodeNetworkInfo + var ret []string + return ret + } + + return o.GarageFeatures +} + +// GetGarageFeaturesOk returns a tuple with the GarageFeatures field value +// and a boolean to check if the value has been set. +func (o *GetNodes200Response) GetGarageFeaturesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.GarageFeatures, true +} + +// SetGarageFeatures sets field value +func (o *GetNodes200Response) SetGarageFeatures(v []string) { + o.GarageFeatures = v +} + +// GetRustVersion returns the RustVersion field value +func (o *GetNodes200Response) GetRustVersion() string { + if o == nil { + var ret string + return ret + } + + return o.RustVersion +} + +// GetRustVersionOk returns a tuple with the RustVersion field value +// and a boolean to check if the value has been set. +func (o *GetNodes200Response) GetRustVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RustVersion, true +} + +// SetRustVersion sets field value +func (o *GetNodes200Response) SetRustVersion(v string) { + o.RustVersion = v +} + +// GetDbEngine returns the DbEngine field value +func (o *GetNodes200Response) GetDbEngine() string { + if o == nil { + var ret string + return ret + } + + return o.DbEngine +} + +// GetDbEngineOk returns a tuple with the DbEngine field value +// and a boolean to check if the value has been set. +func (o *GetNodes200Response) GetDbEngineOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DbEngine, true +} + +// SetDbEngine sets field value +func (o *GetNodes200Response) SetDbEngine(v string) { + o.DbEngine = v +} + +// GetKnownNodes returns the KnownNodes field value +func (o *GetNodes200Response) GetKnownNodes() []NodeNetworkInfo { + if o == nil { + var ret []NodeNetworkInfo return ret } @@ -103,15 +181,15 @@ func (o *GetNodes200Response) GetKnownNodes() map[string]NodeNetworkInfo { // GetKnownNodesOk returns a tuple with the KnownNodes field value // and a boolean to check if the value has been set. -func (o *GetNodes200Response) GetKnownNodesOk() (*map[string]NodeNetworkInfo, bool) { +func (o *GetNodes200Response) GetKnownNodesOk() ([]NodeNetworkInfo, bool) { if o == nil { return nil, false } - return &o.KnownNodes, true + return o.KnownNodes, true } // SetKnownNodes sets field value -func (o *GetNodes200Response) SetKnownNodes(v map[string]NodeNetworkInfo) { +func (o *GetNodes200Response) SetKnownNodes(v []NodeNetworkInfo) { o.KnownNodes = v } @@ -147,6 +225,15 @@ func (o GetNodes200Response) MarshalJSON() ([]byte, error) { if true { toSerialize["garageVersion"] = o.GarageVersion } + if true { + toSerialize["garageFeatures"] = o.GarageFeatures + } + if true { + toSerialize["rustVersion"] = o.RustVersion + } + if true { + toSerialize["dbEngine"] = o.DbEngine + } if true { toSerialize["knownNodes"] = o.KnownNodes } diff --git a/model_import_key_request.go b/model_import_key_request.go index 7411b85..f356bf2 100644 --- a/model_import_key_request.go +++ b/model_import_key_request.go @@ -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,7 @@ import ( // ImportKeyRequest struct for ImportKeyRequest type ImportKeyRequest struct { - Name string `json:"name"` + Name NullableString `json:"name"` AccessKeyId string `json:"accessKeyId"` SecretAccessKey string `json:"secretAccessKey"` } @@ -25,7 +25,7 @@ type ImportKeyRequest struct { // 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 -func NewImportKeyRequest(name string, accessKeyId string, secretAccessKey string) *ImportKeyRequest { +func NewImportKeyRequest(name NullableString, accessKeyId string, secretAccessKey string) *ImportKeyRequest { this := ImportKeyRequest{} this.Name = name this.AccessKeyId = accessKeyId @@ -42,27 +42,29 @@ func NewImportKeyRequestWithDefaults() *ImportKeyRequest { } // GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned func (o *ImportKeyRequest) GetName() string { - if o == nil { + if o == nil || o.Name.Get() == nil { var ret string return ret } - return o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ImportKeyRequest) GetNameOk() (*string, bool) { if o == nil { return nil, false } - return &o.Name, true + return o.Name.Get(), o.Name.IsSet() } // SetName sets field value func (o *ImportKeyRequest) SetName(v string) { - o.Name = v + o.Name.Set(&v) } // GetAccessKeyId returns the AccessKeyId field value @@ -116,7 +118,7 @@ func (o *ImportKeyRequest) SetSecretAccessKey(v string) { func (o ImportKeyRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { - toSerialize["name"] = o.Name + toSerialize["name"] = o.Name.Get() } if true { toSerialize["accessKeyId"] = o.AccessKeyId diff --git a/model_key_info.go b/model_key_info.go index 4ac8071..c5294eb 100644 --- a/model_key_info.go +++ b/model_key_info.go @@ -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. @@ -18,7 +18,7 @@ import ( type KeyInfo struct { Name *string `json:"name,omitempty"` AccessKeyId *string `json:"accessKeyId,omitempty"` - SecretAccessKey *string `json:"secretAccessKey,omitempty"` + SecretAccessKey NullableString `json:"secretAccessKey,omitempty"` Permissions *KeyInfoPermissions `json:"permissions,omitempty"` Buckets []KeyInfoBucketsInner `json:"buckets,omitempty"` } @@ -104,36 +104,46 @@ func (o *KeyInfo) SetAccessKeyId(v string) { o.AccessKeyId = &v } -// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. +// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise (both if not set or set to explicit null). func (o *KeyInfo) GetSecretAccessKey() string { - if o == nil || o.SecretAccessKey == nil { + if o == nil || o.SecretAccessKey.Get() == nil { var ret string return ret } - return *o.SecretAccessKey + return *o.SecretAccessKey.Get() } // GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KeyInfo) GetSecretAccessKeyOk() (*string, bool) { - if o == nil || o.SecretAccessKey == nil { + if o == nil { return nil, false } - return o.SecretAccessKey, true + return o.SecretAccessKey.Get(), o.SecretAccessKey.IsSet() } // HasSecretAccessKey returns a boolean if a field has been set. func (o *KeyInfo) HasSecretAccessKey() bool { - if o != nil && o.SecretAccessKey != nil { + if o != nil && o.SecretAccessKey.IsSet() { return true } return false } -// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. +// SetSecretAccessKey gets a reference to the given NullableString and assigns it to the SecretAccessKey field. func (o *KeyInfo) SetSecretAccessKey(v string) { - o.SecretAccessKey = &v + o.SecretAccessKey.Set(&v) +} +// SetSecretAccessKeyNil sets the value for SecretAccessKey to be an explicit nil +func (o *KeyInfo) SetSecretAccessKeyNil() { + o.SecretAccessKey.Set(nil) +} + +// UnsetSecretAccessKey ensures that no value is present for SecretAccessKey, not even an explicit nil +func (o *KeyInfo) UnsetSecretAccessKey() { + o.SecretAccessKey.Unset() } // GetPermissions returns the Permissions field value if set, zero value otherwise. @@ -208,8 +218,8 @@ func (o KeyInfo) MarshalJSON() ([]byte, error) { if o.AccessKeyId != nil { toSerialize["accessKeyId"] = o.AccessKeyId } - if o.SecretAccessKey != nil { - toSerialize["secretAccessKey"] = o.SecretAccessKey + if o.SecretAccessKey.IsSet() { + toSerialize["secretAccessKey"] = o.SecretAccessKey.Get() } if o.Permissions != nil { toSerialize["permissions"] = o.Permissions diff --git a/model_key_info_buckets_inner.go b/model_key_info_buckets_inner.go index 28f8927..29ac124 100644 --- a/model_key_info_buckets_inner.go +++ b/model_key_info_buckets_inner.go @@ -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. diff --git a/model_key_info_buckets_inner_permissions.go b/model_key_info_buckets_inner_permissions.go index df01894..fa1d663 100644 --- a/model_key_info_buckets_inner_permissions.go +++ b/model_key_info_buckets_inner_permissions.go @@ -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. diff --git a/model_key_info_permissions.go b/model_key_info_permissions.go index c36db57..5173a33 100644 --- a/model_key_info_permissions.go +++ b/model_key_info_permissions.go @@ -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. diff --git a/model_layout_version.go b/model_layout_version.go index ae2fda0..1703084 100644 --- a/model_layout_version.go +++ b/model_layout_version.go @@ -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. diff --git a/model_list_buckets_200_response_inner.go b/model_list_buckets_200_response_inner.go index 2d88a00..1178607 100644 --- a/model_list_buckets_200_response_inner.go +++ b/model_list_buckets_200_response_inner.go @@ -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. diff --git a/model_list_buckets_200_response_inner_local_aliases_inner.go b/model_list_buckets_200_response_inner_local_aliases_inner.go index 2b54d9b..a3ecaf7 100644 --- a/model_list_buckets_200_response_inner_local_aliases_inner.go +++ b/model_list_buckets_200_response_inner_local_aliases_inner.go @@ -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. diff --git a/model_list_keys_200_response_inner.go b/model_list_keys_200_response_inner.go index a140231..284ec22 100644 --- a/model_list_keys_200_response_inner.go +++ b/model_list_keys_200_response_inner.go @@ -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. diff --git a/model_node_cluster_info.go b/model_node_cluster_info.go index bf51b60..ec7f288 100644 --- a/model_node_cluster_info.go +++ b/model_node_cluster_info.go @@ -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. @@ -17,7 +17,7 @@ import ( // NodeClusterInfo struct for NodeClusterInfo type NodeClusterInfo struct { Zone string `json:"zone"` - Capacity NullableInt32 `json:"capacity"` + Capacity NullableInt32 `json:"capacity,omitempty"` // User defined tags, put whatever makes sense for you, these tags are not interpreted by Garage Tags []string `json:"tags"` } @@ -26,10 +26,9 @@ type NodeClusterInfo struct { // 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 -func NewNodeClusterInfo(zone string, capacity NullableInt32, tags []string) *NodeClusterInfo { +func NewNodeClusterInfo(zone string, tags []string) *NodeClusterInfo { this := NodeClusterInfo{} this.Zone = zone - this.Capacity = capacity this.Tags = tags return &this } @@ -66,18 +65,16 @@ func (o *NodeClusterInfo) SetZone(v string) { o.Zone = v } -// GetCapacity returns the Capacity field value -// If the value is explicit nil, the zero value for int32 will be returned +// GetCapacity returns the Capacity field value if set, zero value otherwise (both if not set or set to explicit null). func (o *NodeClusterInfo) GetCapacity() int32 { if o == nil || o.Capacity.Get() == nil { var ret int32 return ret } - return *o.Capacity.Get() } -// GetCapacityOk returns a tuple with the Capacity field value +// GetCapacityOk returns a tuple with the Capacity field value if set, nil otherwise // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NodeClusterInfo) GetCapacityOk() (*int32, bool) { @@ -87,10 +84,28 @@ func (o *NodeClusterInfo) GetCapacityOk() (*int32, bool) { return o.Capacity.Get(), o.Capacity.IsSet() } -// SetCapacity sets field value +// HasCapacity returns a boolean if a field has been set. +func (o *NodeClusterInfo) HasCapacity() bool { + if o != nil && o.Capacity.IsSet() { + return true + } + + return false +} + +// SetCapacity gets a reference to the given NullableInt32 and assigns it to the Capacity field. func (o *NodeClusterInfo) SetCapacity(v int32) { o.Capacity.Set(&v) } +// SetCapacityNil sets the value for Capacity to be an explicit nil +func (o *NodeClusterInfo) SetCapacityNil() { + o.Capacity.Set(nil) +} + +// UnsetCapacity ensures that no value is present for Capacity, not even an explicit nil +func (o *NodeClusterInfo) UnsetCapacity() { + o.Capacity.Unset() +} // GetTags returns the Tags field value func (o *NodeClusterInfo) GetTags() []string { @@ -121,7 +136,7 @@ func (o NodeClusterInfo) MarshalJSON() ([]byte, error) { if true { toSerialize["zone"] = o.Zone } - if true { + if o.Capacity.IsSet() { toSerialize["capacity"] = o.Capacity.Get() } if true { diff --git a/model_node_network_info.go b/model_node_network_info.go index e923de4..373dc38 100644 --- a/model_node_network_info.go +++ b/model_node_network_info.go @@ -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,9 +16,10 @@ import ( // NodeNetworkInfo struct for NodeNetworkInfo type NodeNetworkInfo struct { + Id *string `json:"id,omitempty"` Addr string `json:"addr"` - IsUp bool `json:"is_up"` - LastSeenSecsAgo NullableInt32 `json:"last_seen_secs_ago"` + IsUp bool `json:"isUp"` + LastSeenSecsAgo NullableInt32 `json:"lastSeenSecsAgo"` Hostname string `json:"hostname"` } @@ -43,6 +44,38 @@ func NewNodeNetworkInfoWithDefaults() *NodeNetworkInfo { return &this } +// GetId returns the Id field value if set, zero value otherwise. +func (o *NodeNetworkInfo) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NodeNetworkInfo) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NodeNetworkInfo) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NodeNetworkInfo) SetId(v string) { + o.Id = &v +} + // GetAddr returns the Addr field value func (o *NodeNetworkInfo) GetAddr() string { if o == nil { @@ -143,14 +176,17 @@ func (o *NodeNetworkInfo) SetHostname(v string) { func (o NodeNetworkInfo) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } if true { toSerialize["addr"] = o.Addr } if true { - toSerialize["is_up"] = o.IsUp + toSerialize["isUp"] = o.IsUp } if true { - toSerialize["last_seen_secs_ago"] = o.LastSeenSecsAgo.Get() + toSerialize["lastSeenSecsAgo"] = o.LastSeenSecsAgo.Get() } if true { toSerialize["hostname"] = o.Hostname diff --git a/model_node_role_change.go b/model_node_role_change.go new file mode 100644 index 0000000..f482231 --- /dev/null +++ b/model_node_role_change.go @@ -0,0 +1,148 @@ +/* +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.9.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package garage + +import ( + "encoding/json" + "fmt" +) + +// NodeRoleChange - struct for NodeRoleChange +type NodeRoleChange struct { + NodeRoleRemove *NodeRoleRemove + NodeRoleUpdate *NodeRoleUpdate +} + +// NodeRoleRemoveAsNodeRoleChange is a convenience function that returns NodeRoleRemove wrapped in NodeRoleChange +func NodeRoleRemoveAsNodeRoleChange(v *NodeRoleRemove) NodeRoleChange { + return NodeRoleChange{ + NodeRoleRemove: v, + } +} + +// NodeRoleUpdateAsNodeRoleChange is a convenience function that returns NodeRoleUpdate wrapped in NodeRoleChange +func NodeRoleUpdateAsNodeRoleChange(v *NodeRoleUpdate) NodeRoleChange { + return NodeRoleChange{ + NodeRoleUpdate: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *NodeRoleChange) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NodeRoleRemove + err = newStrictDecoder(data).Decode(&dst.NodeRoleRemove) + if err == nil { + jsonNodeRoleRemove, _ := json.Marshal(dst.NodeRoleRemove) + if string(jsonNodeRoleRemove) == "{}" { // empty struct + dst.NodeRoleRemove = nil + } else { + match++ + } + } else { + dst.NodeRoleRemove = nil + } + + // try to unmarshal data into NodeRoleUpdate + err = newStrictDecoder(data).Decode(&dst.NodeRoleUpdate) + if err == nil { + jsonNodeRoleUpdate, _ := json.Marshal(dst.NodeRoleUpdate) + if string(jsonNodeRoleUpdate) == "{}" { // empty struct + dst.NodeRoleUpdate = nil + } else { + match++ + } + } else { + dst.NodeRoleUpdate = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.NodeRoleRemove = nil + dst.NodeRoleUpdate = nil + + return fmt.Errorf("Data matches more than one schema in oneOf(NodeRoleChange)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("Data failed to match schemas in oneOf(NodeRoleChange)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src NodeRoleChange) MarshalJSON() ([]byte, error) { + if src.NodeRoleRemove != nil { + return json.Marshal(&src.NodeRoleRemove) + } + + if src.NodeRoleUpdate != nil { + return json.Marshal(&src.NodeRoleUpdate) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *NodeRoleChange) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.NodeRoleRemove != nil { + return obj.NodeRoleRemove + } + + if obj.NodeRoleUpdate != nil { + return obj.NodeRoleUpdate + } + + // all schemas are nil + return nil +} + +type NullableNodeRoleChange struct { + value *NodeRoleChange + isSet bool +} + +func (v NullableNodeRoleChange) Get() *NodeRoleChange { + return v.value +} + +func (v *NullableNodeRoleChange) Set(val *NodeRoleChange) { + v.value = val + v.isSet = true +} + +func (v NullableNodeRoleChange) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeRoleChange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeRoleChange(val *NodeRoleChange) *NullableNodeRoleChange { + return &NullableNodeRoleChange{value: val, isSet: true} +} + +func (v NullableNodeRoleChange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeRoleChange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_node_role_remove.go b/model_node_role_remove.go new file mode 100644 index 0000000..d22bf24 --- /dev/null +++ b/model_node_role_remove.go @@ -0,0 +1,144 @@ +/* +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.9.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package garage + +import ( + "encoding/json" +) + +// NodeRoleRemove struct for NodeRoleRemove +type NodeRoleRemove struct { + Id *string `json:"id,omitempty"` + Remove bool `json:"remove"` +} + +// NewNodeRoleRemove instantiates a new NodeRoleRemove 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 +func NewNodeRoleRemove(remove bool) *NodeRoleRemove { + this := NodeRoleRemove{} + this.Remove = remove + return &this +} + +// NewNodeRoleRemoveWithDefaults instantiates a new NodeRoleRemove 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 +func NewNodeRoleRemoveWithDefaults() *NodeRoleRemove { + this := NodeRoleRemove{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NodeRoleRemove) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NodeRoleRemove) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NodeRoleRemove) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NodeRoleRemove) SetId(v string) { + o.Id = &v +} + +// GetRemove returns the Remove field value +func (o *NodeRoleRemove) GetRemove() bool { + if o == nil { + var ret bool + return ret + } + + return o.Remove +} + +// GetRemoveOk returns a tuple with the Remove field value +// and a boolean to check if the value has been set. +func (o *NodeRoleRemove) GetRemoveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Remove, true +} + +// SetRemove sets field value +func (o *NodeRoleRemove) SetRemove(v bool) { + o.Remove = v +} + +func (o NodeRoleRemove) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if true { + toSerialize["remove"] = o.Remove + } + return json.Marshal(toSerialize) +} + +type NullableNodeRoleRemove struct { + value *NodeRoleRemove + isSet bool +} + +func (v NullableNodeRoleRemove) Get() *NodeRoleRemove { + return v.value +} + +func (v *NullableNodeRoleRemove) Set(val *NodeRoleRemove) { + v.value = val + v.isSet = true +} + +func (v NullableNodeRoleRemove) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeRoleRemove) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeRoleRemove(val *NodeRoleRemove) *NullableNodeRoleRemove { + return &NullableNodeRoleRemove{value: val, isSet: true} +} + +func (v NullableNodeRoleRemove) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeRoleRemove) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_node_role_update.go b/model_node_role_update.go new file mode 100644 index 0000000..c6eb873 --- /dev/null +++ b/model_node_role_update.go @@ -0,0 +1,204 @@ +/* +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.9.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package garage + +import ( + "encoding/json" +) + +// NodeRoleUpdate struct for NodeRoleUpdate +type NodeRoleUpdate struct { + Id *string `json:"id,omitempty"` + Zone string `json:"zone"` + Capacity NullableInt32 `json:"capacity"` + Tags []string `json:"tags"` +} + +// NewNodeRoleUpdate instantiates a new NodeRoleUpdate 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 +func NewNodeRoleUpdate(zone string, capacity NullableInt32, tags []string) *NodeRoleUpdate { + this := NodeRoleUpdate{} + this.Zone = zone + this.Capacity = capacity + this.Tags = tags + return &this +} + +// NewNodeRoleUpdateWithDefaults instantiates a new NodeRoleUpdate 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 +func NewNodeRoleUpdateWithDefaults() *NodeRoleUpdate { + this := NodeRoleUpdate{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NodeRoleUpdate) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NodeRoleUpdate) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NodeRoleUpdate) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NodeRoleUpdate) SetId(v string) { + o.Id = &v +} + +// GetZone returns the Zone field value +func (o *NodeRoleUpdate) GetZone() string { + if o == nil { + var ret string + return ret + } + + return o.Zone +} + +// GetZoneOk returns a tuple with the Zone field value +// and a boolean to check if the value has been set. +func (o *NodeRoleUpdate) GetZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Zone, true +} + +// SetZone sets field value +func (o *NodeRoleUpdate) SetZone(v string) { + o.Zone = v +} + +// GetCapacity returns the Capacity field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *NodeRoleUpdate) GetCapacity() int32 { + if o == nil || o.Capacity.Get() == nil { + var ret int32 + return ret + } + + return *o.Capacity.Get() +} + +// GetCapacityOk returns a tuple with the Capacity field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NodeRoleUpdate) GetCapacityOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Capacity.Get(), o.Capacity.IsSet() +} + +// SetCapacity sets field value +func (o *NodeRoleUpdate) SetCapacity(v int32) { + o.Capacity.Set(&v) +} + +// GetTags returns the Tags field value +func (o *NodeRoleUpdate) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *NodeRoleUpdate) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *NodeRoleUpdate) SetTags(v []string) { + o.Tags = v +} + +func (o NodeRoleUpdate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if true { + toSerialize["zone"] = o.Zone + } + if true { + toSerialize["capacity"] = o.Capacity.Get() + } + if true { + toSerialize["tags"] = o.Tags + } + return json.Marshal(toSerialize) +} + +type NullableNodeRoleUpdate struct { + value *NodeRoleUpdate + isSet bool +} + +func (v NullableNodeRoleUpdate) Get() *NodeRoleUpdate { + return v.value +} + +func (v *NullableNodeRoleUpdate) Set(val *NodeRoleUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableNodeRoleUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeRoleUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeRoleUpdate(val *NodeRoleUpdate) *NullableNodeRoleUpdate { + return &NullableNodeRoleUpdate{value: val, isSet: true} +} + +func (v NullableNodeRoleUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeRoleUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_update_bucket_request.go b/model_update_bucket_request.go index d1ea618..ef4a7ab 100644 --- a/model_update_bucket_request.go +++ b/model_update_bucket_request.go @@ -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. diff --git a/model_update_bucket_request_quotas.go b/model_update_bucket_request_quotas.go index 1b1fd02..a810019 100644 --- a/model_update_bucket_request_quotas.go +++ b/model_update_bucket_request_quotas.go @@ -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. diff --git a/model_update_bucket_request_website_access.go b/model_update_bucket_request_website_access.go index 9d6d077..e18ef1a 100644 --- a/model_update_bucket_request_website_access.go +++ b/model_update_bucket_request_website_access.go @@ -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. diff --git a/model_update_key_request.go b/model_update_key_request.go index f32953e..88cefa9 100644 --- a/model_update_key_request.go +++ b/model_update_key_request.go @@ -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. diff --git a/model_update_key_request_allow.go b/model_update_key_request_allow.go index e3e1e2a..41b6ec3 100644 --- a/model_update_key_request_allow.go +++ b/model_update_key_request_allow.go @@ -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. diff --git a/model_update_key_request_deny.go b/model_update_key_request_deny.go index 8f2e51b..64be61d 100644 --- a/model_update_key_request_deny.go +++ b/model_update_key_request_deny.go @@ -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. diff --git a/response.go b/response.go index b2b3651..501856e 100644 --- a/response.go +++ b/response.go @@ -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. diff --git a/utils.go b/utils.go index 902e2b2..4a7afcc 100644 --- a/utils.go +++ b/utils.go @@ -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. From f442d10b102d92ec22cf2ab1bde5b8c6d78a1f62 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 22 Nov 2023 21:17:35 +0100 Subject: [PATCH 2/8] api-v1, 2nd iter --- README.md | 22 ++- api/openapi.yaml | 332 ++++++++++++++++++++-------------------------- api_bucket.go | 175 +++++++----------------- api_key.go | 157 ++++------------------ configuration.go | 2 +- docs/BucketApi.md | 117 +++------------- docs/KeyApi.md | 101 ++------------ 7 files changed, 268 insertions(+), 638 deletions(-) diff --git a/README.md b/README.md index cc3f11d..2bc6a03 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Administrate your Garage cluster programatically, including status, layout, keys 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.9.0 -- Package version: 0.8.0 +- Package version: 0.9.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -83,23 +83,21 @@ 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 diff --git a/api/openapi.yaml b/api/openapi.yaml index e44e49a..7c3e58a 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -203,7 +203,7 @@ paths: summary: Clear staged layout tags: - Layout - /key: + /key?list: get: description: | Returns all API access keys in the cluster. @@ -259,7 +259,7 @@ paths: summary: Create a new API key tags: - Key - /key?id={access_key}: + /key: delete: description: "Delete a key from the cluster. Its access will be removed from\ \ all the buckets. Buckets are not automatically deleted and can be dangling.\ @@ -286,29 +286,48 @@ paths: - Key get: description: "Return information about a specific key like its identifiers,\ - \ its permissions and buckets on which it has permissions. \n\nFor confidentiality\ - \ reasons, the secret key is not returned by default: you must pass the `showSecretKey`\ - \ query parameter to get it.\n" + \ its permissions and buckets on which it has permissions. \nYou can search\ + \ by specifying the exact key identifier (`id`) or by specifying a pattern\ + \ (`search`).\n\nFor confidentiality reasons, the secret key is not returned\ + \ by default: you must pass the `showSecretKey` query parameter to get it.\n" operationId: GetKey parameters: - - description: The exact API access key generated by Garage + - description: | + The exact API access key generated by Garage. + + Incompatible with `search`. example: GK31c2f218a2e44f485b94239e - explode: false - in: path - name: access_key - required: true + explode: true + in: query + name: id + required: false schema: type: string - style: simple + style: form + - description: | + A pattern (beginning or full string) corresponding to a key identifier or friendly name. + + Incompatible with `id`. + example: test-k + explode: true + in: query + name: search + required: false + schema: + type: string + style: form - description: Wether or not the secret key should be returned in the response - example: true + example: "true" explode: true in: query name: showSecretKey required: false schema: - default: false - type: boolean + default: "false" + enum: + - "true" + - "false" + type: string style: form responses: "500": @@ -364,48 +383,6 @@ paths: summary: Update a key tags: - Key - /key?search={pattern}: - get: - description: | - Find the first key matching the given pattern based on its identifier or friendly name and return its information. - - For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. - operationId: SearchKey - parameters: - - description: A pattern (beginning or full string) corresponding to a key identifier - or friendly name - example: test-k - explode: false - in: path - name: pattern - required: true - schema: - type: string - style: simple - - description: Wether or not the secret key should be returned in the response - example: true - explode: true - in: query - name: showSecretKey - required: false - schema: - default: false - type: boolean - style: form - responses: - "500": - description: The server can not handle your request. Check your connectivity - with the rest of the cluster. - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/KeyInfo' - description: | - Returns information about the key - summary: Select key by pattern - tags: - - Key /key/import: post: description: | @@ -436,7 +413,7 @@ paths: summary: Import an existing key tags: - Key - /bucket: + /bucket?list: get: description: | List all the buckets on the cluster with their UUID and their global and local aliases. @@ -475,6 +452,83 @@ paths: summary: List all buckets tags: - Bucket + /bucket: + delete: + description: | + Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty. + + **Warning:** this will delete all aliases associated with the bucket! + operationId: DeleteBucket + parameters: + - description: "The exact bucket identifier, a 32 bytes hexadecimal string" + example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 + explode: true + in: query + name: id + required: true + schema: + type: string + style: form + responses: + "500": + description: The server can not handle your request. Check your connectivity + with the rest of the cluster. + "400": + description: Bucket is not empty + "404": + description: Bucket not found + "204": + description: Bucket has been deleted + summary: Delete a bucket + tags: + - Bucket + get: + description: | + 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). + operationId: GetBucketInfo + parameters: + - description: | + The exact bucket identifier, a 32 bytes hexadecimal string. + + Incompatible with `alias`. + example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 + explode: true + in: query + name: id + required: false + schema: + type: string + style: form + - description: | + The exact global alias of one of the existing buckets. + + Incompatible with `id`. + example: my_documents + explode: true + in: query + name: alias + required: false + schema: + type: string + style: form + responses: + "500": + description: The server can not handle your request. Check your connectivity + with the rest of the cluster. + "404": + description: Bucket not found + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BucketInfo' + description: Returns exhaustive information about the bucket + summary: Get a bucket + tags: + - Bucket post: description: | Creates a new bucket, either with a global alias, a local one, or no alias at all. @@ -503,68 +557,6 @@ paths: summary: Create a bucket tags: - Bucket - /bucket?id={bucket_id}: - delete: - description: | - Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty. - - **Warning:** this will delete all aliases associated with the bucket! - operationId: DeleteBucket - parameters: - - description: "The exact bucket identifier, a 32 bytes hexadecimal string" - example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 - explode: false - in: path - name: bucket_id - required: true - schema: - type: string - style: simple - responses: - "500": - description: The server can not handle your request. Check your connectivity - with the rest of the cluster. - "400": - description: Bucket is not empty - "404": - description: Bucket not found - "204": - description: Bucket has been deleted - summary: Delete a bucket - tags: - - Bucket - get: - description: | - Given a bucket identifier, 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). - operationId: GetBucketInfo - parameters: - - description: "The exact bucket identifier, a 32 bytes hexadecimal string" - example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 - explode: false - in: path - name: bucket_id - required: true - schema: - type: string - style: simple - responses: - "500": - description: The server can not handle your request. Check your connectivity - with the rest of the cluster. - "404": - description: Bucket not found - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/BucketInfo' - description: Returns exhaustive information about the bucket - summary: Get a bucket - tags: - - Bucket put: description: | All fields (`websiteAccess` and `quotas`) are optional. @@ -582,13 +574,13 @@ paths: parameters: - description: "The exact bucket identifier, a 32 bytes hexadecimal string" example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 - explode: false - in: path - name: bucket_id + explode: true + in: query + name: id required: true schema: type: string - style: simple + style: form requestBody: content: application/json: @@ -614,36 +606,6 @@ paths: summary: Update a bucket tags: - Bucket - /bucket?globalAlias={alias}: - get: - description: | - Find a bucket by its global alias - operationId: FindBucketInfo - parameters: - - description: The exact global alias of one of the existing buckets - example: my_documents - explode: false - in: path - name: alias - required: true - schema: - type: string - style: simple - responses: - "500": - description: The server can not handle your request. Check your connectivity - with the rest of the cluster. - "404": - description: Bucket not found - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/BucketInfo' - description: Returns exhaustive information about the bucket - summary: Find a bucket - tags: - - Bucket /bucket/allow: post: description: | @@ -1458,6 +1420,38 @@ components: required: - id type: object + UpdateBucket_request_websiteAccess: + properties: + enabled: + example: true + type: boolean + indexDocument: + example: index.html + type: string + errorDocument: + example: error/400.html + type: string + type: object + UpdateBucket_request_quotas: + properties: + maxSize: + example: 19029801 + format: int64 + nullable: true + type: integer + maxObjects: + format: int64 + nullable: true + type: integer + example: null + type: object + UpdateBucket_request: + properties: + websiteAccess: + $ref: '#/components/schemas/UpdateBucket_request_websiteAccess' + quotas: + $ref: '#/components/schemas/UpdateBucket_request_quotas' + type: object CreateBucket_request_localAlias_allow: example: owner: true @@ -1491,38 +1485,6 @@ components: localAlias: $ref: '#/components/schemas/CreateBucket_request_localAlias' type: object - UpdateBucket_request_websiteAccess: - properties: - enabled: - example: true - type: boolean - indexDocument: - example: index.html - type: string - errorDocument: - example: error/400.html - type: string - type: object - UpdateBucket_request_quotas: - properties: - maxSize: - example: 19029801 - format: int64 - nullable: true - type: integer - maxObjects: - format: int64 - nullable: true - type: integer - example: null - type: object - UpdateBucket_request: - properties: - websiteAccess: - $ref: '#/components/schemas/UpdateBucket_request_websiteAccess' - quotas: - $ref: '#/components/schemas/UpdateBucket_request_quotas' - type: object AllowBucketKey_request_permissions: properties: read: diff --git a/api_bucket.go b/api_bucket.go index 333e9f7..de1bd2a 100644 --- a/api_bucket.go +++ b/api_bucket.go @@ -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 @@ -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"} diff --git a/api_key.go b/api_key.go index 0241848..ec123cb 100644 --- a/api_key.go +++ b/api_key.go @@ -70,7 +70,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{} @@ -176,7 +176,7 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response, return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/key?id={access_key}" + localVarPath := localBasePath + "/key" localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1) localVarHeaderParams := make(map[string]string) @@ -231,12 +231,25 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response, type ApiGetKeyRequest struct { ctx context.Context ApiService *KeyApiService - accessKey string - showSecretKey *bool + 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 bool) ApiGetKeyRequest { +func (r ApiGetKeyRequest) ShowSecretKey(showSecretKey string) ApiGetKeyRequest { r.showSecretKey = &showSecretKey return r } @@ -249,19 +262,18 @@ func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) { GetKey Get key 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, } } @@ -280,13 +292,18 @@ 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, "")) } @@ -498,7 +515,7 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/key" + localVarPath := localBasePath + "/key?list" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -558,122 +575,6 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp return localVarReturnValue, localVarHTTPResponse, nil } -type ApiSearchKeyRequest struct { - ctx context.Context - ApiService *KeyApiService - pattern string - showSecretKey *bool -} - -// Wether or not the secret key should be returned in the response -func (r ApiSearchKeyRequest) ShowSecretKey(showSecretKey bool) ApiSearchKeyRequest { - r.showSecretKey = &showSecretKey - return r -} - -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 or friendly name and return its information. - -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 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) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if r.showSecretKey != nil { - localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, "")) - } - // 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 ApiUpdateKeyRequest struct { ctx context.Context ApiService *KeyApiService @@ -726,7 +627,7 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/key?id={access_key}" + localVarPath := localBasePath + "/key" localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/configuration.go b/configuration.go index c7d19ac..fc46c94 100644 --- a/configuration.go +++ b/configuration.go @@ -101,7 +101,7 @@ 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{ { diff --git a/docs/BucketApi.md b/docs/BucketApi.md index 3991fc6..b8dd581 100644 --- a/docs/BucketApi.md +++ b/docs/BucketApi.md @@ -6,16 +6,15 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**AllowBucketKey**](BucketApi.md#AllowBucketKey) | **Post** /bucket/allow | Allow key [**CreateBucket**](BucketApi.md#CreateBucket) | **Post** /bucket | Create a bucket -[**DeleteBucket**](BucketApi.md#DeleteBucket) | **Delete** /bucket?id={bucket_id} | Delete a bucket +[**DeleteBucket**](BucketApi.md#DeleteBucket) | **Delete** /bucket | Delete a bucket [**DeleteBucketGlobalAlias**](BucketApi.md#DeleteBucketGlobalAlias) | **Delete** /bucket/alias/global | Delete a global alias [**DeleteBucketLocalAlias**](BucketApi.md#DeleteBucketLocalAlias) | **Delete** /bucket/alias/local | Delete a local alias [**DenyBucketKey**](BucketApi.md#DenyBucketKey) | **Post** /bucket/deny | Deny key -[**FindBucketInfo**](BucketApi.md#FindBucketInfo) | **Get** /bucket?globalAlias={alias} | Find a bucket -[**GetBucketInfo**](BucketApi.md#GetBucketInfo) | **Get** /bucket?id={bucket_id} | Get a bucket -[**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket | List all buckets +[**GetBucketInfo**](BucketApi.md#GetBucketInfo) | **Get** /bucket | Get a bucket +[**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket?list | List all buckets [**PutBucketGlobalAlias**](BucketApi.md#PutBucketGlobalAlias) | **Put** /bucket/alias/global | Add a global alias [**PutBucketLocalAlias**](BucketApi.md#PutBucketLocalAlias) | **Put** /bucket/alias/local | Add a local alias -[**UpdateBucket**](BucketApi.md#UpdateBucket) | **Put** /bucket?id={bucket_id} | Update a bucket +[**UpdateBucket**](BucketApi.md#UpdateBucket) | **Put** /bucket | Update a bucket @@ -153,7 +152,7 @@ Name | Type | Description | Notes ## DeleteBucket -> DeleteBucket(ctx, bucketId).Execute() +> DeleteBucket(ctx).Id(id).Execute() Delete a bucket @@ -172,11 +171,11 @@ import ( ) func main() { - bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string + id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.BucketApi.DeleteBucket(context.Background(), bucketId).Execute() + resp, r, err := apiClient.BucketApi.DeleteBucket(context.Background()).Id(id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.DeleteBucket``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -187,10 +186,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string | ### Other Parameters @@ -199,7 +194,7 @@ Other parameters are passed through a pointer to a apiDeleteBucketRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string | ### Return type @@ -423,79 +418,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## FindBucketInfo - -> BucketInfo FindBucketInfo(ctx, alias).Execute() - -Find a bucket - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - alias := "my_documents" // string | The exact global alias of one of the existing buckets - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.BucketApi.FindBucketInfo(context.Background(), alias).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.FindBucketInfo``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `FindBucketInfo`: BucketInfo - fmt.Fprintf(os.Stdout, "Response from `BucketApi.FindBucketInfo`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**alias** | **string** | The exact global alias of one of the existing buckets | - -### Other Parameters - -Other parameters are passed through a pointer to a apiFindBucketInfoRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - -[**BucketInfo**](BucketInfo.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - ## GetBucketInfo -> BucketInfo GetBucketInfo(ctx, bucketId).Execute() +> BucketInfo GetBucketInfo(ctx).Id(id).Alias(alias).Execute() Get a bucket @@ -514,11 +439,12 @@ import ( ) func main() { - bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string + id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. (optional) + alias := "my_documents" // string | The exact global alias of one of the existing buckets. Incompatible with `id`. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.BucketApi.GetBucketInfo(context.Background(), bucketId).Execute() + resp, r, err := apiClient.BucketApi.GetBucketInfo(context.Background()).Id(id).Alias(alias).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.GetBucketInfo``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -531,10 +457,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string | ### Other Parameters @@ -543,7 +465,8 @@ Other parameters are passed through a pointer to a apiGetBucketInfoRequest struc Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. | + **alias** | **string** | The exact global alias of one of the existing buckets. Incompatible with `id`. | ### Return type @@ -764,7 +687,7 @@ Name | Type | Description | Notes ## UpdateBucket -> BucketInfo UpdateBucket(ctx, bucketId).UpdateBucketRequest(updateBucketRequest).Execute() +> BucketInfo UpdateBucket(ctx).Id(id).UpdateBucketRequest(updateBucketRequest).Execute() Update a bucket @@ -783,12 +706,12 @@ import ( ) func main() { - bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string + id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string updateBucketRequest := *openapiclient.NewUpdateBucketRequest() // UpdateBucketRequest | Requested changes on the bucket. Both root fields are optionals. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.BucketApi.UpdateBucket(context.Background(), bucketId).UpdateBucketRequest(updateBucketRequest).Execute() + resp, r, err := apiClient.BucketApi.UpdateBucket(context.Background()).Id(id).UpdateBucketRequest(updateBucketRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.UpdateBucket``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -801,10 +724,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string | ### Other Parameters @@ -813,7 +732,7 @@ Other parameters are passed through a pointer to a apiUpdateBucketRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string | **updateBucketRequest** | [**UpdateBucketRequest**](UpdateBucketRequest.md) | Requested changes on the bucket. Both root fields are optionals. | ### Return type diff --git a/docs/KeyApi.md b/docs/KeyApi.md index 4699776..c3edc05 100644 --- a/docs/KeyApi.md +++ b/docs/KeyApi.md @@ -4,13 +4,12 @@ All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- -[**AddKey**](KeyApi.md#AddKey) | **Post** /key | Create a new API key -[**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key?id={access_key} | Delete a key -[**GetKey**](KeyApi.md#GetKey) | **Get** /key?id={access_key} | Get key information +[**AddKey**](KeyApi.md#AddKey) | **Post** /key?list | Create a new API key +[**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key | Delete a key +[**GetKey**](KeyApi.md#GetKey) | **Get** /key | Get key information [**ImportKey**](KeyApi.md#ImportKey) | **Post** /key/import | Import an existing key -[**ListKeys**](KeyApi.md#ListKeys) | **Get** /key | List all keys -[**SearchKey**](KeyApi.md#SearchKey) | **Get** /key?search={pattern} | Select key by pattern -[**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key?id={access_key} | Update a key +[**ListKeys**](KeyApi.md#ListKeys) | **Get** /key?list | List all keys +[**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key | Update a key @@ -150,7 +149,7 @@ Name | Type | Description | Notes ## GetKey -> KeyInfo GetKey(ctx, accessKey).ShowSecretKey(showSecretKey).Execute() +> KeyInfo GetKey(ctx).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute() Get key information @@ -169,12 +168,13 @@ import ( ) func main() { - accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage - showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false) + id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage. Incompatible with `search`. (optional) + search := "test-k" // string | A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. (optional) + showSecretKey := "true" // string | Wether or not the secret key should be returned in the response (optional) (default to "false") configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.GetKey(context.Background(), accessKey).ShowSecretKey(showSecretKey).Execute() + resp, r, err := apiClient.KeyApi.GetKey(context.Background()).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.GetKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -187,10 +187,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**accessKey** | **string** | The exact API access key generated by Garage | ### Other Parameters @@ -199,8 +195,9 @@ Other parameters are passed through a pointer to a apiGetKeyRequest struct via t Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - **showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false] + **id** | **string** | The exact API access key generated by Garage. Incompatible with `search`. | + **search** | **string** | A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. | + **showSecretKey** | **string** | Wether or not the secret key should be returned in the response | [default to "false"] ### Return type @@ -347,78 +344,6 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via [[Back to README]](../README.md) -## SearchKey - -> KeyInfo SearchKey(ctx, pattern).ShowSecretKey(showSecretKey).Execute() - -Select key by pattern - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - pattern := "test-k" // string | A pattern (beginning or full string) corresponding to a key identifier or friendly name - showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.SearchKey(context.Background(), pattern).ShowSecretKey(showSecretKey).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.SearchKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `SearchKey`: KeyInfo - fmt.Fprintf(os.Stdout, "Response from `KeyApi.SearchKey`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**pattern** | **string** | A pattern (beginning or full string) corresponding to a key identifier or friendly name | - -### Other Parameters - -Other parameters are passed through a pointer to a apiSearchKeyRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - **showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false] - -### Return type - -[**KeyInfo**](KeyInfo.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - ## UpdateKey > KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute() From d89dcefca5d0170cccc8d96c98e1c208549bd5f4 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Nov 2023 08:54:51 +0100 Subject: [PATCH 3/8] fix key query param --- api/openapi.yaml | 16 ++++++++-------- api_key.go | 35 ++++++++++++++++++++++++----------- docs/KeyApi.md | 24 ++++++++---------------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index 7c3e58a..dc71e8c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -268,13 +268,13 @@ paths: parameters: - description: The exact API access key generated by Garage example: GK31c2f218a2e44f485b94239e - explode: false - in: path - name: access_key + explode: true + in: query + name: id required: true schema: type: string - style: simple + style: form responses: "500": description: The server can not handle your request. Check your connectivity @@ -352,13 +352,13 @@ paths: parameters: - description: The exact API access key generated by Garage example: GK31c2f218a2e44f485b94239e - explode: false - in: path - name: access_key + explode: true + in: query + name: id required: true schema: type: string - style: simple + style: form requestBody: content: application/json: diff --git a/api_key.go b/api_key.go index ec123cb..e72f48d 100644 --- a/api_key.go +++ b/api_key.go @@ -16,7 +16,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) @@ -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, } } @@ -177,12 +180,15 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response, } localVarPath := localBasePath + "/key" - localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1) 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{} @@ -578,10 +584,16 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp 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 @@ -601,14 +613,12 @@ Updates information about the specified API access key. @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, } } @@ -628,15 +638,18 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http } localVarPath := localBasePath + "/key" - localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1) 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"} diff --git a/docs/KeyApi.md b/docs/KeyApi.md index c3edc05..1b975b4 100644 --- a/docs/KeyApi.md +++ b/docs/KeyApi.md @@ -81,7 +81,7 @@ Name | Type | Description | Notes ## DeleteKey -> DeleteKey(ctx, accessKey).Execute() +> DeleteKey(ctx).Id(id).Execute() Delete a key @@ -100,11 +100,11 @@ import ( ) func main() { - accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage + id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.DeleteKey(context.Background(), accessKey).Execute() + resp, r, err := apiClient.KeyApi.DeleteKey(context.Background()).Id(id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.DeleteKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -115,10 +115,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**accessKey** | **string** | The exact API access key generated by Garage | ### Other Parameters @@ -127,7 +123,7 @@ Other parameters are passed through a pointer to a apiDeleteKeyRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **id** | **string** | The exact API access key generated by Garage | ### Return type @@ -346,7 +342,7 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via ## UpdateKey -> KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute() +> KeyInfo UpdateKey(ctx).Id(id).UpdateKeyRequest(updateKeyRequest).Execute() Update a key @@ -365,12 +361,12 @@ import ( ) func main() { - accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage + id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage updateKeyRequest := *openapiclient.NewUpdateKeyRequest() // UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KeyApi.UpdateKey(context.Background(), accessKey).UpdateKeyRequest(updateKeyRequest).Execute() + resp, r, err := apiClient.KeyApi.UpdateKey(context.Background()).Id(id).UpdateKeyRequest(updateKeyRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.UpdateKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -383,10 +379,6 @@ func main() { ### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**accessKey** | **string** | The exact API access key generated by Garage | ### Other Parameters @@ -395,7 +387,7 @@ Other parameters are passed through a pointer to a apiUpdateKeyRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **id** | **string** | The exact API access key generated by Garage | **updateKeyRequest** | [**UpdateKeyRequest**](UpdateKeyRequest.md) | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove | ### Return type From 96f080c89ec442a6b480fff1158720a36453ff0a Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Nov 2023 10:04:11 +0100 Subject: [PATCH 4/8] switch capacity to int64 --- api/openapi.yaml | 4 ++++ docs/LayoutApi.md | 2 +- docs/NodeClusterInfo.md | 8 +++---- docs/NodeRoleChange.md | 17 +++++--------- docs/NodeRoleRemove.md | 9 ++------ docs/NodeRoleUpdate.md | 17 +++++--------- model_node_cluster_info.go | 12 +++++----- model_node_role_remove.go | 33 +++++++++++----------------- model_node_role_update.go | 45 ++++++++++++++++---------------------- 9 files changed, 61 insertions(+), 86 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index dc71e8c..aab8146 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -885,6 +885,7 @@ components: type: string capacity: example: 4 + format: int64 nullable: true type: integer tags: @@ -914,6 +915,7 @@ components: example: true type: boolean required: + - id - remove type: object NodeRoleUpdate: @@ -926,6 +928,7 @@ components: type: string capacity: example: 150000000000 + format: int64 nullable: true type: integer tags: @@ -937,6 +940,7 @@ components: type: array required: - capacity + - id - tags - zone type: object diff --git a/docs/LayoutApi.md b/docs/LayoutApi.md index 3e7f13d..d396c58 100644 --- a/docs/LayoutApi.md +++ b/docs/LayoutApi.md @@ -32,7 +32,7 @@ import ( ) func main() { - nodeRoleChange := []openapiclient.NodeRoleChange{openapiclient.NodeRoleChange{NodeRoleRemove: openapiclient.NewNodeRoleRemove(true)}} // []NodeRoleChange | 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. + nodeRoleChange := []openapiclient.NodeRoleChange{openapiclient.NodeRoleChange{NodeRoleRemove: openapiclient.NewNodeRoleRemove("6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f", true)}} // []NodeRoleChange | 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. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) diff --git a/docs/NodeClusterInfo.md b/docs/NodeClusterInfo.md index 1a3b537..aa0aeef 100644 --- a/docs/NodeClusterInfo.md +++ b/docs/NodeClusterInfo.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Zone** | **string** | | -**Capacity** | Pointer to **NullableInt32** | | [optional] +**Capacity** | Pointer to **NullableInt64** | | [optional] **Tags** | **[]string** | User defined tags, put whatever makes sense for you, these tags are not interpreted by Garage | ## Methods @@ -49,20 +49,20 @@ SetZone sets Zone field to given value. ### GetCapacity -`func (o *NodeClusterInfo) GetCapacity() int32` +`func (o *NodeClusterInfo) GetCapacity() int64` GetCapacity returns the Capacity field if non-nil, zero value otherwise. ### GetCapacityOk -`func (o *NodeClusterInfo) GetCapacityOk() (*int32, bool)` +`func (o *NodeClusterInfo) GetCapacityOk() (*int64, bool)` GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetCapacity -`func (o *NodeClusterInfo) SetCapacity(v int32)` +`func (o *NodeClusterInfo) SetCapacity(v int64)` SetCapacity sets Capacity field to given value. diff --git a/docs/NodeRoleChange.md b/docs/NodeRoleChange.md index 5c6322f..8d66e69 100644 --- a/docs/NodeRoleChange.md +++ b/docs/NodeRoleChange.md @@ -4,17 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] +**Id** | **string** | | **Remove** | **bool** | | **Zone** | **string** | | -**Capacity** | **NullableInt32** | | +**Capacity** | **NullableInt64** | | **Tags** | **[]string** | | ## Methods ### NewNodeRoleChange -`func NewNodeRoleChange(remove bool, zone string, capacity NullableInt32, tags []string, ) *NodeRoleChange` +`func NewNodeRoleChange(id string, remove bool, zone string, capacity NullableInt64, tags []string, ) *NodeRoleChange` NewNodeRoleChange instantiates a new NodeRoleChange object This constructor will assign default values to properties that have it defined, @@ -48,11 +48,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *NodeRoleChange) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetRemove @@ -96,20 +91,20 @@ SetZone sets Zone field to given value. ### GetCapacity -`func (o *NodeRoleChange) GetCapacity() int32` +`func (o *NodeRoleChange) GetCapacity() int64` GetCapacity returns the Capacity field if non-nil, zero value otherwise. ### GetCapacityOk -`func (o *NodeRoleChange) GetCapacityOk() (*int32, bool)` +`func (o *NodeRoleChange) GetCapacityOk() (*int64, bool)` GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetCapacity -`func (o *NodeRoleChange) SetCapacity(v int32)` +`func (o *NodeRoleChange) SetCapacity(v int64)` SetCapacity sets Capacity field to given value. diff --git a/docs/NodeRoleRemove.md b/docs/NodeRoleRemove.md index 423b69c..878770c 100644 --- a/docs/NodeRoleRemove.md +++ b/docs/NodeRoleRemove.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] +**Id** | **string** | | **Remove** | **bool** | | ## Methods ### NewNodeRoleRemove -`func NewNodeRoleRemove(remove bool, ) *NodeRoleRemove` +`func NewNodeRoleRemove(id string, remove bool, ) *NodeRoleRemove` NewNodeRoleRemove instantiates a new NodeRoleRemove object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *NodeRoleRemove) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetRemove diff --git a/docs/NodeRoleUpdate.md b/docs/NodeRoleUpdate.md index 9e73fa1..df62a68 100644 --- a/docs/NodeRoleUpdate.md +++ b/docs/NodeRoleUpdate.md @@ -4,16 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] +**Id** | **string** | | **Zone** | **string** | | -**Capacity** | **NullableInt32** | | +**Capacity** | **NullableInt64** | | **Tags** | **[]string** | | ## Methods ### NewNodeRoleUpdate -`func NewNodeRoleUpdate(zone string, capacity NullableInt32, tags []string, ) *NodeRoleUpdate` +`func NewNodeRoleUpdate(id string, zone string, capacity NullableInt64, tags []string, ) *NodeRoleUpdate` NewNodeRoleUpdate instantiates a new NodeRoleUpdate object This constructor will assign default values to properties that have it defined, @@ -47,11 +47,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *NodeRoleUpdate) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetZone @@ -75,20 +70,20 @@ SetZone sets Zone field to given value. ### GetCapacity -`func (o *NodeRoleUpdate) GetCapacity() int32` +`func (o *NodeRoleUpdate) GetCapacity() int64` GetCapacity returns the Capacity field if non-nil, zero value otherwise. ### GetCapacityOk -`func (o *NodeRoleUpdate) GetCapacityOk() (*int32, bool)` +`func (o *NodeRoleUpdate) GetCapacityOk() (*int64, bool)` GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetCapacity -`func (o *NodeRoleUpdate) SetCapacity(v int32)` +`func (o *NodeRoleUpdate) SetCapacity(v int64)` SetCapacity sets Capacity field to given value. diff --git a/model_node_cluster_info.go b/model_node_cluster_info.go index ec7f288..fb72a68 100644 --- a/model_node_cluster_info.go +++ b/model_node_cluster_info.go @@ -17,7 +17,7 @@ import ( // NodeClusterInfo struct for NodeClusterInfo type NodeClusterInfo struct { Zone string `json:"zone"` - Capacity NullableInt32 `json:"capacity,omitempty"` + Capacity NullableInt64 `json:"capacity,omitempty"` // User defined tags, put whatever makes sense for you, these tags are not interpreted by Garage Tags []string `json:"tags"` } @@ -66,9 +66,9 @@ func (o *NodeClusterInfo) SetZone(v string) { } // GetCapacity returns the Capacity field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NodeClusterInfo) GetCapacity() int32 { +func (o *NodeClusterInfo) GetCapacity() int64 { if o == nil || o.Capacity.Get() == nil { - var ret int32 + var ret int64 return ret } return *o.Capacity.Get() @@ -77,7 +77,7 @@ func (o *NodeClusterInfo) GetCapacity() int32 { // GetCapacityOk returns a tuple with the Capacity field value if set, nil otherwise // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *NodeClusterInfo) GetCapacityOk() (*int32, bool) { +func (o *NodeClusterInfo) GetCapacityOk() (*int64, bool) { if o == nil { return nil, false } @@ -93,8 +93,8 @@ func (o *NodeClusterInfo) HasCapacity() bool { return false } -// SetCapacity gets a reference to the given NullableInt32 and assigns it to the Capacity field. -func (o *NodeClusterInfo) SetCapacity(v int32) { +// SetCapacity gets a reference to the given NullableInt64 and assigns it to the Capacity field. +func (o *NodeClusterInfo) SetCapacity(v int64) { o.Capacity.Set(&v) } // SetCapacityNil sets the value for Capacity to be an explicit nil diff --git a/model_node_role_remove.go b/model_node_role_remove.go index d22bf24..127366b 100644 --- a/model_node_role_remove.go +++ b/model_node_role_remove.go @@ -16,7 +16,7 @@ import ( // NodeRoleRemove struct for NodeRoleRemove type NodeRoleRemove struct { - Id *string `json:"id,omitempty"` + Id string `json:"id"` Remove bool `json:"remove"` } @@ -24,8 +24,9 @@ type NodeRoleRemove struct { // 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 -func NewNodeRoleRemove(remove bool) *NodeRoleRemove { +func NewNodeRoleRemove(id string, remove bool) *NodeRoleRemove { this := NodeRoleRemove{} + this.Id = id this.Remove = remove return &this } @@ -38,36 +39,28 @@ func NewNodeRoleRemoveWithDefaults() *NodeRoleRemove { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *NodeRoleRemove) GetId() string { - if o == nil || o.Id == nil { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *NodeRoleRemove) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil { return nil, false } - return o.Id, true + return &o.Id, true } -// HasId returns a boolean if a field has been set. -func (o *NodeRoleRemove) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *NodeRoleRemove) SetId(v string) { - o.Id = &v + o.Id = v } // GetRemove returns the Remove field value @@ -96,7 +89,7 @@ func (o *NodeRoleRemove) SetRemove(v bool) { func (o NodeRoleRemove) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if true { toSerialize["id"] = o.Id } if true { diff --git a/model_node_role_update.go b/model_node_role_update.go index c6eb873..2fb3afe 100644 --- a/model_node_role_update.go +++ b/model_node_role_update.go @@ -16,9 +16,9 @@ import ( // NodeRoleUpdate struct for NodeRoleUpdate type NodeRoleUpdate struct { - Id *string `json:"id,omitempty"` + Id string `json:"id"` Zone string `json:"zone"` - Capacity NullableInt32 `json:"capacity"` + Capacity NullableInt64 `json:"capacity"` Tags []string `json:"tags"` } @@ -26,8 +26,9 @@ type NodeRoleUpdate struct { // 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 -func NewNodeRoleUpdate(zone string, capacity NullableInt32, tags []string) *NodeRoleUpdate { +func NewNodeRoleUpdate(id string, zone string, capacity NullableInt64, tags []string) *NodeRoleUpdate { this := NodeRoleUpdate{} + this.Id = id this.Zone = zone this.Capacity = capacity this.Tags = tags @@ -42,36 +43,28 @@ func NewNodeRoleUpdateWithDefaults() *NodeRoleUpdate { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *NodeRoleUpdate) GetId() string { - if o == nil || o.Id == nil { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *NodeRoleUpdate) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil { return nil, false } - return o.Id, true + return &o.Id, true } -// HasId returns a boolean if a field has been set. -func (o *NodeRoleUpdate) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *NodeRoleUpdate) SetId(v string) { - o.Id = &v + o.Id = v } // GetZone returns the Zone field value @@ -99,10 +92,10 @@ func (o *NodeRoleUpdate) SetZone(v string) { } // GetCapacity returns the Capacity field value -// If the value is explicit nil, the zero value for int32 will be returned -func (o *NodeRoleUpdate) GetCapacity() int32 { +// If the value is explicit nil, the zero value for int64 will be returned +func (o *NodeRoleUpdate) GetCapacity() int64 { if o == nil || o.Capacity.Get() == nil { - var ret int32 + var ret int64 return ret } @@ -112,7 +105,7 @@ func (o *NodeRoleUpdate) GetCapacity() int32 { // GetCapacityOk returns a tuple with the Capacity field value // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *NodeRoleUpdate) GetCapacityOk() (*int32, bool) { +func (o *NodeRoleUpdate) GetCapacityOk() (*int64, bool) { if o == nil { return nil, false } @@ -120,7 +113,7 @@ func (o *NodeRoleUpdate) GetCapacityOk() (*int32, bool) { } // SetCapacity sets field value -func (o *NodeRoleUpdate) SetCapacity(v int32) { +func (o *NodeRoleUpdate) SetCapacity(v int64) { o.Capacity.Set(&v) } @@ -150,7 +143,7 @@ func (o *NodeRoleUpdate) SetTags(v []string) { func (o NodeRoleUpdate) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if true { toSerialize["id"] = o.Id } if true { From 6dad7660a936f556553dbc21477d3a867f0bb07a Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Nov 2023 10:17:56 +0100 Subject: [PATCH 5/8] rework api version --- api/openapi.yaml | 3 +++ docs/LayoutApi.md | 4 ++-- docs/LayoutVersion.md | 15 +++++---------- model_layout_version.go | 41 +++++++++++++++++------------------------ 4 files changed, 27 insertions(+), 36 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index aab8146..5c7b062 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1010,7 +1010,10 @@ components: properties: version: example: 13 + format: int64 type: integer + required: + - version type: object KeyInfo: example: diff --git a/docs/LayoutApi.md b/docs/LayoutApi.md index d396c58..a6d3a24 100644 --- a/docs/LayoutApi.md +++ b/docs/LayoutApi.md @@ -98,7 +98,7 @@ import ( ) func main() { - layoutVersion := *openapiclient.NewLayoutVersion() // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. + layoutVersion := *openapiclient.NewLayoutVersion(int64(13)) // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -225,7 +225,7 @@ import ( ) func main() { - layoutVersion := *openapiclient.NewLayoutVersion() // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. + layoutVersion := *openapiclient.NewLayoutVersion(int64(13)) // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) diff --git a/docs/LayoutVersion.md b/docs/LayoutVersion.md index 6175d85..f6792bf 100644 --- a/docs/LayoutVersion.md +++ b/docs/LayoutVersion.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Version** | Pointer to **int32** | | [optional] +**Version** | **int64** | | ## Methods ### NewLayoutVersion -`func NewLayoutVersion() *LayoutVersion` +`func NewLayoutVersion(version int64, ) *LayoutVersion` NewLayoutVersion instantiates a new LayoutVersion object This constructor will assign default values to properties that have it defined, @@ -27,28 +27,23 @@ but it doesn't guarantee that properties required by API are set ### GetVersion -`func (o *LayoutVersion) GetVersion() int32` +`func (o *LayoutVersion) GetVersion() int64` GetVersion returns the Version field if non-nil, zero value otherwise. ### GetVersionOk -`func (o *LayoutVersion) GetVersionOk() (*int32, bool)` +`func (o *LayoutVersion) GetVersionOk() (*int64, bool)` GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetVersion -`func (o *LayoutVersion) SetVersion(v int32)` +`func (o *LayoutVersion) SetVersion(v int64)` SetVersion sets Version field to given value. -### HasVersion - -`func (o *LayoutVersion) HasVersion() bool` - -HasVersion returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/model_layout_version.go b/model_layout_version.go index 1703084..4003f53 100644 --- a/model_layout_version.go +++ b/model_layout_version.go @@ -16,15 +16,16 @@ import ( // LayoutVersion struct for LayoutVersion type LayoutVersion struct { - Version *int32 `json:"version,omitempty"` + Version int64 `json:"version"` } // NewLayoutVersion instantiates a new LayoutVersion 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 -func NewLayoutVersion() *LayoutVersion { +func NewLayoutVersion(version int64) *LayoutVersion { this := LayoutVersion{} + this.Version = version return &this } @@ -36,41 +37,33 @@ func NewLayoutVersionWithDefaults() *LayoutVersion { return &this } -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *LayoutVersion) GetVersion() int32 { - if o == nil || o.Version == nil { - var ret int32 +// GetVersion returns the Version field value +func (o *LayoutVersion) GetVersion() int64 { + if o == nil { + var ret int64 return ret } - return *o.Version + + return o.Version } -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// GetVersionOk returns a tuple with the Version field value // and a boolean to check if the value has been set. -func (o *LayoutVersion) GetVersionOk() (*int32, bool) { - if o == nil || o.Version == nil { +func (o *LayoutVersion) GetVersionOk() (*int64, bool) { + if o == nil { return nil, false } - return o.Version, true + return &o.Version, true } -// HasVersion returns a boolean if a field has been set. -func (o *LayoutVersion) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int32 and assigns it to the Version field. -func (o *LayoutVersion) SetVersion(v int32) { - o.Version = &v +// SetVersion sets field value +func (o *LayoutVersion) SetVersion(v int64) { + o.Version = v } func (o LayoutVersion) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Version != nil { + if true { toSerialize["version"] = o.Version } return json.Marshal(toSerialize) From ffd9578e975e886d9075a4f2e710117893de8ac7 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Nov 2023 10:21:13 +0100 Subject: [PATCH 6/8] set version back to int32 --- api/openapi.yaml | 1 - docs/LayoutApi.md | 4 ++-- docs/LayoutVersion.md | 10 +++++----- model_layout_version.go | 12 ++++++------ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index 5c7b062..64d13c6 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1010,7 +1010,6 @@ components: properties: version: example: 13 - format: int64 type: integer required: - version diff --git a/docs/LayoutApi.md b/docs/LayoutApi.md index a6d3a24..720e440 100644 --- a/docs/LayoutApi.md +++ b/docs/LayoutApi.md @@ -98,7 +98,7 @@ import ( ) func main() { - layoutVersion := *openapiclient.NewLayoutVersion(int64(13)) // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. + layoutVersion := *openapiclient.NewLayoutVersion(int32(13)) // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -225,7 +225,7 @@ import ( ) func main() { - layoutVersion := *openapiclient.NewLayoutVersion(int64(13)) // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. + layoutVersion := *openapiclient.NewLayoutVersion(int32(13)) // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) diff --git a/docs/LayoutVersion.md b/docs/LayoutVersion.md index f6792bf..47504c7 100644 --- a/docs/LayoutVersion.md +++ b/docs/LayoutVersion.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Version** | **int64** | | +**Version** | **int32** | | ## Methods ### NewLayoutVersion -`func NewLayoutVersion(version int64, ) *LayoutVersion` +`func NewLayoutVersion(version int32, ) *LayoutVersion` NewLayoutVersion instantiates a new LayoutVersion object This constructor will assign default values to properties that have it defined, @@ -27,20 +27,20 @@ but it doesn't guarantee that properties required by API are set ### GetVersion -`func (o *LayoutVersion) GetVersion() int64` +`func (o *LayoutVersion) GetVersion() int32` GetVersion returns the Version field if non-nil, zero value otherwise. ### GetVersionOk -`func (o *LayoutVersion) GetVersionOk() (*int64, bool)` +`func (o *LayoutVersion) GetVersionOk() (*int32, bool)` GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetVersion -`func (o *LayoutVersion) SetVersion(v int64)` +`func (o *LayoutVersion) SetVersion(v int32)` SetVersion sets Version field to given value. diff --git a/model_layout_version.go b/model_layout_version.go index 4003f53..2b4a39c 100644 --- a/model_layout_version.go +++ b/model_layout_version.go @@ -16,14 +16,14 @@ import ( // LayoutVersion struct for LayoutVersion type LayoutVersion struct { - Version int64 `json:"version"` + Version int32 `json:"version"` } // NewLayoutVersion instantiates a new LayoutVersion 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 -func NewLayoutVersion(version int64) *LayoutVersion { +func NewLayoutVersion(version int32) *LayoutVersion { this := LayoutVersion{} this.Version = version return &this @@ -38,9 +38,9 @@ func NewLayoutVersionWithDefaults() *LayoutVersion { } // GetVersion returns the Version field value -func (o *LayoutVersion) GetVersion() int64 { +func (o *LayoutVersion) GetVersion() int32 { if o == nil { - var ret int64 + var ret int32 return ret } @@ -49,7 +49,7 @@ func (o *LayoutVersion) GetVersion() int64 { // GetVersionOk returns a tuple with the Version field value // and a boolean to check if the value has been set. -func (o *LayoutVersion) GetVersionOk() (*int64, bool) { +func (o *LayoutVersion) GetVersionOk() (*int32, bool) { if o == nil { return nil, false } @@ -57,7 +57,7 @@ func (o *LayoutVersion) GetVersionOk() (*int64, bool) { } // SetVersion sets field value -func (o *LayoutVersion) SetVersion(v int64) { +func (o *LayoutVersion) SetVersion(v int32) { o.Version = v } From d1fd35809073b801031b8f47475311dd1f250eab Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 28 Nov 2023 14:32:46 +0100 Subject: [PATCH 7/8] add cluster health --- .openapi-generator/FILES | 2 + README.md | 6 +- api/openapi.yaml | 75 +++++++- api_nodes.go | 104 ++++++++++- docs/GetHealth200Response.md | 198 ++++++++++++++++++++ docs/NodesApi.md | 70 ++++++- model_get_health_200_response.go | 311 +++++++++++++++++++++++++++++++ 7 files changed, 756 insertions(+), 10 deletions(-) create mode 100644 docs/GetHealth200Response.md create mode 100644 model_get_health_200_response.go diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3ae0bd9..6495a78 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -22,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 @@ -62,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 diff --git a/README.md b/README.md index 2bc6a03..6ba34fa 100644 --- a/README.md +++ b/README.md @@ -102,8 +102,9 @@ Class | Method | HTTP request | Description *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 @@ -121,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) diff --git a/api/openapi.yaml b/api/openapi.yaml index 64d13c6..3075224 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -12,6 +12,25 @@ servers: security: - bearerAuth: [] paths: + /health: + get: + description: | + 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). + operationId: GetHealth + responses: + "500": + description: | + The server can not answer your request because it is in a bad state + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GetHealth_200_response' + description: | + Information about the queried node, its environment and the current layout + summary: Cluster health report + tags: + - Nodes /status: get: description: | @@ -34,7 +53,7 @@ paths: $ref: '#/components/schemas/GetNodes_200_response' description: | Information about the queried node, its environment and the current layout - summary: Status of this node and other nodes in the cluster + summary: Describe cluster tags: - Nodes /connect: @@ -74,7 +93,7 @@ paths: type: array description: | The request has been handled correctly but it does not mean that all connection requests succeeded; some might have fail, you need to check the body! - summary: Connect target node to other Garage nodes + summary: Connect a new node tags: - Nodes /layout: @@ -1153,6 +1172,58 @@ components: type: string type: array type: object + GetHealth_200_response: + example: + storageNodesOk: 3 + partitions: 256 + partitionsQuorum: 256 + knownNodes: 4 + connectedNodes: 4 + storageNodes: 3 + partitionsAllOk: 256 + status: healthy + properties: + status: + example: healthy + type: string + knownNodes: + example: 4 + format: int64 + type: integer + connectedNodes: + example: 4 + format: int64 + type: integer + storageNodes: + example: 3 + format: int64 + type: integer + storageNodesOk: + example: 3 + format: int64 + type: integer + partitions: + example: 256 + format: int64 + type: integer + partitionsQuorum: + example: 256 + format: int64 + type: integer + partitionsAllOk: + example: 256 + format: int64 + type: integer + required: + - connectedNodes + - knownNodes + - partitions + - partitionsAllOk + - partitionsQuorum + - status + - storageNodes + - storageNodesOk + type: object GetNodes_200_response: example: layout: diff --git a/api_nodes.go b/api_nodes.go index 6d1bdfa..168b61f 100644 --- a/api_nodes.go +++ b/api_nodes.go @@ -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` 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 diff --git a/docs/GetHealth200Response.md b/docs/GetHealth200Response.md new file mode 100644 index 0000000..ba37c1f --- /dev/null +++ b/docs/GetHealth200Response.md @@ -0,0 +1,198 @@ +# GetHealth200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Status** | **string** | | +**KnownNodes** | **int64** | | +**ConnectedNodes** | **int64** | | +**StorageNodes** | **int64** | | +**StorageNodesOk** | **int64** | | +**Partitions** | **int64** | | +**PartitionsQuorum** | **int64** | | +**PartitionsAllOk** | **int64** | | + +## Methods + +### NewGetHealth200Response + +`func NewGetHealth200Response(status string, knownNodes int64, connectedNodes int64, storageNodes int64, storageNodesOk int64, partitions int64, partitionsQuorum int64, partitionsAllOk int64, ) *GetHealth200Response` + +NewGetHealth200Response instantiates a new GetHealth200Response 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 + +### NewGetHealth200ResponseWithDefaults + +`func NewGetHealth200ResponseWithDefaults() *GetHealth200Response` + +NewGetHealth200ResponseWithDefaults instantiates a new GetHealth200Response 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 + +### GetStatus + +`func (o *GetHealth200Response) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *GetHealth200Response) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *GetHealth200Response) SetStatus(v string)` + +SetStatus sets Status field to given value. + + +### GetKnownNodes + +`func (o *GetHealth200Response) GetKnownNodes() int64` + +GetKnownNodes returns the KnownNodes field if non-nil, zero value otherwise. + +### GetKnownNodesOk + +`func (o *GetHealth200Response) GetKnownNodesOk() (*int64, bool)` + +GetKnownNodesOk returns a tuple with the KnownNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKnownNodes + +`func (o *GetHealth200Response) SetKnownNodes(v int64)` + +SetKnownNodes sets KnownNodes field to given value. + + +### GetConnectedNodes + +`func (o *GetHealth200Response) GetConnectedNodes() int64` + +GetConnectedNodes returns the ConnectedNodes field if non-nil, zero value otherwise. + +### GetConnectedNodesOk + +`func (o *GetHealth200Response) GetConnectedNodesOk() (*int64, bool)` + +GetConnectedNodesOk returns a tuple with the ConnectedNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConnectedNodes + +`func (o *GetHealth200Response) SetConnectedNodes(v int64)` + +SetConnectedNodes sets ConnectedNodes field to given value. + + +### GetStorageNodes + +`func (o *GetHealth200Response) GetStorageNodes() int64` + +GetStorageNodes returns the StorageNodes field if non-nil, zero value otherwise. + +### GetStorageNodesOk + +`func (o *GetHealth200Response) GetStorageNodesOk() (*int64, bool)` + +GetStorageNodesOk returns a tuple with the StorageNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageNodes + +`func (o *GetHealth200Response) SetStorageNodes(v int64)` + +SetStorageNodes sets StorageNodes field to given value. + + +### GetStorageNodesOk + +`func (o *GetHealth200Response) GetStorageNodesOk() int64` + +GetStorageNodesOk returns the StorageNodesOk field if non-nil, zero value otherwise. + +### GetStorageNodesOkOk + +`func (o *GetHealth200Response) GetStorageNodesOkOk() (*int64, bool)` + +GetStorageNodesOkOk returns a tuple with the StorageNodesOk field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageNodesOk + +`func (o *GetHealth200Response) SetStorageNodesOk(v int64)` + +SetStorageNodesOk sets StorageNodesOk field to given value. + + +### GetPartitions + +`func (o *GetHealth200Response) GetPartitions() int64` + +GetPartitions returns the Partitions field if non-nil, zero value otherwise. + +### GetPartitionsOk + +`func (o *GetHealth200Response) GetPartitionsOk() (*int64, bool)` + +GetPartitionsOk returns a tuple with the Partitions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPartitions + +`func (o *GetHealth200Response) SetPartitions(v int64)` + +SetPartitions sets Partitions field to given value. + + +### GetPartitionsQuorum + +`func (o *GetHealth200Response) GetPartitionsQuorum() int64` + +GetPartitionsQuorum returns the PartitionsQuorum field if non-nil, zero value otherwise. + +### GetPartitionsQuorumOk + +`func (o *GetHealth200Response) GetPartitionsQuorumOk() (*int64, bool)` + +GetPartitionsQuorumOk returns a tuple with the PartitionsQuorum field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPartitionsQuorum + +`func (o *GetHealth200Response) SetPartitionsQuorum(v int64)` + +SetPartitionsQuorum sets PartitionsQuorum field to given value. + + +### GetPartitionsAllOk + +`func (o *GetHealth200Response) GetPartitionsAllOk() int64` + +GetPartitionsAllOk returns the PartitionsAllOk field if non-nil, zero value otherwise. + +### GetPartitionsAllOkOk + +`func (o *GetHealth200Response) GetPartitionsAllOkOk() (*int64, bool)` + +GetPartitionsAllOkOk returns a tuple with the PartitionsAllOk field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPartitionsAllOk + +`func (o *GetHealth200Response) SetPartitionsAllOk(v int64)` + +SetPartitionsAllOk sets PartitionsAllOk field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NodesApi.md b/docs/NodesApi.md index dc108b7..fd5a6fd 100644 --- a/docs/NodesApi.md +++ b/docs/NodesApi.md @@ -4,8 +4,9 @@ All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- -[**AddNode**](NodesApi.md#AddNode) | **Post** /connect | Connect target node to other Garage nodes -[**GetNodes**](NodesApi.md#GetNodes) | **Get** /status | Status of this node and other nodes in the cluster +[**AddNode**](NodesApi.md#AddNode) | **Post** /connect | Connect a new node +[**GetHealth**](NodesApi.md#GetHealth) | **Get** /health | Cluster health report +[**GetNodes**](NodesApi.md#GetNodes) | **Get** /status | Describe cluster @@ -13,7 +14,7 @@ Method | HTTP request | Description > []AddNode200ResponseInner AddNode(ctx).RequestBody(requestBody).Execute() -Connect target node to other Garage nodes +Connect a new node @@ -75,11 +76,72 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## GetHealth + +> GetHealth200Response GetHealth(ctx).Execute() + +Cluster health report + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodesApi.GetHealth(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodesApi.GetHealth``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetHealth`: GetHealth200Response + fmt.Fprintf(os.Stdout, "Response from `NodesApi.GetHealth`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetHealthRequest struct via the builder pattern + + +### Return type + +[**GetHealth200Response**](GetHealth200Response.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## GetNodes > GetNodes200Response GetNodes(ctx).Execute() -Status of this node and other nodes in the cluster +Describe cluster diff --git a/model_get_health_200_response.go b/model_get_health_200_response.go new file mode 100644 index 0000000..6d26344 --- /dev/null +++ b/model_get_health_200_response.go @@ -0,0 +1,311 @@ +/* +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.9.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package garage + +import ( + "encoding/json" +) + +// GetHealth200Response struct for GetHealth200Response +type GetHealth200Response struct { + Status string `json:"status"` + KnownNodes int64 `json:"knownNodes"` + ConnectedNodes int64 `json:"connectedNodes"` + StorageNodes int64 `json:"storageNodes"` + StorageNodesOk int64 `json:"storageNodesOk"` + Partitions int64 `json:"partitions"` + PartitionsQuorum int64 `json:"partitionsQuorum"` + PartitionsAllOk int64 `json:"partitionsAllOk"` +} + +// NewGetHealth200Response instantiates a new GetHealth200Response 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 +func NewGetHealth200Response(status string, knownNodes int64, connectedNodes int64, storageNodes int64, storageNodesOk int64, partitions int64, partitionsQuorum int64, partitionsAllOk int64) *GetHealth200Response { + this := GetHealth200Response{} + this.Status = status + this.KnownNodes = knownNodes + this.ConnectedNodes = connectedNodes + this.StorageNodes = storageNodes + this.StorageNodesOk = storageNodesOk + this.Partitions = partitions + this.PartitionsQuorum = partitionsQuorum + this.PartitionsAllOk = partitionsAllOk + return &this +} + +// NewGetHealth200ResponseWithDefaults instantiates a new GetHealth200Response 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 +func NewGetHealth200ResponseWithDefaults() *GetHealth200Response { + this := GetHealth200Response{} + return &this +} + +// GetStatus returns the Status field value +func (o *GetHealth200Response) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *GetHealth200Response) SetStatus(v string) { + o.Status = v +} + +// GetKnownNodes returns the KnownNodes field value +func (o *GetHealth200Response) GetKnownNodes() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.KnownNodes +} + +// GetKnownNodesOk returns a tuple with the KnownNodes field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetKnownNodesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.KnownNodes, true +} + +// SetKnownNodes sets field value +func (o *GetHealth200Response) SetKnownNodes(v int64) { + o.KnownNodes = v +} + +// GetConnectedNodes returns the ConnectedNodes field value +func (o *GetHealth200Response) GetConnectedNodes() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.ConnectedNodes +} + +// GetConnectedNodesOk returns a tuple with the ConnectedNodes field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetConnectedNodesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.ConnectedNodes, true +} + +// SetConnectedNodes sets field value +func (o *GetHealth200Response) SetConnectedNodes(v int64) { + o.ConnectedNodes = v +} + +// GetStorageNodes returns the StorageNodes field value +func (o *GetHealth200Response) GetStorageNodes() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.StorageNodes +} + +// GetStorageNodesOk returns a tuple with the StorageNodes field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetStorageNodesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.StorageNodes, true +} + +// SetStorageNodes sets field value +func (o *GetHealth200Response) SetStorageNodes(v int64) { + o.StorageNodes = v +} + +// GetStorageNodesOk returns the StorageNodesOk field value +func (o *GetHealth200Response) GetStorageNodesOk() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.StorageNodesOk +} + +// GetStorageNodesOkOk returns a tuple with the StorageNodesOk field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetStorageNodesOkOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.StorageNodesOk, true +} + +// SetStorageNodesOk sets field value +func (o *GetHealth200Response) SetStorageNodesOk(v int64) { + o.StorageNodesOk = v +} + +// GetPartitions returns the Partitions field value +func (o *GetHealth200Response) GetPartitions() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.Partitions +} + +// GetPartitionsOk returns a tuple with the Partitions field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetPartitionsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Partitions, true +} + +// SetPartitions sets field value +func (o *GetHealth200Response) SetPartitions(v int64) { + o.Partitions = v +} + +// GetPartitionsQuorum returns the PartitionsQuorum field value +func (o *GetHealth200Response) GetPartitionsQuorum() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.PartitionsQuorum +} + +// GetPartitionsQuorumOk returns a tuple with the PartitionsQuorum field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetPartitionsQuorumOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.PartitionsQuorum, true +} + +// SetPartitionsQuorum sets field value +func (o *GetHealth200Response) SetPartitionsQuorum(v int64) { + o.PartitionsQuorum = v +} + +// GetPartitionsAllOk returns the PartitionsAllOk field value +func (o *GetHealth200Response) GetPartitionsAllOk() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.PartitionsAllOk +} + +// GetPartitionsAllOkOk returns a tuple with the PartitionsAllOk field value +// and a boolean to check if the value has been set. +func (o *GetHealth200Response) GetPartitionsAllOkOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.PartitionsAllOk, true +} + +// SetPartitionsAllOk sets field value +func (o *GetHealth200Response) SetPartitionsAllOk(v int64) { + o.PartitionsAllOk = v +} + +func (o GetHealth200Response) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["status"] = o.Status + } + if true { + toSerialize["knownNodes"] = o.KnownNodes + } + if true { + toSerialize["connectedNodes"] = o.ConnectedNodes + } + if true { + toSerialize["storageNodes"] = o.StorageNodes + } + if true { + toSerialize["storageNodesOk"] = o.StorageNodesOk + } + if true { + toSerialize["partitions"] = o.Partitions + } + if true { + toSerialize["partitionsQuorum"] = o.PartitionsQuorum + } + if true { + toSerialize["partitionsAllOk"] = o.PartitionsAllOk + } + return json.Marshal(toSerialize) +} + +type NullableGetHealth200Response struct { + value *GetHealth200Response + isSet bool +} + +func (v NullableGetHealth200Response) Get() *GetHealth200Response { + return v.value +} + +func (v *NullableGetHealth200Response) Set(val *GetHealth200Response) { + v.value = val + v.isSet = true +} + +func (v NullableGetHealth200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableGetHealth200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetHealth200Response(val *GetHealth200Response) *NullableGetHealth200Response { + return &NullableGetHealth200Response{value: val, isSet: true} +} + +func (v NullableGetHealth200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetHealth200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + From 9dd59cf12c08824bde465a30a1638579b0d1f041 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 28 Nov 2023 15:22:23 +0100 Subject: [PATCH 8/8] patch broken generated code --- model_get_health_200_response.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model_get_health_200_response.go b/model_get_health_200_response.go index 6d26344..3a2032e 100644 --- a/model_get_health_200_response.go +++ b/model_get_health_200_response.go @@ -124,7 +124,7 @@ func (o *GetHealth200Response) SetConnectedNodes(v int64) { } // GetStorageNodes returns the StorageNodes field value -func (o *GetHealth200Response) GetStorageNodes() int64 { +func (o *GetHealth200Response) GetStorageNodesAll() int64 { if o == nil { var ret int64 return ret @@ -135,7 +135,7 @@ func (o *GetHealth200Response) GetStorageNodes() int64 { // GetStorageNodesOk returns a tuple with the StorageNodes field value // and a boolean to check if the value has been set. -func (o *GetHealth200Response) GetStorageNodesOk() (*int64, bool) { +func (o *GetHealth200Response) GetStorageNodesAllOk() (*int64, bool) { if o == nil { return nil, false }