From 8818dcad35b89806697c9c279c1544ee781e6386 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Tue, 3 Mar 2020 20:16:26 +0000 Subject: [PATCH 1/6] Initial v2 api --- v2/.gitignore | 24 + v2/.openapi-generator-ignore | 23 + v2/.openapi-generator/VERSION | 1 + v2/.travis.yml | 8 + v2/LICENCE | 22 + v2/Makefile | 31 + v2/README.md | 131 + v2/api/openapi.yaml | 4813 +++++++++++++++++ v2/api_default.go | 5386 ++++++++++++++++++++ v2/client.go | 533 ++ v2/configuration.go | 131 + v2/docs/AcceptedMessage.md | 11 + v2/docs/AttachVolumeData.md | 11 + v2/docs/AuthUserData.md | 12 + v2/docs/Cluster.md | 20 + v2/docs/CreateNamespaceData.md | 12 + v2/docs/CreatePolicyGroupData.md | 12 + v2/docs/CreateUserData.md | 14 + v2/docs/CreateVolumeData.md | 16 + v2/docs/DefaultApi.md | 1380 +++++ v2/docs/DeploymentInfo.md | 15 + v2/docs/Error.md | 11 + v2/docs/FsType.md | 10 + v2/docs/Health.md | 10 + v2/docs/Licence.md | 15 + v2/docs/LogFormat.md | 10 + v2/docs/LogLevel.md | 10 + v2/docs/Namespace.md | 16 + v2/docs/Node.md | 21 + v2/docs/PoliciesSpecs.md | 13 + v2/docs/PolicyGroup.md | 17 + v2/docs/PolicyGroupUsers.md | 12 + v2/docs/UpdateAuthenticatedUserData.md | 12 + v2/docs/UpdateClusterData.md | 17 + v2/docs/UpdateNamespaceData.md | 12 + v2/docs/UpdateNodeData.md | 12 + v2/docs/UpdatePolicyGroupData.md | 12 + v2/docs/UpdateUserData.md | 14 + v2/docs/UpdateVolumeData.md | 14 + v2/docs/User.md | 17 + v2/docs/Volume.md | 24 + v2/git_push.sh | 58 + v2/go.mod | 9 + v2/go.sum | 17 + v2/model__policies_specs.go | 20 + v2/model_accepted_message.go | 15 + v2/model_attach_volume_data.go | 16 + v2/model_auth_user_data.go | 16 + v2/model_cluster.go | 34 + v2/model_create_namespace_data.go | 18 + v2/model_create_policy_group_data.go | 17 + v2/model_create_user_data.go | 21 + v2/model_create_volume_data.go | 24 + v2/model_deployment_info.go | 22 + v2/model_error.go | 15 + v2/model_fs_type.go | 23 + v2/model_health.go | 20 + v2/model_licence.go | 27 + v2/model_log_format.go | 19 + v2/model_log_level.go | 21 + v2/model_namespace.go | 28 + v2/model_node.go | 38 + v2/model_policy_group.go | 30 + v2/model_policy_group_users.go | 17 + v2/model_update_authenticated_user_data.go | 18 + v2/model_update_cluster_data.go | 26 + v2/model_update_namespace_data.go | 18 + v2/model_update_node_data.go | 18 + v2/model_update_policy_group_data.go | 18 + v2/model_update_user_data.go | 22 + v2/model_update_volume_data.go | 21 + v2/model_user.go | 30 + v2/model_volume.go | 37 + v2/openapi.yaml | 2510 +++++++++ v2/response.go | 47 + 75 files changed, 16175 insertions(+) create mode 100644 v2/.gitignore create mode 100644 v2/.openapi-generator-ignore create mode 100644 v2/.openapi-generator/VERSION create mode 100644 v2/.travis.yml create mode 100644 v2/LICENCE create mode 100644 v2/Makefile create mode 100644 v2/README.md create mode 100644 v2/api/openapi.yaml create mode 100644 v2/api_default.go create mode 100644 v2/client.go create mode 100644 v2/configuration.go create mode 100644 v2/docs/AcceptedMessage.md create mode 100644 v2/docs/AttachVolumeData.md create mode 100644 v2/docs/AuthUserData.md create mode 100644 v2/docs/Cluster.md create mode 100644 v2/docs/CreateNamespaceData.md create mode 100644 v2/docs/CreatePolicyGroupData.md create mode 100644 v2/docs/CreateUserData.md create mode 100644 v2/docs/CreateVolumeData.md create mode 100644 v2/docs/DefaultApi.md create mode 100644 v2/docs/DeploymentInfo.md create mode 100644 v2/docs/Error.md create mode 100644 v2/docs/FsType.md create mode 100644 v2/docs/Health.md create mode 100644 v2/docs/Licence.md create mode 100644 v2/docs/LogFormat.md create mode 100644 v2/docs/LogLevel.md create mode 100644 v2/docs/Namespace.md create mode 100644 v2/docs/Node.md create mode 100644 v2/docs/PoliciesSpecs.md create mode 100644 v2/docs/PolicyGroup.md create mode 100644 v2/docs/PolicyGroupUsers.md create mode 100644 v2/docs/UpdateAuthenticatedUserData.md create mode 100644 v2/docs/UpdateClusterData.md create mode 100644 v2/docs/UpdateNamespaceData.md create mode 100644 v2/docs/UpdateNodeData.md create mode 100644 v2/docs/UpdatePolicyGroupData.md create mode 100644 v2/docs/UpdateUserData.md create mode 100644 v2/docs/UpdateVolumeData.md create mode 100644 v2/docs/User.md create mode 100644 v2/docs/Volume.md create mode 100644 v2/git_push.sh create mode 100644 v2/go.mod create mode 100644 v2/go.sum create mode 100644 v2/model__policies_specs.go create mode 100644 v2/model_accepted_message.go create mode 100644 v2/model_attach_volume_data.go create mode 100644 v2/model_auth_user_data.go create mode 100644 v2/model_cluster.go create mode 100644 v2/model_create_namespace_data.go create mode 100644 v2/model_create_policy_group_data.go create mode 100644 v2/model_create_user_data.go create mode 100644 v2/model_create_volume_data.go create mode 100644 v2/model_deployment_info.go create mode 100644 v2/model_error.go create mode 100644 v2/model_fs_type.go create mode 100644 v2/model_health.go create mode 100644 v2/model_licence.go create mode 100644 v2/model_log_format.go create mode 100644 v2/model_log_level.go create mode 100644 v2/model_namespace.go create mode 100644 v2/model_node.go create mode 100644 v2/model_policy_group.go create mode 100644 v2/model_policy_group_users.go create mode 100644 v2/model_update_authenticated_user_data.go create mode 100644 v2/model_update_cluster_data.go create mode 100644 v2/model_update_namespace_data.go create mode 100644 v2/model_update_node_data.go create mode 100644 v2/model_update_policy_group_data.go create mode 100644 v2/model_update_user_data.go create mode 100644 v2/model_update_volume_data.go create mode 100644 v2/model_user.go create mode 100644 v2/model_volume.go create mode 100644 v2/openapi.yaml create mode 100644 v2/response.go diff --git a/v2/.gitignore b/v2/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/v2/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/v2/.openapi-generator-ignore b/v2/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/v2/.openapi-generator/VERSION b/v2/.openapi-generator/VERSION new file mode 100644 index 0000000..bfbf77e --- /dev/null +++ b/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/v2/.travis.yml b/v2/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/v2/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/v2/LICENCE b/v2/LICENCE new file mode 100644 index 0000000..2ef4451 --- /dev/null +++ b/v2/LICENCE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2015-2020 StorageOS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/v2/Makefile b/v2/Makefile new file mode 100644 index 0000000..ac4b3d2 --- /dev/null +++ b/v2/Makefile @@ -0,0 +1,31 @@ +VERSION ?= 2.0.0-rc1 +GIT_USER_ID ?= storageos +GIT_REPO_ID ?= go-api + +.DEFAULT_GOAL:=help + +.PHONY: help customise + +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-13s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) + +build: generate customise ## Re-generates the API from openapi.yaml + +generate: + docker run --rm -v `pwd`:/local -u `id -u ${USER}`:`id -g ${USER}` \ + openapitools/openapi-generator-cli:latest generate \ + --strict-spec=true \ + --additional-properties enumClassPrefix=true \ + --additional-properties packageName=api \ + --additional-properties packageVersion=$(VERSION) \ + -i /local/openapi.yaml -g go -o /local + +customise: + sed -i 's/\[]map/map/ig' *.go + sed -i "s#module github.com/GIT_USER_ID/GIT_REPO_ID#module github.com/${GIT_USER_ID}/${GIT_REPO_ID}/v2#g" go.mod + +clean: + rm -f .openapi-generator-ignore .gitignore git_push.sh .travis.yml *.go go.mod go.sum + rm -rf .openapi-generator/ api/ docs/ + + diff --git a/v2/README.md b/v2/README.md new file mode 100644 index 0000000..17687f6 --- /dev/null +++ b/v2/README.md @@ -0,0 +1,131 @@ +# Go API client for api + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## 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: 2.0.0 +- Package version: 2.0.0-beta1 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://storageos.com](https://storageos.com) + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./api" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**AttachVolume**](docs/DefaultApi.md#attachvolume) | **Post** /namespaces/{namespaceID}/volumes/{id}/attach | Attach a volume to the given node +*DefaultApi* | [**AuthenticateUser**](docs/DefaultApi.md#authenticateuser) | **Post** /auth/login | Authenticate a user +*DefaultApi* | [**CreateNamespace**](docs/DefaultApi.md#createnamespace) | **Post** /namespaces | Create a new namespace +*DefaultApi* | [**CreatePolicyGroup**](docs/DefaultApi.md#createpolicygroup) | **Post** /policies | Create a new policy group +*DefaultApi* | [**CreateUser**](docs/DefaultApi.md#createuser) | **Post** /users | Create a new user +*DefaultApi* | [**CreateVolume**](docs/DefaultApi.md#createvolume) | **Post** /namespaces/{namespaceID}/volumes | Create a new Volume in the specified namespace +*DefaultApi* | [**DeleteAuthenticatedUser**](docs/DefaultApi.md#deleteauthenticateduser) | **Delete** /users/self | Delete the authenticated user +*DefaultApi* | [**DeleteAuthenticatedUserSessions**](docs/DefaultApi.md#deleteauthenticatedusersessions) | **Delete** /users/self/sessions | Invalidate the logged in user's sessions +*DefaultApi* | [**DeleteNamespace**](docs/DefaultApi.md#deletenamespace) | **Delete** /namespaces/{id} | Delete a namespace +*DefaultApi* | [**DeleteNode**](docs/DefaultApi.md#deletenode) | **Delete** /nodes/{id} | Delete a node +*DefaultApi* | [**DeletePolicyGroup**](docs/DefaultApi.md#deletepolicygroup) | **Delete** /policies/{id} | Delete a policy group +*DefaultApi* | [**DeleteSessions**](docs/DefaultApi.md#deletesessions) | **Delete** /users/{id}/sessions | Invalidate login sessions +*DefaultApi* | [**DeleteUser**](docs/DefaultApi.md#deleteuser) | **Delete** /users/{id} | Delete a user +*DefaultApi* | [**DeleteVolume**](docs/DefaultApi.md#deletevolume) | **Delete** /namespaces/{namespaceID}/volumes/{id} | Delete a volume +*DefaultApi* | [**DetachVolume**](docs/DefaultApi.md#detachvolume) | **Delete** /namespaces/{namespaceID}/volumes/{id}/attach | Detach the given volume +*DefaultApi* | [**GetAuthenticatedUser**](docs/DefaultApi.md#getauthenticateduser) | **Get** /users/self | Get the currently authenticated user's information +*DefaultApi* | [**GetCluster**](docs/DefaultApi.md#getcluster) | **Get** /cluster | Retrieves the cluster's global configuration settings +*DefaultApi* | [**GetDiagnostics**](docs/DefaultApi.md#getdiagnostics) | **Get** /diagnostics | Retrieves a diagnostics bundle from the target node +*DefaultApi* | [**GetNamespace**](docs/DefaultApi.md#getnamespace) | **Get** /namespaces/{id} | Fetch a namespace +*DefaultApi* | [**GetNode**](docs/DefaultApi.md#getnode) | **Get** /nodes/{id} | Fetch a node +*DefaultApi* | [**GetPolicyGroup**](docs/DefaultApi.md#getpolicygroup) | **Get** /policies/{id} | Fetch a policy group +*DefaultApi* | [**GetUser**](docs/DefaultApi.md#getuser) | **Get** /users/{id} | Fetch a user +*DefaultApi* | [**GetVolume**](docs/DefaultApi.md#getvolume) | **Get** /namespaces/{namespaceID}/volumes/{id} | Fetch a volume +*DefaultApi* | [**ListNamespaces**](docs/DefaultApi.md#listnamespaces) | **Get** /namespaces | Fetch the list of namespaces +*DefaultApi* | [**ListNodes**](docs/DefaultApi.md#listnodes) | **Get** /nodes | Fetch the list of nodes +*DefaultApi* | [**ListPolicyGroups**](docs/DefaultApi.md#listpolicygroups) | **Get** /policies | Fetch the list of policy groups +*DefaultApi* | [**ListUsers**](docs/DefaultApi.md#listusers) | **Get** /users | Fetch the list of users +*DefaultApi* | [**ListVolumes**](docs/DefaultApi.md#listvolumes) | **Get** /namespaces/{namespaceID}/volumes | Fetch the list of volumes in the given namespace +*DefaultApi* | [**RefreshJwt**](docs/DefaultApi.md#refreshjwt) | **Post** /auth/refresh | Refresh the JWT +*DefaultApi* | [**Spec**](docs/DefaultApi.md#spec) | **Get** /openapi | Serves this openapi spec file +*DefaultApi* | [**UpdateAuthenticatedUser**](docs/DefaultApi.md#updateauthenticateduser) | **Put** /users/self | Update the authenticated user's information +*DefaultApi* | [**UpdateCluster**](docs/DefaultApi.md#updatecluster) | **Put** /cluster | Update the cluster's global configuration settings +*DefaultApi* | [**UpdateNamespace**](docs/DefaultApi.md#updatenamespace) | **Put** /namespaces/{id} | Update a namespace +*DefaultApi* | [**UpdateNode**](docs/DefaultApi.md#updatenode) | **Put** /nodes/{id} | Update a node +*DefaultApi* | [**UpdatePolicyGroup**](docs/DefaultApi.md#updatepolicygroup) | **Put** /policies/{id} | Update a policy group +*DefaultApi* | [**UpdateUser**](docs/DefaultApi.md#updateuser) | **Put** /users/{id} | Update a user +*DefaultApi* | [**UpdateVolume**](docs/DefaultApi.md#updatevolume) | **Put** /namespaces/{namespaceID}/volumes/{id} | Update a volume + + +## Documentation For Models + + - [AcceptedMessage](docs/AcceptedMessage.md) + - [AttachVolumeData](docs/AttachVolumeData.md) + - [AuthUserData](docs/AuthUserData.md) + - [Cluster](docs/Cluster.md) + - [CreateNamespaceData](docs/CreateNamespaceData.md) + - [CreatePolicyGroupData](docs/CreatePolicyGroupData.md) + - [CreateUserData](docs/CreateUserData.md) + - [CreateVolumeData](docs/CreateVolumeData.md) + - [DeploymentInfo](docs/DeploymentInfo.md) + - [Error](docs/Error.md) + - [FsType](docs/FsType.md) + - [Health](docs/Health.md) + - [Licence](docs/Licence.md) + - [LogFormat](docs/LogFormat.md) + - [LogLevel](docs/LogLevel.md) + - [Namespace](docs/Namespace.md) + - [Node](docs/Node.md) + - [PoliciesSpecs](docs/PoliciesSpecs.md) + - [PolicyGroup](docs/PolicyGroup.md) + - [PolicyGroupUsers](docs/PolicyGroupUsers.md) + - [UpdateAuthenticatedUserData](docs/UpdateAuthenticatedUserData.md) + - [UpdateClusterData](docs/UpdateClusterData.md) + - [UpdateNamespaceData](docs/UpdateNamespaceData.md) + - [UpdateNodeData](docs/UpdateNodeData.md) + - [UpdatePolicyGroupData](docs/UpdatePolicyGroupData.md) + - [UpdateUserData](docs/UpdateUserData.md) + - [UpdateVolumeData](docs/UpdateVolumeData.md) + - [User](docs/User.md) + - [Volume](docs/Volume.md) + + +## Documentation For Authorization + + + +## jwt + +- **Type**: HTTP basic authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + + + +## Author + +info@storageos.com + diff --git a/v2/api/openapi.yaml b/v2/api/openapi.yaml new file mode 100644 index 0000000..57fddc0 --- /dev/null +++ b/v2/api/openapi.yaml @@ -0,0 +1,4813 @@ +openapi: 3.0.2 +info: + contact: + email: info@storageos.com + name: StorageOS + url: https://storageos.com + title: StorageOS API + version: 2.0.0 +externalDocs: + description: The latest StorageOS user documentation + url: https://docs.storageos.com/ +servers: +- url: /v2 +paths: + /auth/login: + post: + description: Generate a new JWT token for a user. + operationId: authenticateUser + requestBody: + $ref: '#/components/requestBodies/AuthUserData' + content: + application/json: + schema: + example: + username: admin + password: supersecret + properties: + username: + type: string + password: + format: password + type: string + required: + - password + - username + title: AuthUserData + type: object + description: The credentials to use for authentication. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Successfully authenticated the returned user. + headers: + Authorization: + description: | + The JWT token - this header should be sent to the server to perform an authenticated request. + explode: false + schema: + type: string + style: simple + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + summary: Authenticate a user + /auth/refresh: + post: + description: Obtain a fresh token with an updated expiry deadline. + operationId: refreshJwt + responses: + "200": + description: Refresh was successful + headers: + Authorization: + description: The new JWT token. + explode: false + schema: + type: string + style: simple + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Refresh the JWT + /users: + get: + description: Fetch the list of users of the cluster. + operationId: listUsers + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UserList' + description: A list of cluster users. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch the list of users + post: + description: Create a new user in the cluster - only administrators can create + new users. + operationId: createUser + requestBody: + $ref: '#/components/requestBodies/CreateUserData' + content: + application/json: + schema: + example: + password: turtlesaregreat + groups: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + isAdmin: true + username: admin + properties: + username: + example: admin + type: string + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + isAdmin: + default: false + description: | + If true, this user is an administrator of the cluster. + Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + example: true + type: boolean + groups: + default: [] + description: | + Defines a set of policy group IDs this user is a member of. + Policy groups can be used to logically group users and apply authorisation policies to all members. + example: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + items: + $ref: '#/components/schemas/PolicyGroupID' + nullable: true + type: array + required: + - password + - username + title: CreateUserData + type: object + description: Data required to create a new user in the cluster. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The account was successfully created + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "409": + content: + application/json: + example: + error: already exists + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote uses an identifier that already exists. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Create a new user + /users/{id}: + delete: + description: | + Remove the user identified by id. + This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + operationId: deleteUser + parameters: + - description: ID of a user + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/UserID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + responses: + "200": + description: The user was successfully deleted. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete a user + get: + description: Fetch the user identified by id. + operationId: getUser + parameters: + - description: ID of a user + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/UserID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The user information. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch a user + put: + description: | + Update the user identified by id. + This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + operationId: updateUser + parameters: + - description: ID of a user + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/UserID' + style: simple + requestBody: + $ref: '#/components/requestBodies/UpdateUserData' + content: + application/json: + schema: + example: + password: turtlesaregreat + groups: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + isAdmin: true + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + isAdmin: + default: false + description: | + If true, this user is an administrator of the cluster. + Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + example: true + type: boolean + groups: + default: [] + description: | + Defines a set of policy group IDs this user is a member of. + Policy groups can be used to logically group users and apply authorisation policies to all members. + example: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + items: + $ref: '#/components/schemas/PolicyGroupID' + nullable: true + type: array + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateUserData + type: object + description: The new User data to store. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The account was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update a user + /users/{id}/sessions: + delete: + description: | + Invalidates active JWTs on a per-user basis, specified by id. + This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + operationId: deleteSessions + parameters: + - description: ID of a user + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/UserID' + style: simple + responses: + "200": + description: The users current session was successfully invalidated. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Invalidate login sessions + /users/self: + delete: + description: Remove the authenticated user from the cluster. + operationId: deleteAuthenticatedUser + parameters: + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + responses: + "200": + description: The authenticated user was successfully deleted. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete the authenticated user + get: + description: Fetch authenticated user's information. + operationId: getAuthenticatedUser + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The authenticated user's information. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Get the currently authenticated user's information + put: + description: Update the authenticated user. + operationId: updateAuthenticatedUser + requestBody: + $ref: '#/components/requestBodies/UpdateAuthenticatedUserData' + content: + application/json: + schema: + example: + password: turtlesaregreat + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateAuthenticatedUserData + type: object + description: The new authenticated user's data. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The account was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update the authenticated user's information + /users/self/sessions: + delete: + description: Invalidates logged in user's active JWTs. + operationId: deleteAuthenticatedUserSessions + responses: + "200": + description: The authenticated user's sessions have been invalidated. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Invalidate the logged in user's sessions + /namespaces: + get: + description: Fetch the list of namespaces in the cluster. + operationId: listNamespaces + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NamespaceList' + description: A list of cluster namespaces. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch the list of namespaces + post: + description: Create a new namespace in the cluster - only administrators can + create new namespaces. + operationId: createNamespace + requestBody: + $ref: '#/components/requestBodies/CreateNamespaceData' + content: + application/json: + schema: + example: + name: dev + labels: + env: prod + rack: db-1 + properties: + name: + description: | + The name of the namespace shown in the CLI and UI + example: dev + pattern: ^[a-z0-9.\-]{1,253}$ + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + title: CreateNamespaceData + type: object + description: Data required to create a new namespace in the cluster. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + description: The namespace was successfully created + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "409": + content: + application/json: + example: + error: already exists + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote uses an identifier that already exists. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Create a new namespace + /namespaces/{id}: + delete: + description: Remove the namespace identified by id. + operationId: deleteNamespace + parameters: + - description: ID of a namespace + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + responses: + "200": + description: The namespace was successfully deleted. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete a namespace + get: + description: Fetch the namespace identified by id. + operationId: getNamespace + parameters: + - description: ID of a namespace + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + description: The namespace information. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch a namespace + put: + description: Update the namespace identified by id. + operationId: updateNamespace + parameters: + - description: ID of a namespace + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + requestBody: + $ref: '#/components/requestBodies/UpdateNamespaceData' + content: + application/json: + schema: + example: + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateNamespaceData + type: object + description: The new namespace data to store. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + description: The namespace was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update a namespace + /nodes: + get: + description: Fetch the list of nodes of the cluster. + operationId: listNodes + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NodeList' + description: A list of cluster nodes. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch the list of nodes + /nodes/{id}: + delete: + description: | + Remove the node identified by id. + A node can only be deleted if it is currently offline. + operationId: deleteNode + parameters: + - description: ID of a node + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NodeID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + - description: | + Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. + The URL parameter value overrides the "async-max" header value, if any. + The value of this header defines the timeout duration for the request, it must be set to a valid duration string. + A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + We reject negative or nil duration values. + explode: true + in: query + name: async-max + required: false + schema: + type: string + style: form + responses: + "200": + description: The node was successfully deleted. + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/AcceptedMessage' + description: | + An aynchronous request has been accepted + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: node not offline + schema: + $ref: '#/components/schemas/Error' + description: | + The request attempted to delete a node that is not currently offline. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete a node + get: + description: Fetch the node identified by id. + operationId: getNode + parameters: + - description: ID of a node + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NodeID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Node' + description: The node information. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch a node + put: + description: Update the node identified by id. + operationId: updateNode + parameters: + - description: ID of a node + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NodeID' + style: simple + requestBody: + $ref: '#/components/requestBodies/UpdateNodeData' + content: + application/json: + schema: + example: + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateNodeData + type: object + description: The new node data to store. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Node' + description: The node was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update a node + /policies: + get: + description: Fetch the list of policy groups in the cluster. + operationId: listPolicyGroups + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyGroupList' + description: A list of cluster policy groups. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch the list of policy groups + post: + description: | + Create a new policy group in the cluster - only administrators can create new policy groups. + operationId: createPolicyGroup + requestBody: + $ref: '#/components/requestBodies/CreatePolicyGroupData' + content: + application/json: + schema: + example: + specs: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + name: dev-users + properties: + name: + example: dev-users + type: string + specs: + default: [] + description: A set of authorisation policies to apply to the policy + group. + example: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + items: + $ref: '#/components/schemas/_policies_specs' + nullable: true + type: array + title: CreatePolicyGroupData + type: object + description: Data required to create a new policy group in the cluster. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyGroup' + description: The policy group was successfully created + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "409": + content: + application/json: + example: + error: already exists + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote uses an identifier that already exists. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Create a new policy group + /policies/{id}: + delete: + description: Remove the policy group identified by id. + operationId: deletePolicyGroup + parameters: + - description: ID of a policy group + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/PolicyGroupID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + responses: + "200": + description: The policy group was successfully deleted. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete a policy group + get: + description: Fetch the policy group identified by id. + operationId: getPolicyGroup + parameters: + - description: ID of a policy group + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/PolicyGroupID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyGroup' + description: The policy group information. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch a policy group + put: + description: Update the policy group identified by id. + operationId: updatePolicyGroup + parameters: + - description: ID of a policy group + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/PolicyGroupID' + style: simple + requestBody: + $ref: '#/components/requestBodies/UpdatePolicyGroupData' + content: + application/json: + schema: + example: + specs: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + specs: + default: [] + description: A set of authorisation policies to apply to the policy + group. + example: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + items: + $ref: '#/components/schemas/_policies_specs' + nullable: true + type: array + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdatePolicyGroupData + type: object + description: The new policy group data to store. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyGroup' + description: The policy group was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update a policy group + /namespaces/{namespaceID}/volumes: + get: + description: Fetch the list of volumes in the cluster. + operationId: listVolumes + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeList' + description: A list of the namespace's volumes. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch the list of volumes in the given namespace + post: + description: Create a new volume in the given namespace + operationId: createVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: | + Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. + The URL parameter value overrides the "async-max" header value, if any. + The value of this header defines the timeout duration for the request, it must be set to a valid duration string. + A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + We reject negative or nil duration values. + explode: true + in: query + name: async-max + required: false + schema: + type: string + style: form + requestBody: + $ref: '#/components/requestBodies/CreateVolumeData' + content: + application/json: + schema: + example: + namespaceID: c5666b58-b805-4215-ab4a-cb094948ccc6 + name: data + description: This volume contains the data for my app + fsType: ext4 + labels: + env: prod + rack: db-1 + sizeBytes: 5000 + properties: + namespaceID: + description: | + A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + name: + description: | + The name of the volume shown in the CLI and UI + example: data + pattern: ^[a-z0-9.\-]{1,253}$ + type: string + fsType: + $ref: '#/components/schemas/FsType' + description: + example: This volume contains the data for my app + type: string + sizeBytes: + description: | + A volume's size in bytes + example: 5000 + minimum: 0 + type: uint64 + required: + - fsType + - name + - namespaceID + - sizeBytes + title: CreateVolumeData + type: object + description: Data required to create a new volume in the cluster. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Volume' + description: The volume was successfully created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/AcceptedMessage' + description: | + An aynchronous request has been accepted + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "409": + content: + application/json: + example: + error: already exists + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote uses an identifier that already exists. + "451": + content: + application/json: + example: + error: insufficient allowed capacity (bytes) (used 53687091200, allowed + 53687091200, requested 5000000) + schema: + $ref: '#/components/schemas/Error' + description: | + The requested operation failed because your storageOS licence does not allow it, either create an account for a free licence or buy a professional licence. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Create a new Volume in the specified namespace + /namespaces/{namespaceID}/volumes/{id}: + delete: + description: Remove the volume identified by id. + operationId: deleteVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: ID of a Volume + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/VolumeID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + - description: | + Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. + The URL parameter value overrides the "async-max" header value, if any. + The value of this header defines the timeout duration for the request, it must be set to a valid duration string. + A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + We reject negative or nil duration values. + explode: true + in: query + name: async-max + required: false + schema: + type: string + style: form + responses: + "200": + description: The volume was successfully deleted. + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/AcceptedMessage' + description: | + An aynchronous request has been accepted + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "422": + content: + application/json: + example: + error: invalid state for operation (currently "deleted") + schema: + $ref: '#/components/schemas/Error' + description: | + An action was requested that cannot be performed on the entity in it's current state. + As an example, this error might be returned when trying to delete a currently mounted volume. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Delete a volume + get: + description: Fetch the volume identified by id. + operationId: getVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: ID of a Volume + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/VolumeID' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Volume' + description: The volume information. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Fetch a volume + put: + description: Update the volume identified by id. + operationId: updateVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: ID of a Volume + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/VolumeID' + style: simple + requestBody: + $ref: '#/components/requestBodies/UpdateVolumeData' + content: + application/json: + schema: + example: + name: new-volume-name + description: This volume contains the data for my app + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + name: + description: | + desired new volume name + example: new-volume-name + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + description: + example: This volume contains the data for my app + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateVolumeData + type: object + description: update a volume to a desired state. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Volume' + description: The volume was successfully updated + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "451": + content: + application/json: + example: + error: insufficient allowed capacity (bytes) (used 53687091200, allowed + 53687091200, requested 5000000) + schema: + $ref: '#/components/schemas/Error' + description: | + The requested operation failed because your storageOS licence does not allow it, either create an account for a free licence or buy a professional licence. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update a volume + /namespaces/{namespaceID}/volumes/{id}/attach: + delete: + description: Detach the volume identified by id. + operationId: detachVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: ID of a Volume + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/VolumeID' + style: simple + - description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + - description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + responses: + "200": + description: The volume was successfully detached. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "422": + content: + application/json: + example: + error: invalid state for operation (currently "deleted") + schema: + $ref: '#/components/schemas/Error' + description: | + An action was requested that cannot be performed on the entity in it's current state. + As an example, this error might be returned when trying to delete a currently mounted volume. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Detach the given volume + post: + description: Attach the volume identified by id to the node identified in the + request's body. + operationId: attachVolume + parameters: + - description: ID of a Namespace + explode: false + in: path + name: namespaceID + required: true + schema: + $ref: '#/components/schemas/NamespaceID' + style: simple + - description: ID of a Volume + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/VolumeID' + style: simple + requestBody: + $ref: '#/components/requestBodies/AttachVolumeData' + content: + application/json: + schema: + example: + nodeID: c5666b58-b805-4215-ab4a-cb094948ccc6 + properties: + nodeID: + description: | + A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + title: AttachVolumeData + type: object + description: Node ID to which the volume will be attached. + required: true + responses: + "200": + description: The volume was successfully attached. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "404": + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + "409": + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + "422": + content: + application/json: + example: + error: invalid state for operation (currently "deleted") + schema: + $ref: '#/components/schemas/Error' + description: | + An action was requested that cannot be performed on the entity in it's current state. + As an example, this error might be returned when trying to delete a currently mounted volume. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Attach a volume to the given node + /cluster: + get: + description: Retrieves the current global configuration settings in use by the + cluster. + operationId: getCluster + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Cluster' + description: The cluster-wide configuration information. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Retrieves the cluster's global configuration settings + put: + description: Update the global configuration settings to use for the cluster. + operationId: updateCluster + requestBody: + $ref: '#/components/requestBodies/UpdateClusterData' + content: + application/json: + schema: + example: + licenceKey: licenceKey + disableVersionCheck: false + disableCrashReporting: false + logFormat: json + logLevel: debug + disableTelemetry: false + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + licenceKey: + description: | + A StorageOS product licence key, used to register a cluster. The format of this type is opaque and may change. + If this field is empty we assume that the called does not want to update the cluster's licence, and do not perform any operation. + type: string + disableTelemetry: + default: false + description: | + Disables collection of telemetry data across the cluster. + example: false + type: boolean + disableCrashReporting: + default: false + description: | + Disables collection of reports for any fatal crashes across the cluster. + example: false + type: boolean + disableVersionCheck: + default: false + description: | + Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. + example: false + type: boolean + logLevel: + $ref: '#/components/schemas/LogLevel' + logFormat: + $ref: '#/components/schemas/LogFormat' + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateClusterData + type: object + description: The new cluster-wide configuration settings to apply. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Cluster' + description: The cluster was successfully updated. + "400": + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "412": + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Update the cluster's global configuration settings + /diagnostics: + get: + description: | + Requests that the target node gathers detailed information about the state of the cluster, using it to then build and return a bundle which can be used for troubleshooting. + The request will only be served when the authenticated user is an administrator. + The node will attempt to gather information about its local state, cluster-wide state and local state of other nodes in the cluster. If the cluster is unhealthy this may cause a slower response. + operationId: getDiagnostics + responses: + "200": + content: + application/gzip: + schema: + format: binary + type: string + description: | + A diagnostics bundle was successfully built and returned. + "401": + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + "403": + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + security: + - jwt: [] + summary: Retrieves a diagnostics bundle from the target node + /openapi: + get: + description: Serves this openapi spec file + operationId: spec + responses: + "200": + content: + text/yaml: + schema: + $ref: '#/components/schemas/OpenAPISpec' + description: The openapi spec file has been served + summary: Serves this openapi spec file +components: + parameters: + ObjectVersion: + description: | + This value is used to perform a conditional delete of the entity. + If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + explode: true + in: query + name: version + required: true + schema: + $ref: '#/components/schemas/Version' + style: form + IgnoreVersion: + description: | + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + explode: true + in: query + name: ignore-version + required: false + schema: + $ref: '#/components/schemas/IgnoreVersion' + style: form + AsyncHeader: + description: | + Optional header which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. + The value of this header defines the timeout duration for the request, it must be set to a valid duration string. + A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + We reject negative or nil duration values. + example: async-max:20s + explode: false + in: header + name: async-max + required: false + schema: + type: string + style: simple + AsyncParam: + description: | + Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. + The URL parameter value overrides the "async-max" header value, if any. + The value of this header defines the timeout duration for the request, it must be set to a valid duration string. + A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + We reject negative or nil duration values. + explode: true + in: query + name: async-max + required: false + schema: + type: string + style: form + requestBodies: + CreateVolumeData: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVolumeData' + required: true + UpdateVolumeData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVolumeData' + required: true + UpdateUserData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserData' + required: true + CreateUserData: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserData' + required: true + CreatePolicyGroupData: + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePolicyGroupData' + required: true + UpdatePolicyGroupData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePolicyGroupData' + required: true + UpdateAuthenticatedUserData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAuthenticatedUserData' + required: true + AuthUserData: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthUserData' + required: true + UpdateNamespaceData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateNamespaceData' + required: true + UpdateNodeData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateNodeData' + required: true + UpdateClusterData: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateClusterData' + required: true + AttachVolumeData: + content: + application/json: + schema: + $ref: '#/components/schemas/AttachVolumeData' + required: true + CreateNamespaceData: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateNamespaceData' + required: true + responses: + BadRequest: + content: + application/json: + example: + error: a short description of the validation failure + schema: + $ref: '#/components/schemas/Error' + description: The request does not conform to the API specification. + ServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The request caused an internal server error and should be retried. + Check the health of the node/cluster and if the error persists, contact support. + StoreError: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: | + The server is currently unable to handle the request due to a temporary store failure. + Check the health of the node/cluster and if the error persists, contact support. + LicenceRestricted: + content: + application/json: + example: + error: insufficient allowed capacity (bytes) (used 53687091200, allowed + 53687091200, requested 5000000) + schema: + $ref: '#/components/schemas/Error' + description: | + The requested operation failed because your storageOS licence does not allow it, either create an account for a free licence or buy a professional licence. + Unauthorised: + content: + application/json: + example: + error: authentication required + schema: + $ref: '#/components/schemas/Error' + description: | + The requested endpoint requires authentication - you must log in first. + If attempting to log in, your credentials were not recognised. + Forbidden: + content: + application/json: + example: + error: unauthorised + schema: + $ref: '#/components/schemas/Error' + description: | + The authenticated user does not have permission to perform the requested action. + NotFound: + content: + application/json: + example: + error: not found + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced resource does not exist. + StaleWrite: + content: + application/json: + example: + error: attempting to write stale object + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote has been concurrently updated by another request - the submitted entity data has been replaced. + The caller should fetch the entity again, check the actions are still required and resubmit the request with the new entity version field. + InvalidStateTransition: + content: + application/json: + example: + error: invalid state for operation (currently "deleted") + schema: + $ref: '#/components/schemas/Error' + description: | + An action was requested that cannot be performed on the entity in it's current state. + As an example, this error might be returned when trying to delete a currently mounted volume. + AlreadyExists: + content: + application/json: + example: + error: already exists + schema: + $ref: '#/components/schemas/Error' + description: | + The entity to be wrote uses an identifier that already exists. + InUse: + content: + application/json: + example: + error: in use + schema: + $ref: '#/components/schemas/Error' + description: | + A referenced entity is currently in use. + Accepted: + content: + application/json: + schema: + $ref: '#/components/schemas/AcceptedMessage' + description: | + An aynchronous request has been accepted + schemas: + OpenAPISpec: + description: | + Serves this openapi specification file. + readOnly: true + type: string + Error: + example: + error: A short description of the error + properties: + error: + type: string + required: + - error + type: object + Version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + IgnoreVersion: + default: false + description: | + Ignoring the entity version constraints. + If set to true this value indicates that the user wants to ignore entity version constraints, thereby "forcing" the operation. + example: true + type: boolean + ExpiresAt: + description: | + The time after which a licence will no longer be valid + This timestamp is set when the licence is created. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + CreatedAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + UpdatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + FsType: + description: | + The file system type of a volume. "block" is a raw block device (no filesystem). + enum: + - ext2 + - ext3 + - ext4 + - xfs + - btrfs + - block + example: ext4 + type: string + Health: + description: | + The operational health of an entity + enum: + - online + - offline + - unknown + example: online + readOnly: true + type: string + Labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + LogLevel: + default: info + description: | + This setting determines the log level for nodes across the cluster to use when recording entries in the log. All entries below the specified log level are discarded, where "error" is the highest log level and "debug" is the lowest. + This setting is only checked by nodes on startup. Changing this setting will not affect the behaviour of nodes that are already operational. + enum: + - debug + - info + - warn + - error + example: debug + type: string + LogFormat: + default: default + description: | + This setting determines the format nodes in the cluster will use for log entries. + This setting is only checked by nodes on startup. Changing this setting will not affect the behaviour of nodes that are already operational. + enum: + - default + - json + example: json + type: string + ClusterID: + description: | + A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + NodeID: + description: | + A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + VolumeID: + description: | + A unique identifier for a volume. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + DeploymentID: + description: | + A unique identifier for a volume deployment. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + NamespaceID: + description: | + A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + UserID: + description: | + A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + PolicyGroupID: + description: | + A unique identifier for a policy group. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + Cluster: + example: + disableVersionCheck: false + licence: + clusterCapacityBytes: 1000000 + kind: basic + clusterID: c5666b58-b805-4215-ab4a-cb094948ccc6 + expiresAt: 2019-03-10T13:42:42Z + customerName: Desmond + createdAt: 2019-03-10T13:42:42Z + disableCrashReporting: false + logFormat: json + logLevel: debug + disableTelemetry: false + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + version: NDI0MjQyNDI0MjQyNDI0MjQy + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + licence: + $ref: '#/components/schemas/Licence' + disableTelemetry: + default: false + description: Disables collection of telemetry data across the cluster. + example: false + type: boolean + disableCrashReporting: + default: false + description: | + Disables collection of reports for any fatal crashes across the cluster. + example: false + type: boolean + disableVersionCheck: + default: false + description: | + Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. + example: false + type: boolean + logLevel: + $ref: '#/components/schemas/LogLevel' + logFormat: + $ref: '#/components/schemas/LogFormat' + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + User: + example: + createdAt: 2019-03-10T13:42:42Z + groups: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + isAdmin: true + version: NDI0MjQyNDI0MjQyNDI0MjQy + username: admin + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + username: + example: admin + type: string + isAdmin: + default: false + description: | + If true, this user is an administrator of the cluster. + Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + example: true + type: boolean + groups: + default: [] + description: | + Defines a set of policy group IDs this user is a member of. + Policy groups can be used to logically group users and apply authorisation policies to all members. + example: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + items: + $ref: '#/components/schemas/PolicyGroupID' + nullable: true + type: array + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + Volume: + example: + replicas: + - inode: 1223 + syncing: true + health: online + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + nodeID: c5666b58-b805-4215-ab4a-cb094948ccc6 + - inode: 1223 + syncing: true + health: online + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + nodeID: c5666b58-b805-4215-ab4a-cb094948ccc6 + description: This volume contains the data for my app + fsType: ext4 + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + master: "" + sizeBytes: 5000 + attachedOn: "" + inode: 42 + createdAt: 2019-03-10T13:42:42Z + namespaceID: "" + name: app-data + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a volume. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + name: + example: app-data + type: string + description: + example: This volume contains the data for my app + type: string + attachedOn: + allOf: + - $ref: '#/components/schemas/NodeID' + readOnly: true + namespaceID: + allOf: + - $ref: '#/components/schemas/NamespaceID' + readOnly: true + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + fsType: + $ref: '#/components/schemas/FsType' + inode: + example: 42 + readOnly: true + type: uint32 + master: + allOf: + - $ref: '#/components/schemas/DeploymentInfo' + readOnly: true + replicas: + default: [] + items: + $ref: '#/components/schemas/DeploymentInfo' + nullable: true + readOnly: true + type: array + sizeBytes: + description: | + A volume's size in bytes + example: 5000 + minimum: 0 + type: uint64 + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + DeploymentInfo: + example: + inode: 1223 + syncing: true + health: online + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + nodeID: c5666b58-b805-4215-ab4a-cb094948ccc6 + properties: + id: + description: | + A unique identifier for a volume deployment. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + nodeID: + description: | + A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + inode: + example: 1223 + readOnly: true + type: uint32 + health: + $ref: '#/components/schemas/Health' + syncing: + description: | + indicates if a volume is undergoing data synchronization operations + type: boolean + type: object + Node: + example: + createdAt: 2019-03-10T13:42:42Z + gossipEndpoint: '["192.0.2.1:5711"]' + ioEndpoint: '["192.0.2.1:5703"]' + name: db1.lcy.storageos.network + health: online + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + supervisorEndpoint: '["192.0.2.1:5704"]' + clusteringEndpoint: '["192.0.2.1:5710"]' + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + name: + description: | + The hostname of the node. + This value is set by the node each time it joins the StorageOS cluster. + example: db1.lcy.storageos.network + readOnly: true + type: string + health: + $ref: '#/components/schemas/Health' + ioEndpoint: + description: | + Endpoint at which we operate our dataplane's dfs service. (used for IO operations) + This value is set on startup by the corresponding environment variable (IO_ADVERTISE_ADDRESS) + example: '["192.0.2.1:5703"]' + readOnly: true + type: string + supervisorEndpoint: + description: | + Endpoint at which we operate our dataplane's supervisor service (used for sync). + This value is set on startup by the corresponding environment variable (SUPERVISOR_ADVERTISE_ADDRESS) + example: '["192.0.2.1:5704"]' + readOnly: true + type: string + gossipEndpoint: + description: | + Endpoint at which we operate our health checking service. + This value is set on startup by the corresponding environment variable (GOSSIP_ADVERTISE_ADDRESS) + example: '["192.0.2.1:5711"]' + readOnly: true + type: string + clusteringEndpoint: + description: | + Endpoint at which we operate our clustering GRPC API. + This value is set on startup by the corresponding environment variable (INTERNAL_API_ADVERTISE_ADDRESS) + example: '["192.0.2.1:5710"]' + readOnly: true + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + Namespace: + example: + createdAt: 2019-03-10T13:42:42Z + name: dev + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + name: + example: dev + readOnly: true + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + PolicyGroup: + example: + specs: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + createdAt: 2019-03-10T13:42:42Z + name: dev-users + id: c5666b58-b805-4215-ab4a-cb094948ccc6 + version: NDI0MjQyNDI0MjQyNDI0MjQy + users: + - id: 82f297ae-8381-4c09-b9a1-8401c83c418d + username: user_a + - id: f4bb11d6-594a-4f21-9d1c-d49711a0453e + username: user_b + - id: 30d3a4dc-971b-4f3e-9b89-5da6fea383ce + username: user_c + updatedAt: 2019-03-29T23:13:13Z + properties: + id: + description: | + A unique identifier for a policy group. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + name: + example: dev-users + type: string + users: + description: The list of user IDs which this policy group governs. + example: + - id: 82f297ae-8381-4c09-b9a1-8401c83c418d + username: user_a + - id: f4bb11d6-594a-4f21-9d1c-d49711a0453e + username: user_b + - id: 30d3a4dc-971b-4f3e-9b89-5da6fea383ce + username: user_c + items: + $ref: '#/components/schemas/PolicyGroup_users' + readOnly: true + type: array + specs: + default: [] + description: A set of authorisation policies to apply to the policy group. + example: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + items: + $ref: '#/components/schemas/_policies_specs' + nullable: true + type: array + createdAt: + description: | + The time the entity was created. + This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + updatedAt: + description: | + The time the entity was last updated. + This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. + This value is for the user's informative purposes only, and correctness is not required. + String format is RFC3339. + example: 2019-03-29T23:13:13Z + format: date-time + readOnly: true + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + type: object + Licence: + description: | + A representation of a cluster's licence properties + example: + clusterCapacityBytes: 1000000 + kind: basic + clusterID: c5666b58-b805-4215-ab4a-cb094948ccc6 + expiresAt: 2019-03-10T13:42:42Z + customerName: Desmond + properties: + clusterID: + description: | + A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + expiresAt: + description: | + The time after which a licence will no longer be valid + This timestamp is set when the licence is created. + String format is RFC3339. + example: 2019-03-10T13:42:42Z + format: date-time + readOnly: true + type: string + clusterCapacityBytes: + description: | + The allowed provisioning capacity in bytes + This value if for the cluster, if provisioning a volume brings the cluster's total provisioned capacity above it the request will fail + example: 1000000 + minimum: 0 + type: uint64 + kind: + description: | + Denotes which category the licence belongs to + example: basic + type: string + customerName: + description: | + A user friendly reference to the customer + example: Desmond + type: string + type: object + AcceptedMessage: + example: + msg: 'asynchronous request accepted with timeout: 10s' + properties: + msg: + type: string + type: object + UserList: + items: + $ref: '#/components/schemas/User' + type: array + NamespaceList: + items: + $ref: '#/components/schemas/Namespace' + type: array + NodeList: + items: + $ref: '#/components/schemas/Node' + type: array + PolicyGroupList: + items: + $ref: '#/components/schemas/PolicyGroup' + type: array + VolumeList: + items: + $ref: '#/components/schemas/Volume' + type: array + AuthUserData: + example: + username: admin + password: supersecret + properties: + username: + type: string + password: + format: password + type: string + required: + - password + - username + title: AuthUserData + type: object + CreateUserData: + example: + password: turtlesaregreat + groups: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + isAdmin: true + username: admin + properties: + username: + example: admin + type: string + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + isAdmin: + default: false + description: | + If true, this user is an administrator of the cluster. + Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + example: true + type: boolean + groups: + default: [] + description: | + Defines a set of policy group IDs this user is a member of. + Policy groups can be used to logically group users and apply authorisation policies to all members. + example: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + items: + $ref: '#/components/schemas/PolicyGroupID' + nullable: true + type: array + required: + - password + - username + title: CreateUserData + type: object + UpdateUserData: + example: + password: turtlesaregreat + groups: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + isAdmin: true + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + isAdmin: + default: false + description: | + If true, this user is an administrator of the cluster. + Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + example: true + type: boolean + groups: + default: [] + description: | + Defines a set of policy group IDs this user is a member of. + Policy groups can be used to logically group users and apply authorisation policies to all members. + example: + - 24d5db6f-9738-4f17-a257-b9dd41a35309 + - 4223b453-4d47-49d5-960f-23fc7a8153ba + items: + $ref: '#/components/schemas/PolicyGroupID' + nullable: true + type: array + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateUserData + type: object + UpdateAuthenticatedUserData: + example: + password: turtlesaregreat + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + password: + default: unchanged + description: If not present, the existing password is not changed + example: turtlesaregreat + format: password + type: string + writeOnly: true + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateAuthenticatedUserData + type: object + CreateNamespaceData: + example: + name: dev + labels: + env: prod + rack: db-1 + properties: + name: + description: | + The name of the namespace shown in the CLI and UI + example: dev + pattern: ^[a-z0-9.\-]{1,253}$ + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + title: CreateNamespaceData + type: object + UpdateNamespaceData: + example: + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateNamespaceData + type: object + UpdateNodeData: + example: + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateNodeData + type: object + _policies_specs: + properties: + namespaceID: + description: | + A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + resourceType: + description: | + The resource type this policy grants access to. + enum: + - '*' + - volume + - policy + example: volume + type: string + readOnly: + default: false + description: | + If true, disallows requests that attempt to mutate the resource. + example: false + type: boolean + CreatePolicyGroupData: + example: + specs: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + name: dev-users + properties: + name: + example: dev-users + type: string + specs: + default: [] + description: A set of authorisation policies to apply to the policy group. + example: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + items: + $ref: '#/components/schemas/_policies_specs' + nullable: true + type: array + title: CreatePolicyGroupData + type: object + UpdatePolicyGroupData: + example: + specs: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + specs: + default: [] + description: A set of authorisation policies to apply to the policy group. + example: + - namespaceID: 251f065a-d89b-4426-a752-5fdd144d00e8 + resourceType: '*' + readOnly: false + - namespaceID: 5f009d1f-6618-43c2-9ae4-e699461dda8e + resourceType: volume + readOnly: true + items: + $ref: '#/components/schemas/_policies_specs' + nullable: true + type: array + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdatePolicyGroupData + type: object + CreateVolumeData: + example: + namespaceID: c5666b58-b805-4215-ab4a-cb094948ccc6 + name: data + description: This volume contains the data for my app + fsType: ext4 + labels: + env: prod + rack: db-1 + sizeBytes: 5000 + properties: + namespaceID: + description: | + A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + name: + description: | + The name of the volume shown in the CLI and UI + example: data + pattern: ^[a-z0-9.\-]{1,253}$ + type: string + fsType: + $ref: '#/components/schemas/FsType' + description: + example: This volume contains the data for my app + type: string + sizeBytes: + description: | + A volume's size in bytes + example: 5000 + minimum: 0 + type: uint64 + required: + - fsType + - name + - namespaceID + - sizeBytes + title: CreateVolumeData + type: object + UpdateVolumeData: + example: + name: new-volume-name + description: This volume contains the data for my app + version: NDI0MjQyNDI0MjQyNDI0MjQy + labels: + env: prod + rack: db-1 + properties: + name: + description: | + desired new volume name + example: new-volume-name + type: string + labels: + additionalProperties: + type: string + description: | + A set of arbitrary key value labels to apply to the entity. + example: + env: prod + rack: db-1 + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + type: object + description: + example: This volume contains the data for my app + type: string + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateVolumeData + type: object + AttachVolumeData: + example: + nodeID: c5666b58-b805-4215-ab4a-cb094948ccc6 + properties: + nodeID: + description: | + A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + readOnly: true + type: string + title: AttachVolumeData + type: object + UpdateClusterData: + example: + licenceKey: licenceKey + disableVersionCheck: false + disableCrashReporting: false + logFormat: json + logLevel: debug + disableTelemetry: false + version: NDI0MjQyNDI0MjQyNDI0MjQy + properties: + licenceKey: + description: | + A StorageOS product licence key, used to register a cluster. The format of this type is opaque and may change. + If this field is empty we assume that the called does not want to update the cluster's licence, and do not perform any operation. + type: string + disableTelemetry: + default: false + description: | + Disables collection of telemetry data across the cluster. + example: false + type: boolean + disableCrashReporting: + default: false + description: | + Disables collection of reports for any fatal crashes across the cluster. + example: false + type: boolean + disableVersionCheck: + default: false + description: | + Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. + example: false + type: boolean + logLevel: + $ref: '#/components/schemas/LogLevel' + logFormat: + $ref: '#/components/schemas/LogFormat' + version: + description: | + An opaque representation of an entity version at the time it was obtained from the API. + All operations that mutate the entity must include this version field in the request unchanged. + The format of this type is undefined and may change but the defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + maxLength: 30 + minLength: 1 + type: string + title: UpdateClusterData + type: object + PolicyGroup_users: + properties: + id: + description: | + A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + type: string + username: + example: admin + type: string + securitySchemes: + jwt: + bearerFormat: JWT + description: StorageOS uses JSON web tokens for authentication. + scheme: bearer + type: http diff --git a/v2/api_default.go b/v2/api_default.go new file mode 100644 index 0000000..9357806 --- /dev/null +++ b/v2/api_default.go @@ -0,0 +1,5386 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "github.com/antihax/optional" + "os" +) + +// Linger please +var ( + _ _context.Context +) + +// DefaultApiService DefaultApi service +type DefaultApiService service + +/* +AttachVolume Attach a volume to the given node +Attach the volume identified by id to the node identified in the request's body. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param id ID of a Volume + * @param attachVolumeData +*/ +func (a *DefaultApiService) AttachVolume(ctx _context.Context, namespaceID string, id string, attachVolumeData AttachVolumeData) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes/{id}/attach" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &attachVolumeData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +AuthenticateUser Authenticate a user +Generate a new JWT token for a user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param authUserData +@return User +*/ +func (a *DefaultApiService) AuthenticateUser(ctx _context.Context, authUserData AuthUserData) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/auth/login" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &authUserData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +CreateNamespace Create a new namespace +Create a new namespace in the cluster - only administrators can create new namespaces. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param createNamespaceData +@return Namespace +*/ +func (a *DefaultApiService) CreateNamespace(ctx _context.Context, createNamespaceData CreateNamespaceData) (Namespace, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Namespace + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &createNamespaceData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 201 { + var v Namespace + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +CreatePolicyGroup Create a new policy group +Create a new policy group in the cluster - only administrators can create new policy groups. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param createPolicyGroupData +@return PolicyGroup +*/ +func (a *DefaultApiService) CreatePolicyGroup(ctx _context.Context, createPolicyGroupData CreatePolicyGroupData) (PolicyGroup, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PolicyGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &createPolicyGroupData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 201 { + var v PolicyGroup + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +CreateUser Create a new user +Create a new user in the cluster - only administrators can create new users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param createUserData +@return User +*/ +func (a *DefaultApiService) CreateUser(ctx _context.Context, createUserData CreateUserData) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &createUserData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 201 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +// CreateVolumeOpts Optional parameters for the method 'CreateVolume' +type CreateVolumeOpts struct { + AsyncMax optional.String +} + +/* +CreateVolume Create a new Volume in the specified namespace +Create a new volume in the given namespace + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param createVolumeData + * @param optional nil or *CreateVolumeOpts - Optional Parameters: + * @param "AsyncMax" (optional.String) - Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. +@return Volume +*/ +func (a *DefaultApiService) CreateVolume(ctx _context.Context, namespaceID string, createVolumeData CreateVolumeData, localVarOptionals *CreateVolumeOpts) (Volume, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.AsyncMax.IsSet() { + localVarQueryParams.Add("async-max", parameterToString(localVarOptionals.AsyncMax.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &createVolumeData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 201 { + var v Volume + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 202 { + var v AcceptedMessage + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 451 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +// DeleteAuthenticatedUserOpts Optional parameters for the method 'DeleteAuthenticatedUser' +type DeleteAuthenticatedUserOpts struct { + IgnoreVersion optional.Bool +} + +/* +DeleteAuthenticatedUser Delete the authenticated user +Remove the authenticated user from the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeleteAuthenticatedUserOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. +*/ +func (a *DefaultApiService) DeleteAuthenticatedUser(ctx _context.Context, version string, localVarOptionals *DeleteAuthenticatedUserOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/self" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +DeleteAuthenticatedUserSessions Invalidate the logged in user's sessions +Invalidates logged in user's active JWTs. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +*/ +func (a *DefaultApiService) DeleteAuthenticatedUserSessions(ctx _context.Context) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/self/sessions" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteNamespaceOpts Optional parameters for the method 'DeleteNamespace' +type DeleteNamespaceOpts struct { + IgnoreVersion optional.Bool +} + +/* +DeleteNamespace Delete a namespace +Remove the namespace identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a namespace + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeleteNamespaceOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. +*/ +func (a *DefaultApiService) DeleteNamespace(ctx _context.Context, id string, version string, localVarOptionals *DeleteNamespaceOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteNodeOpts Optional parameters for the method 'DeleteNode' +type DeleteNodeOpts struct { + IgnoreVersion optional.Bool + AsyncMax optional.String +} + +/* +DeleteNode Delete a node +Remove the node identified by id. A node can only be deleted if it is currently offline. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a node + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeleteNodeOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. + * @param "AsyncMax" (optional.String) - Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. +*/ +func (a *DefaultApiService) DeleteNode(ctx _context.Context, id string, version string, localVarOptionals *DeleteNodeOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AsyncMax.IsSet() { + localVarQueryParams.Add("async-max", parameterToString(localVarOptionals.AsyncMax.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 202 { + var v AcceptedMessage + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeletePolicyGroupOpts Optional parameters for the method 'DeletePolicyGroup' +type DeletePolicyGroupOpts struct { + IgnoreVersion optional.Bool +} + +/* +DeletePolicyGroup Delete a policy group +Remove the policy group identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a policy group + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeletePolicyGroupOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. +*/ +func (a *DefaultApiService) DeletePolicyGroup(ctx _context.Context, id string, version string, localVarOptionals *DeletePolicyGroupOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +DeleteSessions Invalidate login sessions +Invalidates active JWTs on a per-user basis, specified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a user +*/ +func (a *DefaultApiService) DeleteSessions(ctx _context.Context, id string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{id}/sessions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteUserOpts Optional parameters for the method 'DeleteUser' +type DeleteUserOpts struct { + IgnoreVersion optional.Bool +} + +/* +DeleteUser Delete a user +Remove the user identified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a user + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeleteUserOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. +*/ +func (a *DefaultApiService) DeleteUser(ctx _context.Context, id string, version string, localVarOptionals *DeleteUserOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteVolumeOpts Optional parameters for the method 'DeleteVolume' +type DeleteVolumeOpts struct { + IgnoreVersion optional.Bool + AsyncMax optional.String +} + +/* +DeleteVolume Delete a volume +Remove the volume identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param id ID of a Volume + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DeleteVolumeOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. + * @param "AsyncMax" (optional.String) - Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. +*/ +func (a *DefaultApiService) DeleteVolume(ctx _context.Context, namespaceID string, id string, version string, localVarOptionals *DeleteVolumeOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AsyncMax.IsSet() { + localVarQueryParams.Add("async-max", parameterToString(localVarOptionals.AsyncMax.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 202 { + var v AcceptedMessage + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DetachVolumeOpts Optional parameters for the method 'DetachVolume' +type DetachVolumeOpts struct { + IgnoreVersion optional.Bool +} + +/* +DetachVolume Detach the given volume +Detach the volume identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param id ID of a Volume + * @param version This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. + * @param optional nil or *DetachVolumeOpts - Optional Parameters: + * @param "IgnoreVersion" (optional.Bool) - If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. +*/ +func (a *DefaultApiService) DetachVolume(ctx _context.Context, namespaceID string, id string, version string, localVarOptionals *DetachVolumeOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes/{id}/attach" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if strlen(version) < 1 { + return nil, reportError("version must have at least 1 elements") + } + if strlen(version) > 30 { + return nil, reportError("version must have less than 30 elements") + } + + localVarQueryParams.Add("version", parameterToString(version, "")) + if localVarOptionals != nil && localVarOptionals.IgnoreVersion.IsSet() { + localVarQueryParams.Add("ignore-version", parameterToString(localVarOptionals.IgnoreVersion.Value(), "")) + } + // 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +GetAuthenticatedUser Get the currently authenticated user's information +Fetch authenticated user's information. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return User +*/ +func (a *DefaultApiService) GetAuthenticatedUser(ctx _context.Context) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/self" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetCluster Retrieves the cluster's global configuration settings +Retrieves the current global configuration settings in use by the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return Cluster +*/ +func (a *DefaultApiService) GetCluster(ctx _context.Context) (Cluster, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Cluster + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/cluster" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Cluster + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetDiagnostics Retrieves a diagnostics bundle from the target node +Requests that the target node gathers detailed information about the state of the cluster, using it to then build and return a bundle which can be used for troubleshooting. The request will only be served when the authenticated user is an administrator. The node will attempt to gather information about its local state, cluster-wide state and local state of other nodes in the cluster. If the cluster is unhealthy this may cause a slower response. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return *os.File +*/ +func (a *DefaultApiService) GetDiagnostics(ctx _context.Context) (*os.File, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/diagnostics" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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/gzip", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetNamespace Fetch a namespace +Fetch the namespace identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a namespace +@return Namespace +*/ +func (a *DefaultApiService) GetNamespace(ctx _context.Context, id string) (Namespace, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Namespace + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Namespace + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetNode Fetch a node +Fetch the node identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a node +@return Node +*/ +func (a *DefaultApiService) GetNode(ctx _context.Context, id string) (Node, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Node + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Node + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetPolicyGroup Fetch a policy group +Fetch the policy group identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a policy group +@return PolicyGroup +*/ +func (a *DefaultApiService) GetPolicyGroup(ctx _context.Context, id string) (PolicyGroup, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PolicyGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v PolicyGroup + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetUser Fetch a user +Fetch the user identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a user +@return User +*/ +func (a *DefaultApiService) GetUser(ctx _context.Context, id string) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +GetVolume Fetch a volume +Fetch the volume identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param id ID of a Volume +@return Volume +*/ +func (a *DefaultApiService) GetVolume(ctx _context.Context, namespaceID string, id string) (Volume, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Volume + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +ListNamespaces Fetch the list of namespaces +Fetch the list of namespaces in the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return []Namespace +*/ +func (a *DefaultApiService) ListNamespaces(ctx _context.Context) ([]Namespace, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Namespace + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v []Namespace + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +ListNodes Fetch the list of nodes +Fetch the list of nodes of the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return []Node +*/ +func (a *DefaultApiService) ListNodes(ctx _context.Context) ([]Node, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Node + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/nodes" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v []Node + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +ListPolicyGroups Fetch the list of policy groups +Fetch the list of policy groups in the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return []PolicyGroup +*/ +func (a *DefaultApiService) ListPolicyGroups(ctx _context.Context) ([]PolicyGroup, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []PolicyGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v []PolicyGroup + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +ListUsers Fetch the list of users +Fetch the list of users of the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return []User +*/ +func (a *DefaultApiService) ListUsers(ctx _context.Context) ([]User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v []User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +ListVolumes Fetch the list of volumes in the given namespace +Fetch the list of volumes in the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace +@return []Volume +*/ +func (a *DefaultApiService) ListVolumes(ctx _context.Context, namespaceID string) ([]Volume, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Volume + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v []Volume + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +RefreshJwt Refresh the JWT +Obtain a fresh token with an updated expiry deadline. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +*/ +func (a *DefaultApiService) RefreshJwt(ctx _context.Context) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/auth/refresh" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +Spec Serves this openapi spec file +Serves this openapi spec file + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return string +*/ +func (a *DefaultApiService) Spec(ctx _context.Context) (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/openapi" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"text/yaml"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateAuthenticatedUser Update the authenticated user's information +Update the authenticated user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param updateAuthenticatedUserData +@return User +*/ +func (a *DefaultApiService) UpdateAuthenticatedUser(ctx _context.Context, updateAuthenticatedUserData UpdateAuthenticatedUserData) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/self" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateAuthenticatedUserData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateCluster Update the cluster's global configuration settings +Update the global configuration settings to use for the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param updateClusterData +@return Cluster +*/ +func (a *DefaultApiService) UpdateCluster(ctx _context.Context, updateClusterData UpdateClusterData) (Cluster, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Cluster + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/cluster" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateClusterData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Cluster + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateNamespace Update a namespace +Update the namespace identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a namespace + * @param updateNamespaceData +@return Namespace +*/ +func (a *DefaultApiService) UpdateNamespace(ctx _context.Context, id string, updateNamespaceData UpdateNamespaceData) (Namespace, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Namespace + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateNamespaceData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Namespace + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateNode Update a node +Update the node identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a node + * @param updateNodeData +@return Node +*/ +func (a *DefaultApiService) UpdateNode(ctx _context.Context, id string, updateNodeData UpdateNodeData) (Node, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Node + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateNodeData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Node + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdatePolicyGroup Update a policy group +Update the policy group identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a policy group + * @param updatePolicyGroupData +@return PolicyGroup +*/ +func (a *DefaultApiService) UpdatePolicyGroup(ctx _context.Context, id string, updatePolicyGroupData UpdatePolicyGroupData) (PolicyGroup, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PolicyGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updatePolicyGroupData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v PolicyGroup + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateUser Update a user +Update the user identified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id ID of a user + * @param updateUserData +@return User +*/ +func (a *DefaultApiService) UpdateUser(ctx _context.Context, id string, updateUserData UpdateUserData) (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateUserData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} + +/* +UpdateVolume Update a volume +Update the volume identified by id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param namespaceID ID of a Namespace + * @param id ID of a Volume + * @param updateVolumeData +@return Volume +*/ +func (a *DefaultApiService) UpdateVolume(ctx _context.Context, namespaceID string, id string, updateVolumeData UpdateVolumeData) (Volume, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/namespaces/{namespaceID}/volumes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"namespaceID"+"}", _neturl.QueryEscape(parameterToString(namespaceID, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.QueryEscape(parameterToString(id, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = &updateVolumeData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 200 { + var v Volume + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 451 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + 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 +} diff --git a/v2/client.go b/v2/client.go new file mode 100644 index 0000000..ac97853 --- /dev/null +++ b/v2/client.go @@ -0,0 +1,533 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the StorageOS API API v2.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultApi = (*DefaultApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err +} + +// ChangeBasePath changes base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/v2/configuration.go b/v2/configuration.go new file mode 100644 index 0000000..042d4d1 --- /dev/null +++ b/v2/configuration.go @@ -0,0 +1,131 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api + +import ( + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") + +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + +// Configuration stores the configuration of the API client +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://localhost/v2", + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/2.0.0-beta1/go", + Debug: false, + Servers: []ServerConfiguration{ + { + Url: "/v2", + Description: "No description provided", + }, + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/v2/docs/AcceptedMessage.md b/v2/docs/AcceptedMessage.md new file mode 100644 index 0000000..fcf397f --- /dev/null +++ b/v2/docs/AcceptedMessage.md @@ -0,0 +1,11 @@ +# AcceptedMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Msg** | **string** | | [optional] + +[[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/v2/docs/AttachVolumeData.md b/v2/docs/AttachVolumeData.md new file mode 100644 index 0000000..99889aa --- /dev/null +++ b/v2/docs/AttachVolumeData.md @@ -0,0 +1,11 @@ +# AttachVolumeData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NodeID** | **string** | A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. | [optional] [readonly] + +[[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/v2/docs/AuthUserData.md b/v2/docs/AuthUserData.md new file mode 100644 index 0000000..7d9c1d9 --- /dev/null +++ b/v2/docs/AuthUserData.md @@ -0,0 +1,12 @@ +# AuthUserData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | **string** | | +**Password** | **string** | | + +[[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/v2/docs/Cluster.md b/v2/docs/Cluster.md new file mode 100644 index 0000000..1d96009 --- /dev/null +++ b/v2/docs/Cluster.md @@ -0,0 +1,20 @@ +# Cluster + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. | [optional] [readonly] +**Licence** | [**Licence**](Licence.md) | | [optional] +**DisableTelemetry** | **bool** | Disables collection of telemetry data across the cluster. | [optional] [default to false] +**DisableCrashReporting** | **bool** | Disables collection of reports for any fatal crashes across the cluster. | [optional] [default to false] +**DisableVersionCheck** | **bool** | Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. | [optional] [default to false] +**LogLevel** | [**LogLevel**](LogLevel.md) | | [optional] +**LogFormat** | [**LogFormat**](LogFormat.md) | | [optional] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/CreateNamespaceData.md b/v2/docs/CreateNamespaceData.md new file mode 100644 index 0000000..6a2c57a --- /dev/null +++ b/v2/docs/CreateNamespaceData.md @@ -0,0 +1,12 @@ +# CreateNamespaceData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the namespace shown in the CLI and UI | [optional] +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] + +[[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/v2/docs/CreatePolicyGroupData.md b/v2/docs/CreatePolicyGroupData.md new file mode 100644 index 0000000..3a5d113 --- /dev/null +++ b/v2/docs/CreatePolicyGroupData.md @@ -0,0 +1,12 @@ +# CreatePolicyGroupData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] +**Specs** | Pointer to [**[]PoliciesSpecs**](_policies_specs.md) | A set of authorisation policies to apply to the policy group. | [optional] [default to []] + +[[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/v2/docs/CreateUserData.md b/v2/docs/CreateUserData.md new file mode 100644 index 0000000..24ef808 --- /dev/null +++ b/v2/docs/CreateUserData.md @@ -0,0 +1,14 @@ +# CreateUserData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | **string** | | +**Password** | **string** | If not present, the existing password is not changed | [default to unchanged] +**IsAdmin** | **bool** | If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. | [optional] [default to false] +**Groups** | Pointer to **[]string** | Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. | [optional] [default to []] + +[[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/v2/docs/CreateVolumeData.md b/v2/docs/CreateVolumeData.md new file mode 100644 index 0000000..a7219ad --- /dev/null +++ b/v2/docs/CreateVolumeData.md @@ -0,0 +1,16 @@ +# CreateVolumeData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NamespaceID** | **string** | A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. | +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**Name** | **string** | The name of the volume shown in the CLI and UI | +**FsType** | [**FsType**](FsType.md) | | +**Description** | **string** | | [optional] +**SizeBytes** | **uint64** | A volume's size in bytes | + +[[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/v2/docs/DefaultApi.md b/v2/docs/DefaultApi.md new file mode 100644 index 0000000..530c9ce --- /dev/null +++ b/v2/docs/DefaultApi.md @@ -0,0 +1,1380 @@ +# \DefaultApi + +All URIs are relative to *http://localhost/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AttachVolume**](DefaultApi.md#AttachVolume) | **Post** /namespaces/{namespaceID}/volumes/{id}/attach | Attach a volume to the given node +[**AuthenticateUser**](DefaultApi.md#AuthenticateUser) | **Post** /auth/login | Authenticate a user +[**CreateNamespace**](DefaultApi.md#CreateNamespace) | **Post** /namespaces | Create a new namespace +[**CreatePolicyGroup**](DefaultApi.md#CreatePolicyGroup) | **Post** /policies | Create a new policy group +[**CreateUser**](DefaultApi.md#CreateUser) | **Post** /users | Create a new user +[**CreateVolume**](DefaultApi.md#CreateVolume) | **Post** /namespaces/{namespaceID}/volumes | Create a new Volume in the specified namespace +[**DeleteAuthenticatedUser**](DefaultApi.md#DeleteAuthenticatedUser) | **Delete** /users/self | Delete the authenticated user +[**DeleteAuthenticatedUserSessions**](DefaultApi.md#DeleteAuthenticatedUserSessions) | **Delete** /users/self/sessions | Invalidate the logged in user's sessions +[**DeleteNamespace**](DefaultApi.md#DeleteNamespace) | **Delete** /namespaces/{id} | Delete a namespace +[**DeleteNode**](DefaultApi.md#DeleteNode) | **Delete** /nodes/{id} | Delete a node +[**DeletePolicyGroup**](DefaultApi.md#DeletePolicyGroup) | **Delete** /policies/{id} | Delete a policy group +[**DeleteSessions**](DefaultApi.md#DeleteSessions) | **Delete** /users/{id}/sessions | Invalidate login sessions +[**DeleteUser**](DefaultApi.md#DeleteUser) | **Delete** /users/{id} | Delete a user +[**DeleteVolume**](DefaultApi.md#DeleteVolume) | **Delete** /namespaces/{namespaceID}/volumes/{id} | Delete a volume +[**DetachVolume**](DefaultApi.md#DetachVolume) | **Delete** /namespaces/{namespaceID}/volumes/{id}/attach | Detach the given volume +[**GetAuthenticatedUser**](DefaultApi.md#GetAuthenticatedUser) | **Get** /users/self | Get the currently authenticated user's information +[**GetCluster**](DefaultApi.md#GetCluster) | **Get** /cluster | Retrieves the cluster's global configuration settings +[**GetDiagnostics**](DefaultApi.md#GetDiagnostics) | **Get** /diagnostics | Retrieves a diagnostics bundle from the target node +[**GetNamespace**](DefaultApi.md#GetNamespace) | **Get** /namespaces/{id} | Fetch a namespace +[**GetNode**](DefaultApi.md#GetNode) | **Get** /nodes/{id} | Fetch a node +[**GetPolicyGroup**](DefaultApi.md#GetPolicyGroup) | **Get** /policies/{id} | Fetch a policy group +[**GetUser**](DefaultApi.md#GetUser) | **Get** /users/{id} | Fetch a user +[**GetVolume**](DefaultApi.md#GetVolume) | **Get** /namespaces/{namespaceID}/volumes/{id} | Fetch a volume +[**ListNamespaces**](DefaultApi.md#ListNamespaces) | **Get** /namespaces | Fetch the list of namespaces +[**ListNodes**](DefaultApi.md#ListNodes) | **Get** /nodes | Fetch the list of nodes +[**ListPolicyGroups**](DefaultApi.md#ListPolicyGroups) | **Get** /policies | Fetch the list of policy groups +[**ListUsers**](DefaultApi.md#ListUsers) | **Get** /users | Fetch the list of users +[**ListVolumes**](DefaultApi.md#ListVolumes) | **Get** /namespaces/{namespaceID}/volumes | Fetch the list of volumes in the given namespace +[**RefreshJwt**](DefaultApi.md#RefreshJwt) | **Post** /auth/refresh | Refresh the JWT +[**Spec**](DefaultApi.md#Spec) | **Get** /openapi | Serves this openapi spec file +[**UpdateAuthenticatedUser**](DefaultApi.md#UpdateAuthenticatedUser) | **Put** /users/self | Update the authenticated user's information +[**UpdateCluster**](DefaultApi.md#UpdateCluster) | **Put** /cluster | Update the cluster's global configuration settings +[**UpdateNamespace**](DefaultApi.md#UpdateNamespace) | **Put** /namespaces/{id} | Update a namespace +[**UpdateNode**](DefaultApi.md#UpdateNode) | **Put** /nodes/{id} | Update a node +[**UpdatePolicyGroup**](DefaultApi.md#UpdatePolicyGroup) | **Put** /policies/{id} | Update a policy group +[**UpdateUser**](DefaultApi.md#UpdateUser) | **Put** /users/{id} | Update a user +[**UpdateVolume**](DefaultApi.md#UpdateVolume) | **Put** /namespaces/{namespaceID}/volumes/{id} | Update a volume + + + +## AttachVolume + +> AttachVolume(ctx, namespaceID, id, attachVolumeData) + +Attach a volume to the given node + +Attach the volume identified by id to the node identified in the request's body. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**id** | **string**| ID of a Volume | +**attachVolumeData** | [**AttachVolumeData**](AttachVolumeData.md)| | + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## AuthenticateUser + +> User AuthenticateUser(ctx, authUserData) + +Authenticate a user + +Generate a new JWT token for a user. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**authUserData** | [**AuthUserData**](AuthUserData.md)| | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## CreateNamespace + +> Namespace CreateNamespace(ctx, createNamespaceData) + +Create a new namespace + +Create a new namespace in the cluster - only administrators can create new namespaces. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**createNamespaceData** | [**CreateNamespaceData**](CreateNamespaceData.md)| | + +### Return type + +[**Namespace**](Namespace.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## CreatePolicyGroup + +> PolicyGroup CreatePolicyGroup(ctx, createPolicyGroupData) + +Create a new policy group + +Create a new policy group in the cluster - only administrators can create new policy groups. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**createPolicyGroupData** | [**CreatePolicyGroupData**](CreatePolicyGroupData.md)| | + +### Return type + +[**PolicyGroup**](PolicyGroup.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## CreateUser + +> User CreateUser(ctx, createUserData) + +Create a new user + +Create a new user in the cluster - only administrators can create new users. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**createUserData** | [**CreateUserData**](CreateUserData.md)| | + +### Return type + +[**User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## CreateVolume + +> Volume CreateVolume(ctx, namespaceID, createVolumeData, optional) + +Create a new Volume in the specified namespace + +Create a new volume in the given namespace + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**createVolumeData** | [**CreateVolumeData**](CreateVolumeData.md)| | + **optional** | ***CreateVolumeOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a CreateVolumeOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **asyncMax** | **optional.String**| Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. | + +### Return type + +[**Volume**](Volume.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## DeleteAuthenticatedUser + +> DeleteAuthenticatedUser(ctx, version, optional) + +Delete the authenticated user + +Remove the authenticated user from the cluster. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeleteAuthenticatedUserOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeleteAuthenticatedUserOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteAuthenticatedUserSessions + +> DeleteAuthenticatedUserSessions(ctx, ) + +Invalidate the logged in user's sessions + +Invalidates logged in user's active JWTs. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteNamespace + +> DeleteNamespace(ctx, id, version, optional) + +Delete a namespace + +Remove the namespace identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a namespace | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeleteNamespaceOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeleteNamespaceOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteNode + +> DeleteNode(ctx, id, version, optional) + +Delete a node + +Remove the node identified by id. A node can only be deleted if it is currently offline. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a node | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeleteNodeOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeleteNodeOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + **asyncMax** | **optional.String**| Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. | + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeletePolicyGroup + +> DeletePolicyGroup(ctx, id, version, optional) + +Delete a policy group + +Remove the policy group identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a policy group | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeletePolicyGroupOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeletePolicyGroupOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteSessions + +> DeleteSessions(ctx, id) + +Invalidate login sessions + +Invalidates active JWTs on a per-user basis, specified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a user | + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteUser + +> DeleteUser(ctx, id, version, optional) + +Delete a user + +Remove the user identified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a user | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeleteUserOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeleteUserOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DeleteVolume + +> DeleteVolume(ctx, namespaceID, id, version, optional) + +Delete a volume + +Remove the volume identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**id** | **string**| ID of a Volume | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DeleteVolumeOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeleteVolumeOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + **asyncMax** | **optional.String**| Optional parameter which will make the api request asynchronous. The operation will not be cancelled even if the client disconnect. The URL parameter value overrides the \"async-max\" header value, if any. The value of this header defines the timeout duration for the request, it must be set to a valid duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". We reject negative or nil duration values. | + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## DetachVolume + +> DetachVolume(ctx, namespaceID, id, version, optional) + +Detach the given volume + +Detach the volume identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**id** | **string**| ID of a Volume | +**version** | **string**| This value is used to perform a conditional delete of the entity. If the entity has been modified since the version token was obtained, the request will fail with a HTTP 409 Conflict. | + **optional** | ***DetachVolumeOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DetachVolumeOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **ignoreVersion** | **optional.Bool**| If set to true this value indicates that the user wants to ignore entity version constraints, thereby \"forcing\" the operation. | [default to false] + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetAuthenticatedUser + +> User GetAuthenticatedUser(ctx, ) + +Get the currently authenticated user's information + +Fetch authenticated user's information. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetCluster + +> Cluster GetCluster(ctx, ) + +Retrieves the cluster's global configuration settings + +Retrieves the current global configuration settings in use by the cluster. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Cluster**](Cluster.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetDiagnostics + +> *os.File GetDiagnostics(ctx, ) + +Retrieves a diagnostics bundle from the target node + +Requests that the target node gathers detailed information about the state of the cluster, using it to then build and return a bundle which can be used for troubleshooting. The request will only be served when the authenticated user is an administrator. The node will attempt to gather information about its local state, cluster-wide state and local state of other nodes in the cluster. If the cluster is unhealthy this may cause a slower response. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/gzip, 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) + + +## GetNamespace + +> Namespace GetNamespace(ctx, id) + +Fetch a namespace + +Fetch the namespace identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a namespace | + +### Return type + +[**Namespace**](Namespace.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetNode + +> Node GetNode(ctx, id) + +Fetch a node + +Fetch the node identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a node | + +### Return type + +[**Node**](Node.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetPolicyGroup + +> PolicyGroup GetPolicyGroup(ctx, id) + +Fetch a policy group + +Fetch the policy group identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a policy group | + +### Return type + +[**PolicyGroup**](PolicyGroup.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetUser + +> User GetUser(ctx, id) + +Fetch a user + +Fetch the user identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a user | + +### Return type + +[**User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## GetVolume + +> Volume GetVolume(ctx, namespaceID, id) + +Fetch a volume + +Fetch the volume identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**id** | **string**| ID of a Volume | + +### Return type + +[**Volume**](Volume.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## ListNamespaces + +> []Namespace ListNamespaces(ctx, ) + +Fetch the list of namespaces + +Fetch the list of namespaces in the cluster. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[]Namespace**](Namespace.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## ListNodes + +> []Node ListNodes(ctx, ) + +Fetch the list of nodes + +Fetch the list of nodes of the cluster. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[]Node**](Node.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## ListPolicyGroups + +> []PolicyGroup ListPolicyGroups(ctx, ) + +Fetch the list of policy groups + +Fetch the list of policy groups in the cluster. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[]PolicyGroup**](PolicyGroup.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## ListUsers + +> []User ListUsers(ctx, ) + +Fetch the list of users + +Fetch the list of users of the cluster. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[]User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## ListVolumes + +> []Volume ListVolumes(ctx, namespaceID) + +Fetch the list of volumes in the given namespace + +Fetch the list of volumes in the cluster. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | + +### Return type + +[**[]Volume**](Volume.md) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## RefreshJwt + +> RefreshJwt(ctx, ) + +Refresh the JWT + +Obtain a fresh token with an updated expiry deadline. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[jwt](../README.md#jwt) + +### 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) + + +## Spec + +> string Spec(ctx, ) + +Serves this openapi spec file + +Serves this openapi spec file + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/yaml + +[[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) + + +## UpdateAuthenticatedUser + +> User UpdateAuthenticatedUser(ctx, updateAuthenticatedUserData) + +Update the authenticated user's information + +Update the authenticated user. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**updateAuthenticatedUserData** | [**UpdateAuthenticatedUserData**](UpdateAuthenticatedUserData.md)| | + +### Return type + +[**User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdateCluster + +> Cluster UpdateCluster(ctx, updateClusterData) + +Update the cluster's global configuration settings + +Update the global configuration settings to use for the cluster. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**updateClusterData** | [**UpdateClusterData**](UpdateClusterData.md)| | + +### Return type + +[**Cluster**](Cluster.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdateNamespace + +> Namespace UpdateNamespace(ctx, id, updateNamespaceData) + +Update a namespace + +Update the namespace identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a namespace | +**updateNamespaceData** | [**UpdateNamespaceData**](UpdateNamespaceData.md)| | + +### Return type + +[**Namespace**](Namespace.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdateNode + +> Node UpdateNode(ctx, id, updateNodeData) + +Update a node + +Update the node identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a node | +**updateNodeData** | [**UpdateNodeData**](UpdateNodeData.md)| | + +### Return type + +[**Node**](Node.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdatePolicyGroup + +> PolicyGroup UpdatePolicyGroup(ctx, id, updatePolicyGroupData) + +Update a policy group + +Update the policy group identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a policy group | +**updatePolicyGroupData** | [**UpdatePolicyGroupData**](UpdatePolicyGroupData.md)| | + +### Return type + +[**PolicyGroup**](PolicyGroup.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdateUser + +> User UpdateUser(ctx, id, updateUserData) + +Update a user + +Update the user identified by id. This request will not succeed if the target account is the currently authenticated account. Use the separate users/self endpoint for this purpose. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string**| ID of a user | +**updateUserData** | [**UpdateUserData**](UpdateUserData.md)| | + +### Return type + +[**User**](User.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + + +## UpdateVolume + +> Volume UpdateVolume(ctx, namespaceID, id, updateVolumeData) + +Update a volume + +Update the volume identified by id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**namespaceID** | **string**| ID of a Namespace | +**id** | **string**| ID of a Volume | +**updateVolumeData** | [**UpdateVolumeData**](UpdateVolumeData.md)| | + +### Return type + +[**Volume**](Volume.md) + +### Authorization + +[jwt](../README.md#jwt) + +### HTTP request headers + +- **Content-Type**: application/json +- **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) + diff --git a/v2/docs/DeploymentInfo.md b/v2/docs/DeploymentInfo.md new file mode 100644 index 0000000..672ebdf --- /dev/null +++ b/v2/docs/DeploymentInfo.md @@ -0,0 +1,15 @@ +# DeploymentInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a volume deployment. The format of this type is undefined and may change but the defined properties will not change. | [optional] +**NodeID** | **string** | A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. | [optional] [readonly] +**Inode** | **uint32** | | [optional] [readonly] +**Health** | [**Health**](Health.md) | | [optional] +**Syncing** | **bool** | indicates if a volume is undergoing data synchronization operations | [optional] + +[[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/v2/docs/Error.md b/v2/docs/Error.md new file mode 100644 index 0000000..d411ac9 --- /dev/null +++ b/v2/docs/Error.md @@ -0,0 +1,11 @@ +# Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error** | **string** | | + +[[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/v2/docs/FsType.md b/v2/docs/FsType.md new file mode 100644 index 0000000..c1b2273 --- /dev/null +++ b/v2/docs/FsType.md @@ -0,0 +1,10 @@ +# FsType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/v2/docs/Health.md b/v2/docs/Health.md new file mode 100644 index 0000000..265c7f5 --- /dev/null +++ b/v2/docs/Health.md @@ -0,0 +1,10 @@ +# Health + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/v2/docs/Licence.md b/v2/docs/Licence.md new file mode 100644 index 0000000..6a597bf --- /dev/null +++ b/v2/docs/Licence.md @@ -0,0 +1,15 @@ +# Licence + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClusterID** | **string** | A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. | [optional] [readonly] +**ExpiresAt** | [**time.Time**](time.Time.md) | The time after which a licence will no longer be valid This timestamp is set when the licence is created. String format is RFC3339. | [optional] [readonly] +**ClusterCapacityBytes** | **uint64** | The allowed provisioning capacity in bytes This value if for the cluster, if provisioning a volume brings the cluster's total provisioned capacity above it the request will fail | [optional] +**Kind** | **string** | Denotes which category the licence belongs to | [optional] +**CustomerName** | **string** | A user friendly reference to the customer | [optional] + +[[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/v2/docs/LogFormat.md b/v2/docs/LogFormat.md new file mode 100644 index 0000000..995e18e --- /dev/null +++ b/v2/docs/LogFormat.md @@ -0,0 +1,10 @@ +# LogFormat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/v2/docs/LogLevel.md b/v2/docs/LogLevel.md new file mode 100644 index 0000000..14245cd --- /dev/null +++ b/v2/docs/LogLevel.md @@ -0,0 +1,10 @@ +# LogLevel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/v2/docs/Namespace.md b/v2/docs/Namespace.md new file mode 100644 index 0000000..0ab016d --- /dev/null +++ b/v2/docs/Namespace.md @@ -0,0 +1,16 @@ +# Namespace + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. | [optional] +**Name** | **string** | | [optional] [readonly] +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/Node.md b/v2/docs/Node.md new file mode 100644 index 0000000..e343a26 --- /dev/null +++ b/v2/docs/Node.md @@ -0,0 +1,21 @@ +# Node + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. | [optional] [readonly] +**Name** | **string** | The hostname of the node. This value is set by the node each time it joins the StorageOS cluster. | [optional] [readonly] +**Health** | [**Health**](Health.md) | | [optional] +**IoEndpoint** | **string** | Endpoint at which we operate our dataplane's dfs service. (used for IO operations) This value is set on startup by the corresponding environment variable (IO_ADVERTISE_ADDRESS) | [optional] [readonly] +**SupervisorEndpoint** | **string** | Endpoint at which we operate our dataplane's supervisor service (used for sync). This value is set on startup by the corresponding environment variable (SUPERVISOR_ADVERTISE_ADDRESS) | [optional] [readonly] +**GossipEndpoint** | **string** | Endpoint at which we operate our health checking service. This value is set on startup by the corresponding environment variable (GOSSIP_ADVERTISE_ADDRESS) | [optional] [readonly] +**ClusteringEndpoint** | **string** | Endpoint at which we operate our clustering GRPC API. This value is set on startup by the corresponding environment variable (INTERNAL_API_ADVERTISE_ADDRESS) | [optional] [readonly] +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/PoliciesSpecs.md b/v2/docs/PoliciesSpecs.md new file mode 100644 index 0000000..3bfceed --- /dev/null +++ b/v2/docs/PoliciesSpecs.md @@ -0,0 +1,13 @@ +# PoliciesSpecs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NamespaceID** | **string** | A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. | [optional] +**ResourceType** | **string** | The resource type this policy grants access to. | [optional] +**ReadOnly** | **bool** | If true, disallows requests that attempt to mutate the resource. | [optional] [default to false] + +[[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/v2/docs/PolicyGroup.md b/v2/docs/PolicyGroup.md new file mode 100644 index 0000000..68e669c --- /dev/null +++ b/v2/docs/PolicyGroup.md @@ -0,0 +1,17 @@ +# PolicyGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a policy group. The format of this type is undefined and may change but the defined properties will not change.. | [optional] +**Name** | **string** | | [optional] +**Users** | [**[]PolicyGroupUsers**](PolicyGroup_users.md) | The list of user IDs which this policy group governs. | [optional] [readonly] +**Specs** | Pointer to [**[]PoliciesSpecs**](_policies_specs.md) | A set of authorisation policies to apply to the policy group. | [optional] [default to []] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/PolicyGroupUsers.md b/v2/docs/PolicyGroupUsers.md new file mode 100644 index 0000000..d066a89 --- /dev/null +++ b/v2/docs/PolicyGroupUsers.md @@ -0,0 +1,12 @@ +# PolicyGroupUsers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. | [optional] +**Username** | **string** | | [optional] + +[[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/v2/docs/UpdateAuthenticatedUserData.md b/v2/docs/UpdateAuthenticatedUserData.md new file mode 100644 index 0000000..6b1155f --- /dev/null +++ b/v2/docs/UpdateAuthenticatedUserData.md @@ -0,0 +1,12 @@ +# UpdateAuthenticatedUserData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Password** | **string** | If not present, the existing password is not changed | [optional] [default to unchanged] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdateClusterData.md b/v2/docs/UpdateClusterData.md new file mode 100644 index 0000000..b101def --- /dev/null +++ b/v2/docs/UpdateClusterData.md @@ -0,0 +1,17 @@ +# UpdateClusterData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LicenceKey** | **string** | A StorageOS product licence key, used to register a cluster. The format of this type is opaque and may change. If this field is empty we assume that the called does not want to update the cluster's licence, and do not perform any operation. | [optional] +**DisableTelemetry** | **bool** | Disables collection of telemetry data across the cluster. | [optional] [default to false] +**DisableCrashReporting** | **bool** | Disables collection of reports for any fatal crashes across the cluster. | [optional] [default to false] +**DisableVersionCheck** | **bool** | Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. | [optional] [default to false] +**LogLevel** | [**LogLevel**](LogLevel.md) | | [optional] +**LogFormat** | [**LogFormat**](LogFormat.md) | | [optional] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdateNamespaceData.md b/v2/docs/UpdateNamespaceData.md new file mode 100644 index 0000000..5e8fa6b --- /dev/null +++ b/v2/docs/UpdateNamespaceData.md @@ -0,0 +1,12 @@ +# UpdateNamespaceData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdateNodeData.md b/v2/docs/UpdateNodeData.md new file mode 100644 index 0000000..c5a151e --- /dev/null +++ b/v2/docs/UpdateNodeData.md @@ -0,0 +1,12 @@ +# UpdateNodeData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdatePolicyGroupData.md b/v2/docs/UpdatePolicyGroupData.md new file mode 100644 index 0000000..64a6322 --- /dev/null +++ b/v2/docs/UpdatePolicyGroupData.md @@ -0,0 +1,12 @@ +# UpdatePolicyGroupData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Specs** | Pointer to [**[]PoliciesSpecs**](_policies_specs.md) | A set of authorisation policies to apply to the policy group. | [optional] [default to []] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdateUserData.md b/v2/docs/UpdateUserData.md new file mode 100644 index 0000000..f8f2677 --- /dev/null +++ b/v2/docs/UpdateUserData.md @@ -0,0 +1,14 @@ +# UpdateUserData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Password** | **string** | If not present, the existing password is not changed | [optional] [default to unchanged] +**IsAdmin** | **bool** | If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. | [optional] [default to false] +**Groups** | Pointer to **[]string** | Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. | [optional] [default to []] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/UpdateVolumeData.md b/v2/docs/UpdateVolumeData.md new file mode 100644 index 0000000..64012ba --- /dev/null +++ b/v2/docs/UpdateVolumeData.md @@ -0,0 +1,14 @@ +# UpdateVolumeData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | desired new volume name | [optional] +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**Description** | **string** | | [optional] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/User.md b/v2/docs/User.md new file mode 100644 index 0000000..48b0bdb --- /dev/null +++ b/v2/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. | [optional] +**Username** | **string** | | [optional] +**IsAdmin** | **bool** | If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. | [optional] [default to false] +**Groups** | Pointer to **[]string** | Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. | [optional] [default to []] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/docs/Volume.md b/v2/docs/Volume.md new file mode 100644 index 0000000..05c7d68 --- /dev/null +++ b/v2/docs/Volume.md @@ -0,0 +1,24 @@ +# Volume + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | A unique identifier for a volume. The format of this type is undefined and may change but the defined properties will not change. | [optional] +**Name** | **string** | | [optional] +**Description** | **string** | | [optional] +**AttachedOn** | **string** | | [optional] [readonly] +**NamespaceID** | **string** | | [optional] [readonly] +**Labels** | **map[string]string** | A set of arbitrary key value labels to apply to the entity. | [optional] +**FsType** | [**FsType**](FsType.md) | | [optional] +**Inode** | **uint32** | | [optional] [readonly] +**Master** | [**DeploymentInfo**](DeploymentInfo.md) | | [optional] [readonly] +**Replicas** | Pointer to [**[]DeploymentInfo**](DeploymentInfo.md) | | [optional] [readonly] [default to []] +**SizeBytes** | **uint64** | A volume's size in bytes | [optional] +**CreatedAt** | [**time.Time**](time.Time.md) | The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**UpdatedAt** | [**time.Time**](time.Time.md) | The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. | [optional] [readonly] +**Version** | **string** | An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. | [optional] + +[[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/v2/git_push.sh b/v2/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/v2/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/v2/go.mod b/v2/go.mod new file mode 100644 index 0000000..4eb1c0c --- /dev/null +++ b/v2/go.mod @@ -0,0 +1,9 @@ +module github.com/croomes/go-api/v2 + +require ( + github.com/antihax/optional v1.0.0 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + +) + +go 1.13 diff --git a/v2/go.sum b/v2/go.sum new file mode 100644 index 0000000..ee69520 --- /dev/null +++ b/v2/go.sum @@ -0,0 +1,17 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= +github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/v2/model__policies_specs.go b/v2/model__policies_specs.go new file mode 100644 index 0000000..7c277d9 --- /dev/null +++ b/v2/model__policies_specs.go @@ -0,0 +1,20 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// PoliciesSpecs struct for PoliciesSpecs +type PoliciesSpecs struct { + // A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + NamespaceID string `json:"namespaceID,omitempty"` + // The resource type this policy grants access to. + ResourceType string `json:"resourceType,omitempty"` + // If true, disallows requests that attempt to mutate the resource. + ReadOnly bool `json:"readOnly,omitempty"` +} diff --git a/v2/model_accepted_message.go b/v2/model_accepted_message.go new file mode 100644 index 0000000..5c8746d --- /dev/null +++ b/v2/model_accepted_message.go @@ -0,0 +1,15 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// AcceptedMessage struct for AcceptedMessage +type AcceptedMessage struct { + Msg string `json:"msg,omitempty"` +} diff --git a/v2/model_attach_volume_data.go b/v2/model_attach_volume_data.go new file mode 100644 index 0000000..4c9f48e --- /dev/null +++ b/v2/model_attach_volume_data.go @@ -0,0 +1,16 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// AttachVolumeData struct for AttachVolumeData +type AttachVolumeData struct { + // A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + NodeID string `json:"nodeID,omitempty"` +} diff --git a/v2/model_auth_user_data.go b/v2/model_auth_user_data.go new file mode 100644 index 0000000..18a49f0 --- /dev/null +++ b/v2/model_auth_user_data.go @@ -0,0 +1,16 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// AuthUserData struct for AuthUserData +type AuthUserData struct { + Username string `json:"username"` + Password string `json:"password"` +} diff --git a/v2/model_cluster.go b/v2/model_cluster.go new file mode 100644 index 0000000..623de5d --- /dev/null +++ b/v2/model_cluster.go @@ -0,0 +1,34 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// Cluster struct for Cluster +type Cluster struct { + // A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. + Id string `json:"id,omitempty"` + Licence Licence `json:"licence,omitempty"` + // Disables collection of telemetry data across the cluster. + DisableTelemetry bool `json:"disableTelemetry,omitempty"` + // Disables collection of reports for any fatal crashes across the cluster. + DisableCrashReporting bool `json:"disableCrashReporting,omitempty"` + // Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. + DisableVersionCheck bool `json:"disableVersionCheck,omitempty"` + LogLevel LogLevel `json:"logLevel,omitempty"` + LogFormat LogFormat `json:"logFormat,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_create_namespace_data.go b/v2/model_create_namespace_data.go new file mode 100644 index 0000000..c3cbd4e --- /dev/null +++ b/v2/model_create_namespace_data.go @@ -0,0 +1,18 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// CreateNamespaceData struct for CreateNamespaceData +type CreateNamespaceData struct { + // The name of the namespace shown in the CLI and UI + Name string `json:"name,omitempty"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` +} diff --git a/v2/model_create_policy_group_data.go b/v2/model_create_policy_group_data.go new file mode 100644 index 0000000..51ef42c --- /dev/null +++ b/v2/model_create_policy_group_data.go @@ -0,0 +1,17 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// CreatePolicyGroupData struct for CreatePolicyGroupData +type CreatePolicyGroupData struct { + Name string `json:"name,omitempty"` + // A set of authorisation policies to apply to the policy group. + Specs *[]PoliciesSpecs `json:"specs,omitempty"` +} diff --git a/v2/model_create_user_data.go b/v2/model_create_user_data.go new file mode 100644 index 0000000..1fe933f --- /dev/null +++ b/v2/model_create_user_data.go @@ -0,0 +1,21 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// CreateUserData struct for CreateUserData +type CreateUserData struct { + Username string `json:"username"` + // If not present, the existing password is not changed + Password string `json:"password"` + // If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + // Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. + Groups *[]string `json:"groups,omitempty"` +} diff --git a/v2/model_create_volume_data.go b/v2/model_create_volume_data.go new file mode 100644 index 0000000..36abf4e --- /dev/null +++ b/v2/model_create_volume_data.go @@ -0,0 +1,24 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// CreateVolumeData struct for CreateVolumeData +type CreateVolumeData struct { + // A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + NamespaceID string `json:"namespaceID"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + // The name of the volume shown in the CLI and UI + Name string `json:"name"` + FsType FsType `json:"fsType"` + Description string `json:"description,omitempty"` + // A volume's size in bytes + SizeBytes uint64 `json:"sizeBytes"` +} diff --git a/v2/model_deployment_info.go b/v2/model_deployment_info.go new file mode 100644 index 0000000..3c72088 --- /dev/null +++ b/v2/model_deployment_info.go @@ -0,0 +1,22 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// DeploymentInfo struct for DeploymentInfo +type DeploymentInfo struct { + // A unique identifier for a volume deployment. The format of this type is undefined and may change but the defined properties will not change. + Id string `json:"id,omitempty"` + // A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + NodeID string `json:"nodeID,omitempty"` + Inode uint32 `json:"inode,omitempty"` + Health Health `json:"health,omitempty"` + // indicates if a volume is undergoing data synchronization operations + Syncing bool `json:"syncing,omitempty"` +} diff --git a/v2/model_error.go b/v2/model_error.go new file mode 100644 index 0000000..aa143be --- /dev/null +++ b/v2/model_error.go @@ -0,0 +1,15 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// Error struct for Error +type Error struct { + Error string `json:"error"` +} diff --git a/v2/model_fs_type.go b/v2/model_fs_type.go new file mode 100644 index 0000000..19b20f9 --- /dev/null +++ b/v2/model_fs_type.go @@ -0,0 +1,23 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// FsType The file system type of a volume. \"block\" is a raw block device (no filesystem). +type FsType string + +// List of FsType +const ( + FSTYPE_EXT2 FsType = "ext2" + FSTYPE_EXT3 FsType = "ext3" + FSTYPE_EXT4 FsType = "ext4" + FSTYPE_XFS FsType = "xfs" + FSTYPE_BTRFS FsType = "btrfs" + FSTYPE_BLOCK FsType = "block" +) diff --git a/v2/model_health.go b/v2/model_health.go new file mode 100644 index 0000000..cdc830b --- /dev/null +++ b/v2/model_health.go @@ -0,0 +1,20 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// Health The operational health of an entity +type Health string + +// List of Health +const ( + HEALTH_ONLINE Health = "online" + HEALTH_OFFLINE Health = "offline" + HEALTH_UNKNOWN Health = "unknown" +) diff --git a/v2/model_licence.go b/v2/model_licence.go new file mode 100644 index 0000000..c1f6773 --- /dev/null +++ b/v2/model_licence.go @@ -0,0 +1,27 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// Licence A representation of a cluster's licence properties +type Licence struct { + // A unique identifier for a cluster. The format of this type is undefined and may change but the defined properties will not change. + ClusterID string `json:"clusterID,omitempty"` + // The time after which a licence will no longer be valid This timestamp is set when the licence is created. String format is RFC3339. + ExpiresAt time.Time `json:"expiresAt,omitempty"` + // The allowed provisioning capacity in bytes This value if for the cluster, if provisioning a volume brings the cluster's total provisioned capacity above it the request will fail + ClusterCapacityBytes uint64 `json:"clusterCapacityBytes,omitempty"` + // Denotes which category the licence belongs to + Kind string `json:"kind,omitempty"` + // A user friendly reference to the customer + CustomerName string `json:"customerName,omitempty"` +} diff --git a/v2/model_log_format.go b/v2/model_log_format.go new file mode 100644 index 0000000..a34a2d5 --- /dev/null +++ b/v2/model_log_format.go @@ -0,0 +1,19 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// LogFormat This setting determines the format nodes in the cluster will use for log entries. This setting is only checked by nodes on startup. Changing this setting will not affect the behaviour of nodes that are already operational. +type LogFormat string + +// List of LogFormat +const ( + LOGFORMAT_DEFAULT LogFormat = "default" + LOGFORMAT_JSON LogFormat = "json" +) diff --git a/v2/model_log_level.go b/v2/model_log_level.go new file mode 100644 index 0000000..3b1f607 --- /dev/null +++ b/v2/model_log_level.go @@ -0,0 +1,21 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// LogLevel This setting determines the log level for nodes across the cluster to use when recording entries in the log. All entries below the specified log level are discarded, where \"error\" is the highest log level and \"debug\" is the lowest. This setting is only checked by nodes on startup. Changing this setting will not affect the behaviour of nodes that are already operational. +type LogLevel string + +// List of LogLevel +const ( + LOGLEVEL_DEBUG LogLevel = "debug" + LOGLEVEL_INFO LogLevel = "info" + LOGLEVEL_WARN LogLevel = "warn" + LOGLEVEL_ERROR LogLevel = "error" +) diff --git a/v2/model_namespace.go b/v2/model_namespace.go new file mode 100644 index 0000000..f8fd5d2 --- /dev/null +++ b/v2/model_namespace.go @@ -0,0 +1,28 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// Namespace struct for Namespace +type Namespace struct { + // A unique identifier for a namespace. The format of this type is undefined and may change but the defined properties will not change.. + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_node.go b/v2/model_node.go new file mode 100644 index 0000000..381c0ec --- /dev/null +++ b/v2/model_node.go @@ -0,0 +1,38 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// Node struct for Node +type Node struct { + // A unique identifier for a node. The format of this type is undefined and may change but the defined properties will not change. + Id string `json:"id,omitempty"` + // The hostname of the node. This value is set by the node each time it joins the StorageOS cluster. + Name string `json:"name,omitempty"` + Health Health `json:"health,omitempty"` + // Endpoint at which we operate our dataplane's dfs service. (used for IO operations) This value is set on startup by the corresponding environment variable (IO_ADVERTISE_ADDRESS) + IoEndpoint string `json:"ioEndpoint,omitempty"` + // Endpoint at which we operate our dataplane's supervisor service (used for sync). This value is set on startup by the corresponding environment variable (SUPERVISOR_ADVERTISE_ADDRESS) + SupervisorEndpoint string `json:"supervisorEndpoint,omitempty"` + // Endpoint at which we operate our health checking service. This value is set on startup by the corresponding environment variable (GOSSIP_ADVERTISE_ADDRESS) + GossipEndpoint string `json:"gossipEndpoint,omitempty"` + // Endpoint at which we operate our clustering GRPC API. This value is set on startup by the corresponding environment variable (INTERNAL_API_ADVERTISE_ADDRESS) + ClusteringEndpoint string `json:"clusteringEndpoint,omitempty"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_policy_group.go b/v2/model_policy_group.go new file mode 100644 index 0000000..107718f --- /dev/null +++ b/v2/model_policy_group.go @@ -0,0 +1,30 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// PolicyGroup struct for PolicyGroup +type PolicyGroup struct { + // A unique identifier for a policy group. The format of this type is undefined and may change but the defined properties will not change.. + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + // The list of user IDs which this policy group governs. + Users []PolicyGroupUsers `json:"users,omitempty"` + // A set of authorisation policies to apply to the policy group. + Specs *[]PoliciesSpecs `json:"specs,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_policy_group_users.go b/v2/model_policy_group_users.go new file mode 100644 index 0000000..1d20446 --- /dev/null +++ b/v2/model_policy_group_users.go @@ -0,0 +1,17 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// PolicyGroupUsers struct for PolicyGroupUsers +type PolicyGroupUsers struct { + // A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. + Id string `json:"id,omitempty"` + Username string `json:"username,omitempty"` +} diff --git a/v2/model_update_authenticated_user_data.go b/v2/model_update_authenticated_user_data.go new file mode 100644 index 0000000..999b5c6 --- /dev/null +++ b/v2/model_update_authenticated_user_data.go @@ -0,0 +1,18 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateAuthenticatedUserData struct for UpdateAuthenticatedUserData +type UpdateAuthenticatedUserData struct { + // If not present, the existing password is not changed + Password string `json:"password,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_cluster_data.go b/v2/model_update_cluster_data.go new file mode 100644 index 0000000..fe5f3ab --- /dev/null +++ b/v2/model_update_cluster_data.go @@ -0,0 +1,26 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateClusterData struct for UpdateClusterData +type UpdateClusterData struct { + // A StorageOS product licence key, used to register a cluster. The format of this type is opaque and may change. If this field is empty we assume that the called does not want to update the cluster's licence, and do not perform any operation. + LicenceKey string `json:"licenceKey,omitempty"` + // Disables collection of telemetry data across the cluster. + DisableTelemetry bool `json:"disableTelemetry,omitempty"` + // Disables collection of reports for any fatal crashes across the cluster. + DisableCrashReporting bool `json:"disableCrashReporting,omitempty"` + // Disables the mechanism responsible for checking if there is an updated version of StorageOS available for installation. + DisableVersionCheck bool `json:"disableVersionCheck,omitempty"` + LogLevel LogLevel `json:"logLevel,omitempty"` + LogFormat LogFormat `json:"logFormat,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_namespace_data.go b/v2/model_update_namespace_data.go new file mode 100644 index 0000000..d338513 --- /dev/null +++ b/v2/model_update_namespace_data.go @@ -0,0 +1,18 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateNamespaceData struct for UpdateNamespaceData +type UpdateNamespaceData struct { + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_node_data.go b/v2/model_update_node_data.go new file mode 100644 index 0000000..3bfdbfb --- /dev/null +++ b/v2/model_update_node_data.go @@ -0,0 +1,18 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateNodeData struct for UpdateNodeData +type UpdateNodeData struct { + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_policy_group_data.go b/v2/model_update_policy_group_data.go new file mode 100644 index 0000000..6186101 --- /dev/null +++ b/v2/model_update_policy_group_data.go @@ -0,0 +1,18 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdatePolicyGroupData struct for UpdatePolicyGroupData +type UpdatePolicyGroupData struct { + // A set of authorisation policies to apply to the policy group. + Specs *[]PoliciesSpecs `json:"specs,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_user_data.go b/v2/model_update_user_data.go new file mode 100644 index 0000000..d27982d --- /dev/null +++ b/v2/model_update_user_data.go @@ -0,0 +1,22 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateUserData struct for UpdateUserData +type UpdateUserData struct { + // If not present, the existing password is not changed + Password string `json:"password,omitempty"` + // If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + // Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. + Groups *[]string `json:"groups,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_update_volume_data.go b/v2/model_update_volume_data.go new file mode 100644 index 0000000..8febd28 --- /dev/null +++ b/v2/model_update_volume_data.go @@ -0,0 +1,21 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +// UpdateVolumeData struct for UpdateVolumeData +type UpdateVolumeData struct { + // desired new volume name + Name string `json:"name,omitempty"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + Description string `json:"description,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_user.go b/v2/model_user.go new file mode 100644 index 0000000..2157f1d --- /dev/null +++ b/v2/model_user.go @@ -0,0 +1,30 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// User struct for User +type User struct { + // A unique identifier for a user. The format of this type is undefined and may change but the defined properties will not change.. + Id string `json:"id,omitempty"` + Username string `json:"username,omitempty"` + // If true, this user is an administrator of the cluster. Administrators bypass the usual authentication checks and are granted access to all resources. Some actions (such as adding a new user) can only be performed by an administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + // Defines a set of policy group IDs this user is a member of. Policy groups can be used to logically group users and apply authorisation policies to all members. + Groups *[]string `json:"groups,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/model_volume.go b/v2/model_volume.go new file mode 100644 index 0000000..36da72b --- /dev/null +++ b/v2/model_volume.go @@ -0,0 +1,37 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api +import ( + "time" +) +// Volume struct for Volume +type Volume struct { + // A unique identifier for a volume. The format of this type is undefined and may change but the defined properties will not change. + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + AttachedOn string `json:"attachedOn,omitempty"` + NamespaceID string `json:"namespaceID,omitempty"` + // A set of arbitrary key value labels to apply to the entity. + Labels map[string]string `json:"labels,omitempty"` + FsType FsType `json:"fsType,omitempty"` + Inode uint32 `json:"inode,omitempty"` + Master DeploymentInfo `json:"master,omitempty"` + Replicas *[]DeploymentInfo `json:"replicas,omitempty"` + // A volume's size in bytes + SizeBytes uint64 `json:"sizeBytes,omitempty"` + // The time the entity was created. This timestamp is set by the node that created the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + CreatedAt time.Time `json:"createdAt,omitempty"` + // The time the entity was last updated. This timestamp is set by the node that last updated the entity, and may not be correct if the node's local clock was skewed. This value is for the user's informative purposes only, and correctness is not required. String format is RFC3339. + UpdatedAt time.Time `json:"updatedAt,omitempty"` + // An opaque representation of an entity version at the time it was obtained from the API. All operations that mutate the entity must include this version field in the request unchanged. The format of this type is undefined and may change but the defined properties will not change. + Version string `json:"version,omitempty"` +} diff --git a/v2/openapi.yaml b/v2/openapi.yaml new file mode 100644 index 0000000..64695fd --- /dev/null +++ b/v2/openapi.yaml @@ -0,0 +1,2510 @@ +openapi: "3.0.2" +info: + title: "StorageOS API" + version: "2.0.0" + contact: + name: StorageOS + url: https://storageos.com + email: info@storageos.com + +externalDocs: + url: https://docs.storageos.com/ + description: "The latest StorageOS user documentation" + +servers: + - url: /v2 + +components: + securitySchemes: + # The StorageOS API uses JWT (JSON web token) based authentication. + jwt: + type: http + scheme: bearer + bearerFormat: "JWT" + description: StorageOS uses JSON web tokens for authentication. + + schemas: + OpenAPISpec: + type: string + readOnly: true + description: > + Serves this openapi specification file. + + # This is the standard HTTP error format used for all API errors. + + Error: + type: object + required: + - error + properties: + error: + type: string + example: + error: A short description of the error + + # ------------------------------------------------------------------------------ + # generic types used across multiple endpoints + # ------------------------------------------------------------------------------ + + Version: + type: string + maxLength: 30 + minLength: 1 + description: > + An opaque representation of an entity version at the time it was + obtained from the API. + + All operations that mutate the entity must include this version + field in the request unchanged. + + The format of this type is undefined and may change but the + defined properties will not change. + example: NDI0MjQyNDI0MjQyNDI0MjQy + + IgnoreVersion: + type: boolean + default: false + description: > + Ignoring the entity version constraints. + + If set to true this value indicates that the user wants to + ignore entity version constraints, thereby "forcing" the + operation. + example: true + + ExpiresAt: + type: string + format: date-time + readOnly: true + description: > + The time after which a licence will no longer be valid + + This timestamp is set when the licence is created. + + String format is RFC3339. + example: "2019-03-10T13:42:42Z" + + CreatedAt: + type: string + format: date-time + readOnly: true + description: > + The time the entity was created. + + This timestamp is set by the node that created the entity, and + may not be correct if the node's local clock was skewed. + + This value is for the user's informative purposes only, and + correctness is not required. + + String format is RFC3339. + example: "2019-03-10T13:42:42Z" + + UpdatedAt: + type: string + format: date-time + readOnly: true + description: > + The time the entity was last updated. + + This timestamp is set by the node that last updated the entity, + and may not be correct if the node's local clock was skewed. + + This value is for the user's informative purposes only, and + correctness is not required. + + String format is RFC3339. + example: "2019-03-29T23:13:13Z" + + FsType: + type: string + enum: + - "ext2" + - "ext3" + - "ext4" + - "xfs" + - "btrfs" + - "block" + description: > + The file system type of a volume. "block" is a raw block device (no filesystem). + example: "ext4" + + Health: + type: string + readOnly: true + enum: + - "online" + - "offline" + - "unknown" + description: > + The operational health of an entity + example: "online" + + Labels: + type: object + description: > + A set of arbitrary key value labels to apply to the entity. + externalDocs: + url: https://docs.storageos.com/docs/reference/labels + additionalProperties: + type: string + example: + env: prod + rack: db-1 + + LogLevel: + type: string + enum: + - "debug" + - "info" + - "warn" + - "error" + default: "info" + description: > + This setting determines the log level for nodes across + the cluster to use when recording entries in the log. + All entries below the specified log level are discarded, + where "error" is the highest log level and "debug" is + the lowest. + + This setting is only checked by nodes on startup. + Changing this setting will not affect the behaviour of + nodes that are already operational. + example: "debug" + + LogFormat: + type: string + enum: + - "default" + - "json" + default: "default" + description: > + This setting determines the format nodes in the cluster + will use for log entries. + + This setting is only checked by nodes on startup. + Changing this setting will not affect the behaviour of + nodes that are already operational. + example: "json" + + # ------------------------------------------------------------------------------ + # UUIDs + # ------------------------------------------------------------------------------ + + ClusterID: + readOnly: true + type: string + description: > + A unique identifier for a cluster. + The format of this type is undefined and may change but the + defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + NodeID: + readOnly: true + type: string + description: > + A unique identifier for a node. + The format of this type is undefined and may change but the + defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + VolumeID: + type: string + description: > + A unique identifier for a volume. + The format of this type is undefined and may change but the + defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + DeploymentID: + type: string + description: > + A unique identifier for a volume deployment. + The format of this type is undefined and may change but the + defined properties will not change. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + NamespaceID: + type: string + description: > + A unique identifier for a namespace. + The format of this type is undefined and may change but the + defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + UserID: + type: string + description: > + A unique identifier for a user. + The format of this type is undefined and may change but the + defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + PolicyGroupID: + type: string + description: > + A unique identifier for a policy group. + The format of this type is undefined and may change but the + defined properties will not change.. + example: c5666b58-b805-4215-ab4a-cb094948ccc6 + + # ------------------------------------------------------------------------------ + # entity objects (e.g user) + # + # Mutating an entity will have a slightly different data model and are + # defined inline for each endpoint. + # ------------------------------------------------------------------------------ + + Cluster: + type: object + properties: + id: + $ref: "#/components/schemas/ClusterID" + licence: + $ref: "#/components/schemas/Licence" + disableTelemetry: + type: boolean + default: false + description: Disables collection of telemetry data across the cluster. + example: false + disableCrashReporting: + type: boolean + default: false + description: > + Disables collection of reports for any fatal crashes across the + cluster. + example: false + disableVersionCheck: + type: boolean + default: false + description: > + Disables the mechanism responsible for checking if there is an + updated version of StorageOS available for installation. + example: false + logLevel: + $ref: "#/components/schemas/LogLevel" + logFormat: + $ref: "#/components/schemas/LogFormat" + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + User: + type: object + properties: + id: + $ref: "#/components/schemas/UserID" + username: + type: string + example: admin + isAdmin: + type: boolean + default: false + description: > + If true, this user is an administrator of the cluster. + + Administrators bypass the usual authentication checks + and are granted access to all resources. Some actions + (such as adding a new user) can only be performed by an + administrator. + example: true + groups: + type: array + items: + $ref: "#/components/schemas/PolicyGroupID" + default: [] + nullable: true + description: > + Defines a set of policy group IDs this user is a member + of. + + Policy groups can be used to logically group users and + apply authorisation policies to all members. + example: + - "24d5db6f-9738-4f17-a257-b9dd41a35309" + - "4223b453-4d47-49d5-960f-23fc7a8153ba" + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + Volume: + type: object + properties: + id: + $ref: "#/components/schemas/VolumeID" + name: + type: string + example: "app-data" + description: + type: string + example: "This volume contains the data for my app" + attachedOn: + readOnly: true + allOf: + - $ref: "#/components/schemas/NodeID" + namespaceID: + readOnly: true + allOf: + - $ref: "#/components/schemas/NamespaceID" + labels: + $ref: "#/components/schemas/Labels" + fsType: + $ref: "#/components/schemas/FsType" + inode: + readOnly: true + type: uint32 + example: 42 + master: + readOnly: true + allOf: + - $ref: "#/components/schemas/DeploymentInfo" + replicas: + type: array + nullable: true + readOnly: true + default: [] + items: + $ref: "#/components/schemas/DeploymentInfo" + sizeBytes: + type: uint64 + description: > + A volume's size in bytes + minimum: 0 + example: 5000 + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + DeploymentInfo: + type: object + properties: + id: + $ref: "#/components/schemas/DeploymentID" + nodeID: + $ref: "#/components/schemas/NodeID" + inode: + type: uint32 + readOnly: true + example: 1223 + health: + $ref: "#/components/schemas/Health" + syncing: + type: boolean + description: > + indicates if a volume is undergoing data synchronization operations + + Node: + type: object + properties: + id: + $ref: "#/components/schemas/NodeID" + name: + type: string + readOnly: true + description: > + The hostname of the node. + + This value is set by the node each time it joins the + StorageOS cluster. + example: db1.lcy.storageos.network + health: + $ref: "#/components/schemas/Health" + ioEndpoint: + type: string + readOnly: true + description: > + Endpoint at which we operate our dataplane's dfs + service. (used for IO operations) + + This value is set on startup by the corresponding + environment variable (IO_ADVERTISE_ADDRESS) + example: + - "192.0.2.1:5703" + supervisorEndpoint: + type: string + readOnly: true + description: > + Endpoint at which we operate our dataplane's supervisor + service (used for sync). + + This value is set on startup by the corresponding + environment variable (SUPERVISOR_ADVERTISE_ADDRESS) + example: + - "192.0.2.1:5704" + gossipEndpoint: + type: string + readOnly: true + description: > + Endpoint at which we operate our health checking service. + + This value is set on startup by the corresponding + environment variable (GOSSIP_ADVERTISE_ADDRESS) + example: + - "192.0.2.1:5711" + clusteringEndpoint: + type: string + readOnly: true + description: > + Endpoint at which we operate our clustering GRPC API. + + This value is set on startup by the corresponding + environment variable (INTERNAL_API_ADVERTISE_ADDRESS) + example: + - "192.0.2.1:5710" + labels: + $ref: "#/components/schemas/Labels" + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + Namespace: + type: object + properties: + id: + $ref: "#/components/schemas/NamespaceID" + name: + type: string + readOnly: true + example: "dev" + labels: + $ref: "#/components/schemas/Labels" + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + PolicyGroup: + type: object + properties: + id: + $ref: "#/components/schemas/PolicyGroupID" + name: + type: string + example: "dev-users" + users: + type: array + readOnly: true + items: + type: object + properties: + id: + $ref: "#/components/schemas/UserID" + username: + type: string + example: "admin" + description: The list of user IDs which this policy group governs. + example: + - id: "82f297ae-8381-4c09-b9a1-8401c83c418d" + username: "user_a" + - id: "f4bb11d6-594a-4f21-9d1c-d49711a0453e" + username: "user_b" + - id: "30d3a4dc-971b-4f3e-9b89-5da6fea383ce" + username: "user_c" + specs: + type: array + items: + type: object + properties: + namespaceID: + $ref: "#/components/schemas/NamespaceID" + resourceType: + type: string + enum: + - "*" + - "volume" + - "policy" + description: > + The resource type this policy grants access to. + example: "volume" + readOnly: + type: boolean + default: false + description: > + If true, disallows requests that attempt to mutate the + resource. + example: false + description: A set of authorisation policies to apply to the policy group. + default: [] + nullable: true + example: + - namespaceID: "251f065a-d89b-4426-a752-5fdd144d00e8" + resourceType: "*" + readOnly: false + - namespaceID: "5f009d1f-6618-43c2-9ae4-e699461dda8e" + resourceType: "volume" + readOnly: true + createdAt: + $ref: "#/components/schemas/CreatedAt" + updatedAt: + $ref: "#/components/schemas/UpdatedAt" + version: + $ref: "#/components/schemas/Version" + + Licence: + type: object + properties: + clusterID: + $ref: "#/components/schemas/ClusterID" + expiresAt: + $ref: "#/components/schemas/ExpiresAt" + clusterCapacityBytes: + type: uint64 + description: > + The allowed provisioning capacity in bytes + + This value if for the cluster, if provisioning a volume + brings the cluster's total provisioned capacity above + it the request will fail + minimum: 0 + example: 1000000 + kind: + type: string + description: > + Denotes which category the licence belongs to + example: "basic" + customerName: + type: string + description: > + A user friendly reference to the customer + example: "Desmond" + description: > + A representation of a cluster's licence properties + + AcceptedMessage: + type: object + properties: + msg: + type: string + example: + msg: "asynchronous request accepted with timeout: 10s" + + UserList: + type: array + items: + $ref: "#/components/schemas/User" + + NamespaceList: + type: array + items: + $ref: "#/components/schemas/Namespace" + + NodeList: + type: array + items: + $ref: "#/components/schemas/Node" + + PolicyGroupList: + type: array + items: + $ref: "#/components/schemas/PolicyGroup" + + VolumeList: + type: array + items: + $ref: "#/components/schemas/Volume" + + parameters: + ObjectVersion: + name: version + in: query + description: > + This value is used to perform a conditional delete of the + entity. + + If the entity has been modified since the version token was + obtained, the request will fail with a HTTP 409 Conflict. + required: true + schema: + $ref: "#/components/schemas/Version" + IgnoreVersion: + name: ignore-version + in: query + description: > + If set to true this value indicates that the user wants to + ignore entity version constraints, thereby "forcing" the + operation. + required: false + schema: + $ref: "#/components/schemas/IgnoreVersion" + AsyncHeader: + name: async-max + in: header + schema: + type: string + description: > + Optional header which will make the api request asynchronous. The + operation will not be cancelled even if the client disconnect. + + The value of this header defines the timeout duration for the request, + it must be set to a valid duration string. + + A duration string is a possibly signed sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time + units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + + We reject negative or nil duration values. + example: async-max:20s + AsyncParam: + name: async-max + in: query + schema: + type: string + description: > + Optional parameter which will make the api request asynchronous. The + operation will not be cancelled even if the client disconnect. + + The URL parameter value overrides the "async-max" header value, if any. + + The value of this header defines the timeout duration for the request, + it must be set to a valid duration string. + + A duration string is a possibly signed sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms", or "2h45m". Valid time + units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + + We reject negative or nil duration values. + + responses: + BadRequest: + description: The request does not conform to the API specification. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: a short description of the validation failure + + ServerError: + description: > + The request caused an internal server error and should be + retried. + + Check the health of the node/cluster and if the error persists, + contact support. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + StoreError: + description: > + The server is currently unable to handle the request due to + a temporary store failure. + + Check the health of the node/cluster and if the error persists, + contact support. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + LicenceRestricted: + description: > + The requested operation failed because your storageOS licence + does not allow it, either create an account for a free licence + or buy a professional licence. + + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: insufficient allowed capacity (bytes) (used 53687091200, allowed 53687091200, requested 5000000) + + Unauthorised: + description: > + The requested endpoint requires authentication - you must log in + first. + + If attempting to log in, your credentials were not recognised. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: authentication required + + Forbidden: + description: > + The authenticated user does not have permission to perform the + requested action. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: unauthorised + + NotFound: + description: > + A referenced resource does not exist. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: not found + + StaleWrite: + description: > + The entity to be wrote has been concurrently updated by another + request - the submitted entity data has been replaced. + + The caller should fetch the entity again, check the actions are + still required and resubmit the request with the new entity + version field. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: attempting to write stale object + + InvalidStateTransition: + description: > + An action was requested that cannot be performed on the entity + in it's current state. + + As an example, this error might be returned when trying to + delete a currently mounted volume. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: invalid state for operation (currently "deleted") + + AlreadyExists: + description: > + The entity to be wrote uses an identifier that already exists. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: already exists + + InUse: + description: > + A referenced entity is currently in use. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: in use + + Accepted: + description: > + An aynchronous request has been accepted + content: + application/json: + schema: + $ref: "#/components/schemas/AcceptedMessage" + +paths: + /auth/login: + post: + summary: Authenticate a user + operationId: authenticateUser + description: Generate a new JWT token for a user. + requestBody: + description: The credentials to use for authentication. + required: true + content: + application/json: + schema: + type: object + title: AuthUserData + required: + - username + - password + properties: + username: + type: string + password: + type: string + format: password + example: + username: admin + password: supersecret + responses: + "200": + description: Successfully authenticated the returned user. + headers: + Authorization: + description: > + The JWT token - this header should be sent to + the server to perform an authenticated request. + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + # The user is not recognised, or the password is incorrect + $ref: "#/components/responses/Unauthorised" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /auth/refresh: + post: + summary: Refresh the JWT + operationId: refreshJwt + description: Obtain a fresh token with an updated expiry deadline. + security: + - jwt: [] + responses: + "200": + description: Refresh was successful + headers: + Authorization: + description: The new JWT token. + schema: + type: string + "401": + # The user has been removed from the system since acquiring + # the token + $ref: "#/components/responses/Unauthorised" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /users: + post: + summary: Create a new user + operationId: createUser + description: Create a new user in the cluster - only administrators can create new users. + security: + - jwt: [] + requestBody: + description: Data required to create a new user in the cluster. + required: true + content: + application/json: + schema: + # Defined to be able to mark "username" and "password" as required + type: object + title: CreateUserData + required: + - username + - password + properties: + username: + type: string + example: admin + password: + type: string + format: password + description: If not present, the existing password is not changed + default: unchanged + writeOnly: true + example: turtlesaregreat + isAdmin: + type: boolean + default: false + description: > + If true, this user is an administrator of the cluster. + + Administrators bypass the usual authentication checks + and are granted access to all resources. Some actions + (such as adding a new user) can only be performed by an + administrator. + example: true + groups: + type: array + items: + $ref: "#/components/schemas/PolicyGroupID" + default: [] + nullable: true + description: > + Defines a set of policy group IDs this + user is a member of. + + Policy groups can be used to logically + group users and apply authorisation + policies to all members. + example: + - "24d5db6f-9738-4f17-a257-b9dd41a35309" + - "4223b453-4d47-49d5-960f-23fc7a8153ba" + responses: + "201": + description: The account was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "409": + $ref: "#/components/responses/AlreadyExists" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + get: + summary: Fetch the list of users + operationId: listUsers + description: Fetch the list of users of the cluster. + security: + - jwt: [] + responses: + "200": + description: A list of cluster users. + content: + application/json: + schema: + $ref: "#/components/schemas/UserList" + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /users/{id}: + parameters: + - name: id + in: path + description: ID of a user + required: true + schema: + $ref: "#/components/schemas/UserID" + + get: + summary: Fetch a user + operationId: getUser + description: Fetch the user identified by id. + security: + - jwt: [] + responses: + "200": + description: The user information. + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update a user + operationId: updateUser + description: > + Update the user identified by id. + + This request will not succeed if the target account is the + currently authenticated account. Use the separate users/self + endpoint for this purpose. + security: + - jwt: [] + requestBody: + description: The new User data to store. + required: true + content: + application/json: + schema: + type: object + title: UpdateUserData + properties: + password: + type: string + format: password + description: If not present, the existing password is not changed + default: unchanged + writeOnly: true + example: turtlesaregreat + isAdmin: + type: boolean + default: false + description: > + If true, this user is an administrator of the cluster. + + Administrators bypass the usual authentication checks + and are granted access to all resources. Some actions + (such as adding a new user) can only be performed by an + administrator. + example: true + groups: + type: array + items: + $ref: "#/components/schemas/PolicyGroupID" + default: [] + nullable: true + description: > + Defines a set of policy group IDs this + user is a member of. + + Policy groups can be used to logically + group users and apply authorisation + policies to all members. + example: + - "24d5db6f-9738-4f17-a257-b9dd41a35309" + - "4223b453-4d47-49d5-960f-23fc7a8153ba" + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The account was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete a user + operationId: deleteUser + description: > + Remove the user identified by id. + + This request will not succeed if the target account is the + currently authenticated account. Use the separate users/self + endpoint for this purpose. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + + responses: + "200": + description: The user was successfully deleted. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + /users/{id}/sessions: + parameters: + - name: id + in: path + description: ID of a user + required: true + schema: + $ref: "#/components/schemas/UserID" + + delete: + summary: Invalidate login sessions + operationId: deleteSessions + description: > + Invalidates active JWTs on a per-user basis, specified + by id. + + This request will not succeed if the target account is the + currently authenticated account. Use the separate users/self + endpoint for this purpose. + security: + - jwt: [] + responses: + "200": + description: The users current session was successfully invalidated. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + /users/self: + get: + summary: Get the currently authenticated user's information + operationId: getAuthenticatedUser + description: Fetch authenticated user's information. + security: + - jwt: [] + responses: + "200": + description: The authenticated user's information. + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update the authenticated user's information + operationId: updateAuthenticatedUser + description: Update the authenticated user. + security: + - jwt: [] + requestBody: + description: The new authenticated user's data. + required: true + content: + application/json: + schema: + type: object + title: UpdateAuthenticatedUserData + properties: + password: + type: string + format: password + description: If not present, the existing password is not changed + default: unchanged + writeOnly: true + example: turtlesaregreat + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The account was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/User" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete the authenticated user + operationId: deleteAuthenticatedUser + description: Remove the authenticated user from the cluster. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + + responses: + "200": + description: The authenticated user was successfully deleted. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + /users/self/sessions: + delete: + summary: Invalidate the logged in user's sessions + operationId: deleteAuthenticatedUserSessions + description: Invalidates logged in user's active JWTs. + security: + - jwt: [] + responses: + "200": + description: The authenticated user's sessions have been invalidated. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /namespaces: + post: + summary: Create a new namespace + operationId: createNamespace + description: Create a new namespace in the cluster - only administrators can create new namespaces. + security: + - jwt: [] + requestBody: + description: Data required to create a new namespace in the cluster. + required: true + content: + application/json: + schema: + type: object + title: CreateNamespaceData + properties: + name: + type: string + pattern: '^[a-z0-9.\-]{1,253}$' + description: > + The name of the namespace shown in the CLI and UI + example: "dev" + labels: + $ref: "#/components/schemas/Labels" + responses: + "201": + description: The namespace was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "409": + $ref: "#/components/responses/AlreadyExists" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + get: + summary: Fetch the list of namespaces + operationId: listNamespaces + description: Fetch the list of namespaces in the cluster. + security: + - jwt: [] + responses: + "200": + description: A list of cluster namespaces. + content: + application/json: + schema: + $ref: "#/components/schemas/NamespaceList" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /namespaces/{id}: + parameters: + - name: id + in: path + description: ID of a namespace + required: true + schema: + $ref: "#/components/schemas/NamespaceID" + + get: + summary: Fetch a namespace + operationId: getNamespace + description: Fetch the namespace identified by id. + security: + - jwt: [] + responses: + "200": + description: The namespace information. + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update a namespace + operationId: updateNamespace + description: Update the namespace identified by id. + security: + - jwt: [] + requestBody: + description: The new namespace data to store. + required: true + content: + application/json: + schema: + type: object + title: UpdateNamespaceData + properties: + labels: + $ref: "#/components/schemas/Labels" + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The namespace was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete a namespace + operationId: deleteNamespace + description: Remove the namespace identified by id. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + + responses: + "200": + description: The namespace was successfully deleted. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + $ref: "#/components/responses/InUse" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /nodes: + get: + summary: Fetch the list of nodes + operationId: listNodes + description: Fetch the list of nodes of the cluster. + security: + - jwt: [] + responses: + "200": + description: A list of cluster nodes. + content: + application/json: + schema: + $ref: "#/components/schemas/NodeList" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /nodes/{id}: + parameters: + - name: id + in: path + description: ID of a node + required: true + schema: + $ref: "#/components/schemas/NodeID" + + get: + summary: Fetch a node + operationId: getNode + description: Fetch the node identified by id. + security: + - jwt: [] + responses: + "200": + description: The node information. + content: + application/json: + schema: + $ref: "#/components/schemas/Node" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update a node + operationId: updateNode + description: Update the node identified by id. + security: + - jwt: [] + requestBody: + description: The new node data to store. + required: true + content: + application/json: + schema: + type: object + title: UpdateNodeData + properties: + labels: + $ref: "#/components/schemas/Labels" + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The node was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/Node" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete a node + operationId: deleteNode + description: > + Remove the node identified by id. + + A node can only be deleted if it is currently offline. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + - $ref: "#/components/parameters/AsyncHeader" + - $ref: "#/components/parameters/AsyncParam" + + responses: + "200": + description: The node was successfully deleted. + + "202": + $ref: "#/components/responses/Accepted" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + description: > + The request attempted to delete a node that is not + currently offline. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + error: node not offline + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /policies: + post: + summary: Create a new policy group + operationId: createPolicyGroup + description: > + Create a new policy group in the cluster - only administrators + can create new policy groups. + security: + - jwt: [] + requestBody: + description: Data required to create a new policy group in the cluster. + required: true + content: + application/json: + schema: + type: object + title: CreatePolicyGroupData + properties: + name: + type: string + example: "dev-users" + specs: + type: array + items: + type: object + properties: + namespaceID: + $ref: "#/components/schemas/NamespaceID" + resourceType: + type: string + enum: + - "*" + - "volume" + - "policy" + description: > + The resource type this policy grants access to. + example: "volume" + readOnly: + type: boolean + default: false + description: > + If true, disallows requests that attempt to mutate the + resource. + example: false + description: A set of authorisation policies to apply to the policy group. + default: [] + nullable: true + example: + - namespaceID: "251f065a-d89b-4426-a752-5fdd144d00e8" + resourceType: "*" + readOnly: false + - namespaceID: "5f009d1f-6618-43c2-9ae4-e699461dda8e" + resourceType: "volume" + readOnly: true + responses: + "201": + description: The policy group was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/PolicyGroup" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "409": + $ref: "#/components/responses/AlreadyExists" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + get: + summary: Fetch the list of policy groups + operationId: listPolicyGroups + description: Fetch the list of policy groups in the cluster. + security: + - jwt: [] + responses: + "200": + description: A list of cluster policy groups. + content: + application/json: + schema: + $ref: "#/components/schemas/PolicyGroupList" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /policies/{id}: + parameters: + - name: id + in: path + description: ID of a policy group + required: true + schema: + $ref: "#/components/schemas/PolicyGroupID" + + get: + summary: Fetch a policy group + operationId: getPolicyGroup + description: Fetch the policy group identified by id. + security: + - jwt: [] + responses: + "200": + description: The policy group information. + content: + application/json: + schema: + $ref: "#/components/schemas/PolicyGroup" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update a policy group + operationId: updatePolicyGroup + description: Update the policy group identified by id. + security: + - jwt: [] + requestBody: + description: The new policy group data to store. + required: true + content: + application/json: + schema: + type: object + title: UpdatePolicyGroupData + properties: + specs: + type: array + items: + type: object + properties: + namespaceID: + $ref: "#/components/schemas/NamespaceID" + resourceType: + type: string + enum: + - "*" + - "volume" + - "policy" + description: > + The resource type this policy grants access to. + example: "volume" + readOnly: + type: boolean + default: false + description: > + If true, disallows requests that attempt to mutate the + resource. + example: false + description: A set of authorisation policies to apply to the policy group. + default: [] + nullable: true + example: + - namespaceID: "251f065a-d89b-4426-a752-5fdd144d00e8" + resourceType: "*" + readOnly: false + - namespaceID: "5f009d1f-6618-43c2-9ae4-e699461dda8e" + resourceType: "volume" + readOnly: true + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The policy group was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/PolicyGroup" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete a policy group + operationId: deletePolicyGroup + description: Remove the policy group identified by id. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + + responses: + "200": + description: The policy group was successfully deleted. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + $ref: "#/components/responses/InUse" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /namespaces/{namespaceID}/volumes: + parameters: + - name: namespaceID + in: path + description: ID of a Namespace + required: true + schema: + $ref: "#/components/schemas/NamespaceID" + post: + summary: Create a new Volume in the specified namespace + operationId: createVolume + description: Create a new volume in the given namespace + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/AsyncHeader" + - $ref: "#/components/parameters/AsyncParam" + requestBody: + description: Data required to create a new volume in the cluster. + required: true + content: + application/json: + schema: + type: object + title: CreateVolumeData + required: + - name + - namespaceID + - sizeBytes + - fsType + properties: + namespaceID: + $ref: "#/components/schemas/NamespaceID" + labels: + $ref: "#/components/schemas/Labels" + name: + type: string + pattern: '^[a-z0-9.\-]{1,253}$' + description: > + The name of the volume shown in the CLI and UI + example: "data" + fsType: + $ref: "#/components/schemas/FsType" + description: + type: string + example: "This volume contains the data for my app" + sizeBytes: + type: uint64 + description: > + A volume's size in bytes + minimum: 0 + example: 5000 + responses: + "201": + description: The volume was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/Volume" + "202": + $ref: "#/components/responses/Accepted" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "409": + $ref: "#/components/responses/AlreadyExists" + + "451": + $ref: "#/components/responses/LicenceRestricted" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + get: + summary: Fetch the list of volumes in the given namespace + operationId: listVolumes + description: Fetch the list of volumes in the cluster. + security: + - jwt: [] + responses: + "200": + description: A list of the namespace's volumes. + content: + application/json: + schema: + $ref: "#/components/schemas/VolumeList" + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /namespaces/{namespaceID}/volumes/{id}: + parameters: + - name: namespaceID + in: path + description: ID of a Namespace + required: true + schema: + $ref: "#/components/schemas/NamespaceID" + - name: id + in: path + description: ID of a Volume + required: true + schema: + $ref: "#/components/schemas/VolumeID" + + get: + summary: Fetch a volume + operationId: getVolume + description: Fetch the volume identified by id. + security: + - jwt: [] + responses: + "200": + description: The volume information. + content: + application/json: + schema: + $ref: "#/components/schemas/Volume" + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update a volume + operationId: updateVolume + description: Update the volume identified by id. + security: + - jwt: [] + requestBody: + description: update a volume to a desired state. + required: true + content: + application/json: + schema: + type: object + title: UpdateVolumeData + properties: + name: + type: string + description: > + desired new volume name + example: "new-volume-name" + labels: + $ref: "#/components/schemas/Labels" + description: + type: string + example: "This volume contains the data for my app" + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The volume was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/Volume" + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "412": + $ref: "#/components/responses/StaleWrite" + + "451": + $ref: "#/components/responses/LicenceRestricted" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + delete: + summary: Delete a volume + operationId: deleteVolume + description: Remove the volume identified by id. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + + - $ref: "#/components/parameters/AsyncHeader" + - $ref: "#/components/parameters/AsyncParam" + responses: + "200": + description: The volume was successfully deleted. + + "202": + $ref: "#/components/responses/Accepted" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + $ref: "#/components/responses/InUse" + + "412": + $ref: "#/components/responses/StaleWrite" + + "422": + $ref: "#/components/responses/InvalidStateTransition" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + /namespaces/{namespaceID}/volumes/{id}/attach: + parameters: + - name: namespaceID + in: path + description: ID of a Namespace + required: true + schema: + $ref: "#/components/schemas/NamespaceID" + - name: id + in: path + description: ID of a Volume + required: true + schema: + $ref: "#/components/schemas/VolumeID" + + post: + summary: Attach a volume to the given node + operationId: attachVolume + description: Attach the volume identified by id to the node identified in the request's body. + security: + - jwt: [] + requestBody: + description: Node ID to which the volume will be attached. + required: true + content: + application/json: + schema: + type: object + title: AttachVolumeData + properties: + nodeID: + $ref: "#/components/schemas/NodeID" + responses: + "200": + description: The volume was successfully attached. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + $ref: "#/components/responses/InUse" + + "422": + $ref: "#/components/responses/InvalidStateTransition" + + "500": + $ref: "#/components/responses/ServerError" + delete: + summary: Detach the given volume + operationId: detachVolume + description: Detach the volume identified by id. + security: + - jwt: [] + parameters: + - $ref: "#/components/parameters/ObjectVersion" + - $ref: "#/components/parameters/IgnoreVersion" + responses: + "200": + description: The volume was successfully detached. + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "404": + $ref: "#/components/responses/NotFound" + + "409": + $ref: "#/components/responses/InUse" + + "412": + $ref: "#/components/responses/StaleWrite" + + "422": + $ref: "#/components/responses/InvalidStateTransition" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /cluster: + get: + summary: Retrieves the cluster's global configuration settings + operationId: getCluster + description: Retrieves the current global configuration settings in use by the cluster. + security: + - jwt: [] + responses: + "200": + description: The cluster-wide configuration information. + content: + application/json: + schema: + $ref: "#/components/schemas/Cluster" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + put: + summary: Update the cluster's global configuration settings + operationId: updateCluster + description: Update the global configuration settings to use for the cluster. + security: + - jwt: [] + requestBody: + description: The new cluster-wide configuration settings to apply. + required: true + content: + application/json: + schema: + type: object + title: UpdateClusterData + properties: + licenceKey: + type: string + description: > + A StorageOS product licence key, used to + register a cluster. The format of this + type is opaque and may change. + + If this field is empty we assume that + the called does not want to update the + cluster's licence, and do not perform + any operation. + disableTelemetry: + type: boolean + default: false + description: > + Disables collection of telemetry data + across the cluster. + example: false + disableCrashReporting: + type: boolean + default: false + description: > + Disables collection of reports for any + fatal crashes across the cluster. + example: false + disableVersionCheck: + type: boolean + default: false + description: > + Disables the mechanism responsible for + checking if there is an updated version + of StorageOS available for installation. + example: false + logLevel: + $ref: "#/components/schemas/LogLevel" + logFormat: + $ref: "#/components/schemas/LogFormat" + version: + $ref: "#/components/schemas/Version" + responses: + "200": + description: The cluster was successfully updated. + content: + application/json: + schema: + $ref: "#/components/schemas/Cluster" + + "400": + $ref: "#/components/responses/BadRequest" + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "412": + $ref: "#/components/responses/StaleWrite" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /diagnostics: + get: + summary: Retrieves a diagnostics bundle from the target node + operationId: getDiagnostics + description: > + Requests that the target node gathers detailed information + about the state of the cluster, using it to then build and + return a bundle which can be used for troubleshooting. + + The request will only be served when the authenticated user + is an administrator. + + The node will attempt to gather information about its local + state, cluster-wide state and local state of other nodes + in the cluster. If the cluster is unhealthy this may cause + a slower response. + security: + - jwt: [] + responses: + "200": + description: > + A diagnostics bundle was successfully built and + returned. + content: + application/gzip: + schema: + type: string + format: binary + + "401": + $ref: "#/components/responses/Unauthorised" + + "403": + $ref: "#/components/responses/Forbidden" + + "500": + $ref: "#/components/responses/ServerError" + + "503": + $ref: "#/components/responses/StoreError" + + /openapi: + get: + summary: Serves this openapi spec file + operationId: spec + description: Serves this openapi spec file + responses: + "200": + description: The openapi spec file has been served + content: + text/yaml: + schema: + $ref: "#/components/schemas/OpenAPISpec" diff --git a/v2/response.go b/v2/response.go new file mode 100644 index 0000000..b600293 --- /dev/null +++ b/v2/response.go @@ -0,0 +1,47 @@ +/* + * StorageOS API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + * Contact: info@storageos.com + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package api + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResonse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} From 056e213e068764006bb3207fd4b7697baf3a47df Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 10:36:32 +0000 Subject: [PATCH 2/6] Add help to Makefile --- v2/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/v2/Makefile b/v2/Makefile index ac4b3d2..0c73e88 100644 --- a/v2/Makefile +++ b/v2/Makefile @@ -9,9 +9,9 @@ GIT_REPO_ID ?= go-api help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-13s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) -build: generate customise ## Re-generates the API from openapi.yaml +build: generate customise ## Re-generates the API from openapi.yaml. -generate: +generate: ## Runs the openapi-generator on openapi.yaml. docker run --rm -v `pwd`:/local -u `id -u ${USER}`:`id -g ${USER}` \ openapitools/openapi-generator-cli:latest generate \ --strict-spec=true \ @@ -20,11 +20,11 @@ generate: --additional-properties packageVersion=$(VERSION) \ -i /local/openapi.yaml -g go -o /local -customise: +customise: ## Applies customisations to the generated API. sed -i 's/\[]map/map/ig' *.go sed -i "s#module github.com/GIT_USER_ID/GIT_REPO_ID#module github.com/${GIT_USER_ID}/${GIT_REPO_ID}/v2#g" go.mod -clean: +clean: ## Removes generated files. rm -f .openapi-generator-ignore .gitignore git_push.sh .travis.yml *.go go.mod go.sum rm -rf .openapi-generator/ api/ docs/ From 82e949c6c5c3132e42faf8e80fe12ce18737b5b4 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 10:38:56 +0000 Subject: [PATCH 3/6] Update after re-generation --- v2/README.md | 2 +- v2/configuration.go | 2 +- v2/go.mod | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/v2/README.md b/v2/README.md index 17687f6..c24873e 100644 --- a/v2/README.md +++ b/v2/README.md @@ -6,7 +6,7 @@ No description provided (generated by Openapi Generator https://github.com/opena 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: 2.0.0 -- Package version: 2.0.0-beta1 +- Package version: 2.0.0-rc1 - Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit [https://storageos.com](https://storageos.com) diff --git a/v2/configuration.go b/v2/configuration.go index 042d4d1..707090c 100644 --- a/v2/configuration.go +++ b/v2/configuration.go @@ -85,7 +85,7 @@ func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost/v2", DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/2.0.0-beta1/go", + UserAgent: "OpenAPI-Generator/2.0.0-rc1/go", Debug: false, Servers: []ServerConfiguration{ { diff --git a/v2/go.mod b/v2/go.mod index 4eb1c0c..3e8903e 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -1,9 +1,7 @@ -module github.com/croomes/go-api/v2 +module github.com/storageos/go-api/v2 require ( github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - + ) - -go 1.13 From 19f3d91554ede9f33af62e447ad617c03755e2b4 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 14:14:15 +0000 Subject: [PATCH 4/6] Bump to go 1.13 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 853f116..4bf10bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: build: docker: # specify the version - - image: circleci/golang:1.10 + - image: circleci/golang:1.13 #### TEMPLATE_NOTE: go expects specific checkout path representing url #### expecting it in the form of From b73caede55f5850866a8b3d7f28540b540d14e83 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 14:43:13 +0000 Subject: [PATCH 5/6] Fix url parsing that caused v1 test to fail --- netutil/parsers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netutil/parsers.go b/netutil/parsers.go index cb297e8..932c779 100644 --- a/netutil/parsers.go +++ b/netutil/parsers.go @@ -55,6 +55,12 @@ func AddressesFromNodes(nodes []string) ([]string, error) { return nil, newInvalidNodeError(errInvalidHostName) } + // Given input like "http://localhost:8080:8383", url.Parse() will + // return host as "localhost:8000", which isn't a vaild DNS name. + if strings.Contains(host, ":") { + return nil, newInvalidNodeError(errInvalidHostName) + } + port := url.Port() if port == "" { port = DefaultDialPort From beb91058df32e2f3772910947fff2c4ce97b853a Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 14:57:02 +0000 Subject: [PATCH 6/6] Add workflow config --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4bf10bf..68f27ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,3 +20,9 @@ jobs: - run: go get -v -t -d ./... - run: go vet -v $(go list ./... | grep -v /vendor/) - run: go test -v -race $(go list ./... | grep -v /vendor/) + +workflows: + version: 2 + build_and_test: + jobs: + - build \ No newline at end of file