From c9790b5564bbb28e3cee9d4be54a56f93a02d796 Mon Sep 17 00:00:00 2001 From: Xiang Zhang Date: Sun, 29 Sep 2024 23:36:14 +0800 Subject: [PATCH] update cluster swagger (#247) --- .../v1beta1/serverless/cluster.swagger.json | 220 +++++++++++--- .../cluster/.openapi-generator/FILES | 4 + .../v1beta1/serverless/cluster/README.md | 18 +- .../serverless/cluster/api/openapi.yaml | 267 +++++++++++++++-- .../cluster/api_serverless_service.go | 268 +++++++++++++++++- ...rless_service_change_root_password_body.go | 2 +- .../model_serverlessv1beta1_cluster_view.go | 2 +- ...cloud_open_apiserverlessv1beta1_cluster.go | 265 +++++++++-------- ...erverlessv1beta1_create_cluster_request.go | 167 +++++++++++ ...erverlessv1beta1_list_clusters_response.go | 2 +- ...serverlessv1beta1_list_regions_response.go | 2 +- ...l_v1beta1_batch_create_clusters_request.go | 167 +++++++++++ ..._v1beta1_batch_create_clusters_response.go | 154 ++++++++++ ...del_v1beta1_batch_get_clusters_response.go | 154 ++++++++++ ...ess_service_partial_update_cluster_body.go | 2 +- 15 files changed, 1500 insertions(+), 194 deletions(-) create mode 100644 pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_create_cluster_request.go create mode 100644 pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_request.go create mode 100644 pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_response.go create mode 100644 pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_get_clusters_response.go diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster.swagger.json b/pkg/tidbcloud/v1beta1/serverless/cluster.swagger.json index 4154773b..53b062e3 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster.swagger.json +++ b/pkg/tidbcloud/v1beta1/serverless/cluster.swagger.json @@ -24,7 +24,7 @@ "paths": { "/clusters": { "get": { - "summary": "Provides a list of TiDB Serverless clusters in a project.", + "summary": "Provides a list of TiDB Cloud Serverless clusters in a project.", "operationId": "ServerlessService_ListClusters", "responses": { "200": { @@ -121,7 +121,7 @@ }, "/clusters/{clusterId}": { "get": { - "summary": "Retrieves details of a specific TiDB Serverless cluster.", + "summary": "Retrieves details of a specific TiDB Cloud Serverless cluster.", "operationId": "ServerlessService_GetCluster", "responses": { "200": { @@ -162,7 +162,7 @@ ] }, "delete": { - "summary": "Deletes a specific TiDB Serverless cluster.", + "summary": "Deletes a specific TiDB Cloud Serverless cluster.", "operationId": "ServerlessService_DeleteCluster", "responses": { "200": { @@ -194,7 +194,7 @@ }, "/clusters/{cluster.clusterId}": { "patch": { - "summary": "Partially updates a specific TiDB Serverless cluster.", + "summary": "Partially updates a specific TiDB Cloud Serverless cluster.", "operationId": "ServerlessService_PartialUpdateCluster", "responses": { "200": { @@ -234,7 +234,7 @@ }, "/clusters/{clusterId}/password": { "put": { - "summary": "Changes the root password of a specific TiDB Serverless cluster.", + "summary": "Changes the root password of a specific TiDB Cloud Serverless cluster.", "operationId": "ServerlessService_ChangeRootPassword", "responses": { "200": { @@ -274,7 +274,7 @@ }, "/regions": { "get": { - "summary": "Provides a list of available regions for TiDB Serverless clusters.", + "summary": "Provides a list of available regions for TiDB Cloud Serverless clusters.", "operationId": "ServerlessService_ListRegions", "responses": { "200": { @@ -294,6 +294,87 @@ "ServerlessService" ] } + }, + "/clusters:batchCreate": { + "post": { + "summary": "Creates new TiDB Cloud Serverless clusters in batch.\nThe operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success).", + "operationId": "ServerlessService_BatchCreateClusters", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1BatchCreateClustersResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "description": "Message for requesting to create a batch of TiDB Cloud Serverless clusters.", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1BatchCreateClustersRequest" + } + } + ], + "tags": [ + "ServerlessService" + ] + } + }, + "/clusters:batchGet": { + "get": { + "summary": "Retrieves details of TiDB Cloud Serverless clusters in batch.\nThe operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success).\nFor situations requiring partial failures, ListClusters method should be used.", + "operationId": "ServerlessService_BatchGetClusters", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1BatchGetClustersResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterIds", + "description": "A maximum of 1000 clusters can be get in a batch.", + "in": "query", + "required": true, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "view", + "description": "Optional. The level of detail to return for the cluster.\n\n - BASIC: Only basic information about the cluster is returned.\n - FULL: All details about the cluster are returned.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "BASIC", + "FULL" + ] + } + ], + "tags": [ + "ServerlessService" + ] + } } }, "definitions": { @@ -400,7 +481,7 @@ "description": "Required. The new root password for the cluster." } }, - "description": "Message for requesting to change the root password of a TiDB Serverless cluster.", + "description": "Message for requesting to change the root password of a TiDB Cloud Serverless cluster.", "required": [ "password" ] @@ -501,7 +582,7 @@ "BASIC", "FULL" ], - "description": "Enum for the different types of detail view to be returned for a TiDB Serverless cluster.\n\n - BASIC: Only basic information about the cluster is returned.\n - FULL: All details about the cluster are returned." + "description": "Enum for the different types of detail view to be returned for a TiDB Cloud Serverless cluster.\n\n - BASIC: Only basic information about the cluster is returned.\n - FULL: All details about the cluster are returned." }, "tidb_cloud_open_apiserverlessv1beta1Cluster": { "type": "object", @@ -536,16 +617,6 @@ } ] }, - "version": { - "type": "string", - "description": "Output_only. The TiDB version of the cluster.", - "readOnly": true - }, - "createdBy": { - "type": "string", - "description": "Output_only. The email of the creator of the cluster.", - "readOnly": true - }, "automatedBackupPolicy": { "description": "Optional. Automated backup policy to set on the cluster.", "allOf": [ @@ -554,11 +625,6 @@ } ] }, - "userPrefix": { - "type": "string", - "description": "Output_only. The unique prefix in SQL user name.", - "readOnly": true - }, "endpoints": { "description": "Optional. The endpoints for connecting to the cluster.", "allOf": [ @@ -567,6 +633,36 @@ } ] }, + "rootPassword": { + "type": "string", + "example": "my-shining-password", + "maxLength": 64, + "minLength": 8, + "pattern": "^.{8,64}$" + }, + "encryptionConfig": { + "description": "Optional. Encryption settings for the cluster.", + "allOf": [ + { + "$ref": "#/definitions/v1beta1ClusterEncryptionConfig" + } + ] + }, + "version": { + "type": "string", + "description": "Output_only. The TiDB version of the cluster.", + "readOnly": true + }, + "createdBy": { + "type": "string", + "description": "Output_only. The email of the creator of the cluster.", + "readOnly": true + }, + "userPrefix": { + "type": "string", + "description": "Output_only. The unique prefix in SQL user name.", + "readOnly": true + }, "state": { "description": "Output_only. The current state of the cluster.", "readOnly": true, @@ -585,14 +681,6 @@ } ] }, - "encryptionConfig": { - "description": "Optional. Encryption settings for the cluster.", - "allOf": [ - { - "$ref": "#/definitions/v1beta1ClusterEncryptionConfig" - } - ] - }, "labels": { "type": "object", "additionalProperties": { @@ -627,6 +715,23 @@ "region" ] }, + "tidb_cloud_open_apiserverlessv1beta1CreateClusterRequest": { + "type": "object", + "properties": { + "cluster": { + "description": "Required. The cluster to be created.", + "allOf": [ + { + "$ref": "#/definitions/tidb_cloud_open_apiserverlessv1beta1Cluster" + } + ] + } + }, + "description": "Message for requesting to create a TiDB Cloud Serverless cluster.", + "required": [ + "cluster" + ] + }, "tidb_cloud_open_apiserverlessv1beta1ListClustersResponse": { "type": "object", "properties": { @@ -648,7 +753,7 @@ "description": "Total number of available clusters." } }, - "description": "Responses message to the request for listing of TiDB Serverless clusters." + "description": "Responses message to the request for listing of TiDB Cloud Serverless clusters." }, "tidb_cloud_open_apiserverlessv1beta1ListRegionsResponse": { "type": "object", @@ -662,11 +767,56 @@ "description": "A list of available regions." } }, - "description": "Responses message to the request for listing of available regions in TiDB Serverless." + "description": "Responses message to the request for listing of available regions in TiDB Cloud Serverless." + }, + "v1beta1BatchCreateClustersRequest": { + "type": "object", + "properties": { + "requests": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/tidb_cloud_open_apiserverlessv1beta1CreateClusterRequest" + }, + "description": "The request message specifying the resources to create.\nA maximum of 1000 clusters can be created in a batch." + } + }, + "description": "Message for requesting to create a batch of TiDB Cloud Serverless clusters.", + "required": [ + "requests" + ] + }, + "v1beta1BatchCreateClustersResponse": { + "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/tidb_cloud_open_apiserverlessv1beta1Cluster" + }, + "description": "Clusters created." + } + }, + "description": "Responses message to the request for creating a batch of TiDB Cloud Serverless clusters." + }, + "v1beta1BatchGetClustersResponse": { + "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/tidb_cloud_open_apiserverlessv1beta1Cluster" + }, + "description": "Clusters created." + } + }, + "description": "Responses message to the request for retrieving a batch of TiDB Cloud Serverless clusters." }, "v1beta1ChangeRootPasswordResponse": { "type": "object", - "description": "Responses message to the request for changing the root password of a TiDB Serverless cluster." + "description": "Responses message to the request for changing the root password of a TiDB Cloud Serverless cluster." }, "v1beta1ClusterAutomatedBackupPolicy": { "type": "object", @@ -846,7 +996,7 @@ "description": "Required. The update mask indicating which fields are to be updated." } }, - "description": "Message for requesting a partial update on a TiDB Serverless cluster.", + "description": "Message for requesting a partial update on a TiDB Cloud Serverless cluster.", "required": [ "updateMask" ] diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/.openapi-generator/FILES b/pkg/tidbcloud/v1beta1/serverless/cluster/.openapi-generator/FILES index 7995f0ad..d5c3e76e 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/.openapi-generator/FILES +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/.openapi-generator/FILES @@ -21,8 +21,12 @@ model_serverless_service_change_root_password_body.go model_serverless_service_get_cluster_view_parameter.go model_serverlessv1beta1_cluster_view.go model_tidb_cloud_open_apiserverlessv1beta1_cluster.go +model_tidb_cloud_open_apiserverlessv1beta1_create_cluster_request.go model_tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go model_tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go +model_v1beta1_batch_create_clusters_request.go +model_v1beta1_batch_create_clusters_response.go +model_v1beta1_batch_get_clusters_response.go model_v1beta1_cluster_automated_backup_policy.go model_v1beta1_cluster_encryption_config.go model_v1beta1_cluster_endpoints.go diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/README.md b/pkg/tidbcloud/v1beta1/serverless/cluster/README.md index 3f5a0a70..78010242 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/README.md +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/README.md @@ -78,13 +78,15 @@ All URIs are relative to *https://serverless.tidbapi.com/v1beta1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*ServerlessServiceAPI* | [**ServerlessServiceChangeRootPassword**](docs/ServerlessServiceAPI.md#serverlessservicechangerootpassword) | **Put** /clusters/{clusterId}/password | Changes the root password of a specific TiDB Serverless cluster. +*ServerlessServiceAPI* | [**ServerlessServiceBatchCreateClusters**](docs/ServerlessServiceAPI.md#serverlessservicebatchcreateclusters) | **Post** /clusters:batchCreate | Creates new TiDB Cloud Serverless clusters in batch. The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). +*ServerlessServiceAPI* | [**ServerlessServiceBatchGetClusters**](docs/ServerlessServiceAPI.md#serverlessservicebatchgetclusters) | **Get** /clusters:batchGet | Retrieves details of TiDB Cloud Serverless clusters in batch. The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). For situations requiring partial failures, ListClusters method should be used. +*ServerlessServiceAPI* | [**ServerlessServiceChangeRootPassword**](docs/ServerlessServiceAPI.md#serverlessservicechangerootpassword) | **Put** /clusters/{clusterId}/password | Changes the root password of a specific TiDB Cloud Serverless cluster. *ServerlessServiceAPI* | [**ServerlessServiceCreateCluster**](docs/ServerlessServiceAPI.md#serverlessservicecreatecluster) | **Post** /clusters | Creates a new TiDB Serverless cluster. -*ServerlessServiceAPI* | [**ServerlessServiceDeleteCluster**](docs/ServerlessServiceAPI.md#serverlessservicedeletecluster) | **Delete** /clusters/{clusterId} | Deletes a specific TiDB Serverless cluster. -*ServerlessServiceAPI* | [**ServerlessServiceGetCluster**](docs/ServerlessServiceAPI.md#serverlessservicegetcluster) | **Get** /clusters/{clusterId} | Retrieves details of a specific TiDB Serverless cluster. -*ServerlessServiceAPI* | [**ServerlessServiceListClusters**](docs/ServerlessServiceAPI.md#serverlessservicelistclusters) | **Get** /clusters | Provides a list of TiDB Serverless clusters in a project. -*ServerlessServiceAPI* | [**ServerlessServiceListRegions**](docs/ServerlessServiceAPI.md#serverlessservicelistregions) | **Get** /regions | Provides a list of available regions for TiDB Serverless clusters. -*ServerlessServiceAPI* | [**ServerlessServicePartialUpdateCluster**](docs/ServerlessServiceAPI.md#serverlessservicepartialupdatecluster) | **Patch** /clusters/{cluster.clusterId} | Partially updates a specific TiDB Serverless cluster. +*ServerlessServiceAPI* | [**ServerlessServiceDeleteCluster**](docs/ServerlessServiceAPI.md#serverlessservicedeletecluster) | **Delete** /clusters/{clusterId} | Deletes a specific TiDB Cloud Serverless cluster. +*ServerlessServiceAPI* | [**ServerlessServiceGetCluster**](docs/ServerlessServiceAPI.md#serverlessservicegetcluster) | **Get** /clusters/{clusterId} | Retrieves details of a specific TiDB Cloud Serverless cluster. +*ServerlessServiceAPI* | [**ServerlessServiceListClusters**](docs/ServerlessServiceAPI.md#serverlessservicelistclusters) | **Get** /clusters | Provides a list of TiDB Cloud Serverless clusters in a project. +*ServerlessServiceAPI* | [**ServerlessServiceListRegions**](docs/ServerlessServiceAPI.md#serverlessservicelistregions) | **Get** /regions | Provides a list of available regions for TiDB Cloud Serverless clusters. +*ServerlessServiceAPI* | [**ServerlessServicePartialUpdateCluster**](docs/ServerlessServiceAPI.md#serverlessservicepartialupdatecluster) | **Patch** /clusters/{cluster.clusterId} | Partially updates a specific TiDB Cloud Serverless cluster. ## Documentation For Models @@ -103,8 +105,12 @@ Class | Method | HTTP request | Description - [ServerlessServiceGetClusterViewParameter](docs/ServerlessServiceGetClusterViewParameter.md) - [Serverlessv1beta1ClusterView](docs/Serverlessv1beta1ClusterView.md) - [TidbCloudOpenApiserverlessv1beta1Cluster](docs/TidbCloudOpenApiserverlessv1beta1Cluster.md) + - [TidbCloudOpenApiserverlessv1beta1CreateClusterRequest](docs/TidbCloudOpenApiserverlessv1beta1CreateClusterRequest.md) - [TidbCloudOpenApiserverlessv1beta1ListClustersResponse](docs/TidbCloudOpenApiserverlessv1beta1ListClustersResponse.md) - [TidbCloudOpenApiserverlessv1beta1ListRegionsResponse](docs/TidbCloudOpenApiserverlessv1beta1ListRegionsResponse.md) + - [V1beta1BatchCreateClustersRequest](docs/V1beta1BatchCreateClustersRequest.md) + - [V1beta1BatchCreateClustersResponse](docs/V1beta1BatchCreateClustersResponse.md) + - [V1beta1BatchGetClustersResponse](docs/V1beta1BatchGetClustersResponse.md) - [V1beta1ClusterAutomatedBackupPolicy](docs/V1beta1ClusterAutomatedBackupPolicy.md) - [V1beta1ClusterEncryptionConfig](docs/V1beta1ClusterEncryptionConfig.md) - [V1beta1ClusterEndpoints](docs/V1beta1ClusterEndpoints.md) diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/api/openapi.yaml b/pkg/tidbcloud/v1beta1/serverless/cluster/api/openapi.yaml index 864ac324..a2993446 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/api/openapi.yaml +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/api/openapi.yaml @@ -55,7 +55,7 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Provides a list of TiDB Serverless clusters in a project. + summary: Provides a list of TiDB Cloud Serverless clusters in a project. tags: - ServerlessService post: @@ -107,7 +107,7 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Deletes a specific TiDB Serverless cluster. + summary: Deletes a specific TiDB Cloud Serverless cluster. tags: - ServerlessService get: @@ -141,7 +141,7 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Retrieves details of a specific TiDB Serverless cluster. + summary: Retrieves details of a specific TiDB Cloud Serverless cluster. tags: - ServerlessService /clusters/{cluster.clusterId}: @@ -173,7 +173,7 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Partially updates a specific TiDB Serverless cluster. + summary: Partially updates a specific TiDB Cloud Serverless cluster. tags: - ServerlessService x-codegen-request-body-name: body @@ -207,7 +207,7 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Changes the root password of a specific TiDB Serverless cluster. + summary: Changes the root password of a specific TiDB Cloud Serverless cluster. tags: - ServerlessService x-codegen-request-body-name: body @@ -227,7 +227,79 @@ paths: schema: $ref: '#/components/schemas/googlerpcStatus' description: An unexpected error response. - summary: Provides a list of available regions for TiDB Serverless clusters. + summary: Provides a list of available regions for TiDB Cloud Serverless clusters. + tags: + - ServerlessService + /clusters:batchCreate: + post: + operationId: ServerlessService_BatchCreateClusters + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1BatchCreateClustersRequest' + description: Message for requesting to create a batch of TiDB Cloud Serverless + clusters. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1BatchCreateClustersResponse' + description: A successful response. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: |- + Creates new TiDB Cloud Serverless clusters in batch. + The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). + tags: + - ServerlessService + x-codegen-request-body-name: body + /clusters:batchGet: + get: + operationId: ServerlessService_BatchGetClusters + parameters: + - description: A maximum of 1000 clusters can be get in a batch. + explode: true + in: query + name: clusterIds + required: true + schema: + items: + type: string + type: array + style: form + - description: |- + Optional. The level of detail to return for the cluster. + + - BASIC: Only basic information about the cluster is returned. + - FULL: All details about the cluster are returned. + in: query + name: view + schema: + $ref: '#/components/schemas/ServerlessService_GetCluster_view_parameter' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1BatchGetClustersResponse' + description: A successful response. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: |- + Retrieves details of TiDB Cloud Serverless clusters in batch. + The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). + For situations requiring partial failures, ListClusters method should be used. tags: - ServerlessService components: @@ -302,8 +374,8 @@ components: type: string type: object ServerlessServiceChangeRootPasswordBody: - description: Message for requesting to change the root password of a TiDB Serverless - cluster. + description: Message for requesting to change the root password of a TiDB Cloud + Serverless cluster. example: password: password properties: @@ -554,7 +626,7 @@ components: type: object serverlessv1beta1ClusterView: description: |- - Enum for the different types of detail view to be returned for a TiDB Serverless cluster. + Enum for the different types of detail view to be returned for a TiDB Cloud Serverless cluster. - BASIC: Only basic information about the cluster is returned. - FULL: All details about the cluster are returned. @@ -584,6 +656,7 @@ components: userPrefix: userPrefix state: "{}" region: "{}" + rootPassword: my-shining-password properties: name: description: Output_only. The unique name of the cluster. @@ -606,6 +679,27 @@ components: - $ref: '#/components/schemas/ClusterSpendingLimit' description: Optional. The spending limit for the cluster. type: object + automatedBackupPolicy: + allOf: + - $ref: '#/components/schemas/v1beta1ClusterAutomatedBackupPolicy' + description: Optional. Automated backup policy to set on the cluster. + type: object + endpoints: + allOf: + - $ref: '#/components/schemas/v1beta1ClusterEndpoints' + description: Optional. The endpoints for connecting to the cluster. + type: object + rootPassword: + example: my-shining-password + maxLength: 64 + minLength: 8 + pattern: "^.{8,64}$" + type: string + encryptionConfig: + allOf: + - $ref: '#/components/schemas/v1beta1ClusterEncryptionConfig' + description: Optional. Encryption settings for the cluster. + type: object version: description: Output_only. The TiDB version of the cluster. readOnly: true @@ -614,20 +708,10 @@ components: description: Output_only. The email of the creator of the cluster. readOnly: true type: string - automatedBackupPolicy: - allOf: - - $ref: '#/components/schemas/v1beta1ClusterAutomatedBackupPolicy' - description: Optional. Automated backup policy to set on the cluster. - type: object userPrefix: description: Output_only. The unique prefix in SQL user name. readOnly: true type: string - endpoints: - allOf: - - $ref: '#/components/schemas/v1beta1ClusterEndpoints' - description: Optional. The endpoints for connecting to the cluster. - type: object state: allOf: - $ref: '#/components/schemas/commonv1beta1ClusterState' @@ -638,11 +722,6 @@ components: - $ref: '#/components/schemas/v1beta1ClusterUsage' description: Output_only. Usage details of the cluster. type: object - encryptionConfig: - allOf: - - $ref: '#/components/schemas/v1beta1ClusterEncryptionConfig' - description: Optional. Encryption settings for the cluster. - type: object labels: additionalProperties: type: string @@ -674,8 +753,19 @@ components: - displayName - region type: object + tidb_cloud_open_apiserverlessv1beta1CreateClusterRequest: + description: Message for requesting to create a TiDB Cloud Serverless cluster. + properties: + cluster: + allOf: + - $ref: '#/components/schemas/tidb_cloud_open_apiserverlessv1beta1Cluster' + description: Required. The cluster to be created. + type: object + required: + - cluster + type: object tidb_cloud_open_apiserverlessv1beta1ListClustersResponse: - description: Responses message to the request for listing of TiDB Serverless + description: Responses message to the request for listing of TiDB Cloud Serverless clusters. example: totalSize: 0 @@ -700,6 +790,7 @@ components: userPrefix: userPrefix state: "{}" region: "{}" + rootPassword: my-shining-password - encryptionConfig: "{}" endpoints: "{}" automatedBackupPolicy: "{}" @@ -719,6 +810,7 @@ components: userPrefix: userPrefix state: "{}" region: "{}" + rootPassword: my-shining-password properties: clusters: description: A list of clusters. @@ -735,7 +827,7 @@ components: type: object tidb_cloud_open_apiserverlessv1beta1ListRegionsResponse: description: Responses message to the request for listing of available regions - in TiDB Serverless. + in TiDB Cloud Serverless. example: regions: - regionId: regionId @@ -755,9 +847,127 @@ components: $ref: '#/components/schemas/commonv1beta1Region' type: array type: object + v1beta1BatchCreateClustersRequest: + description: Message for requesting to create a batch of TiDB Cloud Serverless + clusters. + properties: + requests: + description: |- + The request message specifying the resources to create. + A maximum of 1000 clusters can be created in a batch. + items: + $ref: '#/components/schemas/tidb_cloud_open_apiserverlessv1beta1CreateClusterRequest' + type: array + required: + - requests + type: object + v1beta1BatchCreateClustersResponse: + description: Responses message to the request for creating a batch of TiDB Cloud + Serverless clusters. + example: + clusters: + - encryptionConfig: "{}" + endpoints: "{}" + automatedBackupPolicy: "{}" + displayName: displayName + usage: "{}" + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + spendingLimit: "{}" + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + userPrefix: userPrefix + state: "{}" + region: "{}" + rootPassword: my-shining-password + - encryptionConfig: "{}" + endpoints: "{}" + automatedBackupPolicy: "{}" + displayName: displayName + usage: "{}" + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + spendingLimit: "{}" + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + userPrefix: userPrefix + state: "{}" + region: "{}" + rootPassword: my-shining-password + properties: + clusters: + description: Clusters created. + items: + $ref: '#/components/schemas/tidb_cloud_open_apiserverlessv1beta1Cluster' + type: array + type: object + v1beta1BatchGetClustersResponse: + description: Responses message to the request for retrieving a batch of TiDB + Cloud Serverless clusters. + example: + clusters: + - encryptionConfig: "{}" + endpoints: "{}" + automatedBackupPolicy: "{}" + displayName: displayName + usage: "{}" + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + spendingLimit: "{}" + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + userPrefix: userPrefix + state: "{}" + region: "{}" + rootPassword: my-shining-password + - encryptionConfig: "{}" + endpoints: "{}" + automatedBackupPolicy: "{}" + displayName: displayName + usage: "{}" + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + spendingLimit: "{}" + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + userPrefix: userPrefix + state: "{}" + region: "{}" + rootPassword: my-shining-password + properties: + clusters: + description: Clusters created. + items: + $ref: '#/components/schemas/tidb_cloud_open_apiserverlessv1beta1Cluster' + type: array + type: object v1beta1ChangeRootPasswordResponse: description: Responses message to the request for changing the root password - of a TiDB Serverless cluster. + of a TiDB Cloud Serverless cluster. type: object v1beta1ClusterAutomatedBackupPolicy: description: Message for automated backup configuration for a cluster. @@ -861,7 +1071,8 @@ components: - azure type: string v1beta1ServerlessServicePartialUpdateClusterBody: - description: Message for requesting a partial update on a TiDB Serverless cluster. + description: Message for requesting a partial update on a TiDB Cloud Serverless + cluster. properties: cluster: $ref: '#/components/schemas/Required__The_cluster_to_be_updated_' diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/api_serverless_service.go b/pkg/tidbcloud/v1beta1/serverless/cluster/api_serverless_service.go index a8bccf25..a3baf7d7 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/api_serverless_service.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/api_serverless_service.go @@ -16,12 +16,268 @@ import ( "io" "net/http" "net/url" + "reflect" "strings" ) // ServerlessServiceAPIService ServerlessServiceAPI service type ServerlessServiceAPIService service +type ApiServerlessServiceBatchCreateClustersRequest struct { + ctx context.Context + ApiService *ServerlessServiceAPIService + body *V1beta1BatchCreateClustersRequest +} + +// Message for requesting to create a batch of TiDB Cloud Serverless clusters. +func (r ApiServerlessServiceBatchCreateClustersRequest) Body(body V1beta1BatchCreateClustersRequest) ApiServerlessServiceBatchCreateClustersRequest { + r.body = &body + return r +} + +func (r ApiServerlessServiceBatchCreateClustersRequest) Execute() (*V1beta1BatchCreateClustersResponse, *http.Response, error) { + return r.ApiService.ServerlessServiceBatchCreateClustersExecute(r) +} + +/* +ServerlessServiceBatchCreateClusters Creates new TiDB Cloud Serverless clusters in batch. The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiServerlessServiceBatchCreateClustersRequest +*/ +func (a *ServerlessServiceAPIService) ServerlessServiceBatchCreateClusters(ctx context.Context) ApiServerlessServiceBatchCreateClustersRequest { + return ApiServerlessServiceBatchCreateClustersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1BatchCreateClustersResponse +func (a *ServerlessServiceAPIService) ServerlessServiceBatchCreateClustersExecute(r ApiServerlessServiceBatchCreateClustersRequest) (*V1beta1BatchCreateClustersResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1BatchCreateClustersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerlessServiceAPIService.ServerlessServiceBatchCreateClusters") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters:batchCreate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body 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.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v GooglerpcStatus + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiServerlessServiceBatchGetClustersRequest struct { + ctx context.Context + ApiService *ServerlessServiceAPIService + clusterIds *[]string + view *ServerlessServiceGetClusterViewParameter +} + +// A maximum of 1000 clusters can be get in a batch. +func (r ApiServerlessServiceBatchGetClustersRequest) ClusterIds(clusterIds []string) ApiServerlessServiceBatchGetClustersRequest { + r.clusterIds = &clusterIds + return r +} + +// Optional. The level of detail to return for the cluster. - BASIC: Only basic information about the cluster is returned. - FULL: All details about the cluster are returned. +func (r ApiServerlessServiceBatchGetClustersRequest) View(view ServerlessServiceGetClusterViewParameter) ApiServerlessServiceBatchGetClustersRequest { + r.view = &view + return r +} + +func (r ApiServerlessServiceBatchGetClustersRequest) Execute() (*V1beta1BatchGetClustersResponse, *http.Response, error) { + return r.ApiService.ServerlessServiceBatchGetClustersExecute(r) +} + +/* +ServerlessServiceBatchGetClusters Retrieves details of TiDB Cloud Serverless clusters in batch. The operation is atomic: it fails for all clusters or succeeds for all clusters (no partial success). For situations requiring partial failures, ListClusters method should be used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiServerlessServiceBatchGetClustersRequest +*/ +func (a *ServerlessServiceAPIService) ServerlessServiceBatchGetClusters(ctx context.Context) ApiServerlessServiceBatchGetClustersRequest { + return ApiServerlessServiceBatchGetClustersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1BatchGetClustersResponse +func (a *ServerlessServiceAPIService) ServerlessServiceBatchGetClustersExecute(r ApiServerlessServiceBatchGetClustersRequest) (*V1beta1BatchGetClustersResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1BatchGetClustersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerlessServiceAPIService.ServerlessServiceBatchGetClusters") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters:batchGet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.clusterIds == nil { + return localVarReturnValue, nil, reportError("clusterIds is required and must be specified") + } + + { + t := *r.clusterIds + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "clusterIds", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "clusterIds", t, "form", "multi") + } + } + if r.view != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "view", r.view, "", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v GooglerpcStatus + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiServerlessServiceChangeRootPasswordRequest struct { ctx context.Context ApiService *ServerlessServiceAPIService @@ -39,7 +295,7 @@ func (r ApiServerlessServiceChangeRootPasswordRequest) Execute() (map[string]int } /* -ServerlessServiceChangeRootPassword Changes the root password of a specific TiDB Serverless cluster. +ServerlessServiceChangeRootPassword Changes the root password of a specific TiDB Cloud Serverless cluster. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param clusterId Required. The ID of the cluster for which the password is to be changed. @@ -272,7 +528,7 @@ func (r ApiServerlessServiceDeleteClusterRequest) Execute() (*TidbCloudOpenApise } /* -ServerlessServiceDeleteCluster Deletes a specific TiDB Serverless cluster. +ServerlessServiceDeleteCluster Deletes a specific TiDB Cloud Serverless cluster. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param clusterId Required. The ID of the cluster to be deleted. @@ -389,7 +645,7 @@ func (r ApiServerlessServiceGetClusterRequest) Execute() (*TidbCloudOpenApiserve } /* -ServerlessServiceGetCluster Retrieves details of a specific TiDB Serverless cluster. +ServerlessServiceGetCluster Retrieves details of a specific TiDB Cloud Serverless cluster. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param clusterId Required. The ID of the cluster to be retrieved. @@ -536,7 +792,7 @@ func (r ApiServerlessServiceListClustersRequest) Execute() (*TidbCloudOpenApiser } /* -ServerlessServiceListClusters Provides a list of TiDB Serverless clusters in a project. +ServerlessServiceListClusters Provides a list of TiDB Cloud Serverless clusters in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiServerlessServiceListClustersRequest @@ -657,7 +913,7 @@ func (r ApiServerlessServiceListRegionsRequest) Execute() (*TidbCloudOpenApiserv } /* -ServerlessServiceListRegions Provides a list of available regions for TiDB Serverless clusters. +ServerlessServiceListRegions Provides a list of available regions for TiDB Cloud Serverless clusters. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiServerlessServiceListRegionsRequest @@ -770,7 +1026,7 @@ func (r ApiServerlessServicePartialUpdateClusterRequest) Execute() (*TidbCloudOp } /* -ServerlessServicePartialUpdateCluster Partially updates a specific TiDB Serverless cluster. +ServerlessServicePartialUpdateCluster Partially updates a specific TiDB Cloud Serverless cluster. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param clusterClusterId Output_only. The unique ID of the cluster. diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverless_service_change_root_password_body.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverless_service_change_root_password_body.go index ae619e3d..fcaa69d9 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverless_service_change_root_password_body.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverless_service_change_root_password_body.go @@ -18,7 +18,7 @@ import ( // checks if the ServerlessServiceChangeRootPasswordBody type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ServerlessServiceChangeRootPasswordBody{} -// ServerlessServiceChangeRootPasswordBody Message for requesting to change the root password of a TiDB Serverless cluster. +// ServerlessServiceChangeRootPasswordBody Message for requesting to change the root password of a TiDB Cloud Serverless cluster. type ServerlessServiceChangeRootPasswordBody struct { // Required. The new root password for the cluster. Password string `json:"password"` diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverlessv1beta1_cluster_view.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverlessv1beta1_cluster_view.go index 78ff419a..b074940e 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverlessv1beta1_cluster_view.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_serverlessv1beta1_cluster_view.go @@ -15,7 +15,7 @@ import ( "fmt" ) -// Serverlessv1beta1ClusterView Enum for the different types of detail view to be returned for a TiDB Serverless cluster. - BASIC: Only basic information about the cluster is returned. - FULL: All details about the cluster are returned. +// Serverlessv1beta1ClusterView Enum for the different types of detail view to be returned for a TiDB Cloud Serverless cluster. - BASIC: Only basic information about the cluster is returned. - FULL: All details about the cluster are returned. type Serverlessv1beta1ClusterView string // List of serverlessv1beta1ClusterView diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_cluster.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_cluster.go index de3eae36..c3189485 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_cluster.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_cluster.go @@ -31,22 +31,23 @@ type TidbCloudOpenApiserverlessv1beta1Cluster struct { Region Commonv1beta1Region `json:"region"` // Optional. The spending limit for the cluster. SpendingLimit *ClusterSpendingLimit `json:"spendingLimit,omitempty"` + // Optional. Automated backup policy to set on the cluster. + AutomatedBackupPolicy *V1beta1ClusterAutomatedBackupPolicy `json:"automatedBackupPolicy,omitempty"` + // Optional. The endpoints for connecting to the cluster. + Endpoints *V1beta1ClusterEndpoints `json:"endpoints,omitempty"` + RootPassword *string `json:"rootPassword,omitempty" validate:"regexp=^.{8,64}$"` + // Optional. Encryption settings for the cluster. + EncryptionConfig *V1beta1ClusterEncryptionConfig `json:"encryptionConfig,omitempty"` // Output_only. The TiDB version of the cluster. Version *string `json:"version,omitempty"` // Output_only. The email of the creator of the cluster. CreatedBy *string `json:"createdBy,omitempty"` - // Optional. Automated backup policy to set on the cluster. - AutomatedBackupPolicy *V1beta1ClusterAutomatedBackupPolicy `json:"automatedBackupPolicy,omitempty"` // Output_only. The unique prefix in SQL user name. UserPrefix *string `json:"userPrefix,omitempty"` - // Optional. The endpoints for connecting to the cluster. - Endpoints *V1beta1ClusterEndpoints `json:"endpoints,omitempty"` // Output_only. The current state of the cluster. State *Commonv1beta1ClusterState `json:"state,omitempty"` // Output_only. Usage details of the cluster. Usage *V1beta1ClusterUsage `json:"usage,omitempty"` - // Optional. Encryption settings for the cluster. - EncryptionConfig *V1beta1ClusterEncryptionConfig `json:"encryptionConfig,omitempty"` // Optional. The labels for the cluster. tidb.cloud/organization. The label for the cluster organization id. tidb.cloud/project. The label for the cluster project id. Labels *map[string]string `json:"labels,omitempty"` // OUTPUT_ONLY. The annotations for the cluster. tidb.cloud/has-set-password. The annotation for whether the cluster has set password. tidb.cloud/available-features. The annotation for the available features of the cluster. @@ -223,6 +224,134 @@ func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetSpendingLimit(v ClusterSpe o.SpendingLimit = &v } +// GetAutomatedBackupPolicy returns the AutomatedBackupPolicy field value if set, zero value otherwise. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetAutomatedBackupPolicy() V1beta1ClusterAutomatedBackupPolicy { + if o == nil || IsNil(o.AutomatedBackupPolicy) { + var ret V1beta1ClusterAutomatedBackupPolicy + return ret + } + return *o.AutomatedBackupPolicy +} + +// GetAutomatedBackupPolicyOk returns a tuple with the AutomatedBackupPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetAutomatedBackupPolicyOk() (*V1beta1ClusterAutomatedBackupPolicy, bool) { + if o == nil || IsNil(o.AutomatedBackupPolicy) { + return nil, false + } + return o.AutomatedBackupPolicy, true +} + +// HasAutomatedBackupPolicy returns a boolean if a field has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasAutomatedBackupPolicy() bool { + if o != nil && !IsNil(o.AutomatedBackupPolicy) { + return true + } + + return false +} + +// SetAutomatedBackupPolicy gets a reference to the given V1beta1ClusterAutomatedBackupPolicy and assigns it to the AutomatedBackupPolicy field. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetAutomatedBackupPolicy(v V1beta1ClusterAutomatedBackupPolicy) { + o.AutomatedBackupPolicy = &v +} + +// GetEndpoints returns the Endpoints field value if set, zero value otherwise. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEndpoints() V1beta1ClusterEndpoints { + if o == nil || IsNil(o.Endpoints) { + var ret V1beta1ClusterEndpoints + return ret + } + return *o.Endpoints +} + +// GetEndpointsOk returns a tuple with the Endpoints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEndpointsOk() (*V1beta1ClusterEndpoints, bool) { + if o == nil || IsNil(o.Endpoints) { + return nil, false + } + return o.Endpoints, true +} + +// HasEndpoints returns a boolean if a field has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasEndpoints() bool { + if o != nil && !IsNil(o.Endpoints) { + return true + } + + return false +} + +// SetEndpoints gets a reference to the given V1beta1ClusterEndpoints and assigns it to the Endpoints field. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetEndpoints(v V1beta1ClusterEndpoints) { + o.Endpoints = &v +} + +// GetRootPassword returns the RootPassword field value if set, zero value otherwise. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetRootPassword() string { + if o == nil || IsNil(o.RootPassword) { + var ret string + return ret + } + return *o.RootPassword +} + +// GetRootPasswordOk returns a tuple with the RootPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetRootPasswordOk() (*string, bool) { + if o == nil || IsNil(o.RootPassword) { + return nil, false + } + return o.RootPassword, true +} + +// HasRootPassword returns a boolean if a field has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasRootPassword() bool { + if o != nil && !IsNil(o.RootPassword) { + return true + } + + return false +} + +// SetRootPassword gets a reference to the given string and assigns it to the RootPassword field. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetRootPassword(v string) { + o.RootPassword = &v +} + +// GetEncryptionConfig returns the EncryptionConfig field value if set, zero value otherwise. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEncryptionConfig() V1beta1ClusterEncryptionConfig { + if o == nil || IsNil(o.EncryptionConfig) { + var ret V1beta1ClusterEncryptionConfig + return ret + } + return *o.EncryptionConfig +} + +// GetEncryptionConfigOk returns a tuple with the EncryptionConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEncryptionConfigOk() (*V1beta1ClusterEncryptionConfig, bool) { + if o == nil || IsNil(o.EncryptionConfig) { + return nil, false + } + return o.EncryptionConfig, true +} + +// HasEncryptionConfig returns a boolean if a field has been set. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasEncryptionConfig() bool { + if o != nil && !IsNil(o.EncryptionConfig) { + return true + } + + return false +} + +// SetEncryptionConfig gets a reference to the given V1beta1ClusterEncryptionConfig and assigns it to the EncryptionConfig field. +func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetEncryptionConfig(v V1beta1ClusterEncryptionConfig) { + o.EncryptionConfig = &v +} + // GetVersion returns the Version field value if set, zero value otherwise. func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetVersion() string { if o == nil || IsNil(o.Version) { @@ -287,38 +416,6 @@ func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetCreatedBy(v string) { o.CreatedBy = &v } -// GetAutomatedBackupPolicy returns the AutomatedBackupPolicy field value if set, zero value otherwise. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetAutomatedBackupPolicy() V1beta1ClusterAutomatedBackupPolicy { - if o == nil || IsNil(o.AutomatedBackupPolicy) { - var ret V1beta1ClusterAutomatedBackupPolicy - return ret - } - return *o.AutomatedBackupPolicy -} - -// GetAutomatedBackupPolicyOk returns a tuple with the AutomatedBackupPolicy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetAutomatedBackupPolicyOk() (*V1beta1ClusterAutomatedBackupPolicy, bool) { - if o == nil || IsNil(o.AutomatedBackupPolicy) { - return nil, false - } - return o.AutomatedBackupPolicy, true -} - -// HasAutomatedBackupPolicy returns a boolean if a field has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasAutomatedBackupPolicy() bool { - if o != nil && !IsNil(o.AutomatedBackupPolicy) { - return true - } - - return false -} - -// SetAutomatedBackupPolicy gets a reference to the given V1beta1ClusterAutomatedBackupPolicy and assigns it to the AutomatedBackupPolicy field. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetAutomatedBackupPolicy(v V1beta1ClusterAutomatedBackupPolicy) { - o.AutomatedBackupPolicy = &v -} - // GetUserPrefix returns the UserPrefix field value if set, zero value otherwise. func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetUserPrefix() string { if o == nil || IsNil(o.UserPrefix) { @@ -351,38 +448,6 @@ func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetUserPrefix(v string) { o.UserPrefix = &v } -// GetEndpoints returns the Endpoints field value if set, zero value otherwise. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEndpoints() V1beta1ClusterEndpoints { - if o == nil || IsNil(o.Endpoints) { - var ret V1beta1ClusterEndpoints - return ret - } - return *o.Endpoints -} - -// GetEndpointsOk returns a tuple with the Endpoints field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEndpointsOk() (*V1beta1ClusterEndpoints, bool) { - if o == nil || IsNil(o.Endpoints) { - return nil, false - } - return o.Endpoints, true -} - -// HasEndpoints returns a boolean if a field has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasEndpoints() bool { - if o != nil && !IsNil(o.Endpoints) { - return true - } - - return false -} - -// SetEndpoints gets a reference to the given V1beta1ClusterEndpoints and assigns it to the Endpoints field. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetEndpoints(v V1beta1ClusterEndpoints) { - o.Endpoints = &v -} - // GetState returns the State field value if set, zero value otherwise. func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetState() Commonv1beta1ClusterState { if o == nil || IsNil(o.State) { @@ -447,38 +512,6 @@ func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetUsage(v V1beta1ClusterUsag o.Usage = &v } -// GetEncryptionConfig returns the EncryptionConfig field value if set, zero value otherwise. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEncryptionConfig() V1beta1ClusterEncryptionConfig { - if o == nil || IsNil(o.EncryptionConfig) { - var ret V1beta1ClusterEncryptionConfig - return ret - } - return *o.EncryptionConfig -} - -// GetEncryptionConfigOk returns a tuple with the EncryptionConfig field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetEncryptionConfigOk() (*V1beta1ClusterEncryptionConfig, bool) { - if o == nil || IsNil(o.EncryptionConfig) { - return nil, false - } - return o.EncryptionConfig, true -} - -// HasEncryptionConfig returns a boolean if a field has been set. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) HasEncryptionConfig() bool { - if o != nil && !IsNil(o.EncryptionConfig) { - return true - } - - return false -} - -// SetEncryptionConfig gets a reference to the given V1beta1ClusterEncryptionConfig and assigns it to the EncryptionConfig field. -func (o *TidbCloudOpenApiserverlessv1beta1Cluster) SetEncryptionConfig(v V1beta1ClusterEncryptionConfig) { - o.EncryptionConfig = &v -} - // GetLabels returns the Labels field value if set, zero value otherwise. func (o *TidbCloudOpenApiserverlessv1beta1Cluster) GetLabels() map[string]string { if o == nil || IsNil(o.Labels) { @@ -628,30 +661,33 @@ func (o TidbCloudOpenApiserverlessv1beta1Cluster) ToMap() (map[string]interface{ if !IsNil(o.SpendingLimit) { toSerialize["spendingLimit"] = o.SpendingLimit } + if !IsNil(o.AutomatedBackupPolicy) { + toSerialize["automatedBackupPolicy"] = o.AutomatedBackupPolicy + } + if !IsNil(o.Endpoints) { + toSerialize["endpoints"] = o.Endpoints + } + if !IsNil(o.RootPassword) { + toSerialize["rootPassword"] = o.RootPassword + } + if !IsNil(o.EncryptionConfig) { + toSerialize["encryptionConfig"] = o.EncryptionConfig + } if !IsNil(o.Version) { toSerialize["version"] = o.Version } if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - if !IsNil(o.AutomatedBackupPolicy) { - toSerialize["automatedBackupPolicy"] = o.AutomatedBackupPolicy - } if !IsNil(o.UserPrefix) { toSerialize["userPrefix"] = o.UserPrefix } - if !IsNil(o.Endpoints) { - toSerialize["endpoints"] = o.Endpoints - } if !IsNil(o.State) { toSerialize["state"] = o.State } if !IsNil(o.Usage) { toSerialize["usage"] = o.Usage } - if !IsNil(o.EncryptionConfig) { - toSerialize["encryptionConfig"] = o.EncryptionConfig - } if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } @@ -713,14 +749,15 @@ func (o *TidbCloudOpenApiserverlessv1beta1Cluster) UnmarshalJSON(data []byte) (e delete(additionalProperties, "displayName") delete(additionalProperties, "region") delete(additionalProperties, "spendingLimit") + delete(additionalProperties, "automatedBackupPolicy") + delete(additionalProperties, "endpoints") + delete(additionalProperties, "rootPassword") + delete(additionalProperties, "encryptionConfig") delete(additionalProperties, "version") delete(additionalProperties, "createdBy") - delete(additionalProperties, "automatedBackupPolicy") delete(additionalProperties, "userPrefix") - delete(additionalProperties, "endpoints") delete(additionalProperties, "state") delete(additionalProperties, "usage") - delete(additionalProperties, "encryptionConfig") delete(additionalProperties, "labels") delete(additionalProperties, "annotations") delete(additionalProperties, "createTime") diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_create_cluster_request.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_create_cluster_request.go new file mode 100644 index 00000000..b8cbb2bb --- /dev/null +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_create_cluster_request.go @@ -0,0 +1,167 @@ +/* +TiDB Cloud Serverless Open API + +TiDB Cloud Serverless Open API + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cluster + +import ( + "encoding/json" + "fmt" +) + +// checks if the TidbCloudOpenApiserverlessv1beta1CreateClusterRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbCloudOpenApiserverlessv1beta1CreateClusterRequest{} + +// TidbCloudOpenApiserverlessv1beta1CreateClusterRequest Message for requesting to create a TiDB Cloud Serverless cluster. +type TidbCloudOpenApiserverlessv1beta1CreateClusterRequest struct { + // Required. The cluster to be created. + Cluster TidbCloudOpenApiserverlessv1beta1Cluster `json:"cluster"` + AdditionalProperties map[string]interface{} +} + +type _TidbCloudOpenApiserverlessv1beta1CreateClusterRequest TidbCloudOpenApiserverlessv1beta1CreateClusterRequest + +// NewTidbCloudOpenApiserverlessv1beta1CreateClusterRequest instantiates a new TidbCloudOpenApiserverlessv1beta1CreateClusterRequest 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 NewTidbCloudOpenApiserverlessv1beta1CreateClusterRequest(cluster TidbCloudOpenApiserverlessv1beta1Cluster) *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest { + this := TidbCloudOpenApiserverlessv1beta1CreateClusterRequest{} + this.Cluster = cluster + return &this +} + +// NewTidbCloudOpenApiserverlessv1beta1CreateClusterRequestWithDefaults instantiates a new TidbCloudOpenApiserverlessv1beta1CreateClusterRequest 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 NewTidbCloudOpenApiserverlessv1beta1CreateClusterRequestWithDefaults() *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest { + this := TidbCloudOpenApiserverlessv1beta1CreateClusterRequest{} + return &this +} + +// GetCluster returns the Cluster field value +func (o *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) GetCluster() TidbCloudOpenApiserverlessv1beta1Cluster { + if o == nil { + var ret TidbCloudOpenApiserverlessv1beta1Cluster + return ret + } + + return o.Cluster +} + +// GetClusterOk returns a tuple with the Cluster field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) GetClusterOk() (*TidbCloudOpenApiserverlessv1beta1Cluster, bool) { + if o == nil { + return nil, false + } + return &o.Cluster, true +} + +// SetCluster sets field value +func (o *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) SetCluster(v TidbCloudOpenApiserverlessv1beta1Cluster) { + o.Cluster = v +} + +func (o TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cluster"] = o.Cluster + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "cluster", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTidbCloudOpenApiserverlessv1beta1CreateClusterRequest := _TidbCloudOpenApiserverlessv1beta1CreateClusterRequest{} + + err = json.Unmarshal(data, &varTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) + + if err != nil { + return err + } + + *o = TidbCloudOpenApiserverlessv1beta1CreateClusterRequest(varTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cluster") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest struct { + value *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest + isSet bool +} + +func (v NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) Get() *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest { + return v.value +} + +func (v *NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) Set(val *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest(val *TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) *NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest { + return &NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest{value: val, isSet: true} +} + +func (v NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbCloudOpenApiserverlessv1beta1CreateClusterRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go index c5e70339..81457bc3 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go @@ -17,7 +17,7 @@ import ( // checks if the TidbCloudOpenApiserverlessv1beta1ListClustersResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &TidbCloudOpenApiserverlessv1beta1ListClustersResponse{} -// TidbCloudOpenApiserverlessv1beta1ListClustersResponse Responses message to the request for listing of TiDB Serverless clusters. +// TidbCloudOpenApiserverlessv1beta1ListClustersResponse Responses message to the request for listing of TiDB Cloud Serverless clusters. type TidbCloudOpenApiserverlessv1beta1ListClustersResponse struct { // A list of clusters. Clusters []TidbCloudOpenApiserverlessv1beta1Cluster `json:"clusters,omitempty"` diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go index aeae95a1..b958b9f9 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go @@ -17,7 +17,7 @@ import ( // checks if the TidbCloudOpenApiserverlessv1beta1ListRegionsResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &TidbCloudOpenApiserverlessv1beta1ListRegionsResponse{} -// TidbCloudOpenApiserverlessv1beta1ListRegionsResponse Responses message to the request for listing of available regions in TiDB Serverless. +// TidbCloudOpenApiserverlessv1beta1ListRegionsResponse Responses message to the request for listing of available regions in TiDB Cloud Serverless. type TidbCloudOpenApiserverlessv1beta1ListRegionsResponse struct { // A list of available regions. Regions []Commonv1beta1Region `json:"regions,omitempty"` diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_request.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_request.go new file mode 100644 index 00000000..3381c8ea --- /dev/null +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_request.go @@ -0,0 +1,167 @@ +/* +TiDB Cloud Serverless Open API + +TiDB Cloud Serverless Open API + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cluster + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1BatchCreateClustersRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1BatchCreateClustersRequest{} + +// V1beta1BatchCreateClustersRequest Message for requesting to create a batch of TiDB Cloud Serverless clusters. +type V1beta1BatchCreateClustersRequest struct { + // The request message specifying the resources to create. A maximum of 1000 clusters can be created in a batch. + Requests []TidbCloudOpenApiserverlessv1beta1CreateClusterRequest `json:"requests"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1BatchCreateClustersRequest V1beta1BatchCreateClustersRequest + +// NewV1beta1BatchCreateClustersRequest instantiates a new V1beta1BatchCreateClustersRequest 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 NewV1beta1BatchCreateClustersRequest(requests []TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) *V1beta1BatchCreateClustersRequest { + this := V1beta1BatchCreateClustersRequest{} + this.Requests = requests + return &this +} + +// NewV1beta1BatchCreateClustersRequestWithDefaults instantiates a new V1beta1BatchCreateClustersRequest 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 NewV1beta1BatchCreateClustersRequestWithDefaults() *V1beta1BatchCreateClustersRequest { + this := V1beta1BatchCreateClustersRequest{} + return &this +} + +// GetRequests returns the Requests field value +func (o *V1beta1BatchCreateClustersRequest) GetRequests() []TidbCloudOpenApiserverlessv1beta1CreateClusterRequest { + if o == nil { + var ret []TidbCloudOpenApiserverlessv1beta1CreateClusterRequest + return ret + } + + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *V1beta1BatchCreateClustersRequest) GetRequestsOk() ([]TidbCloudOpenApiserverlessv1beta1CreateClusterRequest, bool) { + if o == nil { + return nil, false + } + return o.Requests, true +} + +// SetRequests sets field value +func (o *V1beta1BatchCreateClustersRequest) SetRequests(v []TidbCloudOpenApiserverlessv1beta1CreateClusterRequest) { + o.Requests = v +} + +func (o V1beta1BatchCreateClustersRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1BatchCreateClustersRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["requests"] = o.Requests + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1BatchCreateClustersRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "requests", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varV1beta1BatchCreateClustersRequest := _V1beta1BatchCreateClustersRequest{} + + err = json.Unmarshal(data, &varV1beta1BatchCreateClustersRequest) + + if err != nil { + return err + } + + *o = V1beta1BatchCreateClustersRequest(varV1beta1BatchCreateClustersRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "requests") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1BatchCreateClustersRequest struct { + value *V1beta1BatchCreateClustersRequest + isSet bool +} + +func (v NullableV1beta1BatchCreateClustersRequest) Get() *V1beta1BatchCreateClustersRequest { + return v.value +} + +func (v *NullableV1beta1BatchCreateClustersRequest) Set(val *V1beta1BatchCreateClustersRequest) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1BatchCreateClustersRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1BatchCreateClustersRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1BatchCreateClustersRequest(val *V1beta1BatchCreateClustersRequest) *NullableV1beta1BatchCreateClustersRequest { + return &NullableV1beta1BatchCreateClustersRequest{value: val, isSet: true} +} + +func (v NullableV1beta1BatchCreateClustersRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1BatchCreateClustersRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_response.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_response.go new file mode 100644 index 00000000..c11f2d7f --- /dev/null +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_create_clusters_response.go @@ -0,0 +1,154 @@ +/* +TiDB Cloud Serverless Open API + +TiDB Cloud Serverless Open API + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cluster + +import ( + "encoding/json" +) + +// checks if the V1beta1BatchCreateClustersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1BatchCreateClustersResponse{} + +// V1beta1BatchCreateClustersResponse Responses message to the request for creating a batch of TiDB Cloud Serverless clusters. +type V1beta1BatchCreateClustersResponse struct { + // Clusters created. + Clusters []TidbCloudOpenApiserverlessv1beta1Cluster `json:"clusters,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1BatchCreateClustersResponse V1beta1BatchCreateClustersResponse + +// NewV1beta1BatchCreateClustersResponse instantiates a new V1beta1BatchCreateClustersResponse 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 NewV1beta1BatchCreateClustersResponse() *V1beta1BatchCreateClustersResponse { + this := V1beta1BatchCreateClustersResponse{} + return &this +} + +// NewV1beta1BatchCreateClustersResponseWithDefaults instantiates a new V1beta1BatchCreateClustersResponse 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 NewV1beta1BatchCreateClustersResponseWithDefaults() *V1beta1BatchCreateClustersResponse { + this := V1beta1BatchCreateClustersResponse{} + return &this +} + +// GetClusters returns the Clusters field value if set, zero value otherwise. +func (o *V1beta1BatchCreateClustersResponse) GetClusters() []TidbCloudOpenApiserverlessv1beta1Cluster { + if o == nil || IsNil(o.Clusters) { + var ret []TidbCloudOpenApiserverlessv1beta1Cluster + return ret + } + return o.Clusters +} + +// GetClustersOk returns a tuple with the Clusters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1BatchCreateClustersResponse) GetClustersOk() ([]TidbCloudOpenApiserverlessv1beta1Cluster, bool) { + if o == nil || IsNil(o.Clusters) { + return nil, false + } + return o.Clusters, true +} + +// HasClusters returns a boolean if a field has been set. +func (o *V1beta1BatchCreateClustersResponse) HasClusters() bool { + if o != nil && !IsNil(o.Clusters) { + return true + } + + return false +} + +// SetClusters gets a reference to the given []TidbCloudOpenApiserverlessv1beta1Cluster and assigns it to the Clusters field. +func (o *V1beta1BatchCreateClustersResponse) SetClusters(v []TidbCloudOpenApiserverlessv1beta1Cluster) { + o.Clusters = v +} + +func (o V1beta1BatchCreateClustersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1BatchCreateClustersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Clusters) { + toSerialize["clusters"] = o.Clusters + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1BatchCreateClustersResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1BatchCreateClustersResponse := _V1beta1BatchCreateClustersResponse{} + + err = json.Unmarshal(data, &varV1beta1BatchCreateClustersResponse) + + if err != nil { + return err + } + + *o = V1beta1BatchCreateClustersResponse(varV1beta1BatchCreateClustersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusters") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1BatchCreateClustersResponse struct { + value *V1beta1BatchCreateClustersResponse + isSet bool +} + +func (v NullableV1beta1BatchCreateClustersResponse) Get() *V1beta1BatchCreateClustersResponse { + return v.value +} + +func (v *NullableV1beta1BatchCreateClustersResponse) Set(val *V1beta1BatchCreateClustersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1BatchCreateClustersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1BatchCreateClustersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1BatchCreateClustersResponse(val *V1beta1BatchCreateClustersResponse) *NullableV1beta1BatchCreateClustersResponse { + return &NullableV1beta1BatchCreateClustersResponse{value: val, isSet: true} +} + +func (v NullableV1beta1BatchCreateClustersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1BatchCreateClustersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_get_clusters_response.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_get_clusters_response.go new file mode 100644 index 00000000..f24faf92 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_batch_get_clusters_response.go @@ -0,0 +1,154 @@ +/* +TiDB Cloud Serverless Open API + +TiDB Cloud Serverless Open API + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cluster + +import ( + "encoding/json" +) + +// checks if the V1beta1BatchGetClustersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1BatchGetClustersResponse{} + +// V1beta1BatchGetClustersResponse Responses message to the request for retrieving a batch of TiDB Cloud Serverless clusters. +type V1beta1BatchGetClustersResponse struct { + // Clusters created. + Clusters []TidbCloudOpenApiserverlessv1beta1Cluster `json:"clusters,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1BatchGetClustersResponse V1beta1BatchGetClustersResponse + +// NewV1beta1BatchGetClustersResponse instantiates a new V1beta1BatchGetClustersResponse 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 NewV1beta1BatchGetClustersResponse() *V1beta1BatchGetClustersResponse { + this := V1beta1BatchGetClustersResponse{} + return &this +} + +// NewV1beta1BatchGetClustersResponseWithDefaults instantiates a new V1beta1BatchGetClustersResponse 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 NewV1beta1BatchGetClustersResponseWithDefaults() *V1beta1BatchGetClustersResponse { + this := V1beta1BatchGetClustersResponse{} + return &this +} + +// GetClusters returns the Clusters field value if set, zero value otherwise. +func (o *V1beta1BatchGetClustersResponse) GetClusters() []TidbCloudOpenApiserverlessv1beta1Cluster { + if o == nil || IsNil(o.Clusters) { + var ret []TidbCloudOpenApiserverlessv1beta1Cluster + return ret + } + return o.Clusters +} + +// GetClustersOk returns a tuple with the Clusters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1BatchGetClustersResponse) GetClustersOk() ([]TidbCloudOpenApiserverlessv1beta1Cluster, bool) { + if o == nil || IsNil(o.Clusters) { + return nil, false + } + return o.Clusters, true +} + +// HasClusters returns a boolean if a field has been set. +func (o *V1beta1BatchGetClustersResponse) HasClusters() bool { + if o != nil && !IsNil(o.Clusters) { + return true + } + + return false +} + +// SetClusters gets a reference to the given []TidbCloudOpenApiserverlessv1beta1Cluster and assigns it to the Clusters field. +func (o *V1beta1BatchGetClustersResponse) SetClusters(v []TidbCloudOpenApiserverlessv1beta1Cluster) { + o.Clusters = v +} + +func (o V1beta1BatchGetClustersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1BatchGetClustersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Clusters) { + toSerialize["clusters"] = o.Clusters + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1BatchGetClustersResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1BatchGetClustersResponse := _V1beta1BatchGetClustersResponse{} + + err = json.Unmarshal(data, &varV1beta1BatchGetClustersResponse) + + if err != nil { + return err + } + + *o = V1beta1BatchGetClustersResponse(varV1beta1BatchGetClustersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusters") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1BatchGetClustersResponse struct { + value *V1beta1BatchGetClustersResponse + isSet bool +} + +func (v NullableV1beta1BatchGetClustersResponse) Get() *V1beta1BatchGetClustersResponse { + return v.value +} + +func (v *NullableV1beta1BatchGetClustersResponse) Set(val *V1beta1BatchGetClustersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1BatchGetClustersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1BatchGetClustersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1BatchGetClustersResponse(val *V1beta1BatchGetClustersResponse) *NullableV1beta1BatchGetClustersResponse { + return &NullableV1beta1BatchGetClustersResponse{value: val, isSet: true} +} + +func (v NullableV1beta1BatchGetClustersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1BatchGetClustersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_serverless_service_partial_update_cluster_body.go b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_serverless_service_partial_update_cluster_body.go index fdea74ab..eb4606be 100644 --- a/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_serverless_service_partial_update_cluster_body.go +++ b/pkg/tidbcloud/v1beta1/serverless/cluster/model_v1beta1_serverless_service_partial_update_cluster_body.go @@ -18,7 +18,7 @@ import ( // checks if the V1beta1ServerlessServicePartialUpdateClusterBody type satisfies the MappedNullable interface at compile time var _ MappedNullable = &V1beta1ServerlessServicePartialUpdateClusterBody{} -// V1beta1ServerlessServicePartialUpdateClusterBody Message for requesting a partial update on a TiDB Serverless cluster. +// V1beta1ServerlessServicePartialUpdateClusterBody Message for requesting a partial update on a TiDB Cloud Serverless cluster. type V1beta1ServerlessServicePartialUpdateClusterBody struct { Cluster *RequiredTheClusterToBeUpdated `json:"cluster,omitempty"` // Required. The update mask indicating which fields are to be updated.