-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afc95a8
commit 3fbc66a
Showing
101 changed files
with
1,366 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,191 @@ | ||
# sdk-go-dbaas-mongo | ||
With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API. | ||
|
||
# Go API client for ionoscloud | ||
|
||
With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API. | ||
|
||
MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas. | ||
|
||
The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the Data Center Designer (DCD) and the API use the same concepts consistently and are well suited for smooth and intuitive use. | ||
|
||
### Example | ||
|
||
## 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: 1.0.0 | ||
- Package version: 1.4.0 | ||
- Build package: org.openapitools.codegen.languages.GoClientCodegen | ||
|
||
## Installation | ||
|
||
Install the following dependencies: | ||
|
||
```shell | ||
go get github.com/stretchr/testify/assert | ||
go get golang.org/x/net/context | ||
``` | ||
|
||
Put the package under your project folder and add the following in import: | ||
|
||
```golang | ||
import ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo" | ||
``` | ||
|
||
To use a proxy, set the environment variable `HTTP_PROXY`: | ||
|
||
```golang | ||
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`. | ||
|
||
```golang | ||
ctx := context.WithValue(context.Background(), ionoscloud.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`. | ||
|
||
```golang | ||
ctx := context.WithValue(context.Background(), ionoscloud.ContextServerVariables, map[string]string{ | ||
"basePath": "v2", | ||
}) | ||
``` | ||
|
||
Note, enum values are always validated and all unused variables are silently ignored. | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *https://api.ionos.com/databases/mongodb* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
*ClustersApi* | [**ClustersDelete**](docs/api/ClustersApi.md#clustersdelete) | **Delete** /clusters/{clusterId} | Delete a Cluster | ||
*ClustersApi* | [**ClustersFindById**](docs/api/ClustersApi.md#clustersfindbyid) | **Get** /clusters/{clusterId} | Get a cluster by id | ||
*ClustersApi* | [**ClustersGet**](docs/api/ClustersApi.md#clustersget) | **Get** /clusters | Get Clusters | ||
*ClustersApi* | [**ClustersPatch**](docs/api/ClustersApi.md#clusterspatch) | **Patch** /clusters/{clusterId} | Patch a cluster | ||
*ClustersApi* | [**ClustersPost**](docs/api/ClustersApi.md#clusterspost) | **Post** /clusters | Create a Cluster | ||
*LogsApi* | [**ClustersLogsGet**](docs/api/LogsApi.md#clusterslogsget) | **Get** /clusters/{clusterId}/logs | Get logs of your cluster | ||
*MetadataApi* | [**InfosVersionGet**](docs/api/MetadataApi.md#infosversionget) | **Get** /infos/version | Get API Version | ||
*MetadataApi* | [**InfosVersionsGet**](docs/api/MetadataApi.md#infosversionsget) | **Get** /infos/versions | Get All API Versions | ||
*RestoresApi* | [**ClustersRestorePost**](docs/api/RestoresApi.md#clustersrestorepost) | **Post** /clusters/{clusterId}/restore | In-place restore of a cluster | ||
*SnapshotsApi* | [**ClustersSnapshotsGet**](docs/api/SnapshotsApi.md#clusterssnapshotsget) | **Get** /clusters/{clusterId}/snapshots | Get the snapshots of your cluster | ||
*TemplatesApi* | [**TemplatesGet**](docs/api/TemplatesApi.md#templatesget) | **Get** /templates | Get Templates | ||
*UsersApi* | [**ClustersUsersDelete**](docs/api/UsersApi.md#clustersusersdelete) | **Delete** /clusters/{clusterId}/users/{username} | Delete a MongoDB User by ID | ||
*UsersApi* | [**ClustersUsersFindById**](docs/api/UsersApi.md#clustersusersfindbyid) | **Get** /clusters/{clusterId}/users/{username} | Get a MongoDB User by ID | ||
*UsersApi* | [**ClustersUsersGet**](docs/api/UsersApi.md#clustersusersget) | **Get** /clusters/{clusterId}/users | Get all Cluster Users | ||
*UsersApi* | [**ClustersUsersPatch**](docs/api/UsersApi.md#clustersuserspatch) | **Patch** /clusters/{clusterId}/users/{username} | Patch a MongoDB User by ID | ||
*UsersApi* | [**ClustersUsersPost**](docs/api/UsersApi.md#clustersuserspost) | **Post** /clusters/{clusterId}/users | Create MongoDB User | ||
|
||
|
||
## Documentation For Models | ||
|
||
- [APIVersion](docs/models/APIVersion.md) | ||
- [BackupProperties](docs/models/BackupProperties.md) | ||
- [BiConnectorProperties](docs/models/BiConnectorProperties.md) | ||
- [ClusterList](docs/models/ClusterList.md) | ||
- [ClusterListAllOf](docs/models/ClusterListAllOf.md) | ||
- [ClusterLogs](docs/models/ClusterLogs.md) | ||
- [ClusterLogsInstances](docs/models/ClusterLogsInstances.md) | ||
- [ClusterLogsInstancesMessages](docs/models/ClusterLogsInstancesMessages.md) | ||
- [ClusterProperties](docs/models/ClusterProperties.md) | ||
- [ClusterResponse](docs/models/ClusterResponse.md) | ||
- [Connection](docs/models/Connection.md) | ||
- [CreateClusterProperties](docs/models/CreateClusterProperties.md) | ||
- [CreateClusterRequest](docs/models/CreateClusterRequest.md) | ||
- [CreateRestoreRequest](docs/models/CreateRestoreRequest.md) | ||
- [DayOfTheWeek](docs/models/DayOfTheWeek.md) | ||
- [ErrorMessage](docs/models/ErrorMessage.md) | ||
- [ErrorResponse](docs/models/ErrorResponse.md) | ||
- [Health](docs/models/Health.md) | ||
- [MaintenanceWindow](docs/models/MaintenanceWindow.md) | ||
- [Metadata](docs/models/Metadata.md) | ||
- [Pagination](docs/models/Pagination.md) | ||
- [PaginationLinks](docs/models/PaginationLinks.md) | ||
- [PatchClusterProperties](docs/models/PatchClusterProperties.md) | ||
- [PatchClusterRequest](docs/models/PatchClusterRequest.md) | ||
- [PatchUserProperties](docs/models/PatchUserProperties.md) | ||
- [PatchUserRequest](docs/models/PatchUserRequest.md) | ||
- [ResourceType](docs/models/ResourceType.md) | ||
- [SnapshotList](docs/models/SnapshotList.md) | ||
- [SnapshotListAllOf](docs/models/SnapshotListAllOf.md) | ||
- [SnapshotProperties](docs/models/SnapshotProperties.md) | ||
- [SnapshotResponse](docs/models/SnapshotResponse.md) | ||
- [State](docs/models/State.md) | ||
- [StorageType](docs/models/StorageType.md) | ||
- [TemplateList](docs/models/TemplateList.md) | ||
- [TemplateListAllOf](docs/models/TemplateListAllOf.md) | ||
- [TemplateProperties](docs/models/TemplateProperties.md) | ||
- [TemplateResponse](docs/models/TemplateResponse.md) | ||
- [User](docs/models/User.md) | ||
- [UserMetadata](docs/models/UserMetadata.md) | ||
- [UserProperties](docs/models/UserProperties.md) | ||
- [UserRoles](docs/models/UserRoles.md) | ||
- [UsersList](docs/models/UsersList.md) | ||
|
||
|
||
## Documentation For Authorization | ||
|
||
|
||
Authentication schemes defined for the API: | ||
### basicAuth | ||
|
||
- **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) | ||
``` | ||
|
||
### tokenAuth | ||
|
||
- **Type**: API key | ||
- **API key parameter name**: Authorization | ||
- **Location**: HTTP header | ||
|
||
Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. | ||
|
||
Example | ||
|
||
```golang | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo" | ||
) | ||
|
||
func main() { | ||
//either provide username and password, or token. | ||
configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") | ||
apiClient := ionoscloud.NewAPIClient(configuration) | ||
resource, resp, err := apiClient.MetadataApi.InfosVersionsGet(context.Background()).Execute() | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `MetadataApi.InfosVersionsGet``: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) | ||
} | ||
// response from `InfosVersionsGet`: []APIVersion | ||
fmt.Fprintf(os.Stdout, "Response from `MetadataApi.InfosVersionsGet`: %v\n", resource) | ||
} | ||
auth := context.WithValue( | ||
context.Background(), | ||
sw.ContextAPIKeys, | ||
map[string]sw.APIKey{ | ||
"Authorization": {Key: "API_KEY_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 | ||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.