diff --git a/api/openapi.yaml b/api/openapi.yaml index a126bc7..83424ba 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -205,6 +205,57 @@ paths: summary: Get a cluster by id tags: - Clusters + patch: + description: Patch attributes of a MongoDB cluster. + operationId: clustersPatch + parameters: + - description: The unique ID of the cluster. + explode: false + in: path + name: clusterId + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchClusterRequest' + description: Part of the cluster which should be modified. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ClusterResponse' + description: Successful operation. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: | + Any erroneous status code: 400 (parse error), 401 (auth error), + 402 (trial access), 403 (insufficient permissions), 404 (not found), + 405 (unsupported HTTP method), 415 (unsupported content type), + 422 (validation error), 429 (request rate limit exceeded), + 500 (server error), 503 (maintenance) + headers: + Content-Type: + description: The content type of the response. + explode: false + schema: + default: application/problem+json + type: string + style: simple + security: + - basicAuth: [] + - tokenAuth: [] + summary: Patch a cluster + tags: + - Clusters /clusters/{clusterId}/users: get: description: Retrieves a list of MongoDB users. @@ -427,6 +478,74 @@ paths: summary: Get a MongoDB User by ID tags: - Users + patch: + description: Patches a MongoDB user specified by its ID. + operationId: clustersUsersPatch + parameters: + - description: The unique ID of the cluster. + explode: false + in: path + name: clusterId + required: true + schema: + type: string + style: simple + - description: The authentication database. + explode: false + in: path + name: database + required: true + schema: + type: string + style: simple + - description: The authentication username. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchUserRequest' + description: Part of the MongoDB user which should be modified. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: | + The user identified by the username and database parameters will be patched. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: | + Any erroneous status code: 400 (parse error), 401 (auth error), + 402 (trial access), 403 (insufficient permissions), 404 (not found), + 405 (unsupported HTTP method), 415 (unsupported content type), + 422 (validation error), 429 (request rate limit exceeded), + 500 (server error), 503 (maintenance) + headers: + Content-Type: + description: The content type of the response. + explode: false + schema: + default: application/problem+json + type: string + style: simple + security: + - basicAuth: [] + - tokenAuth: [] + summary: Patch a MongoDB User by ID + tags: + - Users /clusters/{clusterId}/logs: get: description: Retrieves MongoDB logs based on the given parameters. @@ -831,7 +950,6 @@ components: createdBy: john.doe@example.com state: CREATING properties: - database: admin password: password roles: - database: database @@ -845,7 +963,6 @@ components: createdBy: john.doe@example.com state: CREATING properties: - database: admin password: password roles: - database: database @@ -868,7 +985,6 @@ components: UserProperties: description: Mongodb user properties. example: - database: admin password: password roles: - database: database @@ -879,11 +995,8 @@ components: properties: username: type: string - database: - description: The user database to use for authentication. - example: admin - type: string password: + minLength: 10 type: string writeOnly: true roles: @@ -903,7 +1016,6 @@ components: createdBy: john.doe@example.com state: CREATING properties: - database: admin password: password roles: - database: database @@ -919,6 +1031,44 @@ components: properties: $ref: '#/components/schemas/UserProperties' type: object + PatchUserRequest: + description: MongoDB database user patch request. + example: + metadata: + createdByUserId: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3 + createdDate: 2020-12-10T13:37:50+01:00 + createdBy: john.doe@example.com + state: CREATING + properties: + password: password + roles: + - database: database + role: read + - database: database + role: read + properties: + metadata: + $ref: '#/components/schemas/UserMetadata' + properties: + $ref: '#/components/schemas/PatchUserProperties' + PatchUserProperties: + description: MongoDB database user patch request properties. + example: + password: password + roles: + - database: database + role: read + - database: database + role: read + properties: + password: + minLength: 10 + type: string + writeOnly: true + roles: + items: + $ref: '#/components/schemas/UserRoles' + type: array UserRoles: description: a list of mongodb user role. example: @@ -1034,6 +1184,7 @@ components: - collection - cluster - user + - snapshot type: string ResourceId: description: The unique ID of the resource. @@ -1066,6 +1217,9 @@ components: description: The MongoDB version of your cluster. example: "5.0" type: string + x-extensible-enum: + - "5.0" + - "6.0" location: description: | The physical location where the cluster will be created. This is the location where all your instances will be located. This property is immutable. @@ -1096,6 +1250,8 @@ components: templateID: description: | The unique ID of the template, which specifies the number of cores, storage size, and memory. + You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). + To get a list of all templates to confirm the changes use the /templates endpoint. example: 498ae72f-411f-11eb-9d07-046c59cc737e type: string connectionString: @@ -1304,12 +1460,17 @@ components: templateID: description: | The unique ID of the template, which specifies the number of cores, storage size, and memory. + You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). + To get a list of all templates to confirm the changes use the /templates endpoint. example: 498ae72f-411f-11eb-9d07-046c59cc737e type: string mongoDBVersion: description: The MongoDB version of your cluster. example: "5.0" type: string + x-extensible-enum: + - "5.0" + - "6.0" instances: description: | The total number of instances in the cluster (one primary and n-1 secondaries). @@ -1349,9 +1510,86 @@ components: - mongodbVersion - templateID type: object + PatchClusterRequest: + description: Request payload to change a cluster. + example: + metadata: + createdByUserId: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3 + createdDate: 2020-12-10T13:37:50+01:00 + createdBy: john.doe@example.com + lastModifiedDate: 2020-12-11T13:37:50+01:00 + lastModifiedBy: jane.doe@example.com + state: AVAILABLE + lastModifiedByUserId: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3 + properties: + maintenanceWindow: + dayOfTheWeek: Monday + time: 16:30:59 + instances: 3 + displayName: MongoDB cluster + templateID: 498ae72f-411f-11eb-9d07-046c59cc737e + connections: + - cidrList: + - 192.168.1.100/24 + - 192.168.1.101/24 + datacenterId: 5a029f4a-72e5-11ec-90d6-0242ac120003 + lanId: "2" + properties: + metadata: + $ref: '#/components/schemas/Metadata' + properties: + $ref: '#/components/schemas/PatchClusterProperties' + type: object + PatchClusterProperties: + description: Properties of the payload to change a cluster. + example: + maintenanceWindow: + dayOfTheWeek: Monday + time: 16:30:59 + instances: 3 + displayName: MongoDB cluster + templateID: 498ae72f-411f-11eb-9d07-046c59cc737e + connections: + - cidrList: + - 192.168.1.100/24 + - 192.168.1.101/24 + datacenterId: 5a029f4a-72e5-11ec-90d6-0242ac120003 + lanId: "2" + properties: + displayName: + description: The name of your cluster. + example: MongoDB cluster + type: string + maintenanceWindow: + $ref: '#/components/schemas/MaintenanceWindow' + instances: + description: | + The total number of instances in the cluster (one primary and n-1 secondaries). + example: 3 + type: integer + x-extensible-enum: + - 3 + - 5 + - 7 + connections: + items: + $ref: '#/components/schemas/Connection' + maxItems: 1 + minItems: 0 + type: array + templateID: + description: | + The unique ID of the template, which specifies the number of cores, storage size, and memory. + You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). + To get a list of all templates to confirm the changes use the /templates endpoint. + example: 498ae72f-411f-11eb-9d07-046c59cc737e + type: string + type: object TemplateID: description: | The unique ID of the template, which specifies the number of cores, storage size, and memory. + You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). + To get a list of all templates to confirm the changes use the /templates endpoint. example: 498ae72f-411f-11eb-9d07-046c59cc737e type: string ClusterLogs: @@ -1380,6 +1618,9 @@ components: description: The MongoDB version of your cluster. example: "5.0" type: string + x-extensible-enum: + - "5.0" + - "6.0" ConnectionString: description: The connection string for your cluster. example: mongo+srv://m-498ae72f-411f-11eb-9d07-046c59cc737e.mongodb.de-txl.ionos.com @@ -1422,10 +1663,9 @@ components: type: string cidrList: description: | - The list of IPs and subnet for your cluster. + The list of IPs for your cluster. + All IPs must be in a /24 network. Note the following unavailable IP ranges: - 10.233.64.0/18 - 10.233.0.0/18 10.233.114.0/24 example: - 192.168.1.100/24 @@ -1473,6 +1713,7 @@ components: TemplateList: allOf: - $ref: '#/components/schemas/TemplateList_allOf' + - $ref: '#/components/schemas/Pagination' description: The list of MongoDB templates. type: object TemplateResponse: @@ -1482,6 +1723,14 @@ components: description: The unique template ID. example: 15c6dd2f-02d2-4987-b439-9a58dd59ecc3 type: string + name: + description: The name of the template. + example: MongoDB Community 4XL + type: string + edition: + description: The edition of the template (e.g. enterprise) + example: enterprise + type: string cores: description: The number of CPU cores. example: 1 @@ -1553,6 +1802,12 @@ components: type: object TemplateList_allOf: properties: + type: + $ref: '#/components/schemas/ResourceType' + id: + description: The unique ID of the resource. + example: 498ae72f-411f-11eb-9d07-046c59cc737e + type: string items: items: $ref: '#/components/schemas/TemplateResponse' diff --git a/api_clusters.go b/api_clusters.go index 96a78ab..9ecc3ac 100644 --- a/api_clusters.go +++ b/api_clusters.go @@ -440,6 +440,153 @@ func (a *ClustersApiService) ClustersGetExecute(r ApiClustersGetRequest) (Cluste return localVarReturnValue, localVarAPIResponse, nil } +type ApiClustersPatchRequest struct { + ctx _context.Context + ApiService *ClustersApiService + clusterId string + patchClusterRequest *PatchClusterRequest +} + +func (r ApiClustersPatchRequest) PatchClusterRequest(patchClusterRequest PatchClusterRequest) ApiClustersPatchRequest { + r.patchClusterRequest = &patchClusterRequest + return r +} + +func (r ApiClustersPatchRequest) Execute() (ClusterResponse, *APIResponse, error) { + return r.ApiService.ClustersPatchExecute(r) +} + +/* + * ClustersPatch Patch a cluster + * Patch attributes of a MongoDB cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The unique ID of the cluster. + * @return ApiClustersPatchRequest + */ +func (a *ClustersApiService) ClustersPatch(ctx _context.Context, clusterId string) ApiClustersPatchRequest { + return ApiClustersPatchRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + * @return ClusterResponse + */ +func (a *ClustersApiService) ClustersPatchExecute(r ApiClustersPatchRequest) (ClusterResponse, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ClusterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClustersApiService.ClustersPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.patchClusterRequest == nil { + return localVarReturnValue, nil, reportError("patchClusterRequest is required and must be specified") + } + + // 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 = r.patchClusterRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["tokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ClustersPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + type ApiClustersPostRequest struct { ctx _context.Context ApiService *ClustersApiService diff --git a/api_users.go b/api_users.go index b74e300..71c12a2 100644 --- a/api_users.go +++ b/api_users.go @@ -451,6 +451,161 @@ func (a *UsersApiService) ClustersUsersGetExecute(r ApiClustersUsersGetRequest) return localVarReturnValue, localVarAPIResponse, nil } +type ApiClustersUsersPatchRequest struct { + ctx _context.Context + ApiService *UsersApiService + clusterId string + database string + username string + patchUserRequest *PatchUserRequest +} + +func (r ApiClustersUsersPatchRequest) PatchUserRequest(patchUserRequest PatchUserRequest) ApiClustersUsersPatchRequest { + r.patchUserRequest = &patchUserRequest + return r +} + +func (r ApiClustersUsersPatchRequest) Execute() (User, *APIResponse, error) { + return r.ApiService.ClustersUsersPatchExecute(r) +} + +/* + * ClustersUsersPatch Patch a MongoDB User by ID + * Patches a MongoDB user specified by its ID. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The unique ID of the cluster. + * @param database The authentication database. + * @param username The authentication username. + * @return ApiClustersUsersPatchRequest + */ +func (a *UsersApiService) ClustersUsersPatch(ctx _context.Context, clusterId string, database string, username string) ApiClustersUsersPatchRequest { + return ApiClustersUsersPatchRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + database: database, + username: username, + } +} + +/* + * Execute executes the request + * @return User + */ +func (a *UsersApiService) ClustersUsersPatchExecute(r ApiClustersUsersPatchRequest) (User, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.ClustersUsersPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/users/{database}/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"database"+"}", _neturl.PathEscape(parameterToString(r.database, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.patchUserRequest == nil { + return localVarReturnValue, nil, reportError("patchUserRequest is required and must be specified") + } + + // 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 = r.patchUserRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["tokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ClustersUsersPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + type ApiClustersUsersPostRequest struct { ctx _context.Context ApiService *UsersApiService diff --git a/client.go b/client.go index 17cce25..eb0a4bb 100644 --- a/client.go +++ b/client.go @@ -50,7 +50,7 @@ const ( RequestStatusFailed = "FAILED" RequestStatusDone = "DONE" - Version = "1.0.0" + Version = "1.1.0" ) // APIClient manages communication with the IONOS DBaaS MongoDB REST API API v0.1.0 diff --git a/configuration.go b/configuration.go index d85e2c0..f3a96ec 100644 --- a/configuration.go +++ b/configuration.go @@ -128,7 +128,7 @@ func NewConfiguration(username, password, token, hostUrl string) *Configuration cfg := &Configuration{ DefaultHeader: make(map[string]string), DefaultQueryParams: url.Values{}, - UserAgent: "ionos-cloud-sdk-go-dbaas-mongo/v1.0.0", + UserAgent: "ionos-cloud-sdk-go-dbaas-mongo/v1.1.0", Debug: false, Username: username, Password: password, diff --git a/docs/.gitbook.yaml b/docs/.gitbook.yaml deleted file mode 100644 index c587c58..0000000 --- a/docs/.gitbook.yaml +++ /dev/null @@ -1,4 +0,0 @@ -root: docs -structure: - readme: README.md - summary: summary.md \ No newline at end of file diff --git a/docs/api/ClustersApi.md b/docs/api/ClustersApi.md index bf60719..1245184 100644 --- a/docs/api/ClustersApi.md +++ b/docs/api/ClustersApi.md @@ -7,6 +7,7 @@ All URIs are relative to *https://api.ionos.com/databases/mongodb* |[**ClustersDelete**](ClustersApi.md#ClustersDelete) | **Delete** /clusters/{clusterId} | Delete a Cluster| |[**ClustersFindById**](ClustersApi.md#ClustersFindById) | **Get** /clusters/{clusterId} | Get a cluster by id| |[**ClustersGet**](ClustersApi.md#ClustersGet) | **Get** /clusters | Get Clusters| +|[**ClustersPatch**](ClustersApi.md#ClustersPatch) | **Patch** /clusters/{clusterId} | Patch a cluster| |[**ClustersPost**](ClustersApi.md#ClustersPost) | **Post** /clusters | Create a Cluster| @@ -207,6 +208,75 @@ Other parameters are passed through a pointer to an apiClustersGetRequest struct +## ClustersPatch + +```go +var result ClusterResponse = ClustersPatch(ctx, clusterId) + .PatchClusterRequest(patchClusterRequest) + .Execute() +``` + +Patch a cluster + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + + ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo" +) + +func main() { + clusterId := "clusterId_example" // string | The unique ID of the cluster. + patchClusterRequest := *openapiclient.NewPatchClusterRequest() // PatchClusterRequest | Part of the cluster which should be modified. + + configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") + apiClient := ionoscloud.NewAPIClient(configuration) + resource, resp, err := apiClient.ClustersApi.ClustersPatch(context.Background(), clusterId).PatchClusterRequest(patchClusterRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ClustersApi.ClustersPatch``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) + } + // response from `ClustersPatch`: ClusterResponse + fmt.Fprintf(os.Stdout, "Response from `ClustersApi.ClustersPatch`: %v\n", resource) +} +``` + +### Path Parameters + + +|Name | Type | Description | Notes| +|------------- | ------------- | ------------- | -------------| +|**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| +|**clusterId** | **string** | The unique ID of the cluster. | | + +### Other Parameters + +Other parameters are passed through a pointer to an apiClustersPatchRequest struct via the builder pattern + + +|Name | Type | Description | Notes| +|------------- | ------------- | ------------- | -------------| +| **patchClusterRequest** | [**PatchClusterRequest**](PatchClusterRequest.md) | Part of the cluster which should be modified. | | + +### Return type + +[**ClusterResponse**](ClusterResponse.md) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + + ## ClustersPost ```go diff --git a/docs/api/UsersApi.md b/docs/api/UsersApi.md index dedbe99..4d3e88f 100644 --- a/docs/api/UsersApi.md +++ b/docs/api/UsersApi.md @@ -7,6 +7,7 @@ All URIs are relative to *https://api.ionos.com/databases/mongodb* |[**ClustersUsersDelete**](UsersApi.md#ClustersUsersDelete) | **Delete** /clusters/{clusterId}/users/{database}/{username} | Delete a MongoDB User by ID| |[**ClustersUsersFindById**](UsersApi.md#ClustersUsersFindById) | **Get** /clusters/{clusterId}/users/{database}/{username} | Get a MongoDB User by ID| |[**ClustersUsersGet**](UsersApi.md#ClustersUsersGet) | **Get** /clusters/{clusterId}/users | Get a Cluster Users| +|[**ClustersUsersPatch**](UsersApi.md#ClustersUsersPatch) | **Patch** /clusters/{clusterId}/users/{database}/{username} | Patch a MongoDB User by ID| |[**ClustersUsersPost**](UsersApi.md#ClustersUsersPost) | **Post** /clusters/{clusterId}/users | Create MongoDB User| @@ -217,6 +218,79 @@ Other parameters are passed through a pointer to an apiClustersUsersGetRequest s +## ClustersUsersPatch + +```go +var result User = ClustersUsersPatch(ctx, clusterId, database, username) + .PatchUserRequest(patchUserRequest) + .Execute() +``` + +Patch a MongoDB User by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + + ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mongo" +) + +func main() { + clusterId := "clusterId_example" // string | The unique ID of the cluster. + database := "database_example" // string | The authentication database. + username := "username_example" // string | The authentication username. + patchUserRequest := *openapiclient.NewPatchUserRequest() // PatchUserRequest | Part of the MongoDB user which should be modified. + + configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") + apiClient := ionoscloud.NewAPIClient(configuration) + resource, resp, err := apiClient.UsersApi.ClustersUsersPatch(context.Background(), clusterId, database, username).PatchUserRequest(patchUserRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ClustersUsersPatch``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) + } + // response from `ClustersUsersPatch`: User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.ClustersUsersPatch`: %v\n", resource) +} +``` + +### Path Parameters + + +|Name | Type | Description | Notes| +|------------- | ------------- | ------------- | -------------| +|**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| +|**clusterId** | **string** | The unique ID of the cluster. | | +|**database** | **string** | The authentication database. | | +|**username** | **string** | The authentication username. | | + +### Other Parameters + +Other parameters are passed through a pointer to an apiClustersUsersPatchRequest struct via the builder pattern + + +|Name | Type | Description | Notes| +|------------- | ------------- | ------------- | -------------| +| **patchUserRequest** | [**PatchUserRequest**](PatchUserRequest.md) | Part of the MongoDB user which should be modified. | | + +### Return type + +[**User**](User.md) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + + ## ClustersUsersPost ```go diff --git a/docs/models/ClusterProperties.md b/docs/models/ClusterProperties.md index 7704882..59f2785 100644 --- a/docs/models/ClusterProperties.md +++ b/docs/models/ClusterProperties.md @@ -13,7 +13,7 @@ Properties of a database cluster. |**Instances** | Pointer to **int32** | The total number of instances in the cluster (one primary and n-1 secondaries). | [optional] | |**Connections** | Pointer to [**[]Connection**](Connection.md) | | [optional] | |**MaintenanceWindow** | Pointer to [**MaintenanceWindow**](MaintenanceWindow.md) | | [optional] | -|**TemplateID** | Pointer to **string** | The unique ID of the template, which specifies the number of cores, storage size, and memory. | [optional] | +|**TemplateID** | Pointer to **string** | The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. | [optional] | |**ConnectionString** | Pointer to **string** | The connection string for your cluster. | [optional] | ## Methods diff --git a/docs/models/Connection.md b/docs/models/Connection.md index 1e68560..2ccabb1 100644 --- a/docs/models/Connection.md +++ b/docs/models/Connection.md @@ -9,7 +9,7 @@ The network connection details for your cluster. |------------ | ------------- | ------------- | -------------| |**DatacenterId** | **string** | The datacenter to which your cluster will be connected. | | |**LanId** | **string** | The numeric LAN ID with which you connect your cluster. | | -|**CidrList** | **[]string** | The list of IPs and subnet for your cluster. Note the following unavailable IP ranges: 10.233.64.0/18 10.233.0.0/18 10.233.114.0/24 | | +|**CidrList** | **[]string** | The list of IPs for your cluster. All IPs must be in a /24 network. Note the following unavailable IP ranges: 10.233.114.0/24 | | ## Methods diff --git a/docs/models/CreateClusterProperties.md b/docs/models/CreateClusterProperties.md index 51f9d76..ae8f01d 100644 --- a/docs/models/CreateClusterProperties.md +++ b/docs/models/CreateClusterProperties.md @@ -7,7 +7,7 @@ The properties with all data needed to create a new MongoDB cluster. |Name | Type | Description | Notes| |------------ | ------------- | ------------- | -------------| -|**TemplateID** | **string** | The unique ID of the template, which specifies the number of cores, storage size, and memory. | | +|**TemplateID** | **string** | The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. | | |**MongoDBVersion** | Pointer to **string** | The MongoDB version of your cluster. | [optional] | |**Instances** | **int32** | The total number of instances in the cluster (one primary and n-1 secondaries). | | |**Connections** | [**[]Connection**](Connection.md) | | | diff --git a/docs/models/PatchClusterProperties.md b/docs/models/PatchClusterProperties.md new file mode 100644 index 0000000..7ffec4b --- /dev/null +++ b/docs/models/PatchClusterProperties.md @@ -0,0 +1,145 @@ +# PatchClusterProperties + +Properties of the payload to change a cluster. + + +## Properties + +|Name | Type | Description | Notes| +|------------ | ------------- | ------------- | -------------| +|**DisplayName** | Pointer to **string** | The name of your cluster. | [optional] | +|**MaintenanceWindow** | Pointer to [**MaintenanceWindow**](MaintenanceWindow.md) | | [optional] | +|**Instances** | Pointer to **int32** | The total number of instances in the cluster (one primary and n-1 secondaries). | [optional] | +|**Connections** | Pointer to [**[]Connection**](Connection.md) | | [optional] | +|**TemplateID** | Pointer to **string** | The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. | [optional] | + +## Methods + + +### GetDisplayName + +`func (o *PatchClusterProperties) GetDisplayName() string` + +GetDisplayName returns the DisplayName field if non-nil, zero value otherwise. + +### GetDisplayNameOk + +`func (o *PatchClusterProperties) GetDisplayNameOk() (*string, bool)` + +GetDisplayNameOk returns a tuple with the DisplayName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDisplayName + +`func (o *PatchClusterProperties) SetDisplayName(v string)` + +SetDisplayName sets DisplayName field to given value. + +### HasDisplayName + +`func (o *PatchClusterProperties) HasDisplayName() bool` + +HasDisplayName returns a boolean if a field has been set. + +### GetMaintenanceWindow + +`func (o *PatchClusterProperties) GetMaintenanceWindow() MaintenanceWindow` + +GetMaintenanceWindow returns the MaintenanceWindow field if non-nil, zero value otherwise. + +### GetMaintenanceWindowOk + +`func (o *PatchClusterProperties) GetMaintenanceWindowOk() (*MaintenanceWindow, bool)` + +GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaintenanceWindow + +`func (o *PatchClusterProperties) SetMaintenanceWindow(v MaintenanceWindow)` + +SetMaintenanceWindow sets MaintenanceWindow field to given value. + +### HasMaintenanceWindow + +`func (o *PatchClusterProperties) HasMaintenanceWindow() bool` + +HasMaintenanceWindow returns a boolean if a field has been set. + +### GetInstances + +`func (o *PatchClusterProperties) GetInstances() int32` + +GetInstances returns the Instances field if non-nil, zero value otherwise. + +### GetInstancesOk + +`func (o *PatchClusterProperties) GetInstancesOk() (*int32, bool)` + +GetInstancesOk returns a tuple with the Instances field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstances + +`func (o *PatchClusterProperties) SetInstances(v int32)` + +SetInstances sets Instances field to given value. + +### HasInstances + +`func (o *PatchClusterProperties) HasInstances() bool` + +HasInstances returns a boolean if a field has been set. + +### GetConnections + +`func (o *PatchClusterProperties) GetConnections() []Connection` + +GetConnections returns the Connections field if non-nil, zero value otherwise. + +### GetConnectionsOk + +`func (o *PatchClusterProperties) GetConnectionsOk() (*[]Connection, bool)` + +GetConnectionsOk returns a tuple with the Connections field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConnections + +`func (o *PatchClusterProperties) SetConnections(v []Connection)` + +SetConnections sets Connections field to given value. + +### HasConnections + +`func (o *PatchClusterProperties) HasConnections() bool` + +HasConnections returns a boolean if a field has been set. + +### GetTemplateID + +`func (o *PatchClusterProperties) GetTemplateID() string` + +GetTemplateID returns the TemplateID field if non-nil, zero value otherwise. + +### GetTemplateIDOk + +`func (o *PatchClusterProperties) GetTemplateIDOk() (*string, bool)` + +GetTemplateIDOk returns a tuple with the TemplateID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTemplateID + +`func (o *PatchClusterProperties) SetTemplateID(v string)` + +SetTemplateID sets TemplateID field to given value. + +### HasTemplateID + +`func (o *PatchClusterProperties) HasTemplateID() bool` + +HasTemplateID returns a boolean if a field has been set. + + + diff --git a/docs/models/PatchClusterRequest.md b/docs/models/PatchClusterRequest.md new file mode 100644 index 0000000..932d050 --- /dev/null +++ b/docs/models/PatchClusterRequest.md @@ -0,0 +1,67 @@ +# PatchClusterRequest + +Request payload to change a cluster. + + +## Properties + +|Name | Type | Description | Notes| +|------------ | ------------- | ------------- | -------------| +|**Metadata** | Pointer to [**Metadata**](Metadata.md) | | [optional] | +|**Properties** | Pointer to [**PatchClusterProperties**](PatchClusterProperties.md) | | [optional] | + +## Methods + + +### GetMetadata + +`func (o *PatchClusterRequest) GetMetadata() Metadata` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *PatchClusterRequest) GetMetadataOk() (*Metadata, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *PatchClusterRequest) SetMetadata(v Metadata)` + +SetMetadata sets Metadata field to given value. + +### HasMetadata + +`func (o *PatchClusterRequest) HasMetadata() bool` + +HasMetadata returns a boolean if a field has been set. + +### GetProperties + +`func (o *PatchClusterRequest) GetProperties() PatchClusterProperties` + +GetProperties returns the Properties field if non-nil, zero value otherwise. + +### GetPropertiesOk + +`func (o *PatchClusterRequest) GetPropertiesOk() (*PatchClusterProperties, bool)` + +GetPropertiesOk returns a tuple with the Properties field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProperties + +`func (o *PatchClusterRequest) SetProperties(v PatchClusterProperties)` + +SetProperties sets Properties field to given value. + +### HasProperties + +`func (o *PatchClusterRequest) HasProperties() bool` + +HasProperties returns a boolean if a field has been set. + + + diff --git a/docs/models/PatchUserProperties.md b/docs/models/PatchUserProperties.md new file mode 100644 index 0000000..511cf56 --- /dev/null +++ b/docs/models/PatchUserProperties.md @@ -0,0 +1,67 @@ +# PatchUserProperties + +MongoDB database user patch request properties. + + +## Properties + +|Name | Type | Description | Notes| +|------------ | ------------- | ------------- | -------------| +|**Password** | Pointer to **string** | | [optional] | +|**Roles** | Pointer to [**[]UserRoles**](UserRoles.md) | | [optional] | + +## Methods + + +### GetPassword + +`func (o *PatchUserProperties) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *PatchUserProperties) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *PatchUserProperties) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *PatchUserProperties) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetRoles + +`func (o *PatchUserProperties) GetRoles() []UserRoles` + +GetRoles returns the Roles field if non-nil, zero value otherwise. + +### GetRolesOk + +`func (o *PatchUserProperties) GetRolesOk() (*[]UserRoles, bool)` + +GetRolesOk returns a tuple with the Roles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRoles + +`func (o *PatchUserProperties) SetRoles(v []UserRoles)` + +SetRoles sets Roles field to given value. + +### HasRoles + +`func (o *PatchUserProperties) HasRoles() bool` + +HasRoles returns a boolean if a field has been set. + + + diff --git a/docs/models/PatchUserRequest.md b/docs/models/PatchUserRequest.md new file mode 100644 index 0000000..2e0db76 --- /dev/null +++ b/docs/models/PatchUserRequest.md @@ -0,0 +1,67 @@ +# PatchUserRequest + +MongoDB database user patch request. + + +## Properties + +|Name | Type | Description | Notes| +|------------ | ------------- | ------------- | -------------| +|**Metadata** | Pointer to [**UserMetadata**](UserMetadata.md) | | [optional] | +|**Properties** | Pointer to [**PatchUserProperties**](PatchUserProperties.md) | | [optional] | + +## Methods + + +### GetMetadata + +`func (o *PatchUserRequest) GetMetadata() UserMetadata` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *PatchUserRequest) GetMetadataOk() (*UserMetadata, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *PatchUserRequest) SetMetadata(v UserMetadata)` + +SetMetadata sets Metadata field to given value. + +### HasMetadata + +`func (o *PatchUserRequest) HasMetadata() bool` + +HasMetadata returns a boolean if a field has been set. + +### GetProperties + +`func (o *PatchUserRequest) GetProperties() PatchUserProperties` + +GetProperties returns the Properties field if non-nil, zero value otherwise. + +### GetPropertiesOk + +`func (o *PatchUserRequest) GetPropertiesOk() (*PatchUserProperties, bool)` + +GetPropertiesOk returns a tuple with the Properties field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProperties + +`func (o *PatchUserRequest) SetProperties(v PatchUserProperties)` + +SetProperties sets Properties field to given value. + +### HasProperties + +`func (o *PatchUserRequest) HasProperties() bool` + +HasProperties returns a boolean if a field has been set. + + + diff --git a/docs/models/ResourceType.md b/docs/models/ResourceType.md index 049e063..f12ca7c 100644 --- a/docs/models/ResourceType.md +++ b/docs/models/ResourceType.md @@ -8,6 +8,7 @@ The resource type. |COLLECTION | |CLUSTER | |USER | +|SNAPSHOT | diff --git a/docs/models/TemplateList.md b/docs/models/TemplateList.md index fc20212..c8f49a2 100644 --- a/docs/models/TemplateList.md +++ b/docs/models/TemplateList.md @@ -7,11 +7,66 @@ The list of MongoDB templates. |Name | Type | Description | Notes| |------------ | ------------- | ------------- | -------------| +|**Type** | Pointer to [**ResourceType**](ResourceType.md) | | [optional] | +|**Id** | Pointer to **string** | The unique ID of the resource. | [optional] | |**Items** | Pointer to [**[]TemplateResponse**](TemplateResponse.md) | | [optional] | +|**Offset** | Pointer to **int32** | The offset specified in the request (if none was specified, the default offset is 0) (not implemented yet). | [optional] [readonly] | +|**Limit** | Pointer to **int32** | The limit specified in the request (if none was specified, use the endpoint's default pagination limit) (not implemented yet, always return number of items). | [optional] [readonly] | +|**Links** | Pointer to [**PaginationLinks**](PaginationLinks.md) | | [optional] | ## Methods +### GetType + +`func (o *TemplateList) GetType() ResourceType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *TemplateList) GetTypeOk() (*ResourceType, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *TemplateList) SetType(v ResourceType)` + +SetType sets Type field to given value. + +### HasType + +`func (o *TemplateList) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetId + +`func (o *TemplateList) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *TemplateList) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *TemplateList) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *TemplateList) HasId() bool` + +HasId returns a boolean if a field has been set. + ### GetItems `func (o *TemplateList) GetItems() []TemplateResponse` @@ -37,5 +92,80 @@ SetItems sets Items field to given value. HasItems returns a boolean if a field has been set. +### GetOffset + +`func (o *TemplateList) GetOffset() int32` + +GetOffset returns the Offset field if non-nil, zero value otherwise. + +### GetOffsetOk + +`func (o *TemplateList) GetOffsetOk() (*int32, bool)` + +GetOffsetOk returns a tuple with the Offset field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOffset + +`func (o *TemplateList) SetOffset(v int32)` + +SetOffset sets Offset field to given value. + +### HasOffset + +`func (o *TemplateList) HasOffset() bool` + +HasOffset returns a boolean if a field has been set. + +### GetLimit + +`func (o *TemplateList) GetLimit() int32` + +GetLimit returns the Limit field if non-nil, zero value otherwise. + +### GetLimitOk + +`func (o *TemplateList) GetLimitOk() (*int32, bool)` + +GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLimit + +`func (o *TemplateList) SetLimit(v int32)` + +SetLimit sets Limit field to given value. + +### HasLimit + +`func (o *TemplateList) HasLimit() bool` + +HasLimit returns a boolean if a field has been set. + +### GetLinks + +`func (o *TemplateList) GetLinks() PaginationLinks` + +GetLinks returns the Links field if non-nil, zero value otherwise. + +### GetLinksOk + +`func (o *TemplateList) GetLinksOk() (*PaginationLinks, bool)` + +GetLinksOk returns a tuple with the Links field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLinks + +`func (o *TemplateList) SetLinks(v PaginationLinks)` + +SetLinks sets Links field to given value. + +### HasLinks + +`func (o *TemplateList) HasLinks() bool` + +HasLinks returns a boolean if a field has been set. + diff --git a/docs/models/TemplateListAllOf.md b/docs/models/TemplateListAllOf.md index bfb7229..2c0a092 100644 --- a/docs/models/TemplateListAllOf.md +++ b/docs/models/TemplateListAllOf.md @@ -6,11 +6,63 @@ |Name | Type | Description | Notes| |------------ | ------------- | ------------- | -------------| +|**Type** | Pointer to [**ResourceType**](ResourceType.md) | | [optional] | +|**Id** | Pointer to **string** | The unique ID of the resource. | [optional] | |**Items** | Pointer to [**[]TemplateResponse**](TemplateResponse.md) | | [optional] | ## Methods +### GetType + +`func (o *TemplateListAllOf) GetType() ResourceType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *TemplateListAllOf) GetTypeOk() (*ResourceType, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *TemplateListAllOf) SetType(v ResourceType)` + +SetType sets Type field to given value. + +### HasType + +`func (o *TemplateListAllOf) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetId + +`func (o *TemplateListAllOf) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *TemplateListAllOf) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *TemplateListAllOf) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *TemplateListAllOf) HasId() bool` + +HasId returns a boolean if a field has been set. + ### GetItems `func (o *TemplateListAllOf) GetItems() []TemplateResponse` diff --git a/docs/models/TemplateResponse.md b/docs/models/TemplateResponse.md index 4066b3f..7eaa6f0 100644 --- a/docs/models/TemplateResponse.md +++ b/docs/models/TemplateResponse.md @@ -8,6 +8,8 @@ A MongoDB template item. |Name | Type | Description | Notes| |------------ | ------------- | ------------- | -------------| |**Id** | Pointer to **string** | The unique template ID. | [optional] | +|**Name** | Pointer to **string** | The name of the template. | [optional] | +|**Edition** | Pointer to **string** | The edition of the template (e.g. enterprise) | [optional] | |**Cores** | Pointer to **int32** | The number of CPU cores. | [optional] | |**Ram** | Pointer to **int32** | The amount of memory in GB. | [optional] | |**StorageSize** | Pointer to **int32** | The amount of storage size in GB. | [optional] | @@ -40,6 +42,56 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. +### GetName + +`func (o *TemplateResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TemplateResponse) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TemplateResponse) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *TemplateResponse) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetEdition + +`func (o *TemplateResponse) GetEdition() string` + +GetEdition returns the Edition field if non-nil, zero value otherwise. + +### GetEditionOk + +`func (o *TemplateResponse) GetEditionOk() (*string, bool)` + +GetEditionOk returns a tuple with the Edition field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEdition + +`func (o *TemplateResponse) SetEdition(v string)` + +SetEdition sets Edition field to given value. + +### HasEdition + +`func (o *TemplateResponse) HasEdition() bool` + +HasEdition returns a boolean if a field has been set. + ### GetCores `func (o *TemplateResponse) GetCores() int32` diff --git a/docs/models/UserProperties.md b/docs/models/UserProperties.md index 30e54e2..4716058 100644 --- a/docs/models/UserProperties.md +++ b/docs/models/UserProperties.md @@ -8,7 +8,6 @@ Mongodb user properties. |Name | Type | Description | Notes| |------------ | ------------- | ------------- | -------------| |**Username** | **string** | | | -|**Database** | **string** | The user database to use for authentication. | | |**Password** | **string** | | | |**Roles** | Pointer to [**[]UserRoles**](UserRoles.md) | | [optional] | @@ -35,26 +34,6 @@ and a boolean to check if the value has been set. SetUsername sets Username field to given value. -### GetDatabase - -`func (o *UserProperties) GetDatabase() string` - -GetDatabase returns the Database field if non-nil, zero value otherwise. - -### GetDatabaseOk - -`func (o *UserProperties) GetDatabaseOk() (*string, bool)` - -GetDatabaseOk returns a tuple with the Database field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetDatabase - -`func (o *UserProperties) SetDatabase(v string)` - -SetDatabase sets Database field to given value. - - ### GetPassword `func (o *UserProperties) GetPassword() string` diff --git a/docs/summary.md b/docs/summary.md index 658481b..5779852 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -34,6 +34,10 @@ * [Metadata](models/Metadata.md) * [Pagination](models/Pagination.md) * [PaginationLinks](models/PaginationLinks.md) +* [PatchClusterProperties](models/PatchClusterProperties.md) +* [PatchClusterRequest](models/PatchClusterRequest.md) +* [PatchUserProperties](models/PatchUserProperties.md) +* [PatchUserRequest](models/PatchUserRequest.md) * [ResourceType](models/ResourceType.md) * [SnapshotList](models/SnapshotList.md) * [SnapshotListAllOf](models/SnapshotListAllOf.md) diff --git a/model_cluster_properties.go b/model_cluster_properties.go index 114c5b9..71a89bf 100644 --- a/model_cluster_properties.go +++ b/model_cluster_properties.go @@ -26,7 +26,7 @@ type ClusterProperties struct { Instances *int32 `json:"instances,omitempty"` Connections *[]Connection `json:"connections,omitempty"` MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - // The unique ID of the template, which specifies the number of cores, storage size, and memory. + // The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. TemplateID *string `json:"templateID,omitempty"` // The connection string for your cluster. ConnectionString *string `json:"connectionString,omitempty"` diff --git a/model_connection.go b/model_connection.go index 15c0d30..6d8eeee 100644 --- a/model_connection.go +++ b/model_connection.go @@ -20,7 +20,7 @@ type Connection struct { DatacenterId *string `json:"datacenterId"` // The numeric LAN ID with which you connect your cluster. LanId *string `json:"lanId"` - // The list of IPs and subnet for your cluster. Note the following unavailable IP ranges: 10.233.64.0/18 10.233.0.0/18 10.233.114.0/24 + // The list of IPs for your cluster. All IPs must be in a /24 network. Note the following unavailable IP ranges: 10.233.114.0/24 CidrList *[]string `json:"cidrList"` } diff --git a/model_create_cluster_properties.go b/model_create_cluster_properties.go index 912dab8..d01813a 100644 --- a/model_create_cluster_properties.go +++ b/model_create_cluster_properties.go @@ -16,7 +16,7 @@ import ( // CreateClusterProperties The properties with all data needed to create a new MongoDB cluster. type CreateClusterProperties struct { - // The unique ID of the template, which specifies the number of cores, storage size, and memory. + // The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. TemplateID *string `json:"templateID"` // The MongoDB version of your cluster. MongoDBVersion *string `json:"mongoDBVersion,omitempty"` diff --git a/model_patch_cluster_properties.go b/model_patch_cluster_properties.go new file mode 100644 index 0000000..9350718 --- /dev/null +++ b/model_patch_cluster_properties.go @@ -0,0 +1,296 @@ +/* + * IONOS DBaaS MongoDB REST API + * + * 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. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// PatchClusterProperties Properties of the payload to change a cluster. +type PatchClusterProperties struct { + // The name of your cluster. + DisplayName *string `json:"displayName,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + // The total number of instances in the cluster (one primary and n-1 secondaries). + Instances *int32 `json:"instances,omitempty"` + Connections *[]Connection `json:"connections,omitempty"` + // The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint. + TemplateID *string `json:"templateID,omitempty"` +} + +// NewPatchClusterProperties instantiates a new PatchClusterProperties object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPatchClusterProperties() *PatchClusterProperties { + this := PatchClusterProperties{} + + return &this +} + +// NewPatchClusterPropertiesWithDefaults instantiates a new PatchClusterProperties object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPatchClusterPropertiesWithDefaults() *PatchClusterProperties { + this := PatchClusterProperties{} + return &this +} + +// GetDisplayName returns the DisplayName field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PatchClusterProperties) GetDisplayName() *string { + if o == nil { + return nil + } + + return o.DisplayName + +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterProperties) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *PatchClusterProperties) SetDisplayName(v string) { + + o.DisplayName = &v + +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *PatchClusterProperties) HasDisplayName() bool { + if o != nil && o.DisplayName != nil { + return true + } + + return false +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value +// If the value is explicit nil, the zero value for MaintenanceWindow will be returned +func (o *PatchClusterProperties) GetMaintenanceWindow() *MaintenanceWindow { + if o == nil { + return nil + } + + return o.MaintenanceWindow + +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterProperties) GetMaintenanceWindowOk() (*MaintenanceWindow, bool) { + if o == nil { + return nil, false + } + + return o.MaintenanceWindow, true +} + +// SetMaintenanceWindow sets field value +func (o *PatchClusterProperties) SetMaintenanceWindow(v MaintenanceWindow) { + + o.MaintenanceWindow = &v + +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *PatchClusterProperties) HasMaintenanceWindow() bool { + if o != nil && o.MaintenanceWindow != nil { + return true + } + + return false +} + +// GetInstances returns the Instances field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *PatchClusterProperties) GetInstances() *int32 { + if o == nil { + return nil + } + + return o.Instances + +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterProperties) GetInstancesOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Instances, true +} + +// SetInstances sets field value +func (o *PatchClusterProperties) SetInstances(v int32) { + + o.Instances = &v + +} + +// HasInstances returns a boolean if a field has been set. +func (o *PatchClusterProperties) HasInstances() bool { + if o != nil && o.Instances != nil { + return true + } + + return false +} + +// GetConnections returns the Connections field value +// If the value is explicit nil, the zero value for []Connection will be returned +func (o *PatchClusterProperties) GetConnections() *[]Connection { + if o == nil { + return nil + } + + return o.Connections + +} + +// GetConnectionsOk returns a tuple with the Connections field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterProperties) GetConnectionsOk() (*[]Connection, bool) { + if o == nil { + return nil, false + } + + return o.Connections, true +} + +// SetConnections sets field value +func (o *PatchClusterProperties) SetConnections(v []Connection) { + + o.Connections = &v + +} + +// HasConnections returns a boolean if a field has been set. +func (o *PatchClusterProperties) HasConnections() bool { + if o != nil && o.Connections != nil { + return true + } + + return false +} + +// GetTemplateID returns the TemplateID field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PatchClusterProperties) GetTemplateID() *string { + if o == nil { + return nil + } + + return o.TemplateID + +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterProperties) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *PatchClusterProperties) SetTemplateID(v string) { + + o.TemplateID = &v + +} + +// HasTemplateID returns a boolean if a field has been set. +func (o *PatchClusterProperties) HasTemplateID() bool { + if o != nil && o.TemplateID != nil { + return true + } + + return false +} + +func (o PatchClusterProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.DisplayName != nil { + toSerialize["displayName"] = o.DisplayName + } + + if o.MaintenanceWindow != nil { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + + if o.Instances != nil { + toSerialize["instances"] = o.Instances + } + + if o.Connections != nil { + toSerialize["connections"] = o.Connections + } + + if o.TemplateID != nil { + toSerialize["templateID"] = o.TemplateID + } + + return json.Marshal(toSerialize) +} + +type NullablePatchClusterProperties struct { + value *PatchClusterProperties + isSet bool +} + +func (v NullablePatchClusterProperties) Get() *PatchClusterProperties { + return v.value +} + +func (v *NullablePatchClusterProperties) Set(val *PatchClusterProperties) { + v.value = val + v.isSet = true +} + +func (v NullablePatchClusterProperties) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchClusterProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchClusterProperties(val *PatchClusterProperties) *NullablePatchClusterProperties { + return &NullablePatchClusterProperties{value: val, isSet: true} +} + +func (v NullablePatchClusterProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchClusterProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_patch_cluster_request.go b/model_patch_cluster_request.go new file mode 100644 index 0000000..32722ac --- /dev/null +++ b/model_patch_cluster_request.go @@ -0,0 +1,164 @@ +/* + * IONOS DBaaS MongoDB REST API + * + * 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. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// PatchClusterRequest Request payload to change a cluster. +type PatchClusterRequest struct { + Metadata *Metadata `json:"metadata,omitempty"` + Properties *PatchClusterProperties `json:"properties,omitempty"` +} + +// NewPatchClusterRequest instantiates a new PatchClusterRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPatchClusterRequest() *PatchClusterRequest { + this := PatchClusterRequest{} + + return &this +} + +// NewPatchClusterRequestWithDefaults instantiates a new PatchClusterRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPatchClusterRequestWithDefaults() *PatchClusterRequest { + this := PatchClusterRequest{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for Metadata will be returned +func (o *PatchClusterRequest) GetMetadata() *Metadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterRequest) GetMetadataOk() (*Metadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *PatchClusterRequest) SetMetadata(v Metadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *PatchClusterRequest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for PatchClusterProperties will be returned +func (o *PatchClusterRequest) GetProperties() *PatchClusterProperties { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchClusterRequest) GetPropertiesOk() (*PatchClusterProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *PatchClusterRequest) SetProperties(v PatchClusterProperties) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *PatchClusterRequest) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o PatchClusterRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullablePatchClusterRequest struct { + value *PatchClusterRequest + isSet bool +} + +func (v NullablePatchClusterRequest) Get() *PatchClusterRequest { + return v.value +} + +func (v *NullablePatchClusterRequest) Set(val *PatchClusterRequest) { + v.value = val + v.isSet = true +} + +func (v NullablePatchClusterRequest) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchClusterRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchClusterRequest(val *PatchClusterRequest) *NullablePatchClusterRequest { + return &NullablePatchClusterRequest{value: val, isSet: true} +} + +func (v NullablePatchClusterRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchClusterRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_patch_user_properties.go b/model_patch_user_properties.go new file mode 100644 index 0000000..0479292 --- /dev/null +++ b/model_patch_user_properties.go @@ -0,0 +1,164 @@ +/* + * IONOS DBaaS MongoDB REST API + * + * 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. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// PatchUserProperties MongoDB database user patch request properties. +type PatchUserProperties struct { + Password *string `json:"password,omitempty"` + Roles *[]UserRoles `json:"roles,omitempty"` +} + +// NewPatchUserProperties instantiates a new PatchUserProperties object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPatchUserProperties() *PatchUserProperties { + this := PatchUserProperties{} + + return &this +} + +// NewPatchUserPropertiesWithDefaults instantiates a new PatchUserProperties object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPatchUserPropertiesWithDefaults() *PatchUserProperties { + this := PatchUserProperties{} + return &this +} + +// GetPassword returns the Password field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PatchUserProperties) GetPassword() *string { + if o == nil { + return nil + } + + return o.Password + +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchUserProperties) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Password, true +} + +// SetPassword sets field value +func (o *PatchUserProperties) SetPassword(v string) { + + o.Password = &v + +} + +// HasPassword returns a boolean if a field has been set. +func (o *PatchUserProperties) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// GetRoles returns the Roles field value +// If the value is explicit nil, the zero value for []UserRoles will be returned +func (o *PatchUserProperties) GetRoles() *[]UserRoles { + if o == nil { + return nil + } + + return o.Roles + +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchUserProperties) GetRolesOk() (*[]UserRoles, bool) { + if o == nil { + return nil, false + } + + return o.Roles, true +} + +// SetRoles sets field value +func (o *PatchUserProperties) SetRoles(v []UserRoles) { + + o.Roles = &v + +} + +// HasRoles returns a boolean if a field has been set. +func (o *PatchUserProperties) HasRoles() bool { + if o != nil && o.Roles != nil { + return true + } + + return false +} + +func (o PatchUserProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Password != nil { + toSerialize["password"] = o.Password + } + + if o.Roles != nil { + toSerialize["roles"] = o.Roles + } + + return json.Marshal(toSerialize) +} + +type NullablePatchUserProperties struct { + value *PatchUserProperties + isSet bool +} + +func (v NullablePatchUserProperties) Get() *PatchUserProperties { + return v.value +} + +func (v *NullablePatchUserProperties) Set(val *PatchUserProperties) { + v.value = val + v.isSet = true +} + +func (v NullablePatchUserProperties) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchUserProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchUserProperties(val *PatchUserProperties) *NullablePatchUserProperties { + return &NullablePatchUserProperties{value: val, isSet: true} +} + +func (v NullablePatchUserProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchUserProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_patch_user_request.go b/model_patch_user_request.go new file mode 100644 index 0000000..0c760c4 --- /dev/null +++ b/model_patch_user_request.go @@ -0,0 +1,164 @@ +/* + * IONOS DBaaS MongoDB REST API + * + * 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. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// PatchUserRequest MongoDB database user patch request. +type PatchUserRequest struct { + Metadata *UserMetadata `json:"metadata,omitempty"` + Properties *PatchUserProperties `json:"properties,omitempty"` +} + +// NewPatchUserRequest instantiates a new PatchUserRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPatchUserRequest() *PatchUserRequest { + this := PatchUserRequest{} + + return &this +} + +// NewPatchUserRequestWithDefaults instantiates a new PatchUserRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPatchUserRequestWithDefaults() *PatchUserRequest { + this := PatchUserRequest{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for UserMetadata will be returned +func (o *PatchUserRequest) GetMetadata() *UserMetadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchUserRequest) GetMetadataOk() (*UserMetadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *PatchUserRequest) SetMetadata(v UserMetadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *PatchUserRequest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for PatchUserProperties will be returned +func (o *PatchUserRequest) GetProperties() *PatchUserProperties { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchUserRequest) GetPropertiesOk() (*PatchUserProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *PatchUserRequest) SetProperties(v PatchUserProperties) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *PatchUserRequest) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o PatchUserRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullablePatchUserRequest struct { + value *PatchUserRequest + isSet bool +} + +func (v NullablePatchUserRequest) Get() *PatchUserRequest { + return v.value +} + +func (v *NullablePatchUserRequest) Set(val *PatchUserRequest) { + v.value = val + v.isSet = true +} + +func (v NullablePatchUserRequest) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchUserRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchUserRequest(val *PatchUserRequest) *NullablePatchUserRequest { + return &NullablePatchUserRequest{value: val, isSet: true} +} + +func (v NullablePatchUserRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchUserRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_resource_type.go b/model_resource_type.go index ffcb3bf..35fa09d 100644 --- a/model_resource_type.go +++ b/model_resource_type.go @@ -23,6 +23,7 @@ const ( COLLECTION ResourceType = "collection" CLUSTER ResourceType = "cluster" USER ResourceType = "user" + SNAPSHOT ResourceType = "snapshot" ) func (v *ResourceType) UnmarshalJSON(src []byte) error { @@ -32,7 +33,7 @@ func (v *ResourceType) UnmarshalJSON(src []byte) error { return err } enumTypeValue := ResourceType(value) - for _, existing := range []ResourceType{"collection", "cluster", "user"} { + for _, existing := range []ResourceType{"collection", "cluster", "user", "snapshot"} { if existing == enumTypeValue { *v = enumTypeValue return nil diff --git a/model_template_list.go b/model_template_list.go index 38e14a4..0ea5a34 100644 --- a/model_template_list.go +++ b/model_template_list.go @@ -16,7 +16,15 @@ import ( // TemplateList The list of MongoDB templates. type TemplateList struct { + Type *ResourceType `json:"type,omitempty"` + // The unique ID of the resource. + Id *string `json:"id,omitempty"` Items *[]TemplateResponse `json:"items,omitempty"` + // The offset specified in the request (if none was specified, the default offset is 0) (not implemented yet). + Offset *int32 `json:"offset,omitempty"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit) (not implemented yet, always return number of items). + Limit *int32 `json:"limit,omitempty"` + Links *PaginationLinks `json:"_links,omitempty"` } // NewTemplateList instantiates a new TemplateList object @@ -37,6 +45,82 @@ func NewTemplateListWithDefaults() *TemplateList { return &this } +// GetType returns the Type field value +// If the value is explicit nil, the zero value for ResourceType will be returned +func (o *TemplateList) GetType() *ResourceType { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateList) GetTypeOk() (*ResourceType, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *TemplateList) SetType(v ResourceType) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *TemplateList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TemplateList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *TemplateList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *TemplateList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + // GetItems returns the Items field value // If the value is explicit nil, the zero value for []TemplateResponse will be returned func (o *TemplateList) GetItems() *[]TemplateResponse { @@ -75,12 +159,146 @@ func (o *TemplateList) HasItems() bool { return false } +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *TemplateList) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *TemplateList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *TemplateList) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *TemplateList) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *TemplateList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *TemplateList) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for PaginationLinks will be returned +func (o *TemplateList) GetLinks() *PaginationLinks { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateList) GetLinksOk() (*PaginationLinks, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *TemplateList) SetLinks(v PaginationLinks) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *TemplateList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + func (o TemplateList) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Items != nil { toSerialize["items"] = o.Items } + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + return json.Marshal(toSerialize) } diff --git a/model_template_list_all_of.go b/model_template_list_all_of.go index ba0dd59..fa7c61d 100644 --- a/model_template_list_all_of.go +++ b/model_template_list_all_of.go @@ -16,6 +16,9 @@ import ( // TemplateListAllOf struct for TemplateListAllOf type TemplateListAllOf struct { + Type *ResourceType `json:"type,omitempty"` + // The unique ID of the resource. + Id *string `json:"id,omitempty"` Items *[]TemplateResponse `json:"items,omitempty"` } @@ -37,6 +40,82 @@ func NewTemplateListAllOfWithDefaults() *TemplateListAllOf { return &this } +// GetType returns the Type field value +// If the value is explicit nil, the zero value for ResourceType will be returned +func (o *TemplateListAllOf) GetType() *ResourceType { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateListAllOf) GetTypeOk() (*ResourceType, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *TemplateListAllOf) SetType(v ResourceType) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *TemplateListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TemplateListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *TemplateListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *TemplateListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + // GetItems returns the Items field value // If the value is explicit nil, the zero value for []TemplateResponse will be returned func (o *TemplateListAllOf) GetItems() *[]TemplateResponse { @@ -77,6 +156,14 @@ func (o *TemplateListAllOf) HasItems() bool { func (o TemplateListAllOf) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Items != nil { toSerialize["items"] = o.Items } diff --git a/model_template_response.go b/model_template_response.go index e3e8fb1..624d2a1 100644 --- a/model_template_response.go +++ b/model_template_response.go @@ -18,6 +18,10 @@ import ( type TemplateResponse struct { // The unique template ID. Id *string `json:"id,omitempty"` + // The name of the template. + Name *string `json:"name,omitempty"` + // The edition of the template (e.g. enterprise) + Edition *string `json:"edition,omitempty"` // The number of CPU cores. Cores *int32 `json:"cores,omitempty"` // The amount of memory in GB. @@ -82,6 +86,82 @@ func (o *TemplateResponse) HasId() bool { return false } +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TemplateResponse) GetName() *string { + if o == nil { + return nil + } + + return o.Name + +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Name, true +} + +// SetName sets field value +func (o *TemplateResponse) SetName(v string) { + + o.Name = &v + +} + +// HasName returns a boolean if a field has been set. +func (o *TemplateResponse) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// GetEdition returns the Edition field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TemplateResponse) GetEdition() *string { + if o == nil { + return nil + } + + return o.Edition + +} + +// GetEditionOk returns a tuple with the Edition field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateResponse) GetEditionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Edition, true +} + +// SetEdition sets field value +func (o *TemplateResponse) SetEdition(v string) { + + o.Edition = &v + +} + +// HasEdition returns a boolean if a field has been set. +func (o *TemplateResponse) HasEdition() bool { + if o != nil && o.Edition != nil { + return true + } + + return false +} + // GetCores returns the Cores field value // If the value is explicit nil, the zero value for int32 will be returned func (o *TemplateResponse) GetCores() *int32 { @@ -202,6 +282,14 @@ func (o TemplateResponse) MarshalJSON() ([]byte, error) { toSerialize["id"] = o.Id } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + if o.Edition != nil { + toSerialize["edition"] = o.Edition + } + if o.Cores != nil { toSerialize["cores"] = o.Cores } diff --git a/model_user_properties.go b/model_user_properties.go index d951c20..e9014b9 100644 --- a/model_user_properties.go +++ b/model_user_properties.go @@ -16,9 +16,7 @@ import ( // UserProperties Mongodb user properties. type UserProperties struct { - Username *string `json:"username"` - // The user database to use for authentication. - Database *string `json:"database"` + Username *string `json:"username"` Password *string `json:"password"` Roles *[]UserRoles `json:"roles,omitempty"` } @@ -27,11 +25,10 @@ type UserProperties struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewUserProperties(username string, database string, password string) *UserProperties { +func NewUserProperties(username string, password string) *UserProperties { this := UserProperties{} this.Username = &username - this.Database = &database this.Password = &password return &this @@ -83,44 +80,6 @@ func (o *UserProperties) HasUsername() bool { return false } -// GetDatabase returns the Database field value -// If the value is explicit nil, the zero value for string will be returned -func (o *UserProperties) GetDatabase() *string { - if o == nil { - return nil - } - - return o.Database - -} - -// GetDatabaseOk returns a tuple with the Database field value -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *UserProperties) GetDatabaseOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Database, true -} - -// SetDatabase sets field value -func (o *UserProperties) SetDatabase(v string) { - - o.Database = &v - -} - -// HasDatabase returns a boolean if a field has been set. -func (o *UserProperties) HasDatabase() bool { - if o != nil && o.Database != nil { - return true - } - - return false -} - // GetPassword returns the Password field value // If the value is explicit nil, the zero value for string will be returned func (o *UserProperties) GetPassword() *string { @@ -203,10 +162,6 @@ func (o UserProperties) MarshalJSON() ([]byte, error) { toSerialize["username"] = o.Username } - if o.Database != nil { - toSerialize["database"] = o.Database - } - if o.Password != nil { toSerialize["password"] = o.Password }