Skip to content

Latest commit

 

History

History
265 lines (221 loc) · 17.4 KB

README.md

File metadata and controls

265 lines (221 loc) · 17.4 KB

Go API client for begetOpenapiCloud

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1.3.1
  • Package version: v1.3.1
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import begetOpenapiCloud "github.com/LTD-Beget/openapi-cloud-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), begetOpenapiCloud.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), begetOpenapiCloud.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), begetOpenapiCloud.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), begetOpenapiCloud.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.beget.com

Class Method HTTP request Description
CloudServiceApi CloudServiceChangeConfiguration Patch /v1/cloud/{service_id}/configuration
CloudServiceApi CloudServiceCreate Post /v1/cloud
CloudServiceApi CloudServiceGet Get /v1/cloud/{service_id}
CloudServiceApi CloudServiceGetConfigurationList Get /v1/cloud/configuration
CloudServiceApi CloudServiceGetList Get /v1/cloud
CloudServiceApi CloudServiceRemove Delete /v1/cloud/{service_id}
CloudServiceApi CloudServiceUpdate Patch /v1/cloud/{service_id}
MysqlServiceApi MysqlServiceChangeAccessPassword Patch /v1/cloud/mysql/{service_id}/db/{db_name}/access/{host}
MysqlServiceApi MysqlServiceCreateAccess Post /v1/cloud/mysql/{service_id}/db/{db_name}/access
MysqlServiceApi MysqlServiceCreateDb Post /v1/cloud/mysql/{service_id}/db
MysqlServiceApi MysqlServiceGetConfig Get /v1/cloud/mysql/{service_id}/config
MysqlServiceApi MysqlServiceGetDbList Get /v1/cloud/mysql/{service_id}/db
MysqlServiceApi MysqlServiceRemoveAccess Delete /v1/cloud/mysql/{service_id}/db/{db_name}/access/{host}
MysqlServiceApi MysqlServiceRemoveDb Delete /v1/cloud/mysql/{service_id}/db/{db_name}
MysqlServiceApi MysqlServiceSetConfig Put /v1/cloud/mysql/{service_id}/config
MysqlServiceApi MysqlServiceUpdateDb Patch /v1/cloud/mysql/{service_id}/db/{db_name}
MysqlStatisticServiceApi MysqlStatisticServiceGetCpu Get /v1/cloud/mysql/{service_id}/statistic/cpu
MysqlStatisticServiceApi MysqlStatisticServiceGetCpuDetails Get /v1/cloud/mysql/{service_id}/statistic/cpu-details
MysqlStatisticServiceApi MysqlStatisticServiceGetDisk Get /v1/cloud/mysql/{service_id}/statistic/disk
MysqlStatisticServiceApi MysqlStatisticServiceGetDiskUsage Get /v1/cloud/mysql/{service_id}/statistic/disk-usage
MysqlStatisticServiceApi MysqlStatisticServiceGetLoadAverage Get /v1/cloud/mysql/{service_id}/statistic/load-average
MysqlStatisticServiceApi MysqlStatisticServiceGetMemory Get /v1/cloud/mysql/{service_id}/statistic/memory
MysqlStatisticServiceApi MysqlStatisticServiceGetNetwork Get /v1/cloud/mysql/{service_id}/statistic/network
PostgresqlServiceApi PostgresqlServiceCreateDb Post /v1/cloud/postgresql/{service_id}/db
PostgresqlServiceApi PostgresqlServiceCreateRole Post /v1/cloud/postgresql/{service_id}/role
PostgresqlServiceApi PostgresqlServiceGetConfig Get /v1/cloud/postgresql/{service_id}/config
PostgresqlServiceApi PostgresqlServiceGetDbList Get /v1/cloud/postgresql/{service_id}/db
PostgresqlServiceApi PostgresqlServiceGetRemoteAccess Get /v1/cloud/postgresql/{service_id}/remote-access
PostgresqlServiceApi PostgresqlServiceGetRoleList Get /v1/cloud/postgresql/{service_id}/role
PostgresqlServiceApi PostgresqlServiceRemoveDb Delete /v1/cloud/postgresql/{service_id}/db/{db_name}
PostgresqlServiceApi PostgresqlServiceRemoveRole Delete /v1/cloud/postgresql/{service_id}/role/{role_name}
PostgresqlServiceApi PostgresqlServiceSetConfig Put /v1/cloud/postgresql/{service_id}/config
PostgresqlServiceApi PostgresqlServiceUpdateDb Patch /v1/cloud/postgresql/{service_id}/db/{db_name}
PostgresqlServiceApi PostgresqlServiceUpdateRemoteAccess Put /v1/cloud/postgresql/{service_id}/remote-access
PostgresqlServiceApi PostgresqlServiceUpdateRole Patch /v1/cloud/postgresql/{service_id}/role/{role_name}
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetCpu Get /v1/cloud/postgresql/{service_id}/statistic/cpu
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetCpuDetails Get /v1/cloud/postgresql/{service_id}/statistic/cpu-details
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetDisk Get /v1/cloud/postgresql/{service_id}/statistic/disk
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetDiskUsage Get /v1/cloud/postgresql/{service_id}/statistic/disk-usage
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetLoadAverage Get /v1/cloud/postgresql/{service_id}/statistic/load-average
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetMemory Get /v1/cloud/postgresql/{service_id}/statistic/memory
PostgresqlStatisticServiceApi PostgresqlStatisticServiceGetNetwork Get /v1/cloud/postgresql/{service_id}/statistic/network

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author